Skip to content

Commit edd220f

Browse files
authored
feat(cubestore): Query cache - limits by time_to_idle and max_capacity (#6132)
1 parent df73851 commit edd220f

File tree

11 files changed

+215
-92
lines changed

11 files changed

+215
-92
lines changed

rust/cubestore/Cargo.lock

Lines changed: 88 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/cubestore/cubestore-sql-tests/src/benches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl Bench for ParquetMetadataCacheBench {
8686
let config = Config::test(name.as_str()).update_config(|mut c| {
8787
c.partition_split_threshold = 10_000_000;
8888
c.max_partition_split_threshold = 10_000_000;
89-
c.max_cached_queries = 0;
89+
c.query_cache_max_capacity_bytes = 0;
9090
c.metadata_cache_max_capacity_bytes =
9191
env_parse("CUBESTORE_METADATA_CACHE_MAX_CAPACITY_BYTES", 0);
9292
c.metadata_cache_time_to_idle_secs = 1000;

rust/cubestore/cubestore/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ http-auth-basic = "0.1.2"
7979
tracing = "0.1.25"
8080
tracing-futures = { version = "0.2.5", features = ["tokio", "tokio-executor"] }
8181
lru = "0.6.5"
82+
moka = { version = "0.10.1", features = ["future"]}
8283
ctor = "0.1.20"
8384
json = "0.12.4"
8485
futures-util = "0.3.17"
@@ -90,6 +91,7 @@ indoc = "1.0"
9091
rdkafka = { version = "0.29.0" }
9192
parse-size = "1.0.0"
9293
humansize = "2.1.3"
94+
deepsize = "0.2.0"
9395

9496
[target.'cfg(target_os = "linux")'.dependencies]
9597
rdkafka = { version = "0.29.0", features = ["ssl", "gssapi", "cmake-build"] }

rust/cubestore/cubestore/src/app_metrics.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ pub static STARTUPS: Counter = metrics::counter("cs.startup");
1010
/// Incoming SQL queries that do data reads.
1111
pub static DATA_QUERIES: Counter = metrics::counter("cs.sql.query.data");
1212
pub static DATA_QUERIES_CACHE_HIT: Counter = metrics::counter("cs.sql.query.data.cache.hit");
13+
// Approximate number of entries in this cache.
1314
pub static DATA_QUERIES_CACHE_SIZE: Gauge = metrics::gauge("cs.sql.query.data.cache.size");
15+
// Approximate total weighted size of entries in this cache.
16+
pub static DATA_QUERIES_CACHE_WEIGHT: Gauge = metrics::gauge("cs.sql.query.data.cache.weight");
1417
pub static DATA_QUERY_TIME_MS: Histogram = metrics::histogram("cs.sql.query.data.ms");
1518
/// Incoming SQL queries that only read metadata or do trivial computations.
1619
pub static META_QUERIES: Counter = metrics::counter("cs.sql.query.meta");

0 commit comments

Comments
 (0)