mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-17 10:48:18 -07:00
use existing db cache size
This commit is contained in:
parent
661101c9ae
commit
d76e95e8fc
@ -45,8 +45,6 @@ pub struct Config {
|
|||||||
database_path: String,
|
database_path: String,
|
||||||
#[serde(default = "default_db_cache_capacity_mb")]
|
#[serde(default = "default_db_cache_capacity_mb")]
|
||||||
db_cache_capacity_mb: f64,
|
db_cache_capacity_mb: f64,
|
||||||
#[serde(default = "default_sled_cache_capacity_bytes")]
|
|
||||||
sled_cache_capacity_bytes: u64,
|
|
||||||
#[serde(default = "default_sqlite_read_pool_size")]
|
#[serde(default = "default_sqlite_read_pool_size")]
|
||||||
sqlite_read_pool_size: usize,
|
sqlite_read_pool_size: usize,
|
||||||
#[serde(default = "true_fn")]
|
#[serde(default = "true_fn")]
|
||||||
@ -111,10 +109,6 @@ fn default_db_cache_capacity_mb() -> f64 {
|
|||||||
200.0
|
200.0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_sled_cache_capacity_bytes() -> u64 {
|
|
||||||
1024 * 1024 * 1024
|
|
||||||
}
|
|
||||||
|
|
||||||
fn default_sqlite_read_pool_size() -> usize {
|
fn default_sqlite_read_pool_size() -> usize {
|
||||||
num_cpus::get().max(1)
|
num_cpus::get().max(1)
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ impl DatabaseEngine for Engine {
|
|||||||
Ok(Arc::new(Engine(
|
Ok(Arc::new(Engine(
|
||||||
sled::Config::default()
|
sled::Config::default()
|
||||||
.path(&config.database_path)
|
.path(&config.database_path)
|
||||||
.cache_capacity(config.sled_cache_capacity_bytes)
|
.cache_capacity((config.db_cache_capacity_mb * 1024.0 * 1024.0) as u64)
|
||||||
.use_compression(true)
|
.use_compression(true)
|
||||||
.open()?,
|
.open()?,
|
||||||
)))
|
)))
|
||||||
|
Loading…
Reference in New Issue
Block a user