aboutsummaryrefslogtreecommitdiff
path: root/src/util/config.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-05-03 17:27:43 +0200
committerAlex Auvolat <alex@adnab.me>2021-05-03 17:27:43 +0200
commit575726358c72772b7be00d0f8eaff76506118f7a (patch)
treea70969ceea0606c0634f5a88e111418219842bbe /src/util/config.rs
parent339c61178948c6d504578344aadedd2cfb80e42b (diff)
downloadgarage-575726358c72772b7be00d0f8eaff76506118f7a.tar.gz
garage-575726358c72772b7be00d0f8eaff76506118f7a.zip
Tune Sled configuration
- Make sled cache size and flush interval configurable - Set less agressive default values: - cache size 128MB instead of 1GB - Flush interval 2 seconds instead of .5 seconds
Diffstat (limited to 'src/util/config.rs')
-rw-r--r--src/util/config.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util/config.rs b/src/util/config.rs
index bb70467b..093b3850 100644
--- a/src/util/config.rs
+++ b/src/util/config.rs
@@ -26,6 +26,14 @@ pub struct Config {
/// Consul service name to use
pub consul_service_name: Option<String>,
+ /// Sled cache size, in bytes
+ #[serde(default = "default_sled_cache_capacity")]
+ pub sled_cache_capacity: u64,
+
+ /// Sled flush interval in milliseconds
+ #[serde(default = "default_sled_flush_every_ms")]
+ pub sled_flush_every_ms: u64,
+
/// Max number of concurrent RPC request
#[serde(default = "default_max_concurrent_rpc_requests")]
pub max_concurrent_rpc_requests: usize,
@@ -86,6 +94,12 @@ pub struct WebConfig {
pub index: String,
}
+fn default_sled_cache_capacity() -> u64 {
+ 128 * 1024 * 1024
+}
+fn default_sled_flush_every_ms() -> u64 {
+ 2000
+}
fn default_max_concurrent_rpc_requests() -> usize {
12
}