<!--$Id: config.so,v 10.20 2003/10/18 19:16:04 bostic Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB Reference Guide: Configuring the memory pool</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <a name="2"><!--meow--></a> <table width="100%"><tr valign=top> <td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Memory Pool Subsystem</dl></h3></td> <td align=right><a href="../mp/intro.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../txn/intro.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p> <h3 align=center>Configuring the memory pool</h3> <p>There are two issues to consider when configuring the memory pool.</p> <p>The first issue, the most important tuning parameter for Berkeley DB applications, is the size of the memory pool. There are two ways to specify the pool size. First, calling the <a href="../../api_c/env_set_cachesize.html">DB_ENV->set_cachesize</a> method specifies the pool size for all of the applications sharing the Berkeley DB environment. Second, the <a href="../../api_c/db_set_cachesize.html">DB->set_cachesize</a> method only specifies a pool size for the specific database. Note: It is meaningless to call <a href="../../api_c/db_set_cachesize.html">DB->set_cachesize</a> for a database opened inside of a Berkeley DB environment because the environment pool size will override any pool size specified for a single database. For information on tuning the Berkeley DB cache size, see <a href="../../ref/am_conf/cachesize.html">Selecting a cache size</a>.</p> <p>The second memory pool configuration issue is the maximum size an underlying file can be and still be mapped into the process address space (instead of reading the file's pages into the cache). Mapping files into the process address space can result in better performance because available virtual memory is often much larger than the local cache, and page faults are faster than page copying on many systems. However, in the presence of limited virtual memory, it can cause resource starvation; and in the presence of large databases, it can result in immense process sizes. In addition, because of the requirements of the Berkeley DB transactional implementation, only read-only files can be mapped into process memory.</p> <p>To specify that no files are to be mapped into the process address space, specify the <a href="../../api_c/env_set_flags.html#DB_NOMMAP">DB_NOMMAP</a> flag to the <a href="../../api_c/env_set_flags.html">DB_ENV->set_flags</a> method. To specify that any individual file should not be mapped into the process address space, specify the <a href="../../api_c/env_set_flags.html#DB_NOMMAP">DB_NOMMAP</a> flag to the <a href="../../api_c/memp_fopen.html">DB_MPOOLFILE->open</a> interface. To limit the size of files mapped into the process address space, use the <a href="../../api_c/env_set_mp_mmapsize.html">DB_ENV->set_mp_mmapsize</a> method.</p> <table width="100%"><tr><td><br></td><td align=right><a href="../mp/intro.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../txn/intro.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>