state: document memory_cache_bytes, reduce default
Closes #1026 Because of the way that sled uses this parameter, the actual in-memory size may be much larger. Dialing this down should help avoid high memory usage.
This commit is contained in:
parent
68b9a70a60
commit
e2c5b71323
|
|
@ -27,7 +27,16 @@ pub struct Config {
|
||||||
/// | Other | `std::env::current_dir()/cache` | |
|
/// | Other | `std::env::current_dir()/cache` | |
|
||||||
pub cache_dir: PathBuf,
|
pub cache_dir: PathBuf,
|
||||||
|
|
||||||
/// The maximum number of bytes to use caching data in memory.
|
/// Controls the size of the database cache, in bytes.
|
||||||
|
///
|
||||||
|
/// This corresponds to `sled`'s [`cache_capacity`][cc] parameter.
|
||||||
|
/// Note that the behavior of this parameter is [somewhat
|
||||||
|
/// unintuitive][gh], measuring the on-disk size of the cached data,
|
||||||
|
/// not the in-memory size, which may be much larger, especially for
|
||||||
|
/// smaller keys and values.
|
||||||
|
///
|
||||||
|
/// [cc]: https://docs.rs/sled/0.34.4/sled/struct.Config.html#method.cache_capacity
|
||||||
|
/// [gh]: https://github.com/spacejam/sled/issues/986#issuecomment-592950100
|
||||||
pub memory_cache_bytes: u64,
|
pub memory_cache_bytes: u64,
|
||||||
|
|
||||||
/// Whether to use an ephemeral database.
|
/// Whether to use an ephemeral database.
|
||||||
|
|
@ -87,7 +96,7 @@ impl Default for Config {
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
cache_dir,
|
cache_dir,
|
||||||
memory_cache_bytes: 512 * 1024 * 1024,
|
memory_cache_bytes: 50_000_000,
|
||||||
ephemeral: false,
|
ephemeral: false,
|
||||||
debug_stop_at_height: None,
|
debug_stop_at_height: None,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue