aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-03-27 15:26:08 +0100
committerAlex Auvolat <alex@adnab.me>2024-03-27 16:22:40 +0100
commit0d3e285d133459fd53e28f879a86c0de1a0c36df (patch)
tree4301ed7bd7ed72e79701c68bebdb4c5ea1db37a5 /src/util
parent95eb8808e8ede5439cf6352ce4f9a148fac2f236 (diff)
downloadgarage-0d3e285d133459fd53e28f879a86c0de1a0c36df.tar.gz
garage-0d3e285d133459fd53e28f879a86c0de1a0c36df.zip
[fix-buffering] implement `block_ram_buffer_max` to avoid excessive RAM usage
Diffstat (limited to 'src/util')
-rw-r--r--src/util/config.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/config.rs b/src/util/config.rs
index 8ecbdfbb..5372a1ec 100644
--- a/src/util/config.rs
+++ b/src/util/config.rs
@@ -52,6 +52,14 @@ pub struct Config {
)]
pub compression_level: Option<i32>,
+ /// Maximum amount of block data to buffer in RAM for sending to
+ /// remote nodes when these nodes are on slower links
+ #[serde(
+ deserialize_with = "deserialize_capacity",
+ default = "default_block_ram_buffer_max"
+ )]
+ pub block_ram_buffer_max: usize,
+
/// Skip the permission check of secret files. Useful when
/// POSIX ACLs (or more complex chmods) are used.
#[serde(default)]
@@ -255,6 +263,9 @@ fn default_sled_flush_every_ms() -> u64 {
fn default_block_size() -> usize {
1048576
}
+fn default_block_ram_buffer_max() -> usize {
+ 256 * 1024 * 1024
+}
fn default_compression() -> Option<i32> {
Some(1)