Set the size of the shared memory buffer pool, that is, the size of 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 default cache size is 256KB, and may not be specified as less than 20KB. Any cache size less than 500MB is automatically increased by 25% to account for buffer pool overhead; cache sizes larger than 500MB are used as specified. The current maximum size of a single cache is 4GB. (All sizes are in powers-of-two, that is, 256KB is 2^18 not 256,000.)
The database environment's cache size may also be set using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "set_cachesize", one or more whitespace characters, and the 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 3" would create a 2.5GB logical cache, split between three physical caches. Because the DB_CONFIG file is read when the database environment is opened, it will silently overrule configuration done before that time.
This method configures a database environment, including all threads of control accessing the database environment, not only the operations performed using a specified Environment handle.
This method may not be called after the environment has been opened. If joining an existing database environment, any information specified to this method will be ignored.
This method may be called at any time during the life of the application.
cacheSize The size of the shared memory buffer pool, that is, the size of the cache.
When I have a host, the memory total is 16G.
I don't know what mean of this document.
How many max cache size can be set ?
or cacheCount (4)* 4G = 16G?
I'm a little confused about what you are quoting. Most of your quote seems to be from DB_ENV->set_cachesize(), but set_cachesize does not have a parameter named cacheSize. The parameters for set_cachesize are gbytes, bytes and ncache.
You use set_cachesize to specify the logical cache that you can optionally split into more than one physical region. The maximum size of the logical cache is 4GB and there is only one logical cache. You specify the total size of the logical cache with the gbytes and bytes parameters. If you set ncache to a value greater than 1, you split this logical cache into separate physical regions. So, for example, if you specify (gbytes=2, bytes=0, ncache=1) you will have a logical cache of 2GB that internally is split into 2 separate physical regions of 1GB each.
You can read more about the memory pool cache in the Reference Guide sections "Selecting a cache size" and "Configuring the memory pool".
If you have other Berkeley DB questions that are not specific to replication, you should direct them to the general Berkeley DB forum where you will have the benefit of a wider set of Berkeley DB experts:
Thank you for providing the Berkeley DB version. Now I can consult the correct version of the documentation and the source code.
Now that I look at the source code, I think my earlier answer misinterpreted the limitation on cache size. It looks like you can create a total logical cache of 16G divided into 4 physical regions of 4G each. The 4G size limitation is on the size of each physical region for a 32-bit system.