Why some of background jobs delayed when process available?

Question: Hi, all:

I found several background jobs got delayed for more than 2K seconds last night around 7PM. They are all scheduled to run on 7Pm or a little after 7PM. There is two other background jobs which started around 7PM and ran about 3K seconds. Other than that, there is no other processes which occupied background process for long. There is more than enough background processes(we had totally 8 background processes allocated in these 2 servers (including 2 class A reserved processes) available for those delayed jobs during 7Pm-8Pm. Why there were still delayed for that long? I can not get a clue? Does anybody have any suggestions?

Thanks.

Answer:
are you 100% sure that there were some free background processes? HAve you actually logged in at around 7pm to check this?
_________________
SapFans Moderator
NetWeaver ‘04–SAP Web AS for ORACLE certified

Search: /forums/search.php
SAP Notes: http://service.sap.com/notes
SAP Help: http://help.sap.com
Basic Rules: /forums/viewtopic.php?t=222759

Answer:
Hi, all:

I found several background jobs got delayed for more than 2K seconds last night around 7PM. They are all scheduled to run on 7Pm or a little after 7PM. There is two other background jobs which started around 7PM and ran about 3K seconds. Other than that, there is no other processes which occupied background process for long. The
re is more than enough background processes(we had totally 8 background processes allocated in these 2 servers (including 2 class A reserved processes) available for those delayed jobs during 7Pm-8Pm. Why there were still delayed for that long? I can not get a clue? Does anybody have any suggestions?

Thanks.
Out of 8 total processes you have 2 reserved for class A. If all processes are free then you have 6 for class B or C and 2 for class A. Suppose two class A jobs kick in at the same time and there no class B or class C jobs are running at that time. Now you have out of 8 processes 2 are occupied by two class A jobs and you have 6 processes remained. Out of these 6 processes SAP sets asides 2 for class A and now you have only 4 processes available for class B and class C. By reserving 2 for class A SAP always keeps 2 processes available for class A. Now this does not mean that if class B or class C jobs are running and class A jobs needs to run then it will kick class B or class C and start job A to run. For example, there is nothing running on your system thus you have 2 processes for class A and 6 for class B or C. Now 6 class B or class C jobs starts and they will occupy 6 available processes. SAP is still happy because you have ask it to keep 2 processes for class A and there is no class A job running and 2 class processes are free. Now three class A jobs starts. Guess what... 2 will run and the third one will delay even though it is class A because other 6 processes are occupied by alread active class B or C jobs. As soon as class B or C jobs completes, SAP will allocate the freed process to your class A job and it will start running.

While all 8 processes were occupied and one class C becomes ready to run but it will get delayed. Mean while another class A job gets ready to run but it too will be delayed. Now one of class B or class C jobs completes. Guess what...waiting class A will run before class C job eventhough it has been waiting longer than Class A.

So that is how batch management works in SAP.

Answer:
Hi, Snowy:

No, I did not log in to check at 7PM.

But I checked using SM37 to list all the finished background jobs of yesterday . This should have given me a complete view.

Answer:
Suppose two class A jobs kick in at the same time and there no class B or class C jobs are running at that time.



so when there is no background jobs running and then 2 class A jobs come in, will these two jobs run in the two reserved class A processes or they will run in 2 ouf of those 6 normal background processes?

Answer:
Suppose two class A jobs kick in at the same time and there no class B or class C jobs are running at that time.



so when there is no background jobs running and then 2 class A jobs come in, will these two jobs run in the two reserved class A processes or they will run in 2 ouf of those 6 normal background processes?

When you reserve 2 for class A does not mean that specific two processes are marked as for class A only. All it means is out of all available processes keep any 2 for class A. There fore when all 8 are free and 2 class A jobs starts it will take any 2 processes to run those 2 class A jobs. Now you are left with 6 free processes. Again sice you have specified that keep 2 for class A, SAP will keep 2 free for class A out of free 6 processes, thus with two class A jobs active you are left with only 4 free for class B & C - 2 are occupied by active class A and two set aside for future class A job to run.... get the picture?

Answer:
Hi, Snowy:

No, I did not log in to check at 7PM.

But I checked using SM37 to list all the finished background jobs of yesterday . This should have given me a complete view.

What SM37 won't tell you though is what else was occupping all the batch processes at 7PM. Suppose class B or C Job1, Job2, Job3, Job4, Job5, and Job6 prior to 7PM and ran beyond 7pm. At 6:59 two class A jobs started and they did not complete until say 7:30pm and at 7 pm your third class A starts, it won't have any processes available to it to run until one of those class B or C jobs completes or one of two active class A jobs completes.

Answer:
Hi, all:

I found several background jobs got delayed for more than 2K seconds last night around 7PM. They are all scheduled to run on 7Pm or a little after 7PM. There is two other background jobs which started around 7PM and ran about 3K seconds. Other than that, there is no other processes which occupied background process for long. The
re is more than enough background processes(we had totally 8 background processes allocated in these 2 servers (including 2 class A reserved processes) available for those delayed jobs during 7Pm-8Pm. Why there were still delayed for that long? I can not get a clue? Does anybody have any suggestions?

Thanks.
Out of 8 total processes you have 2 reserved for class A. If all processes are free then you have 6 for class B or C and 2 for class A. Suppose two class A jobs kick in at the same time and there no class B or class C jobs are running at that time. Now you have out of 8 processes 2 are occupied by two class A jobs and you have 6 processes remained. Out of these 6 processes SAP sets asides 2 for class A and now you have only 4 processes available for class B and class C. By reserving 2 for class A SAP always keeps 2 processes available for class A. Now this does not mean that if class B or class C jobs are running and class A jobs needs to run then it will kick class B or class C and start job A to run. For example, there is nothing running on your system thus you have 2 processes for class A and 6 for class B or C. Now 6 class B or class C jobs starts and they will occupy 6 available processes. SAP is still happy because you have ask it to keep 2 processes for class A and there is no class A job running and 2 class processes are free. Now three class A jobs starts. Guess what... 2 will run and the third one will delay even though it is class A because other 6 processes are occupied by alread active class B or C jobs. As soon as class B or C jobs completes, SAP will allocate the freed process to your class A job and it will start running.

While all 8 processes were occupied and one class C becomes ready to run but it will get delayed. Mean while another class A job gets ready to run but it too will be delayed. Now one of class B or class C jobs completes. Guess what...waiting class A will run before class C job eventhough it has been waiting longer than Class A.

So that is how batch management works in SAP.

quality information always welcome!

Answer:
Thanks for the information

Answer:
also check number of entries in table TBTCO. If there are too many entries, you schedluing may slowdown to a crawl. also check TBTCO's database stats.
_________________
SapFans Moderator
NetWeaver ‘04–SAP Web AS for ORACLE certified

Search: /forums/search.php
SAP Notes: http://service.sap.com/notes
SAP Help: http://help.sap.com
Basic Rules: /forums/viewtopic.php?t=222759

Answer:
Hi there, my favourite subject

The assumptions about A class are true but what you can do is remove A class reservation from RZ04 and A class jobs will still get first preference.
I will get to how you see this but first you need to get an overview of useage.

Go to RZ20 (another of my favourate transactions) and expand SAP CCMS Monitor Templates and then double click on Background Processing.
In here navigate to node Systemwide - Background - Background Service - Systemwidequeuelength Single click this node then clikc the button at the top that looks like a jigsaw (display Details) button. At the bottom of the next screen you will see two sets of figures, ine in seconds and one in hours. Single click any number in the hours row and then click the graph button (display performance values graphically) and you will see how long your job queueu was for the last 24 hours averaged out by hour. Over a couple of days you will get an idea of how many jobs wait when and if you need more BTC. (if you need more history you need something called CPH)

Now if you still have a problem with an odd delay it can be down to many things. and it is really a lot to explain here, it depends on what you see in different transaction. Suffice to say to start consider the following

By default only one job will run in each BTC WP per minute apart from event and immediate type jobs. Use SM37 to see how many jobs ran in the last 5 minutes and count the WP's up. If they work out as I describe then everything is working as designed and you need more WP or less A class reserved ones.

If everything is not running well you need to check that time based scheduling is working OK. To do this go to transaction SM61, go into change mode, double click the time driven scheduler, click on the trace tab and ensure the radio buttons Fine Trace and Once are selected.
Within the next minute a trace will appear in the first free WP at the time SAPMSSY2 runs (time driven scheduling) and the trace will be turned off due to the once button. If the trace level still shows fine trace in SM61 then time driven scheduling is not running and in this case cancel any sessions of sapmssy2 you can see in dialog WP's and try again. If it still fails then type transaction SBTA, a blank screen will appear and you should press enter once (nothing seems to happen) andthen back out of the transaction. Note do not press enter twice or when time driven scheduling is already running or you can get jobs failing/locks happening.

If the trace did run and is visible in the DIA WP trace file (look down in order until you see an obvious trace at te bottom of a file) you will see in this trace the decision making process of job scheduling and the jobs allocated to run.

If the jobs failed to run then you need to use SM61 again to trace the job starter (also a part of sapmssy2) that runs in both dialog and BTCH WP's so have a look at both for a trace and you should see an error.

If all of that fails then do a DB01 and smack your forehead heartily when you see some job locks there (batch only uses DB locks!) and wonder why you did not check this earlier.

If that fails do and SM65 - goto - additional tests and run them all and fix any DB corruptions and run again and read any output carefully.

If this runs clean and there is plenty of space in your DB and global directory job job information to be held then try restarting your system

If that fails then raise a call with SAP and have a well earned cup of tea.
_________________
regards,
Chap

Answer:
Hi, Chap:

Thank you very much for your effort. Yes, I should have checked DB01 earlier.

By the way, I am always confused on SM12 and DB01. Why we have two types of locking mechanism and what is the difference?

Answer:
Database locks are dangerous so SAP designed its own locking mechanism above that for its own dictionary. This is viewed via SM12 and locks records logically in SAP rather than at the database level.

DB01 is the database level locks.
_________________
regards,
Chap
Copyright ?2007 - 2008 www.jt77.com