/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2009 Oracle. All rights reserved.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace BerkeleyDB {
///
/// A class representing configuration parameters for a
/// 's memory pool subsystem.
///
public class MPoolConfig {
///
/// The size of the shared memory buffer pool — that is, 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 maximum size of a single cache is
/// 4GB on 32-bit systems and 10TB on 64-bit systems. (All sizes are in
/// powers-of-two, that is, 256KB is 2^18 not 256,000.) For information
/// on tuning the Berkeley DB cache size, see Selecting a cache size in
/// the Programmer's Reference Guide.
///
///
public CacheInfo CacheSize;
///
/// The maximum cache size.
///
///
///
/// The specified size is rounded to the nearest multiple of the cache
/// region size, which is the initial cache size divided by
/// CacheSize.NCaches. If no value
/// is specified, it defaults to the initial cache size.
///
///
public CacheInfo MaxCacheSize;
internal bool maxOpenFDIsSet;
private int maxOpenFD;
///
/// The number of file descriptors the library will open concurrently
/// when flushing dirty pages from the cache.
///
public int MaxOpenFiles {
get { return maxOpenFD; }
set {
maxOpenFDIsSet = true;
maxOpenFD = value;
}
}
internal bool maxSeqWriteIsSet;
private int maxSeqWrites;
private uint maxSeqWritesPause;
///
/// Limit the number of sequential write operations scheduled by the
/// library when flushing dirty pages from the cache.
///
///
/// The maximum number of sequential write operations scheduled by the
/// library when flushing dirty pages from the cache, or 0 if there is
/// no limitation on the number of sequential write operations.
///
///
/// The number of microseconds the thread of control should pause before
/// scheduling further write operations. It must be specified as an
/// unsigned 32-bit number of microseconds, limiting the maximum pause
/// to roughly 71 minutes.
///
public void SetMaxSequentialWrites(int maxWrites, uint pause) {
maxSeqWriteIsSet = true;
maxSeqWrites = maxWrites;
maxSeqWritesPause = pause;
}
///
/// The number of microseconds the thread of control should pause before
/// scheduling further write operations.
///
public uint SequentialWritePause { get { return maxSeqWritesPause; } }
///
/// The number of sequential write operations scheduled by the library
/// when flushing dirty pages from the cache.
///
public int MaxSequentialWrites { get { return maxSeqWrites; } }
internal bool mmapSizeSet;
private uint mmap_size;
///
/// The maximum file size, in bytes, for a file to be mapped into the
/// process address space. If no value is specified, it defaults to
/// 10MB.
///
///
/// Files that are opened read-only in the cache (and that satisfy a few
/// other criteria) are, by default, mapped into the process address
/// space instead of being copied into the local cache. This can result
/// in better-than-usual performance because available virtual memory is
/// normally much larger than the local cache, and page faults are
/// faster than page copying on many systems. However, it can cause
/// resource starvation in the presence of limited virtual memory, and
/// it can result in immense process sizes in the presence of large
/// databases.
///
public uint MMapSize {
get { return mmap_size; }
set {
mmapSizeSet = true;
mmap_size = value;
}
}
}
}