diff --git a/Cargo.lock b/Cargo.lock index ebb558bc375cf..7c0ecd2c81fed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3103,7 +3103,7 @@ dependencies = [ [[package]] name = "foyer" version = "0.1.0" -source = "git+https://github.com/MrCroxx/foyer?rev=2261151#2261151107ad362851f5fff9ce4fa56e61911b10" +source = "git+https://github.com/MrCroxx/foyer?rev=9232b3a#9232b3aa468460b60c44c26eac62dadf3594a383" dependencies = [ "foyer-common", "foyer-intrusive", @@ -3114,7 +3114,7 @@ dependencies = [ [[package]] name = "foyer-common" version = "0.1.0" -source = "git+https://github.com/MrCroxx/foyer?rev=2261151#2261151107ad362851f5fff9ce4fa56e61911b10" +source = "git+https://github.com/MrCroxx/foyer?rev=9232b3a#9232b3aa468460b60c44c26eac62dadf3594a383" dependencies = [ "bytes", "foyer-workspace-hack", @@ -3129,7 +3129,7 @@ dependencies = [ [[package]] name = "foyer-intrusive" version = "0.1.0" -source = "git+https://github.com/MrCroxx/foyer?rev=2261151#2261151107ad362851f5fff9ce4fa56e61911b10" +source = "git+https://github.com/MrCroxx/foyer?rev=9232b3a#9232b3aa468460b60c44c26eac62dadf3594a383" dependencies = [ "bytes", "cmsketch", @@ -3146,10 +3146,9 @@ dependencies = [ [[package]] name = "foyer-storage" version = "0.1.0" -source = "git+https://github.com/MrCroxx/foyer?rev=2261151#2261151107ad362851f5fff9ce4fa56e61911b10" +source = "git+https://github.com/MrCroxx/foyer?rev=9232b3a#9232b3aa468460b60c44c26eac62dadf3594a383" dependencies = [ "anyhow", - "async-channel", "bitflags 2.4.0", "bitmaps", "bytes", @@ -3170,16 +3169,19 @@ dependencies = [ "thiserror", "tracing", "twox-hash", + "zstd 0.13.0", ] [[package]] name = "foyer-workspace-hack" version = "0.1.0" -source = "git+https://github.com/MrCroxx/foyer?rev=2261151#2261151107ad362851f5fff9ce4fa56e61911b10" +source = "git+https://github.com/MrCroxx/foyer?rev=9232b3a#9232b3aa468460b60c44c26eac62dadf3594a383" dependencies = [ + "cc", "crossbeam-utils", "either", "futures-channel", + "futures-core", "futures-executor", "futures-sink", "futures-util", diff --git a/src/common/src/config.rs b/src/common/src/config.rs index 9e515ba471967..709ceae4b2799 100644 --- a/src/common/src/config.rs +++ b/src/common/src/config.rs @@ -634,9 +634,6 @@ pub struct FileCacheConfig { #[serde(default = "default::file_cache::file_capacity_mb")] pub file_capacity_mb: usize, - #[serde(default)] - pub buffer_pool_size_mb: Option, - #[serde(default = "default::file_cache::device_align")] pub device_align: usize, @@ -661,17 +658,17 @@ pub struct FileCacheConfig { #[serde(default = "default::file_cache::insert_rate_limit_mb")] pub insert_rate_limit_mb: usize, - #[serde(default = "default::file_cache::flush_rate_limit_mb")] - pub flush_rate_limit_mb: usize, - #[serde(default = "default::file_cache::reclaim_rate_limit_mb")] pub reclaim_rate_limit_mb: usize, - #[serde(default = "default::file_cache::allocation_bits")] - pub allocation_bits: usize, + #[serde(default = "default::file_cache::ring_buffer_capacity_mb")] + pub ring_buffer_capacity_mb: usize, + + #[serde(default = "default::file_cache::catalog_bits")] + pub catalog_bits: usize, - #[serde(default = "default::file_cache::allocation_timeout_ms")] - pub allocation_timeout_ms: usize, + #[serde(default = "default::file_cache::compression")] + pub compression: String, #[serde(default, flatten)] pub unrecognized: Unrecognized, @@ -1127,10 +1124,6 @@ pub mod default { 64 } - pub fn buffer_pool_size_mb() -> usize { - 1024 - } - pub fn device_align() -> usize { 4096 } @@ -1163,20 +1156,20 @@ pub mod default { 0 } - pub fn flush_rate_limit_mb() -> usize { + pub fn reclaim_rate_limit_mb() -> usize { 0 } - pub fn reclaim_rate_limit_mb() -> usize { - 0 + pub fn ring_buffer_capacity_mb() -> usize { + 256 } - pub fn allocation_bits() -> usize { - 0 + pub fn catalog_bits() -> usize { + 6 } - pub fn allocation_timeout_ms() -> usize { - 10 + pub fn compression() -> String { + "none".to_string() } } @@ -1391,8 +1384,8 @@ pub struct StorageMemoryConfig { pub block_cache_capacity_mb: usize, pub meta_cache_capacity_mb: usize, pub shared_buffer_capacity_mb: usize, - pub data_file_cache_buffer_pool_capacity_mb: usize, - pub meta_file_cache_buffer_pool_capacity_mb: usize, + pub data_file_cache_ring_buffer_capacity_mb: usize, + pub meta_file_cache_ring_buffer_capacity_mb: usize, pub compactor_memory_limit_mb: usize, pub high_priority_ratio_in_percent: usize, } @@ -1410,16 +1403,8 @@ pub fn extract_storage_memory_config(s: &RwConfig) -> StorageMemoryConfig { .storage .shared_buffer_capacity_mb .unwrap_or(default::storage::shared_buffer_capacity_mb()); - let data_file_cache_buffer_pool_size_mb = s - .storage - .data_file_cache - .buffer_pool_size_mb - .unwrap_or(default::file_cache::buffer_pool_size_mb()); - let meta_file_cache_buffer_pool_size_mb = s - .storage - .meta_file_cache - .buffer_pool_size_mb - .unwrap_or(default::file_cache::buffer_pool_size_mb()); + let data_file_cache_ring_buffer_capacity_mb = s.storage.data_file_cache.ring_buffer_capacity_mb; + let meta_file_cache_ring_buffer_capacity_mb = s.storage.meta_file_cache.ring_buffer_capacity_mb; let compactor_memory_limit_mb = s .storage .compactor_memory_limit_mb @@ -1433,8 +1418,8 @@ pub fn extract_storage_memory_config(s: &RwConfig) -> StorageMemoryConfig { block_cache_capacity_mb, meta_cache_capacity_mb, shared_buffer_capacity_mb, - data_file_cache_buffer_pool_capacity_mb: data_file_cache_buffer_pool_size_mb, - meta_file_cache_buffer_pool_capacity_mb: meta_file_cache_buffer_pool_size_mb, + data_file_cache_ring_buffer_capacity_mb, + meta_file_cache_ring_buffer_capacity_mb, compactor_memory_limit_mb, high_priority_ratio_in_percent, } diff --git a/src/compute/src/memory_management/mod.rs b/src/compute/src/memory_management/mod.rs index b6811935a1e9d..aed720e36786f 100644 --- a/src/compute/src/memory_management/mod.rs +++ b/src/compute/src/memory_management/mod.rs @@ -155,39 +155,15 @@ pub fn storage_memory_config( >> 20, ); - // `foyer` uses a buffer pool to manage dirty buffers. - // - // buffer size = region size (single file size with fs device) - // - // writing buffer + flushing buffer + free buffer = buffer pool buffers - // - // To utilize flushers and allocators, buffers should >= allocators + flushers. - // - // Adding more buffers can prevent allocators from waiting for buffers to be freed by flushers. - - let data_file_cache_buffer_pool_capacity_mb = if storage_config.data_file_cache.dir.is_empty() { + let data_file_cache_ring_buffer_capacity_mb = if storage_config.data_file_cache.dir.is_empty() { 0 } else { - storage_config - .data_file_cache - .buffer_pool_size_mb - .unwrap_or( - storage_config.data_file_cache.file_capacity_mb - * (storage_config.data_file_cache.flushers - + 2 * (1 << storage_config.data_file_cache.allocation_bits)), - ) + storage_config.data_file_cache.ring_buffer_capacity_mb }; - let meta_file_cache_buffer_pool_capacity_mb = if storage_config.meta_file_cache.dir.is_empty() { + let meta_file_cache_ring_buffer_capacity_mb = if storage_config.meta_file_cache.dir.is_empty() { 0 } else { - storage_config - .meta_file_cache - .buffer_pool_size_mb - .unwrap_or( - storage_config.meta_file_cache.file_capacity_mb - * (storage_config.meta_file_cache.flushers - + 2 * (1 << storage_config.meta_file_cache.allocation_bits)), - ) + storage_config.meta_file_cache.ring_buffer_capacity_mb }; let compactor_memory_limit_mb = storage_config.compactor_memory_limit_mb.unwrap_or( @@ -197,8 +173,8 @@ pub fn storage_memory_config( let total_calculated_mb = block_cache_capacity_mb + meta_cache_capacity_mb + shared_buffer_capacity_mb - + data_file_cache_buffer_pool_capacity_mb - + meta_file_cache_buffer_pool_capacity_mb + + data_file_cache_ring_buffer_capacity_mb + + meta_file_cache_ring_buffer_capacity_mb + compactor_memory_limit_mb; let soft_limit_mb = (non_reserved_memory_bytes as f64 * (storage_memory_proportion + compactor_memory_proportion).ceil()) @@ -217,8 +193,8 @@ pub fn storage_memory_config( block_cache_capacity_mb, meta_cache_capacity_mb, shared_buffer_capacity_mb, - data_file_cache_buffer_pool_capacity_mb, - meta_file_cache_buffer_pool_capacity_mb, + data_file_cache_ring_buffer_capacity_mb, + meta_file_cache_ring_buffer_capacity_mb, compactor_memory_limit_mb, high_priority_ratio_in_percent, } @@ -246,6 +222,7 @@ mod tests { #[test] fn test_storage_memory_config() { let mut storage_config = StorageConfig::default(); + let total_non_reserved_memory_bytes = 8 << 30; let memory_config = @@ -253,8 +230,8 @@ mod tests { assert_eq!(memory_config.block_cache_capacity_mb, 737); assert_eq!(memory_config.meta_cache_capacity_mb, 860); assert_eq!(memory_config.shared_buffer_capacity_mb, 737); - assert_eq!(memory_config.data_file_cache_buffer_pool_capacity_mb, 0); - assert_eq!(memory_config.meta_file_cache_buffer_pool_capacity_mb, 0); + assert_eq!(memory_config.data_file_cache_ring_buffer_capacity_mb, 0); + assert_eq!(memory_config.meta_file_cache_ring_buffer_capacity_mb, 0); assert_eq!(memory_config.compactor_memory_limit_mb, 819); storage_config.data_file_cache.dir = "data".to_string(); @@ -264,22 +241,20 @@ mod tests { assert_eq!(memory_config.block_cache_capacity_mb, 737); assert_eq!(memory_config.meta_cache_capacity_mb, 860); assert_eq!(memory_config.shared_buffer_capacity_mb, 737); - assert_eq!(memory_config.data_file_cache_buffer_pool_capacity_mb, 384); - assert_eq!(memory_config.meta_file_cache_buffer_pool_capacity_mb, 384); + assert_eq!(memory_config.data_file_cache_ring_buffer_capacity_mb, 256); + assert_eq!(memory_config.meta_file_cache_ring_buffer_capacity_mb, 256); assert_eq!(memory_config.compactor_memory_limit_mb, 819); storage_config.block_cache_capacity_mb = Some(512); storage_config.meta_cache_capacity_mb = Some(128); storage_config.shared_buffer_capacity_mb = Some(1024); - storage_config.data_file_cache.buffer_pool_size_mb = Some(1024); - storage_config.meta_file_cache.buffer_pool_size_mb = Some(1024); storage_config.compactor_memory_limit_mb = Some(512); let memory_config = storage_memory_config(0, true, &storage_config); assert_eq!(memory_config.block_cache_capacity_mb, 512); assert_eq!(memory_config.meta_cache_capacity_mb, 128); assert_eq!(memory_config.shared_buffer_capacity_mb, 1024); - assert_eq!(memory_config.data_file_cache_buffer_pool_capacity_mb, 1024); - assert_eq!(memory_config.meta_file_cache_buffer_pool_capacity_mb, 1024); + assert_eq!(memory_config.data_file_cache_ring_buffer_capacity_mb, 256); + assert_eq!(memory_config.meta_file_cache_ring_buffer_capacity_mb, 256); assert_eq!(memory_config.compactor_memory_limit_mb, 512); } } diff --git a/src/compute/src/server.rs b/src/compute/src/server.rs index bfa2ad6584090..672e0f43bea06 100644 --- a/src/compute/src/server.rs +++ b/src/compute/src/server.rs @@ -496,8 +496,8 @@ fn total_storage_memory_limit_bytes(storage_memory_config: &StorageMemoryConfig) let total_storage_memory_mb = storage_memory_config.block_cache_capacity_mb + storage_memory_config.meta_cache_capacity_mb + storage_memory_config.shared_buffer_capacity_mb - + storage_memory_config.data_file_cache_buffer_pool_capacity_mb - + storage_memory_config.meta_file_cache_buffer_pool_capacity_mb + + storage_memory_config.data_file_cache_ring_buffer_capacity_mb + + storage_memory_config.meta_file_cache_ring_buffer_capacity_mb + storage_memory_config.compactor_memory_limit_mb; total_storage_memory_mb << 20 } @@ -538,8 +538,8 @@ fn print_memory_config( convert((storage_memory_config.block_cache_capacity_mb << 20) as _), convert((storage_memory_config.meta_cache_capacity_mb << 20) as _), convert((storage_memory_config.shared_buffer_capacity_mb << 20) as _), - convert((storage_memory_config.data_file_cache_buffer_pool_capacity_mb << 20) as _), - convert((storage_memory_config.meta_file_cache_buffer_pool_capacity_mb << 20) as _), + convert((storage_memory_config.data_file_cache_ring_buffer_capacity_mb << 20) as _), + convert((storage_memory_config.meta_file_cache_ring_buffer_capacity_mb << 20) as _), if embedded_compactor_enabled { convert((storage_memory_config.compactor_memory_limit_mb << 20) as _) } else { diff --git a/src/config/example.toml b/src/config/example.toml index 141078ddf8a54..f381fce00ab09 100644 --- a/src/config/example.toml +++ b/src/config/example.toml @@ -124,10 +124,10 @@ recover_concurrency = 8 lfu_window_to_cache_size_ratio = 1 lfu_tiny_lru_capacity_ratio = 0.01 insert_rate_limit_mb = 0 -flush_rate_limit_mb = 0 reclaim_rate_limit_mb = 0 -allocation_bits = 0 -allocation_timeout_ms = 10 +ring_buffer_capacity_mb = 256 +catalog_bits = 6 +compression = "none" [storage.meta_file_cache] dir = "" @@ -141,10 +141,10 @@ recover_concurrency = 8 lfu_window_to_cache_size_ratio = 1 lfu_tiny_lru_capacity_ratio = 0.01 insert_rate_limit_mb = 0 -flush_rate_limit_mb = 0 reclaim_rate_limit_mb = 0 -allocation_bits = 0 -allocation_timeout_ms = 10 +ring_buffer_capacity_mb = 256 +catalog_bits = 6 +compression = "none" [storage.cache_refill] data_refill_levels = [] diff --git a/src/storage/Cargo.toml b/src/storage/Cargo.toml index 0a948c52dbaa6..9b06310bde62c 100644 --- a/src/storage/Cargo.toml +++ b/src/storage/Cargo.toml @@ -25,7 +25,7 @@ dyn-clone = "1.0.14" either = "1" enum-as-inner = "0.6" fail = "0.5" -foyer = { git = "https://github.com/MrCroxx/foyer", rev = "2261151" } +foyer = { git = "https://github.com/MrCroxx/foyer", rev = "9232b3a" } futures = { version = "0.3", default-features = false, features = ["alloc"] } futures-async-stream = { workspace = true } hex = "0.4" diff --git a/src/storage/src/hummock/file_cache/store.rs b/src/storage/src/hummock/file_cache/store.rs index 222700c8376b2..59a84d2d80487 100644 --- a/src/storage/src/hummock/file_cache/store.rs +++ b/src/storage/src/hummock/file_cache/store.rs @@ -16,13 +16,13 @@ use std::fmt::Debug; use std::hash::Hash; use std::path::PathBuf; use std::sync::Arc; -use std::time::Duration; use bytes::{Buf, BufMut, Bytes}; use foyer::common::code::{Key, Value}; use foyer::intrusive::eviction::lfu::LfuConfig; use foyer::storage::admission::rated_ticket::RatedTicketAdmissionPolicy; use foyer::storage::admission::AdmissionPolicy; +use foyer::storage::compress::Compression; use foyer::storage::device::fs::FsDeviceConfig; pub use foyer::storage::metrics::set_metrics_registry as set_foyer_metrics_registry; use foyer::storage::reinsertion::ReinsertionPolicy; @@ -59,21 +59,20 @@ where pub dir: PathBuf, pub capacity: usize, pub file_capacity: usize, - pub buffer_pool_size: usize, pub device_align: usize, pub device_io_size: usize, pub flushers: usize, - pub flush_rate_limit: usize, pub reclaimers: usize, pub reclaim_rate_limit: usize, pub recover_concurrency: usize, pub lfu_window_to_cache_size_ratio: usize, pub lfu_tiny_lru_capacity_ratio: f64, pub insert_rate_limit: usize, - pub allocator_bits: usize, - pub allocation_timeout: Duration, + pub ring_buffer_capacity: usize, + pub catalog_bits: usize, pub admissions: Vec>>, pub reinsertions: Vec>>, + pub compression: Compression, } impl Clone for FileCacheConfig @@ -87,21 +86,20 @@ where dir: self.dir.clone(), capacity: self.capacity, file_capacity: self.file_capacity, - buffer_pool_size: self.buffer_pool_size, device_align: self.device_align, device_io_size: self.device_io_size, flushers: self.flushers, - flush_rate_limit: self.flush_rate_limit, reclaimers: self.reclaimers, reclaim_rate_limit: self.reclaim_rate_limit, recover_concurrency: self.recover_concurrency, lfu_window_to_cache_size_ratio: self.lfu_window_to_cache_size_ratio, lfu_tiny_lru_capacity_ratio: self.lfu_tiny_lru_capacity_ratio, insert_rate_limit: self.insert_rate_limit, - allocator_bits: self.allocator_bits, - allocation_timeout: self.allocation_timeout, + ring_buffer_capacity: self.ring_buffer_capacity, + catalog_bits: self.catalog_bits, admissions: self.admissions.clone(), reinsertions: self.reinsertions.clone(), + compression: self.compression, } } } @@ -255,18 +253,17 @@ where align: config.device_align, io_size: config.device_io_size, }, - allocator_bits: config.allocator_bits, - catalog_bits: 6, + ring_buffer_capacity: config.ring_buffer_capacity, + catalog_bits: config.catalog_bits, admissions, reinsertions: config.reinsertions, - buffer_pool_size: config.buffer_pool_size, + flusher_buffer_size: 131072, // TODO: make it configurable flushers: config.flushers, - flush_rate_limit: config.flush_rate_limit, reclaimers: config.reclaimers, reclaim_rate_limit: config.reclaim_rate_limit, - allocation_timeout: config.allocation_timeout, clean_region_threshold: config.reclaimers + config.reclaimers / 2, recover_concurrency: config.recover_concurrency, + compression: config.compression, } .into(), runtime: RuntimeConfig { diff --git a/src/storage/src/opts.rs b/src/storage/src/opts.rs index a3243cbc8c465..c850761a9df40 100644 --- a/src/storage/src/opts.rs +++ b/src/storage/src/opts.rs @@ -67,7 +67,6 @@ pub struct StorageOpts { pub data_file_cache_dir: String, pub data_file_cache_capacity_mb: usize, pub data_file_cache_file_capacity_mb: usize, - pub data_file_cache_buffer_pool_size_mb: usize, pub data_file_cache_device_align: usize, pub data_file_cache_device_io_size: usize, pub data_file_cache_flushers: usize, @@ -76,10 +75,10 @@ pub struct StorageOpts { pub data_file_cache_lfu_window_to_cache_size_ratio: usize, pub data_file_cache_lfu_tiny_lru_capacity_ratio: f64, pub data_file_cache_insert_rate_limit_mb: usize, - pub data_file_cache_flush_rate_limit_mb: usize, pub data_file_cache_reclaim_rate_limit_mb: usize, - pub data_file_cache_allocation_bits: usize, - pub data_file_cache_allocation_timeout_ms: usize, + pub data_file_cache_ring_buffer_capacity_mb: usize, + pub data_file_cache_catalog_bits: usize, + pub data_file_cache_compression: String, pub cache_refill_data_refill_levels: Vec, pub cache_refill_timeout_ms: u64, @@ -92,7 +91,6 @@ pub struct StorageOpts { pub meta_file_cache_dir: String, pub meta_file_cache_capacity_mb: usize, pub meta_file_cache_file_capacity_mb: usize, - pub meta_file_cache_buffer_pool_size_mb: usize, pub meta_file_cache_device_align: usize, pub meta_file_cache_device_io_size: usize, pub meta_file_cache_flushers: usize, @@ -101,10 +99,10 @@ pub struct StorageOpts { pub meta_file_cache_lfu_window_to_cache_size_ratio: usize, pub meta_file_cache_lfu_tiny_lru_capacity_ratio: f64, pub meta_file_cache_insert_rate_limit_mb: usize, - pub meta_file_cache_flush_rate_limit_mb: usize, pub meta_file_cache_reclaim_rate_limit_mb: usize, - pub meta_file_cache_allocation_bits: usize, - pub meta_file_cache_allocation_timeout_ms: usize, + pub meta_file_cache_ring_buffer_capacity_mb: usize, + pub meta_file_cache_catalog_bits: usize, + pub meta_file_cache_compression: String, /// The storage url for storing backups. pub backup_storage_url: String, @@ -167,7 +165,6 @@ impl From<(&RwConfig, &SystemParamsReader, &StorageMemoryConfig)> for StorageOpt data_file_cache_dir: c.storage.data_file_cache.dir.clone(), data_file_cache_capacity_mb: c.storage.data_file_cache.capacity_mb, data_file_cache_file_capacity_mb: c.storage.data_file_cache.file_capacity_mb, - data_file_cache_buffer_pool_size_mb: s.data_file_cache_buffer_pool_capacity_mb, data_file_cache_device_align: c.storage.data_file_cache.device_align, data_file_cache_device_io_size: c.storage.data_file_cache.device_io_size, data_file_cache_flushers: c.storage.data_file_cache.flushers, @@ -182,14 +179,16 @@ impl From<(&RwConfig, &SystemParamsReader, &StorageMemoryConfig)> for StorageOpt .data_file_cache .lfu_tiny_lru_capacity_ratio, data_file_cache_insert_rate_limit_mb: c.storage.data_file_cache.insert_rate_limit_mb, - data_file_cache_flush_rate_limit_mb: c.storage.data_file_cache.flush_rate_limit_mb, data_file_cache_reclaim_rate_limit_mb: c.storage.data_file_cache.reclaim_rate_limit_mb, - data_file_cache_allocation_bits: c.storage.data_file_cache.allocation_bits, - data_file_cache_allocation_timeout_ms: c.storage.data_file_cache.allocation_timeout_ms, + data_file_cache_ring_buffer_capacity_mb: c + .storage + .data_file_cache + .ring_buffer_capacity_mb, + data_file_cache_catalog_bits: c.storage.data_file_cache.catalog_bits, + data_file_cache_compression: c.storage.data_file_cache.compression.clone(), meta_file_cache_dir: c.storage.meta_file_cache.dir.clone(), meta_file_cache_capacity_mb: c.storage.meta_file_cache.capacity_mb, meta_file_cache_file_capacity_mb: c.storage.meta_file_cache.file_capacity_mb, - meta_file_cache_buffer_pool_size_mb: s.meta_file_cache_buffer_pool_capacity_mb, meta_file_cache_device_align: c.storage.meta_file_cache.device_align, meta_file_cache_device_io_size: c.storage.meta_file_cache.device_io_size, meta_file_cache_flushers: c.storage.meta_file_cache.flushers, @@ -204,10 +203,13 @@ impl From<(&RwConfig, &SystemParamsReader, &StorageMemoryConfig)> for StorageOpt .meta_file_cache .lfu_tiny_lru_capacity_ratio, meta_file_cache_insert_rate_limit_mb: c.storage.meta_file_cache.insert_rate_limit_mb, - meta_file_cache_flush_rate_limit_mb: c.storage.meta_file_cache.flush_rate_limit_mb, meta_file_cache_reclaim_rate_limit_mb: c.storage.meta_file_cache.reclaim_rate_limit_mb, - meta_file_cache_allocation_bits: c.storage.meta_file_cache.allocation_bits, - meta_file_cache_allocation_timeout_ms: c.storage.meta_file_cache.allocation_timeout_ms, + meta_file_cache_ring_buffer_capacity_mb: c + .storage + .meta_file_cache + .ring_buffer_capacity_mb, + meta_file_cache_catalog_bits: c.storage.meta_file_cache.catalog_bits, + meta_file_cache_compression: c.storage.meta_file_cache.compression.clone(), cache_refill_data_refill_levels: c.storage.cache_refill.data_refill_levels.clone(), cache_refill_timeout_ms: c.storage.cache_refill.timeout_ms, cache_refill_concurrency: c.storage.cache_refill.concurrency, diff --git a/src/storage/src/store_impl.rs b/src/storage/src/store_impl.rs index 8460b75ebc0dc..06305bb208df2 100644 --- a/src/storage/src/store_impl.rs +++ b/src/storage/src/store_impl.rs @@ -537,7 +537,6 @@ impl StateStoreImpl { dir: PathBuf::from(opts.data_file_cache_dir.clone()), capacity: opts.data_file_cache_capacity_mb * MB, file_capacity: opts.data_file_cache_file_capacity_mb * MB, - buffer_pool_size: opts.data_file_cache_buffer_pool_size_mb * MB, device_align: opts.data_file_cache_device_align, device_io_size: opts.data_file_cache_device_io_size, lfu_window_to_cache_size_ratio: opts.data_file_cache_lfu_window_to_cache_size_ratio, @@ -545,15 +544,19 @@ impl StateStoreImpl { insert_rate_limit: opts.data_file_cache_insert_rate_limit_mb * MB, flushers: opts.data_file_cache_flushers, reclaimers: opts.data_file_cache_reclaimers, - flush_rate_limit: opts.data_file_cache_flush_rate_limit_mb * MB, reclaim_rate_limit: opts.data_file_cache_reclaim_rate_limit_mb * MB, recover_concurrency: opts.data_file_cache_recover_concurrency, - allocator_bits: opts.data_file_cache_allocation_bits, - allocation_timeout: Duration::from_millis( - opts.data_file_cache_allocation_timeout_ms as u64, - ), + ring_buffer_capacity: opts.data_file_cache_ring_buffer_capacity_mb * MB, + catalog_bits: opts.data_file_cache_catalog_bits, admissions: vec![], reinsertions: vec![], + compression: match opts.data_file_cache_compression.as_str() { + "none" => foyer::storage::compress::Compression::None, + _ => panic!( + "data file cache compression type not support: {}", + opts.data_file_cache_compression + ), + }, }; let cache = FileCache::open(config) .await @@ -575,7 +578,6 @@ impl StateStoreImpl { dir: PathBuf::from(opts.meta_file_cache_dir.clone()), capacity: opts.meta_file_cache_capacity_mb * MB, file_capacity: opts.meta_file_cache_file_capacity_mb * MB, - buffer_pool_size: opts.meta_file_cache_buffer_pool_size_mb * MB, device_align: opts.meta_file_cache_device_align, device_io_size: opts.meta_file_cache_device_io_size, lfu_window_to_cache_size_ratio: opts.meta_file_cache_lfu_window_to_cache_size_ratio, @@ -583,15 +585,19 @@ impl StateStoreImpl { insert_rate_limit: opts.meta_file_cache_insert_rate_limit_mb * MB, flushers: opts.meta_file_cache_flushers, reclaimers: opts.meta_file_cache_reclaimers, - flush_rate_limit: opts.meta_file_cache_flush_rate_limit_mb * MB, reclaim_rate_limit: opts.meta_file_cache_reclaim_rate_limit_mb * MB, recover_concurrency: opts.meta_file_cache_recover_concurrency, - allocator_bits: opts.meta_file_cache_allocation_bits, - allocation_timeout: Duration::from_millis( - opts.meta_file_cache_allocation_timeout_ms as u64, - ), + ring_buffer_capacity: opts.meta_file_cache_ring_buffer_capacity_mb * MB, + catalog_bits: opts.meta_file_cache_catalog_bits, admissions: vec![], reinsertions: vec![], + compression: match opts.meta_file_cache_compression.as_str() { + "none" => foyer::storage::compress::Compression::None, + _ => panic!( + "meta file cache compression type not support: {}", + opts.meta_file_cache_compression + ), + }, }; FileCache::open(config) .await