KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: CPU Usage Under Windows NT
PRODUCT: 4D | VERSION: | PLATFORM:
Published On: July 28, 2000
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

What is the normal behaviour of 4D Server under Win NT? The amount of CPU utilization is not directly correlated with the number of clients currently logged on, but more so with the activity of the clients. That is, a single client logged in and executing a processor-intensive operation could peg the CPU utilization of 4D Server. On the other hand, 50 clients could be logged in and doing very little activity and 4D Server CPU utilization would be less.

Let's have a closer look at what happens under the hood of the 4D multi-tasking engine. First, 4D is always doing something! The 4D scheduler (the level 0 of its multi-tasking environment that runs within one OS thread) is constantly running a loop that checks whether a time-slice should be allocated to a 4D System process (i.e., Design) or to a User defined process (started, for instance, with New process). Because all 4D processes run in only one OS-based thread, the scheduler's process time-allocation loop also includes a test to see whether "it is time" to give time to the Operating System itself. This latter test is based on three parameters:

A. The # of ticks the scheduler waits before calling WaitNextEvent Specifies the "waiting delay" before the scheduler calls WaitNextEvent. This value is expressed in ticks. The greater it is, the less 4D calls WaitNextEvent and the less 4D calls back the OS. Increasing this value gives 4D longer chunks of time for processing. The user interface may seem slower, as the user is given control less frequently.
B. The Maximum # of ticks the scheduler gives to the OS at each step Specifies the minimal time the OS gets each time 4D calls it back. This value is expressed in ticks. The greater it is, the more time is guaranteed to the OS.
C. The Minimum # of ticks the scheduler gives to the OS at each step Specifies the maximum time the OS gets each time 4D calls it back. This value is expressed in ticks. The greater it is, the more time is given to the OS.

When you install 4D for the first time, it comes with the settings A=1, B=8 and C=0. These settings are intended to create an "average optimal performance" on the 4D side. With these settings, it is normal for 4D to demand (and get) a good share of the CPU time.

You can tune up the settings in order to give more time to the OS, and thus optimize your configuration when you want to run several applications in parallel. Conversely, you can also tune up the system to dedicate even more time to 4D (you might want to do this with a machine fully dedicated to 4D Server).
The following are some examples of settings from the "Tune Up" tab of the Database Properties under 4D Server.

To apportion about 40% of the CPU time to 4D Server:
Number of ticks between calls to OS: 2
Maximum number of ticks per call to OS: 4
Minimum number of ticks per call to OS: 4

To apportion about 60% of the CPU time to 4D Server:
Number of ticks between calls to OS: 2
Maximum number of ticks per call to OS: 2
Minimum number of ticks per call to OS: 0

To apportion about 95% of the CPU time to 4D Server:
Number of ticks between calls to OS: 16
Maximum number of ticks per call to OS: 1
Minimum number of ticks per call to OS: 0

You can use different settings depending on what you want to achieve: more time for 4D, or more time for the OS and other applications. Note that these settings are on a per-application basis, they must be setup for 4th Dimension, 4D Client and 4D Server individually. To modify a compiled database, the interpreted version must be configured before it is run through 4D Compiler.