The information managed by the solidDB® server is stored either in memory or on disk. Since memory access is faster than disk access, it is desirable for data requests to be satisfied by access to memory rather than access to disk. The database cache uses available memory to store information that is read from the hard disk. The database cache is also used to buffer the database pages while the server is executing a checkpoint. When an application next time requests the information that was stored in the cache, the data can be read from memory instead of the hard disk.
Defining database cache size
In a disk-based database, the database cache uses available memory to store information that is read from the hard disk. The database cache is also used to buffer the database pages while the server is executing the checkpoint both in disk-based and in-memory databases. When an application next time requests this information, the data is read from memory instead of from the hard disk.
The default size of the cache depends on the platform. You can change the cache size through the IndexFile.CacheSize parameter. Typically, you need to increase the cache size when there are several concurrent users.
If a database is primarily disk-based, the following estimates can be used:
▪0.5 MB per each concurrent user of the system or
▪2-5% of the database size When estimating the necessary cache size by using the values above, use the larger value.
If the database is purely an in-memory database, the factory value suffices. When you decrease the cache size of an in-memory database, the size cannot be less than 8 MB to facilitate efficient checkpoint activity.
Increase the value of IndexFile.CacheSize carefully. If the value is too large, it leads to poor performance because the server process does not fit completely in memory, and therefore swapping of the server code itself occurs. If the cache size is too small, the cache hit rate remains poor. The symptoms of poor cache performance are database queries that seem to be slower than expected and excessive disk activity during queries.
You can verify whether the server is retrieving most of the data from disk instead of memory by checking the cache hit rate using the command ADMIN COMMAND 'status'. Alternatively, check the overall cache and file ratio statistics using ADMIN COMMAND 'perfmon'. Typically, the cache hit rate needs to be better than 95%.
Note If you are using a diskless server with disk-based tables, the database cache size has to be configured to contain the whole database. This is because a diskless server does not use any disk storage space, it maintains all D-tables in the database cache.
The size unit is bytes. You can also specify the amount of space in units of megabytes, for example, "10M" for 10 megabytes.
Note The cache size cannot be decreased dynamically. To decrease the cache size, edit the parameter value in the solid.ini configuration file and restart the server.
The solidDB® server uses a hash table to ease access to the cache. The hash table size equals the number of pages in the cache. This guarantees almost collision-free access. If the cache size is increased dynamically, the hash table is not automatically enlarged, which results in a higher collision probability. To avoid collision, use the IndexFile.ReferenceCacheSizeForHash parameter to accommodate the enlarged cache. The IndexFile.ReferenceCacheSizeForHash parameter value is used for calculating the cache hash table size. Use the parameter if you know the maximum cache size during the server lifecycle in advance. If the value is not given, hash table collisions might occur when the cache size is increased.
Note The ReferenceCacheSizeForHash parameter value must not be smaller than the IndexFile.CacheSize value. If it is, the IndexFile.ReferenceCacheSizeForHash parameter value is rejected and the default value is used. Also, a message is printed to the solmsg.out log file.