Controlling memory usage
When Greentree upgraded to JADE 7 it bought with it a new disk cache system. The database now uses its own disk cache and not the Windows file system cache to improve performance.
The purpose of the cache is to hold data that is likely to be used again in memory, this avoids having to read the data from disk again. If the cache size is too small the same information is read from the database repeatedly. If it’s too big then memory is wasted by not being used. We want to give the database as much memory as it needs without wasting it or leaving the OS too little to operate.
There are 4 disk cache settings in the PersistentDb section of the Jadegt.ini file, the most important for controlling memory usage are the DiskCache Min and Max Segments.
If these are commented out or set to default the disk cache will eventually take half of the available memory. This may be ok if you have a lot of free ram available and only one database on the server. If you have two, they may eventually try and take half each causing contention and leaving none for the OS.
While we don’t recommend the approach, we know some sites run a test and live system on the same server. Make sure if you do there is enough ram and you have allocated the correct amount to each. You may have other apps running on the server and more than half the ram may be used, and this would also cause contention and performance issues.
There is one other parameter that could keep memory free, but it comes with an expensive performance overhead, DiskCacheFreeMemoryTarget, this will give back memory when overall memory is under pressure. This setting should be used as a safety net in case something unexpected happens.
What we should be doing is using our Min and Max parameters to allocate the correct amount of ram to the disk cache in a way that doesn’t consume all the memory on the server.
What do the numbers mean?
Let’s start with DiskCacheBlocksPerSegment, when left as default it creates a segment size of 64MB, 16 of these 64MB segments will make 1GB.
- If I had a system with 16GB of ram with one database I could allocate 2GB of ram on start-up and a maximum of 4GB leaving 12GB for other Greentree services (including two WebWorkers) and OS. More memory could be allocated to disk cache if WebWorkers were not running or I increased the amount of physical memory on the server. As a safety net, I’ll set my DiskCacheFreeMemoryTarget to 1GB so I never completely run out of ram, it will probably never reach this value.
- DiskCacheBlocksPerSegment=
- DiskCacheFreeMemoryTarget=1G
- DiskCacheMaxSegments=64
- DiskCacheMinSegments=32
How do I tell if I need more ram?
When a system starts it will allocate the DiskCacheMinSegments, when needed the other segments will be allocated over time. If the DiskCacheMaxSegments value is reached very quickly and consistently the system could benefit from more physical memory. When the segments are allocated, this entry is written to the Jommsg.log file
Start with:
- DiskCache: segment size=67108864 (8192 blocks), segments allocated=32 (min=32, max=64)
Add below when further segments are allocated:
- PDB: DiskCache: segment allocated: _poolSegments= 38, pool size now 2550136832 bytes (311296 blocks)
-
Here it’s up to 38 when it reaches 64 all the segments have been allocated.
-
If I wanted to add a test system to this server, it would also require more physical memory although I could make the disk cache settings much less if the test system wasn’t used for performance tests.
The key message is don’t just leave the defaults as they are. If your server is running out of memory, then you may need to throttle back the memory usage but it’s always better to add a bit more ram. In the perfect world you would put more memory in the server than you need, run Greentree for a day with the defaults then see how many segments get allocated over time. This would let you know how much the system would need to run at peak performance.
One more key change for JADE 7 in the ini is the HPSM memory setting, this replaces the jadelocal setting for shared memory, the system will still run with the old settings but will run faster with the new one. Remove the old jadelocal setting and replace with the new settings are below.
[JadeClient]
; The [JadeClient] section is used by App Servers and Fat Clients only
; Greentree recommends using HPSM transport if the app server and db server are on the same machine
ServerNodeSpecifications=HPSM,Global\Greentree
[JadeServer]
; the [JadeServer] section is used by Database Servers only
; Greentree recommends HPSM transport - disable JadeLocal enable HPSM
NetworkSpecification2=JadeLocal,disabled,Greentree
NetworkSpecification3=HPSM,enabled,Global\Greentree