Kbase P181971: Questions and answers on impact of the PAUSE statement on Operating System performance
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/7/2011 |
|
Status: Unverified
GOAL:
4GL/ABL: Questions and answers on impact of the PAUSE statement on Operating System performance
GOAL:
Does executing a long pause statement like "PAUSE 60 NO-MESSAGE." Have any negative impact on machine performance such as the runtime doing a CPU loop to eat up the time?
GOAL:
Does the PAUSE statement use any operating system resources?
GOAL:
Does the PAUSE statement work the same on an AppServer as it does on a client?
GOAL:
Does the PAUSE statement work the same on Windows and UNIX Operating Systems?
GOAL:
Does the operating system of the AppServer change anything in how the statement works?
GOAL:
Does using the PAUSE statement on a Windows or UNIX based state-free AppServer negatively impact the performance of the Operating System?
GOAL:
Can the PAUSE statement be used in a remote AppServer Procedure that will spend most of its time waiting without negatively impacting the Operating System performance?
GOAL:
Is using the SLEEP Operating System function call better than using the PAUSE statement from a performance point of view?
GOAL:
How can I test the impact of the PAUSE statement and the SLEEP function on the operating system?
FACT(s) (Environment):
All Supported Operating Systems
OpenEdge 10.2x
FIX:
The PAUSE statement uses a system timer to wait the specified amount of time, which has negligible CPU impact because it does not use a CPU-intensive delay loop. A system timer has a very low footprint. So low that it does not negatively impact the Operating System. The PAUSE statement on an AppServer (in any operating mode) uses the system's sleep function to wait the required amount of time. On Windows the call is divided into 30-second chunks; for example, PAUSE 300 is done with 10 calls to the system's Sleep() function. This adds a negligible amount of overhead to the process. On Unix, the PAUSE is not broken into multiple calls but the entire PAUSE is done in one system call nanosleep(). Both the Windows and the UNIX sleep functions are very efficient and do not waste CPU cycles.
Calling the Windows Operating System Sleep() function or the UNIX system nanosleep() function is preferable, performance wise, to using the 4GL PAUSE statement because the internal parsing involved in the execution of the PAUSE statement. The following code snippet shows how to invoke the WIN32 Operating System Sleep() function call:
RUN sleep ( 5000 ).
PROCEDURE Sleep EXTERNAL "KERNEL32":
DEFINE INPUT PARAMETER piMilliseconds AS LONG NO-UNDO.
END PROCEDURE.
To test the memory consumed by the PAUSE or the SLEEP when executed on the AppServer:
1. Define a state-free AppServer with a single agent (min & max agents = 1).
2. Write a remote 4GL Procedure on the AppServer that does nothing but PAUSE/SLEEP 300.
3. Call the remote 4GL Procedure from a 4GL client.
4. Use the Windows Task Manager (or some UNIX process monitor) to monitor and verify that the _proapsv process is not consuming any CPU.
5. Note which of the two options,(PAUSE or SLEEP) consumes more memory and make up your decision.