Working Set Size

When an Analytica computation requires more memory than the amount of physical RAM, parts of the Analytica memory space will be swapped into virtual memory. This is managed by the Windows operating system.

For example, in Analytica 64-bit, if you have only 16 GB of RAM on your computer, but you are evaluating a large model that requires 50 GB of memory to evaluate, most of the "memory" used by Analytica will be swapped out to a disk file in virtual memory, while perhaps only 14GB of physical RAM will actually be used to hold Analytica computations. As Analytica proceeds through the computation of your model, previously computed results that haven't been accessed in a while will be swapped out to disk to make room in RAM for the objects and values required for the next part of the computation. Since RAM access is at least 3 orders of magnitude faster than disk access, it is important to keep all of the values in the current computation in physical RAM.

One of the parameters used by the operating system during the management of virtual memory is the working set size. Windows must balance the amount of RAM it allows Analytica to consume with the demands of other processes running on your computer. As it turns over more RAM to Analytica, it may need to swap other applications to virtual memory. When those other applications need to respond after having been swapped out, a substantial delay can be incurred as other things are swapped out to make room for them in RAM, and then as they are swapped back into memory. When this happens excessively, it can make your system feel like it is frozen -- extremely non-responsive. It doesn't really matter what the priority level of the Analytica process is either. The delay is caused by the contention for that physical RAM.

The management of Working Set size can help to keep those other applications responsive when Analytica is involved in a long memory-intensive computation, even when Analytica is making heavy use of virtual memory. For example, if you have only 16GB of RAM, Analytica 64-bit will limit its maximum working set size to about 14GB, ensuring that at least 2GB is left alone for other processes. Since 2GB is usually enough to hold all your standard non-heavy-duty-number-crunching applications entirely in RAM, these end up not getting swapped out to virtual memory and remain responsive.

The management of working set size is only possible on some Windows operating systems. These include Windows XP 64-bit and Windows Server. It is not possible to manage working set size to ensure the responsiveness of other applications on the standard 32-bit variety of Windows XP. In the operating systems where it is possible to limit working set size, and where you have 8GB or RAM or more, Analytica will attempt to limit its working set size so that at least 2 GB of RAM remains beyond the maximum working set size. When you have more than 16GB of RAM, a larger margin is set aside in proportion to the total amount of RAM on your system.

You may want to tune this behavior for your own computer and your own applications. (Tuning is only possible on the operating systems that support a maximum working set size, such as XP 64-bit and Windows Server). There are a couple considerations. If you know that you'll have two instances of Analytica running concurrently, then you might want to have the maximum working set size. If you have 16GB of RAM, it might make sense to limit the maximum working set size for each to 7GB, so the two together have a 14GB ceiling. For an ADE-based web application, where multiple ADE instances may run concurrently, more stringent ceilings on maximum working set size may be justified. You may also want more than 2GB of untouched working space for other applications, or you may want to go the other direction and allow Analytica to utilize more working set space.

To manually override the working set constraints, you can set the registry settings:

  • WorkingSetMax (DWORD, in megabytes)
  • WorkingSetMin (DWORD, in megabytes)
  • WorkingSetFlags

You can set these in either of the following registry hives (for Analytica 64-bit):

HKEY_LOCAL_MACHINE/Software/Lumina Decision Systems/Analytica/4.6
HKEY_CURRENT_USER/Software/Lumina Decision Systems/Analytica/4.6x64

When set in HKLM, the settings apply to all Analytica accounts on your machine. When set in HKCU, they apply only to your account. If using ADE on a web server, you should use the HKLM hive since your HKCU is not the same as your web application's account.

The WorkingSetFlags are:

1 = Hard Min Limit
2 = Soft Min Limit
4 = Hard Max limit
8 = Soft Max Limit.

You can add these together, e.g.,

6 = soft min and hard max limits.

In a soft limit, the OS may violate the limit if memory is scarce (min) or abundant (max).

See Also


You are not allowed to post comments.