1<!--$Id: config.so,v 10.20 2003/10/18 19:16:04 bostic Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB Reference Guide: Configuring the memory pool</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<a name="2"><!--meow--></a> 12<table width="100%"><tr valign=top> 13<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Memory Pool Subsystem</dl></b></td> 14<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> 15</td></tr></table> 16<p align=center><b>Configuring the memory pool</b></p> 17<p>There are two issues to consider when configuring the memory pool.</p> 18<p>The first issue, the most important tuning parameter for Berkeley DB 19applications, is the size of the memory pool. There are two ways to 20specify the pool size. First, calling the <a href="/api_c/env_set_cachesize.html">DB_ENV->set_cachesize</a> method 21specifies the pool size for all of the applications sharing the Berkeley DB 22environment. Second, the <a href="/api_c/db_set_cachesize.html">DB->set_cachesize</a> method only specifies a 23pool size for the specific database. Note: It is meaningless to call 24<a href="/api_c/db_set_cachesize.html">DB->set_cachesize</a> for a database opened inside of a Berkeley DB 25environment because the environment pool size will override any pool 26size specified for a single database. For information on tuning the 27Berkeley DB cache size, see <a href="/ref/am_conf/cachesize.html">Selecting 28a cache size</a>.</p> 29<p>The second memory pool configuration issue is the maximum size an 30underlying file can be and still be mapped into the process address 31space (instead of reading the file's pages into the cache). Mapping 32files into the process address space can result in better performance 33because available virtual memory is often much larger than the local 34cache, and page faults are faster than page copying on many systems. 35However, in the presence of limited virtual memory, it can cause 36resource starvation; and in the presence of large databases, it can 37result in immense process sizes. In addition, because of the 38requirements of the Berkeley DB transactional implementation, only read-only 39files can be mapped into process memory.</p> 40<p>To specify that no files are to be mapped into the process address 41space, specify the <a href="/api_c/env_set_flags.html#DB_NOMMAP">DB_NOMMAP</a> flag to the 42<a href="/api_c/env_set_flags.html">DB_ENV->set_flags</a> method. To specify that any individual file should 43not be mapped into the process address space, specify the 44<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 45the size of files mapped into the process address space, use the 46<a href="/api_c/env_set_mp_mmapsize.html">DB_ENV->set_mp_mmapsize</a> method.</p> 47<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> 48</td></tr></table> 49<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 50</body> 51</html> 52