Go to the source code of this file.
int mdbm_pool_parse_pool_size |
( |
const char * |
value | ) |
|
Parse and return the configured pool size for the this process.
- Parameters
-
value | configuration setting value. The format of the value is comma (,) separated list name=value pairs where name is the application basename (e.g. yapache, yjava_daemon) and the value is the number of handles in the pool. |
- Returns
- Number of configured number of mdbm handles for the pool
void mdbm_pool_verify_pool_size |
( |
int * |
vals, |
|
|
int |
count |
|
) |
| |
Verifies and returns updated values for number of handles in the pool.
The maximum useful size of handles is affected by both the maximum allowed number of open files (NOFILE) and the maximum number of processes (NPROC):
NOFILE limit: Each mdbm handle requires two open file entries (one for the db file and one for the lock file). Thus, if ynetdblib sees that the number of requested mdbm handles exceeds 3/4 of the maximum allowed number of open files ( determined by getrlimit(RLIMIT_NOFILE, ...), it will scale back accordingly.
NPROC limit: Since each thread requires only one mdbm handle, and not all threads need to open ynetdblib mdbm files, there is no good reason to support having as many handles as the maximum number of processes. Thus, if ynetdblib sees that the number of requested mdbm handles exceeds 3/4 of the maximum allowed number of processes (determined by getrlimit(RLIMIT_NPROC, ...) it will scale back accordingly.
- Parameters
-
vals | integer array that includes the values to be checked. If the value is larger than the system limit as described above, the array is updated to reflect the new value |
count | the number of integers in the vals array |
Create a pool of mdbm handles.
- Parameters
-
db | MDBM handle that will be duplicated |
size | number of duplicated handles |
- Returns
- pointer to newly created pool object. This object must destroyed using mdbm_pool_destroy_pool function.
Delete a mdbm handle pool.
- Parameters
-
pool | pointer to a pool object that was returned from calling mdbm_pool_create_pool function |
- Returns
- 1 if successful or 0 for failure.
Acquire an MDBM handle for database operations.
If there are no available handles in the pool, the function will block until there is one available.
- Parameters
-
pool | pointer to a pool object that was returned from calling mdbm_pool_create_pool function |
- Returns
- pointer to MDBM handle or NULL for failure. The MDBM handle must be returned to the pool with the mdbm_pool_release_handle function
Release MDBM handle back to the pool.
- Parameters
-
pool | pointer to a pool object that was returned from calling mdbm_pool_create_pool function |
db | pointer to the MDBM handle to be released back to the pool. This pointer must have been acquired from the mdbm_pool_acquire_handle call. |
- Returns
- 1 if successful or 0 for failure.
Acquire an exclusive MDBM handle for database operations.
The original MDBM handle that was used for duplication is returned to the caller. The function guarnatees that all of the duplicated MDBM handles are in the pool and nobody is using them.
- Parameters
-
pool | pointer to a pool object that was returned from calling mdbm_pool_create_pool function |
- Returns
- pointer to MDBM handle or NULL for failure. The MDBM handle must be returned to the pool with the mdbm_pool_release_handle function
Release an exclusive MDBM handle.
- Parameters
-
pool | pointer to a pool object that was returned from calling mdbm_pool_create_pool function |
db | pointer to the exclusive MDBM handle to be released. This pointer must have been acquired from the mdbm_pool_acquire_excl_handle call. |
- Returns
- 1 if successful or 0 for failure.