Struct rocksdb::WriteBufferManager
source · pub struct WriteBufferManager(/* private fields */);
Implementations§
source§impl WriteBufferManager
impl WriteBufferManager
sourcepub fn new_write_buffer_manager(buffer_size: size_t, allow_stall: bool) -> Self
pub fn new_write_buffer_manager(buffer_size: size_t, allow_stall: bool) -> Self
https://github.com/facebook/rocksdb/wiki/Write-Buffer-Manager Write buffer manager helps users control the total memory used by memtables across multiple column families and/or DB instances. Users can enable this control by 2 ways:
1- Limit the total memtable usage across multiple column families and DBs under a threshold. 2- Cost the memtable memory usage to block cache so that memory of RocksDB can be capped by the single limit. The usage of a write buffer manager is similar to rate_limiter and sst_file_manager. Users can create one write buffer manager object and pass it to all the options of column families or DBs whose memtable size they want to be controlled by this object.
A memory limit is given when creating the write buffer manager object. RocksDB will try to limit the total memory to under this limit.
a flush will be triggered on one column family of the DB you are inserting to,
If mutable memtable size exceeds about 90% of the limit, If the total memory is over the limit, more aggressive flush may also be triggered only if the mutable memtable size also exceeds 50% of the limit. Both checks are needed because if already more than half memory is being flushed, triggering more flush may not help.
The total memory is counted as total memory allocated in the arena, even if some of that may not yet be used by memtable.
buffer_size: the memory limit in bytes. allow_stall: If set true, it will enable stalling of all writers when memory usage exceeds buffer_size (soft limit). It will wait for flush to complete and memory usage to drop down
sourcepub fn new_write_buffer_manager_with_cache(
buffer_size: size_t,
allow_stall: bool,
cache: Cache,
) -> Self
pub fn new_write_buffer_manager_with_cache( buffer_size: size_t, allow_stall: bool, cache: Cache, ) -> Self
Users can set up RocksDB to cost memory used by memtables to block cache. This can happen no matter whether you enable memtable memory limit or not. This option is added to manage memory (memtables + block cache) under a single limit.
buffer_size: the memory limit in bytes. allow_stall: If set true, it will enable stalling of all writers when memory usage exceeds buffer_size (soft limit). It will wait for flush to complete and memory usage to drop down cache: the block cache instance
sourcepub fn get_buffer_size(&self) -> usize
pub fn get_buffer_size(&self) -> usize
Returns the current buffer size in bytes.
sourcepub fn set_buffer_size(&self, new_size: usize)
pub fn set_buffer_size(&self, new_size: usize)
Set the buffer size in bytes.
sourcepub fn set_allow_stall(&self, allow_stall: bool)
pub fn set_allow_stall(&self, allow_stall: bool)
set the allow_stall flag.
Trait Implementations§
source§impl Clone for WriteBufferManager
impl Clone for WriteBufferManager
source§fn clone(&self) -> WriteBufferManager
fn clone(&self) -> WriteBufferManager
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for WriteBufferManager
impl RefUnwindSafe for WriteBufferManager
impl Send for WriteBufferManager
impl Sync for WriteBufferManager
impl Unpin for WriteBufferManager
impl UnwindSafe for WriteBufferManager
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)