From a12a90557818d68d633f3fef5d0f041d8d1f52b6 Mon Sep 17 00:00:00 2001 From: Yingwen Date: Wed, 21 Aug 2024 16:38:38 +0800 Subject: [PATCH] chore: disable ttl for write cache by default (#4595) * chore: remove default write cache ttl * docs: update example config * chore: fix ci --- config/config.md | 10 ++++++---- config/datanode.example.toml | 9 +++++++-- config/standalone.example.toml | 9 +++++++-- src/cmd/tests/load_config_test.rs | 2 ++ src/mito2/src/config.rs | 2 +- tests-integration/tests/http.rs | 1 - 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/config/config.md b/config/config.md index 295eacf4f195..cd73ecbb9410 100644 --- a/config/config.md +++ b/config/config.md @@ -116,11 +116,12 @@ | `region_engine.mito.global_write_buffer_reject_size` | String | `2GB` | Global write buffer size threshold to reject write requests. If not set, it's default to 2 times of `global_write_buffer_size` | | `region_engine.mito.sst_meta_cache_size` | String | `128MB` | Cache size for SST metadata. Setting it to 0 to disable the cache.
If not set, it's default to 1/32 of OS memory with a max limitation of 128MB. | | `region_engine.mito.vector_cache_size` | String | `512MB` | Cache size for vectors and arrow arrays. Setting it to 0 to disable the cache.
If not set, it's default to 1/16 of OS memory with a max limitation of 512MB. | -| `region_engine.mito.page_cache_size` | String | `512MB` | Cache size for pages of SST row groups. Setting it to 0 to disable the cache.
If not set, it's default to 1/16 of OS memory with a max limitation of 512MB. | +| `region_engine.mito.page_cache_size` | String | `512MB` | Cache size for pages of SST row groups. Setting it to 0 to disable the cache.
If not set, it's default to 1/8 of OS memory. | +| `region_engine.mito.selector_result_cache_size` | String | `512MB` | Cache size for time series selector (e.g. `last_value()`). Setting it to 0 to disable the cache.
If not set, it's default to 1/16 of OS memory with a max limitation of 512MB. | | `region_engine.mito.enable_experimental_write_cache` | Bool | `false` | Whether to enable the experimental write cache. | | `region_engine.mito.experimental_write_cache_path` | String | `""` | File system path for write cache, defaults to `{data_home}/write_cache`. | | `region_engine.mito.experimental_write_cache_size` | String | `512MB` | Capacity for write cache. | -| `region_engine.mito.experimental_write_cache_ttl` | String | `1h` | TTL for write cache. | +| `region_engine.mito.experimental_write_cache_ttl` | String | `None` | TTL for write cache. | | `region_engine.mito.sst_write_buffer_size` | String | `8MB` | Buffer size for SST writing. | | `region_engine.mito.scan_parallelism` | Integer | `0` | Parallelism to scan a region (default: 1/4 of cpu cores).
- `0`: using the default value (1/4 of cpu cores).
- `1`: scan in current thread.
- `n`: scan in parallelism n. | | `region_engine.mito.parallel_scan_channel_size` | Integer | `32` | Capacity of the channel to send data from parallel scan tasks to the main task. | @@ -408,11 +409,12 @@ | `region_engine.mito.global_write_buffer_reject_size` | String | `2GB` | Global write buffer size threshold to reject write requests. If not set, it's default to 2 times of `global_write_buffer_size` | | `region_engine.mito.sst_meta_cache_size` | String | `128MB` | Cache size for SST metadata. Setting it to 0 to disable the cache.
If not set, it's default to 1/32 of OS memory with a max limitation of 128MB. | | `region_engine.mito.vector_cache_size` | String | `512MB` | Cache size for vectors and arrow arrays. Setting it to 0 to disable the cache.
If not set, it's default to 1/16 of OS memory with a max limitation of 512MB. | -| `region_engine.mito.page_cache_size` | String | `512MB` | Cache size for pages of SST row groups. Setting it to 0 to disable the cache.
If not set, it's default to 1/16 of OS memory with a max limitation of 512MB. | +| `region_engine.mito.page_cache_size` | String | `512MB` | Cache size for pages of SST row groups. Setting it to 0 to disable the cache.
If not set, it's default to 1/8 of OS memory. | +| `region_engine.mito.selector_result_cache_size` | String | `512MB` | Cache size for time series selector (e.g. `last_value()`). Setting it to 0 to disable the cache.
If not set, it's default to 1/16 of OS memory with a max limitation of 512MB. | | `region_engine.mito.enable_experimental_write_cache` | Bool | `false` | Whether to enable the experimental write cache. | | `region_engine.mito.experimental_write_cache_path` | String | `""` | File system path for write cache, defaults to `{data_home}/write_cache`. | | `region_engine.mito.experimental_write_cache_size` | String | `512MB` | Capacity for write cache. | -| `region_engine.mito.experimental_write_cache_ttl` | String | `1h` | TTL for write cache. | +| `region_engine.mito.experimental_write_cache_ttl` | String | `None` | TTL for write cache. | | `region_engine.mito.sst_write_buffer_size` | String | `8MB` | Buffer size for SST writing. | | `region_engine.mito.scan_parallelism` | Integer | `0` | Parallelism to scan a region (default: 1/4 of cpu cores).
- `0`: using the default value (1/4 of cpu cores).
- `1`: scan in current thread.
- `n`: scan in parallelism n. | | `region_engine.mito.parallel_scan_channel_size` | Integer | `32` | Capacity of the channel to send data from parallel scan tasks to the main task. | diff --git a/config/datanode.example.toml b/config/datanode.example.toml index caaff9a3fb87..a7357f934566 100644 --- a/config/datanode.example.toml +++ b/config/datanode.example.toml @@ -394,9 +394,13 @@ sst_meta_cache_size = "128MB" vector_cache_size = "512MB" ## Cache size for pages of SST row groups. Setting it to 0 to disable the cache. -## If not set, it's default to 1/16 of OS memory with a max limitation of 512MB. +## If not set, it's default to 1/8 of OS memory. page_cache_size = "512MB" +## Cache size for time series selector (e.g. `last_value()`). Setting it to 0 to disable the cache. +## If not set, it's default to 1/16 of OS memory with a max limitation of 512MB. +selector_result_cache_size = "512MB" + ## Whether to enable the experimental write cache. enable_experimental_write_cache = false @@ -407,7 +411,8 @@ experimental_write_cache_path = "" experimental_write_cache_size = "512MB" ## TTL for write cache. -experimental_write_cache_ttl = "1h" +## +toml2docs:none-default +experimental_write_cache_ttl = "8h" ## Buffer size for SST writing. sst_write_buffer_size = "8MB" diff --git a/config/standalone.example.toml b/config/standalone.example.toml index ffc2de5e647c..9258397bb82d 100644 --- a/config/standalone.example.toml +++ b/config/standalone.example.toml @@ -431,9 +431,13 @@ sst_meta_cache_size = "128MB" vector_cache_size = "512MB" ## Cache size for pages of SST row groups. Setting it to 0 to disable the cache. -## If not set, it's default to 1/16 of OS memory with a max limitation of 512MB. +## If not set, it's default to 1/8 of OS memory. page_cache_size = "512MB" +## Cache size for time series selector (e.g. `last_value()`). Setting it to 0 to disable the cache. +## If not set, it's default to 1/16 of OS memory with a max limitation of 512MB. +selector_result_cache_size = "512MB" + ## Whether to enable the experimental write cache. enable_experimental_write_cache = false @@ -444,7 +448,8 @@ experimental_write_cache_path = "" experimental_write_cache_size = "512MB" ## TTL for write cache. -experimental_write_cache_ttl = "1h" +## +toml2docs:none-default +experimental_write_cache_ttl = "8h" ## Buffer size for SST writing. sst_write_buffer_size = "8MB" diff --git a/src/cmd/tests/load_config_test.rs b/src/cmd/tests/load_config_test.rs index c2fa6261c373..6cf1df97b0ad 100644 --- a/src/cmd/tests/load_config_test.rs +++ b/src/cmd/tests/load_config_test.rs @@ -82,6 +82,7 @@ fn test_load_datanode_example_config() { vector_cache_size: ReadableSize::mb(512), page_cache_size: ReadableSize::mb(512), max_background_jobs: 4, + experimental_write_cache_ttl: Some(Duration::from_secs(60 * 60 * 8)), ..Default::default() }), RegionEngineConfig::File(EngineConfig {}), @@ -218,6 +219,7 @@ fn test_load_standalone_example_config() { vector_cache_size: ReadableSize::mb(512), page_cache_size: ReadableSize::mb(512), max_background_jobs: 4, + experimental_write_cache_ttl: Some(Duration::from_secs(60 * 60 * 8)), ..Default::default() }), RegionEngineConfig::File(EngineConfig {}), diff --git a/src/mito2/src/config.rs b/src/mito2/src/config.rs index 5f0917688f35..7af36ab8963c 100644 --- a/src/mito2/src/config.rs +++ b/src/mito2/src/config.rs @@ -143,7 +143,7 @@ impl Default for MitoConfig { enable_experimental_write_cache: false, experimental_write_cache_path: String::new(), experimental_write_cache_size: ReadableSize::mb(512), - experimental_write_cache_ttl: Some(Duration::from_secs(60 * 60)), + experimental_write_cache_ttl: None, sst_write_buffer_size: DEFAULT_WRITE_BUFFER_SIZE, scan_parallelism: divide_num_cpus(4), parallel_scan_channel_size: DEFAULT_SCAN_CHANNEL_SIZE, diff --git a/tests-integration/tests/http.rs b/tests-integration/tests/http.rs index db8df835a587..cd1fb700e6af 100644 --- a/tests-integration/tests/http.rs +++ b/tests-integration/tests/http.rs @@ -836,7 +836,6 @@ auto_flush_interval = "30m" enable_experimental_write_cache = false experimental_write_cache_path = "" experimental_write_cache_size = "512MiB" -experimental_write_cache_ttl = "1h" sst_write_buffer_size = "8MiB" parallel_scan_channel_size = 32 allow_stale_entries = false