diff --git a/configs/blabber.toml b/configs/blabber.toml index 38e5a0be..c316a349 100644 --- a/configs/blabber.toml +++ b/configs/blabber.toml @@ -54,6 +54,8 @@ start = 1 topics = 1 topic_len = 1 message_len = 64 +# specify an approximate compression ratio for the message payload +compression_ratio = 1.0 weight = 1 # the total number of clients that will subscribe to this set of topics subscriber_poolsize = 100 diff --git a/configs/kafka.toml b/configs/kafka.toml index cf3b93a5..8f08a60f 100644 --- a/configs/kafka.toml +++ b/configs/kafka.toml @@ -84,9 +84,7 @@ topic_names = ["hello", "world"] partitions = 10 # the value length, in bytes message_len = 512 -# approximate compression ratio for the message payload. The config value -# represents the uncompressed size divided by the compressed size. <= 1.0 means -# the message is all random bytes. Higher values are more compressible. -message_compression_ratio = 1.0 +# specify an approximate compression ratio for the message payload +compression_ration = 1.0 # the key length, in bytes key_len = 8 \ No newline at end of file diff --git a/configs/memcached.toml b/configs/memcached.toml index 3f1a2180..3c368be0 100644 --- a/configs/memcached.toml +++ b/configs/memcached.toml @@ -63,6 +63,8 @@ nkeys = 1_000_000 vlen = 128 # use random bytes for the values vkind = "bytes" +# specify an approximate compression ratio for the value +compression_ratio = 1.0 # optionally: specify a TTL for the keys, by default there is no expiration # ttl = "15m" # controls what commands will be used in this keyspace diff --git a/configs/momento.toml b/configs/momento.toml index cb37d300..05d29223 100644 --- a/configs/momento.toml +++ b/configs/momento.toml @@ -73,6 +73,8 @@ klen = 32 nkeys = 1_000_000 # sets the value length, in bytes vlen = 128 +# specify an approximate compression ratio for the value payload +compression_ratio = 1.0 # use random bytes for the values vkind = "bytes" # override the default ttl for this keyspace setting it to 15 minutes diff --git a/configs/momento_pubsub.toml b/configs/momento_pubsub.toml index 15ba83f0..b7ffb6f9 100644 --- a/configs/momento_pubsub.toml +++ b/configs/momento_pubsub.toml @@ -67,6 +67,8 @@ topics = 10 topic_len = 64 # sets the value length, in bytes message_len = 128 +# specify an approximate compression ratio for the message payload +compression_ratio = 1.0 # An example set of topics using a high number of subscribers per topic. [[workload.topics]] @@ -84,3 +86,5 @@ topics = 1 topic_len = 32 # sets the value length, in bytes message_len = 128 +# specify an approximate compression ratio for the message payload +compression_ratio = 1.0 diff --git a/configs/segcache.toml b/configs/segcache.toml index c95ab9f9..9d940d07 100644 --- a/configs/segcache.toml +++ b/configs/segcache.toml @@ -86,10 +86,8 @@ nkeys = 1_000_000 vlen = 128 # use random bytes for the values vkind = "bytes" -# approximate compression ratio for the value. The config value represents the -# uncompressed size divided by the compressed size. <= 1.0 means the value is -# all random bytes. Higher values are more compressible. -message_compression_ratio = 1.0 +# specify an approximate compression ratio for the value payload +compression_ratio = 1.0 # controls what commands will be used in this keyspace commands = [ # get a value diff --git a/configs/smoketest.toml b/configs/smoketest.toml index e575d0cd..0aaeb7b0 100644 --- a/configs/smoketest.toml +++ b/configs/smoketest.toml @@ -36,7 +36,7 @@ klen = 32 nkeys = 1_000_000 vlen = 128 vkind = "bytes" -message_compression_ratio = 10.0 +compression_ratio = 10.0 commands = [ { verb = "get", weight = 80 }, { verb = "set", weight = 20 }, diff --git a/src/config/workload.rs b/src/config/workload.rs index cd8fb9bf..22fd8f82 100644 --- a/src/config/workload.rs +++ b/src/config/workload.rs @@ -49,7 +49,7 @@ pub struct Topics { topic_names: Vec, message_len: usize, #[serde(default)] - message_compression_ratio: Option, + compression_ratio: Option, #[serde(default = "one")] key_len: usize, weight: usize, @@ -91,8 +91,8 @@ impl Topics { self.message_len } - pub fn message_compression_ratio(&self) -> f64 { - self.message_compression_ratio.unwrap_or(1.0) + pub fn compression_ratio(&self) -> f64 { + self.compression_ratio.unwrap_or(1.0) } pub fn subscriber_poolsize(&self) -> usize { @@ -145,7 +145,7 @@ pub struct Keyspace { #[serde(default)] vkind: Option, #[serde(default)] - value_compression_ratio: Option, + compression_ratio: Option, #[serde(default)] // no ttl is treated as no-expires or max ttl for the protocol ttl: Option, @@ -188,8 +188,8 @@ impl Keyspace { self.vkind.unwrap_or(ValueKind::Bytes) } - pub fn value_compression_ratio(&self) -> f64 { - self.value_compression_ratio.unwrap_or(1.0) + pub fn compression_ratio(&self) -> f64 { + self.compression_ratio.unwrap_or(1.0) } pub fn ttl(&self) -> Option { diff --git a/src/workload/mod.rs b/src/workload/mod.rs index 197f14d0..c66d1e83 100644 --- a/src/workload/mod.rs +++ b/src/workload/mod.rs @@ -399,7 +399,7 @@ pub struct Topics { impl Topics { pub fn new(config: &Config, topics: &config::Topics) -> Self { - let message_random_bytes = if topics.message_compression_ratio() <= 1.0 { + let message_random_bytes = if topics.compression_ratio() <= 1.0 { // this indicates the message should not be compressible, to achieve // this all bytes will be random topics.message_len() @@ -430,7 +430,7 @@ impl Topics { let ratio = m.len() as f64 / compressed.len() as f64; - if ratio < topics.message_compression_ratio() { + if ratio < topics.compression_ratio() { break; } @@ -556,7 +556,7 @@ impl Distribution { impl Keyspace { pub fn new(config: &Config, keyspace: &config::Keyspace) -> Self { let value_random_bytes = - if keyspace.value_compression_ratio() <= 1.0 || keyspace.vlen().is_none() { + if keyspace.compression_ratio() <= 1.0 || keyspace.vlen().is_none() { // this indicates the message should not be compressible, to achieve // this all bytes will be random keyspace.vlen().unwrap_or(0) @@ -587,7 +587,7 @@ impl Keyspace { let ratio = m.len() as f64 / compressed.len() as f64; - if ratio < keyspace.value_compression_ratio() { + if ratio < keyspace.compression_ratio() { break; }