Skip to content

Commit 498d4b5

Browse files
authored
feat(cubestore): Initial support for KV cache (#5861)
1 parent 6212efe commit 498d4b5

File tree

25 files changed

+1463
-172
lines changed

25 files changed

+1463
-172
lines changed

rust/cubestore/Cargo.lock

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

rust/cubestore/cubestore-sql-tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ tempfile = "3.2.0"
5252
tar = "0.4.38"
5353

5454
[dev-dependencies]
55-
criterion = { version = "0.3.5", features = ["async_tokio"] }
55+
criterion = { version = "0.4.0", features = ["async_tokio", "html_reports"] }
5656
rocksdb = { version = "0.16.0", default-features = false, features = ["bzip2"] }
5757

5858
[[bench]]

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub fn cubestore_benches() -> Vec<Arc<dyn Bench>> {
3535
return vec![
3636
Arc::new(SimpleBench {}),
3737
Arc::new(ParquetMetadataCacheBench {}),
38+
Arc::new(CacheSetGetBench {}),
3839
];
3940
}
4041

@@ -144,6 +145,42 @@ impl Bench for ParquetMetadataCacheBench {
144145
}
145146
}
146147

148+
pub struct CacheSetGetBench;
149+
#[async_trait]
150+
impl Bench for CacheSetGetBench {
151+
fn config(self: &Self, prefix: &str) -> (String, Config) {
152+
let name = config_name(prefix, "cache_set_get");
153+
let config = Config::test(name.as_str()).update_config(|c| c);
154+
(name, config)
155+
}
156+
157+
async fn setup(self: &Self, services: &CubeServices) -> Result<Arc<BenchState>, CubeError> {
158+
services
159+
.sql_service
160+
.exec_query("CACHE SET TTL 600 'my_key' 'my_value'")
161+
.await?;
162+
163+
let state = Arc::new(());
164+
Ok(state)
165+
}
166+
167+
async fn bench(
168+
self: &Self,
169+
services: &CubeServices,
170+
_state: Arc<BenchState>,
171+
) -> Result<(), CubeError> {
172+
let r = services
173+
.sql_service
174+
.exec_query("CACHE GET 'my_key'")
175+
.await?;
176+
177+
let rows = to_rows(&r);
178+
assert_eq!(rows, vec![vec![TableValue::String("my_value".to_string())]]);
179+
180+
Ok(())
181+
}
182+
}
183+
147184
async fn download_and_unzip(url: &str, dataset: &str) -> Result<Box<Path>, CubeError> {
148185
let root = std::env::current_dir()?.join("data");
149186
let dataset_path = root.join(dataset);

0 commit comments

Comments
 (0)