Skip to content

Commit

Permalink
Zipf distribution.
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitkulshreshtha committed Dec 5, 2024
1 parent fc0d35e commit 0ffc7b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions datastores/gossip_kv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ lazy_static = "1.5.0"
notify = { version = "6.1.1", default-features = false, features = ["macos_kqueue"] }
prometheus = "0.13.4"
rand = "0.8.5"
rand_distr = "0.4.3"
serde = "1.0.203"
serde_json = "1.0.117"
shlex = "1.3.0"
Expand Down
8 changes: 6 additions & 2 deletions datastores/gossip_kv/load_test_server/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use governor::{Quota, RateLimiter};
use lazy_static::lazy_static;
use hydroflow::util::{unbounded_channel, unsync_channel};
use prometheus::{gather, register_int_counter, Encoder, IntCounter, TextEncoder};
use rand::Rng;
use rand_distr::Zipf;
use tokio::sync::mpsc::{Sender, UnboundedSender};
use tokio::sync::watch::Receiver;
use tokio::task;
Expand Down Expand Up @@ -106,10 +108,12 @@ fn run_server(
let put_throughput = opts.max_set_throughput;

local.spawn_local(async move {
let key_master : u64 = 100;
let mut rng = rand::thread_rng();
let zipf: Zipf<f64> = rand_distr::Zipf::new(1_000_000, 1.07).unwrap();

loop {
let request = ClientRequest::Set {
key: key_master.clone(),
key: rng.sample(zipf) as u64,
value: "FOOBAR".to_string(),
};
client_input_tx.send((request, UNKNOWN_ADDRESS)).await.unwrap();
Expand Down

0 comments on commit 0ffc7b9

Please sign in to comment.