Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ static WAIT: AtomicUsize = AtomicUsize::new(0);
static METRICS_SNAPSHOT: Lazy<Arc<RwLock<MetricsSnapshot>>> =
Lazy::new(|| Arc::new(RwLock::new(Default::default())));

// queue depth per client thread
static QUEUE_DEPTH: usize = 64;

fn main() {
// custom panic hook to terminate whole process after unwinding
std::panic::set_hook(Box::new(|s| {
Expand Down Expand Up @@ -135,17 +138,30 @@ fn main() {
});
}

let (client_sender, client_receiver) =
bounded(config.client().map(|c| c.threads() * 2).unwrap_or(1));
let (client_sender, client_receiver) = bounded(
config
.client()
.map(|c| c.threads() * QUEUE_DEPTH)
.unwrap_or(1),
);
let (pubsub_sender, pubsub_receiver) = bounded(
config
.pubsub()
.map(|c| c.publisher_threads() * 2)
.map(|c| c.publisher_threads() * QUEUE_DEPTH)
.unwrap_or(1),
);
let (store_sender, store_receiver) = bounded(
config
.storage()
.map(|c| c.threads() * QUEUE_DEPTH)
.unwrap_or(1),
);
let (oltp_sender, oltp_receiver) = bounded(
config
.oltp()
.map(|c| c.threads() * QUEUE_DEPTH)
.unwrap_or(1),
);
let (store_sender, store_receiver) =
bounded(config.storage().map(|c| c.threads() * 2).unwrap_or(1));
let (oltp_sender, oltp_receiver) = bounded(config.oltp().map(|c| c.threads() * 2).unwrap_or(1));

output!("Protocol: {:?}", config.general().protocol());

Expand Down
7 changes: 5 additions & 2 deletions src/workload/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ pub use store::StoreClientRequest;

static SEQUENCE_NUMBER: AtomicU64 = AtomicU64::new(0);

// a multiplier for the ratelimiter token bucket capacity
static BUCKET_CAPACITY: u64 = 64;

pub fn launch_workload(
generator: Generator,
config: &Config,
Expand Down Expand Up @@ -114,7 +117,7 @@ impl Generator {

Arc::new(
Ratelimiter::builder(amount, interval)
.max_tokens(amount * 8)
.max_tokens(amount * BUCKET_CAPACITY)
.build()
.expect("failed to initialize ratelimiter"),
)
Expand Down Expand Up @@ -993,7 +996,7 @@ pub async fn reconnect<TRequestKind>(

Arc::new(
Ratelimiter::builder(amount, interval)
.max_tokens(amount * 8)
.max_tokens(amount * BUCKET_CAPACITY)
.build()
.expect("failed to initialize ratelimiter"),
)
Expand Down
Loading