From 780b92ada9afcf1d58085a83a0b9e6bc982203d1 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 17 Feb 2015 17:25:57 +0000 Subject: Imported from /home/lorry/working-area/delta_berkeleydb/db-6.1.23.tar.gz. --- docs/programmer_reference/env_size.html | 139 +++++++++++++++++--------------- 1 file changed, 72 insertions(+), 67 deletions(-) (limited to 'docs/programmer_reference/env_size.html') diff --git a/docs/programmer_reference/env_size.html b/docs/programmer_reference/env_size.html index 78f1398d..de849860 100644 --- a/docs/programmer_reference/env_size.html +++ b/docs/programmer_reference/env_size.html @@ -14,7 +14,7 @@

The Berkeley DB environment allocates memory to hold shared - structures, either in shared regions or in process data space (if the - DB_PRIVATE flag is specified). There are three distinct memory - regions: + structures, either in shared regions or in process data space + (if the DB_PRIVATE flag is specified). There are three + distinct memory regions:

- The shared structures in the main region are used by the lock, - transaction, logging, thread and replicatoin subsystems. + The shared structures in the main region are used by the + lock, transaction, logging, thread and replicatoin subsystems.

- Determining the amount of space allocated for each of these shared - structures is dependent upon the structure in question. The sizing - of the memory pool is discussed in - Configuring the memory pool. The amount - of memory needed for mutexes is calculated from the number of - mutexes needed by various subsystems and can be adjusted using the - DB_ENV->mutex_set_increment() method. + Determining the amount of space allocated for each of these + shared structures is dependent upon the structure in question. + The sizing of the memory pool is discussed in Configuring the memory pool. The + amount of memory needed for mutexes is calculated from the + number of mutexes needed by various subsystems and can be + adjusted using the DB_ENV->mutex_set_increment() method.

- For applications using shared memory (that is, they do not specify - DB_PRIVATE), a maximum memory size for the main region must be - specified or left to default. The maximum memory size is specified - using the DB_ENV->set_memory_max() method. + For applications using shared memory (that is, they do not + specify DB_PRIVATE), a maximum memory size for the main + region must be specified or left to default. The maximum + memory size is specified using the DB_ENV->set_memory_max() method.

-

+

The amount of memory needed by an application is dependent on the resources that the application uses. For a very rough estimate, add all of the following together: @@ -90,37 +89,40 @@

  1. -

    - The environment has an overhead of about 80 kilobytes - without statistics enabled or 250 kilobytes with statistics - enabled. +

    + The environment has an overhead of about 80 + kilobytes without statistics enabled or 250 kilobytes + with statistics enabled.

  2. - Identify the amount of space you require for your locks: + Identify the amount of space you require for your + locks:

    1. -

      - Estimate the number of threads of control that will - simultaneously access the environment. +

      + Estimate the number of threads of control + that will simultaneously access the + environment.

    2. -

      - Estimate the number of concurrency locks that, on average, - will be required by each thread. For information on - sizing concurrency locks, see - Configuring locking: sizing the system. +

      + Estimate the number of concurrency locks + that, on average, will be required by each + thread. For information on sizing concurrency + locks, see Configuring locking: sizing the + system.

    3. -

      - Multiply these two numbers, then multiply by 1/2 to - arrive at the number of kilobytes required to - service your locks. +

      + Multiply these two numbers, then multiply + by 1/2 to arrive at the number of kilobytes + required to service your locks.

    @@ -128,44 +130,45 @@
  3. - Estimate the number of open database handles you will use - at any given time. For each database handle, there is an - overhead of about 1/2 kilobyte. + Estimate the number of open database handles you + will use at any given time. For each database handle, + there is an overhead of about 1/2 kilobyte.

  4. - Add 1 kilobyte for each active transaction. + Add 1 kilobyte for each active transaction.

Note that these are very rough guidelines. It is best to - overestimate the needs of your applications, because if the memory - allocation is exhausted the application must be shutdown to - increase the allocation. + overestimate the needs of your applications, because if the + memory allocation is exhausted the application must be + shutdown to increase the allocation.

The estimate for maximum memory need not be exact. In most - situations there is little penalty for over estimating. For systems - using memory mapped files for the shared environment, this only - allocates the address space in the process to hold the maximum - memory. The backing file will only be extended as needed. For - systems running with DB_PRIVATE specified, the maximum memory - serves only as a limit and memory is allocated from the process - data space as needed. No maximum need be set for private - environments. + situations there is little penalty for over estimating. For + systems using memory mapped files for the shared environment, + this only allocates the address space in the process to hold + the maximum memory. The backing file will only be extended as + needed. For systems running with DB_PRIVATE specified, the + maximum memory serves only as a limit and memory is allocated + from the process data space as needed. No maximum need be set + for private environments.

-

- For locking and thread information, groups of objects are allocated - when needed so that there is less contention in the allocator - during performance critical operations. Once allocated to a - particular use, this memory will only be used for that structure. - To avoid runtime contention, or to ensure a minimum number of a - particular type of object, the DB_ENV->set_memory_init() method can be - used. This method can set the initial numbers of particular types - of structures to allocate at environment creation time. +

+ For locking and thread information, groups of objects are + allocated when needed so that there is less contention in the + allocator during performance critical operations. Once + allocated to a particular use, this memory will only be used + for that structure. To avoid runtime contention, or to ensure + a minimum number of a particular type of object, the + DB_ENV->set_memory_init() method can be used. This method can set + the initial numbers of particular types of structures to + allocate at environment creation time.

-- cgit v1.2.1