View previous topic :: View next topic
|
Author |
Message |
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
I have to optimise my current CPU utilization.
Scenario: I have to call 3 subprogrames from main program, so currently these programes are getting called one after another, but is there any way of calling these programes simultaneously?? if this can be achieved thru any of the CICS features then also its fine.
Please let me know in case of additional info. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
How is calling 3 subprograms in parallel going to have any impact on CPU time? They are all doing the same work, and using the same resources, so there's no CPU impact from what you want to do.
In CICS you can use START to create an independent transaction, so if you recode the subprograms to run as transactions, you could run all three of them in parallel. This may require massive changes to the application, of course, as they no longer would be subprograms but independent main programs, but it could be done. Of course, total CPU utilization will probably go up from the CICS overhead of starting three more transactions. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Rohit, perhaps you can describe your problem to us, rather than look for a solution which may not help you at all.
By "CPU utilization" you mean the user wants a better response time, for instance? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
is this a batch application or cics? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
a brief scenario of what your program does would help us to make suggestions. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Thank you for all your replies..
Actually in the current project, we have various services that needs to be called from CICS environment.So currently I am taking very small example here, I am calling three services(Sub programes) from a driver CICS program(CICS) so they are getting executed seqentially, now my question was like instead of calling it sequentiall, is there any of calling/executing them parallel?
@Robert: You said is perfectly, but this change will not be only for 3 subprograms, as a mass level these would be hundreds of program that may get impacted. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
And yes, I really don't guess, how would CPU stats will be looking after this change, but yes certainly it will help to reduce the execution time. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Also in a Batch, is there any way where we call the subprogram and don't expect control back again in the calling program? in CICS we have XCTL concept so anything similar to that in a batch? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Something to think about your last question- how do you end the called program; GOBACK or STOP RUN..? Not a good programming practice, IMHO. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
"Hundreds" of modules? Batch as well?
What is it you are imagining that you can do in this way? You need to be doing discrete tasks on discrete data guaranteed to be unaffected by other things happening at the time, in reality or potentiality. I'd really like to see how you imagine doing this for hundreds of different modules.
One thing you'd have to ensure is that users don't access the same data for update at the same time. That'd be fun.
And in batch?
Exactly, in some detail, outline what you imagine you would like to do, along with the benefits you'd feel would accrue, please. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
use TD queues with ATI in CICS if you want to have tasks started without returning.
in batch, use MQS with ATI to start tasks, which will not return. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Thank you for all your inputs,
We are fianally thinking of implementing this by the use of MQs.
@Bill:
Also in a batch is there any way of doing the same stuff??
I am imaging below things,
1)ProgA calls ProgB,ProgC,ProgD sequentially and each subprogram is updating into some DB2 table, and these sub programes are independent on each other(No common tables between them)
2)Now instead of calling them sequentially, Can we call them parallel and get the updations done as the total elapsed time in a job can be reduced? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
Can we call them parallel and get the updations done as the total elapsed time in a job can be reduced?
|
as explained earlier, initiating separate enclaves (batch multi-threading)
actually uses more resoures than simple CALLs within a thread.
and, the only way you are going to reduce elapsed time is: - buy more hardware
- reduce the number of jobs running
- find the bottlenecks in you code and optimize
- redesign
and actually, 3 and 4 will only reduce CPU, which may or may not affect ELAPSED,
especially if 1 and 2 are not optimal.
suggestion: forget about multi-threading as a solution to your problem. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the whole topic is a complete waste of time ....
mostly due to poor terminology
let's start with
Quote: |
I have to call 3 subprogrames from main program, |
the sentence implies that after each call the control is returned to the main program
and running the 3 subprogram in <parallel> means some synchronization has to take place so that the main program resumes it' s flow only after all the 3 subprogram have finished their processing.
now if the subprograms were doing each a 10000by10000 matrix inversion
it might be worth to try to run them in parallel, but ....
... and now at the end it comes out that they are going to use MQ
most puzzling topic around |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Thanks a ton again!!
@Enrico:
I would certainly have enrich my terminology, so as to avoid the confusion. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
For batch it is simple. Design your system so that related tasks are in one job, unrelated tasks in others. Of course, don't do this and have each processing a huge amount of input, most of which is ignored.. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you mention DB2.
how often are you issuing COMMITs? |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
I am issuing commit once in the main program( i.e when call to all the sub progs are successful). |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
We are fianally thinking of implementing this by the use of MQs. |
Quote: |
I am issuing commit once in the main program( i.e when call to all the sub progs are successful). |
so You need a <synchronization> point after all the subprograms have <finished>
how does MQ fit in all this?
the hole is getting deeper and deeper ...
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you want to improve throughput, why not look at the problems in the existing programs, rather than try to invent some way around it?
You seem to be introducing extra complexity without any surety of benefit as regards throughput. Test it thoroughly with a dummy set of modules to prove the concept as it applies to your system. For performance issues the biggest improvements, after things caused by plain stupidity, are from changes to how existing logic is implemented, but to the extent of doing it "better" rather than doing the same thing is some magic new way.
By the way, can we assume you mean you commit once after each set of calls, rather than "once" fullstop? |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
@Bill: Yes, I commit once after all 3 calls.
This was just a thought, that came to my mind of having MQs used..Let me now test this and if it really takes less time with 100% fuctionality then would be key success, otherwise I still need to think of some other thing around.
Thanks you All again for your thoughts/suggesstions. |
|
Back to top |
|
|
|