Skip to content
This repository was archived by the owner on Jul 17, 2025. It is now read-only.

Commit 7b6b36c

Browse files
committed
bench: more tweaks for memcached
Signed-off-by: Reto Achermann <achreto@gmail.com>
1 parent 656a34f commit 7b6b36c

File tree

1 file changed

+44
-15
lines changed

1 file changed

+44
-15
lines changed

kernel/tests/s11_rackscale_benchmarks.rs

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ fn s11_rackscale_shmem_leveldb_benchmark() {
463463
bench.run_bench(false, is_smoke);
464464
}
465465

466+
const MEMCACHED_MEM_SIZE_MB: usize = 4 * 1024;
467+
const MEMCACHED_NUM_QUERIES: usize = 10_000_000;
468+
466469
#[derive(Clone)]
467470
struct MemcachedInternalConfig {
468471
pub num_queries: usize,
@@ -606,21 +609,24 @@ fn rackscale_memcached_benchmark(transport: RackscaleTransport) {
606609
// keep in sync with the s10_memcached_benchmark_internal configuration
607610
// and the s11_rackscale_memcached_benchmark_sharded configuration
608611
MemcachedInternalConfig {
609-
num_queries: 10_000_000,
610-
mem_size: 16, // 64 * 1024,
612+
num_queries: MEMCACHED_NUM_QUERIES,
613+
mem_size: MEMCACHED_MEM_SIZE_MB,
611614
}
612615
};
613616

614617
let mut test = RackscaleRun::new("userspace-smp".to_string(), built);
615618
test.controller_match_fn = controller_match_fn;
616619
test.transport = transport;
617-
test.shmem_size *= 2;
618620
test.use_affinity_shmem = cfg!(feature = "affinity-shmem");
619621
test.use_qemu_huge_pages = cfg!(feature = "affinity-shmem");
620622
test.file_name = file_name.to_string();
621623
test.arg = Some(config);
622624
test.run_dhcpd_for_baseline = true;
623625

626+
if !is_smoke {
627+
test.shmem_size = MEMCACHED_MEM_SIZE_MB * 2;
628+
}
629+
624630
fn cmd_fn(num_cores: usize, arg: Option<MemcachedInternalConfig>) -> String {
625631
let config = arg.expect("missing leveldb config");
626632
format!(
@@ -642,8 +648,7 @@ fn rackscale_memcached_benchmark(transport: RackscaleTransport) {
642648
8192
643649
} else {
644650
// Memory must also be divisible by number of nodes, which could be 1, 2, 3, or 4
645-
// 2048 * (((((num_cores + 1) / 2) + 3 - 1) / 3) * 3)
646-
3 * 1024 // 3 * 128 * 1024
651+
2048 * (((((num_cores + 1) / 2) + 3 - 1) / 3) * 3)
647652
}
648653
}
649654

@@ -845,8 +850,8 @@ fn s11_rackscale_memcached_benchmark_sharded_linux() {
845850
// keep in sync with the s10_memcached_benchmark_internal configuration
846851
MemcachedShardedConfig {
847852
num_servers: 1,
848-
num_queries: 10_000_000,
849-
mem_size: 16, // 64 * 1024,
853+
num_queries: MEMCACHED_NUM_QUERIES,
854+
mem_size: MEMCACHED_MEM_SIZE_MB,
850855
protocol: "tcp",
851856
is_local_host: true,
852857
num_threads: 4,
@@ -1010,6 +1015,7 @@ fn s11_rackscale_memcached_benchmark_sharded_linux() {
10101015
let mut pty =
10111016
spawn_loadbalancer(&config, timeout_ms).expect("failed to spawn load balancer");
10121017
let mut output = String::new();
1018+
use rexpect::errors::ErrorKind::Timeout;
10131019
match parse_memcached_output(&mut pty, &mut output) {
10141020
Ok(res) => {
10151021
let r = csv_file.write(format!("{},", env!("GIT_HASH")).as_bytes());
@@ -1028,8 +1034,19 @@ fn s11_rackscale_memcached_benchmark_sharded_linux() {
10281034

10291035
println!("{:?}", res);
10301036
}
1037+
10311038
Err(e) => {
1032-
println!("error: {}", e);
1039+
if let Timeout(expected, got, timeout) = e.0 {
1040+
println!("Timeout while waiting for {} ms\n", timeout.as_millis());
1041+
println!("Expected: `{expected}`\n");
1042+
println!("Got:",);
1043+
for l in got.lines().take(5) {
1044+
println!(" > {l}");
1045+
}
1046+
} else {
1047+
println!("error: {}", e);
1048+
}
1049+
10331050
let r = csv_file.write(format!("{},", env!("GIT_HASH")).as_bytes());
10341051
assert!(r.is_ok());
10351052
let out = format!(
@@ -1080,8 +1097,8 @@ fn s11_rackscale_memcached_benchmark_sharded_nros() {
10801097
// keep in sync with the s10_memcached_benchmark_internal configuration
10811098
MemcachedShardedConfig {
10821099
num_servers: 1,
1083-
num_queries: 10_000_000,
1084-
mem_size: 16, // 64 * 1024,
1100+
num_queries: MEMCACHED_NUM_QUERIES,
1101+
mem_size: MEMCACHED_MEM_SIZE_MB,
10851102
protocol: "tcp",
10861103
is_local_host: true,
10871104
num_threads: 4,
@@ -1178,8 +1195,18 @@ fn s11_rackscale_memcached_benchmark_sharded_nros() {
11781195
.open(file_name)
11791196
.expect("Can't open file");
11801197

1198+
use rexpect::errors::Error;
1199+
use rexpect::errors::ErrorKind::Timeout;
11811200
let res = match parse_memcached_output(proc, output) {
11821201
Ok(res) => res,
1202+
Err(Error(Timeout(expected, got, timeout), st)) => {
1203+
println!("Expected: `{expected}`\n");
1204+
println!("Got:",);
1205+
for l in got.lines().take(5) {
1206+
println!(" > {l}");
1207+
}
1208+
return Err(Error(Timeout(expected, got, timeout), st));
1209+
}
11831210
Err(err) => {
11841211
println!("Failed: {:?}", err);
11851212
return Err(err);
@@ -1268,6 +1295,10 @@ fn s11_rackscale_memcached_benchmark_sharded_nros() {
12681295
test.run_dhcpd_for_baseline = true;
12691296
test.is_multi_node = true;
12701297

1298+
if !is_smoke {
1299+
test.shmem_size = MEMCACHED_MEM_SIZE_MB * 2;
1300+
}
1301+
12711302
fn cmd_fn(num_cores: usize, arg: Option<MemcachedShardedConfig>) -> String {
12721303
let config = arg.expect("missing configuration");
12731304
format!(
@@ -1281,17 +1312,15 @@ fn s11_rackscale_memcached_benchmark_sharded_nros() {
12811312
}
12821313

12831314
fn rackscale_timeout_fn(num_cores: usize) -> u64 {
1284-
180_000 + 1_500 * num_cores as u64
1315+
300_000 + 4_500 * num_cores as u64
12851316
}
12861317

1287-
fn mem_fn(_num_cores: usize, is_smoke: bool) -> usize {
1318+
fn mem_fn(num_cores: usize, is_smoke: bool) -> usize {
12881319
if is_smoke {
12891320
8192
12901321
} else {
12911322
// Memory must also be divisible by number of nodes, which could be 1, 2, 3, or 4
1292-
// 256 * 1024 //2048 * (((((num_cores + 1) / 2) + 3 - 1) / 3) * 3)
1293-
// 3 * 128 * 1024
1294-
3 * 1024
1323+
2048 * (((((num_cores + 1) / 2) + 3 - 1) / 3) * 3)
12951324
}
12961325
}
12971326

0 commit comments

Comments
 (0)