Tuesday, August 19, 2014

Important points about Process Scheduler

1) What is the ‘Heartbeat’? 

How often (in Seconds) the server agent check to see (PSSERVERSTAT table) if the server should change the status.

2) Define The Server Agent(PSPRCSRV.EXE)?

The Server Agent is responsible for starting all server processes.  Every fifteen seconds, it looks in the Process Request Table for server processes that are scheduled to run.  If nothing is scheduled, the Server Agent “sleeps” for fifteen seconds, and then checks again. 

3) What is PSPRCSRQST?

The Process Request Table (PSPRCSRQST) resides at the center of all process scheduler activity.  When a process is initiated, a row is added to the table with details describing the process.  The information here is also replicated in the PSPRCSQUE table which is read by the process scheduler agent.  Finally, the Process Monitor and Report Manager use this table to report process activity. 

4) What is PSPRCSQUE?

The Process Queue Table (PSPRCSQUE)is used by the Process Scheduler Agents to find new requests and to manage the status of those requests.  When a process is initiated, a row is added to the table with details describing the process.  The server agent reads the table at regular intervals, and starts processes that are run on the server side.  The processes themselves update the status field. 

5) What is the Server Table?

The Server Status Table (PSSERVERSTAT) maintains a list of process scheduler servers in the environment and whether they are running, suspended or stopped. 

6) When the Process Scheduler is booted, it sets its status to 3, which means "Running". It will update its timestamp based on the heartbeat interval defined in the Server definition. The Process Scheduler checks this timestamp and compares it to the time coming from the database. If the difference is more than a minute, the Process Monitor assumes the Scheduler has crashed and it sets the status to Down. This action has no impact on the Process Scheduler itself as it will continue to run processes.

7) In addition, the Process Scheduler uses a table, PSPRCSCLOCK, which operates as a single threaded mechanism. Meaning, this table has one column and one record. The only statement that can be performed on this table is an update to 1.


For example, anytime there's an insert or an update to be performed on PSPRCSRQST or PSPRCSQUE, the procedure followed by the Process Scheduler is:

a) Lock the PSPRCSCLOCK table.
b) Update the value to 1.
c) Commit the transaction and release the lock.

If the process updating the value dies, the table remains locked. When this occurs, the Process Scheduler cannot unlock the table and so no new processes can be submitted to run. This in turn prevents the Scheduler from updating its timestamp and so the Process Monitor views the Scheduler as down.

8) When the Process Scheduler tables, PSPRCSRQST and PSPRCSQUE, contain many rows Process Scheduler performance can suffer because it cannot read the contents of the tables in time. This then makes it difficult to update the timestamp under the "heartbeat" time and it causes the Scheduler to come down. To avoid this, the purge process should be run on a regular basis to keep the tables clean.

9) Another reason why this behavior can occur is if the system time on the Process Scheduler machine(s) is not in sync with the time on the database and Application Server machines.  The Process Scheduler compares its time to the value from the database.  If there is enough of a difference, it will cause the Process Scheduler to come down.

1 comment :