Sets the size of the shared memory buffer pool — that is, the cache. The cache should be the size of the normal working data set of the application, with some small amount of additional memory for unusual situations. (Note: the working set is not the same as the number of pages accessed simultaneously, and is usually much larger.)
The value specified for this parameter is the maximum value that your application will be able to use for your in-memory cache. If your application does not have enough data to fill up the amount of space specified here, then your application will only use the amount of memory required by the data that your application does have.
For the DB, the default cache size is 8MB. You cannot specify a cache size value of less than 100KB.
Any cache size less than 500MB is automatically increased by 25% to account for cache overhead; cache sizes larger than 500MB are used as specified. The maximum size of a single cache is 4GB on 32-bit systems and 10TB on 64-bit systems. (All sizes are in powers-of-two, that is, 256KB is 2^18 not 256,000.)
It is possible to specify cache sizes large enough they cannot be allocated contiguously on some architectures. For example, some releases of Solaris limit the amount of memory that may be allocated contiguously by a process. If ncache is 0 or 1, the cache will be allocated contiguously in memory. If it is greater than 1, the cache will be split across ncache separate regions, where the region size is equal to the initial cache size divided by ncache.
The cache size supplied to this parameter will be rounded to the nearest multiple of the region size and may not be larger than the maximum possible cache size configured for your application (use the set_cache_max to do this). The ncache parameter is ignored when resizing the cache.
The syntax of this parameter in the DB_CONFIG file is a
single line with the string
set_cachesize
, one or more whitespace
characters, and the initial cache size specified in three
parts: the gigabytes of cache, the additional bytes of
cache, and the number of caches, also separated by
whitespace characters. For example:
set_cachesize 2 524288000 1
Creates a single 2.5GB physical cache.
Note that this parameter is ignored unless it is specified before you initially create your environment, or you re-create your environment after changing it.
For more information, see DB_ENV->set_cachesize() .