diff --git a/Cargo.lock b/Cargo.lock index c93b1a7..d00b27a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -37,6 +49,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -182,6 +200,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "bitflags" version = "1.3.2" @@ -282,7 +306,7 @@ version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "syn 2.0.50", @@ -590,12 +614,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - [[package]] name = "err-derive" version = "0.3.1" @@ -834,7 +852,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash", + "ahash 0.7.8", "serde", ] @@ -843,6 +861,10 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash 0.8.11", + "allocator-api2", +] [[package]] name = "hdrhistogram" @@ -850,7 +872,7 @@ version = "7.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d" dependencies = [ - "base64", + "base64 0.21.7", "byteorder", "crossbeam-channel", "flate2", @@ -858,15 +880,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.4.1" @@ -950,16 +963,6 @@ dependencies = [ "png", ] -[[package]] -name = "indexmap" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" -dependencies = [ - "equivalent", - "hashbrown 0.14.3", -] - [[package]] name = "itertools" version = "0.11.0" @@ -971,9 +974,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -1027,10 +1030,10 @@ dependencies = [ [[package]] name = "latte-cli" -version = "0.25.0" +version = "0.26.0" dependencies = [ "anyhow", - "base64", + "base64 0.22.1", "chrono", "clap", "console", @@ -1040,7 +1043,7 @@ dependencies = [ "futures", "hdrhistogram", "hytra", - "itertools 0.12.1", + "itertools 0.13.0", "jemallocator", "lazy_static", "metrohash", @@ -1061,8 +1064,8 @@ dependencies = [ "serde_json", "statrs", "status-line", - "strum 0.26.1", - "strum_macros 0.26.1", + "strum", + "strum_macros", "thiserror", "time", "tokio", @@ -1194,9 +1197,9 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.29.0" +version = "0.32.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d506eb7e08d6329505faa8a3a00a5dcc6de9f76e0c77e4b75763ae3c770831ff" +checksum = "7b5c17de023a86f59ed79891b2e5d5a94c705dbe904a5b5c9c952ea6221b03e4" dependencies = [ "approx", "matrixmultiply", @@ -1212,9 +1215,9 @@ dependencies = [ [[package]] name = "nalgebra-macros" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" +checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998" dependencies = [ "proc-macro2", "quote", @@ -1391,27 +1394,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.50", -] - [[package]] name = "object" version = "0.32.2" @@ -1639,16 +1621,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit", -] - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -1962,9 +1934,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scylla" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d2db76aa23f55d2ece5354e1a3778633098a3d1ea76153f494d71e92cd02d8" +checksum = "9439d92eea9f86c07175c819c3a129ca28b02477b47df26db354a1f4ea7ee276" dependencies = [ "arc-swap", "async-trait", @@ -1973,10 +1945,11 @@ dependencies = [ "chrono", "dashmap", "futures", + "hashbrown 0.14.3", "histogram", "itertools 0.11.0", + "lazy_static", "lz4_flex", - "num_enum", "openssl", "rand", "rand_pcg", @@ -1985,8 +1958,6 @@ dependencies = [ "smallvec", "snap", "socket2", - "strum 0.23.0", - "strum_macros 0.23.1", "thiserror", "tokio", "tokio-openssl", @@ -1996,15 +1967,14 @@ dependencies = [ [[package]] name = "scylla-cql" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345626c0dd5d9624c413daaba854685bba6a65cff4eb5ea0fb0366df16901f67" +checksum = "64037fb9d9c59ae15137fff9a56c4d528908dfd38d09e75b5f8e56e3894966dd" dependencies = [ "async-trait", "byteorder", "bytes", "lz4_flex", - "num_enum", "scylla-macros", "snap", "thiserror", @@ -2014,9 +1984,9 @@ dependencies = [ [[package]] name = "scylla-macros" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb6085ff9c3fd7e5163826901d39164ab86f11bdca16b2f766a00c528ff9cef9" +checksum = "7e5fe1d389adebe6a1a27bce18b81a65ff18c25d58a795de490e18b0e7a27b9f" dependencies = [ "darling", "proc-macro2", @@ -2098,9 +2068,9 @@ dependencies = [ [[package]] name = "simba" -version = "0.6.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0b7840f121a46d63066ee7a99fc81dcabbc6105e437cae43528cea199b5a05f" +checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" dependencies = [ "approx", "num-complex 0.4.5", @@ -2157,12 +2127,11 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "statrs" -version = "0.16.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d08e5e1748192713cc281da8b16924fb46be7b0c2431854eadc785823e5696e" +checksum = "f697a07e4606a0a25c044de247e583a330dbb1731d11bc7350b81f48ad567255" dependencies = [ "approx", - "lazy_static", "nalgebra", "num-traits", "rand", @@ -2190,32 +2159,13 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" -[[package]] -name = "strum" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" - [[package]] name = "strum" version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f" dependencies = [ - "strum_macros 0.26.1", -] - -[[package]] -name = "strum_macros" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", + "strum_macros", ] [[package]] @@ -2224,7 +2174,7 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a3417fc93d76740d974a01654a09777cb500428cc874ca9f45edfe0c4d4cd18" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "rustversion", @@ -2375,23 +2325,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml_datetime" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow", -] - [[package]] name = "tracing" version = "0.1.40" @@ -2483,12 +2416,6 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-segmentation" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" - [[package]] name = "unicode-width" version = "0.1.11" @@ -2802,15 +2729,6 @@ version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - [[package]] name = "wio" version = "0.2.2" @@ -2831,3 +2749,23 @@ dependencies = [ "once_cell", "pkg-config", ] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] diff --git a/Cargo.toml b/Cargo.toml index b5f2f15..f969d62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "latte-cli" description = "A database benchmarking tool for Apache Cassandra" -version = "0.25.0" +version = "0.26.0" authors = ["Piotr Kołaczkowski "] edition = "2021" readme = "README.md" @@ -14,7 +14,7 @@ path = "src/main.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anyhow = "1.0" -base64 = "0.21" +base64 = "0.22" rmp = "0.8.10" rmp-serde = "1.0.0-beta.2" chrono = { version = "0.4.18", features = ["serde"] } @@ -26,7 +26,7 @@ err-derive = "0.3" futures = "0.3" hdrhistogram = "7.1.0" hytra = "0.1.2" -itertools = "0.12" +itertools = "0.13" jemallocator = "0.5" lazy_static = "1.4.0" metrohash = "1.0" @@ -39,11 +39,11 @@ rand = "0.8" regex = "1.5" rune = "0.12" rust-embed = "8" -scylla = { version = "0.12", features = ["ssl"] } +scylla = { version = "0.13", features = ["ssl"] } search_path = "0.1" serde = { version = "1.0.116", features = ["derive"] } serde_json = "1.0.57" -statrs = "0.16" +statrs = "0.17" status-line = "0.2.0" strum = { version = "0.26", features = ["derive"] } strum_macros = "0.26" diff --git a/README.md b/README.md index 84d89d3..90b1901 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,7 @@ are pure, i.e. invoking them multiple times with the same parameters yields alwa - `latte::hash_select(i, vector)` – selects an item from a vector based on a hash - `latte::blob(i, len)` – generates a random binary blob of length `len` - `latte::normal(i, mean, std_dev)` – generates a floating point number from a normal distribution +- `latte::uniform(i, min, max)` – generates a floating point number from a uniform distribution #### Numeric conversions diff --git a/src/config.rs b/src/config.rs index 7799109..64c4d91 100644 --- a/src/config.rs +++ b/src/config.rs @@ -544,6 +544,7 @@ pub struct AppConfig { } #[derive(Debug, Deserialize, Default)] +#[allow(unused)] pub struct SchemaConfig { #[serde(default)] pub script: Vec, @@ -552,6 +553,7 @@ pub struct SchemaConfig { } #[derive(Debug, Deserialize)] +#[allow(unused)] pub struct LoadConfig { pub count: u64, #[serde(default)] @@ -567,6 +569,7 @@ mod defaults { } #[derive(Debug, Deserialize)] +#[allow(unused)] pub struct RunConfig { #[serde(default = "defaults::ratio")] pub ratio: f64, @@ -577,6 +580,7 @@ pub struct RunConfig { } #[derive(Debug, Deserialize)] +#[allow(unused)] pub struct WorkloadConfig { #[serde(default)] pub schema: SchemaConfig, diff --git a/src/context.rs b/src/context.rs index 86d0cf2..d4656db 100644 --- a/src/context.rs +++ b/src/context.rs @@ -28,7 +28,7 @@ use scylla::prepared_statement::PreparedStatement; use scylla::transport::errors::{DbError, NewSessionError, QueryError}; use scylla::transport::session::PoolSize; use scylla::{ExecutionProfile, QueryResult, SessionBuilder}; -use statrs::distribution::Normal; +use statrs::distribution::{Normal, Uniform}; use tokio::time::{Duration, Instant}; use try_lock::TryLock; use uuid::{Variant, Version}; @@ -731,6 +731,12 @@ pub fn normal(i: i64, mean: f64, std_dev: f64) -> Result { Ok(distribution.sample(&mut rng)) } +pub fn uniform(i: i64, min: f64, max: f64) -> Result { + let mut rng = StdRng::seed_from_u64(i as u64); + let distribution = Uniform::new(min, max).map_err(|e| VmError::panic(format!("{e}")))?; + Ok(distribution.sample(&mut rng)) +} + /// Restricts a value to a certain interval unless it is NaN. pub fn clamp_float(value: f64, min: f64, max: f64) -> f64 { value.clamp(min, max) diff --git a/src/stats.rs b/src/stats.rs index 0b1ef52..4326b21 100644 --- a/src/stats.rs +++ b/src/stats.rs @@ -560,7 +560,6 @@ pub struct Recorder { pub row_count: u64, pub cycle_times_ns: Histogram, pub resp_times_ns: Histogram, - pub queue_len_sum: u64, log: Log, rate_limit: Option, concurrency_limit: NonZeroUsize, @@ -590,7 +589,6 @@ impl Recorder { error_count: 0, cycle_times_ns: Histogram::new(3).unwrap(), resp_times_ns: Histogram::new(3).unwrap(), - queue_len_sum: 0, } } diff --git a/src/workload.rs b/src/workload.rs index ebefc0e..49b1653 100644 --- a/src/workload.rs +++ b/src/workload.rs @@ -142,6 +142,7 @@ impl Program { .function(&["uuid"], context::Uuid::new) .unwrap(); latte_module.function(&["normal"], context::normal).unwrap(); + latte_module.function(&["uniform"], context::uniform).unwrap(); latte_module .macro_(&["param"], move |ctx, ts| context::param(ctx, ¶ms, ts)) .unwrap();