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

Commit 85f2990

Browse files
committed
tests: unify memcached memory/query config
Signed-off-by: Reto Achermann <[email protected]>
1 parent 1455f41 commit 85f2990

File tree

5 files changed

+38
-25
lines changed

5 files changed

+38
-25
lines changed

kernel/tests/s10_benchmarks.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,9 @@ fn s10_leveldb_benchmark() {
872872
}
873873
}
874874

875+
use testutils::configs::MEMCACHED_MEM_SIZE_MB;
876+
use testutils::configs::MEMCACHED_NUM_QUERIES;
877+
875878
#[test]
876879
fn s10_memcached_benchmark_internal() {
877880
setup_network(1);
@@ -899,9 +902,10 @@ fn s10_memcached_benchmark_internal() {
899902
(16 * 1024 /* MB */, 16 /* MB */, 2000000, 300_000)
900903
} else {
901904
(
902-
256 * 1024, /* MB */
903-
16, // 64 * 1024, /* MB */
904-
100_000_000,
905+
// keep in sync with the s11_ra
906+
32 * 1024, /* MB */
907+
MEMCACHED_MEM_SIZE_MB,
908+
MEMCACHED_NUM_QUERIES,
905909
600_000,
906910
)
907911
};

kernel/tests/s11_rackscale_benchmarks.rs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ use testutils::builder::Machine;
2424
use testutils::rackscale_runner::{RackscaleBench, RackscaleRun};
2525
use testutils::runner_args::RackscaleTransport;
2626

27+
use testutils::configs::MEMCACHED_MEM_SIZE_MB;
28+
use testutils::configs::MEMCACHED_NUM_QUERIES;
29+
2730
#[test]
2831
#[cfg(not(feature = "baremetal"))]
2932
fn s11_rackscale_shmem_fxmark_benchmark() {
@@ -138,7 +141,7 @@ fn rackscale_fxmark_benchmark(transport: RackscaleTransport) {
138141
fn timeout_fn(num_cores: usize) -> u64 {
139142
180_000 + 5_000 * num_cores as u64
140143
}
141-
fn mem_fn(num_cores: usize, is_smoke: bool) -> usize {
144+
fn mem_fn(num_cores: usize, _num_clients: usize, is_smoke: bool) -> usize {
142145
if is_smoke {
143146
8192
144147
} else {
@@ -302,7 +305,7 @@ fn rackscale_vmops_benchmark(transport: RackscaleTransport, benchtype: VMOpsBenc
302305
fn rackscale_timeout_fn(num_cores: usize) -> u64 {
303306
240_000 + 1_000 * num_cores as u64
304307
}
305-
fn mem_fn(num_cores: usize, is_smoke: bool) -> usize {
308+
fn mem_fn(num_cores: usize, _num_clients: usize, is_smoke: bool) -> usize {
306309
if is_smoke {
307310
8192
308311
} else {
@@ -440,7 +443,7 @@ fn s11_rackscale_shmem_leveldb_benchmark() {
440443
240_000 + 500 * num_cores as u64
441444
}
442445

443-
fn mem_fn(num_cores: usize, is_smoke: bool) -> usize {
446+
fn mem_fn(num_cores: usize, _num_clients: usize, is_smoke: bool) -> usize {
444447
if is_smoke {
445448
8192
446449
} else {
@@ -463,9 +466,6 @@ fn s11_rackscale_shmem_leveldb_benchmark() {
463466
bench.run_bench(false, is_smoke);
464467
}
465468

466-
const MEMCACHED_MEM_SIZE_MB: usize = 16;
467-
const MEMCACHED_NUM_QUERIES: usize = 1000_000;
468-
469469
#[derive(Clone)]
470470
struct MemcachedInternalConfig {
471471
pub num_queries: usize,
@@ -625,8 +625,8 @@ fn rackscale_memcached_benchmark(transport: RackscaleTransport) {
625625

626626
if !is_smoke {
627627
test.shmem_size = std::cmp::max(
628-
MEMCACHED_MEM_SIZE_MB * 8,
629-
testutils::helpers::SHMEM_SIZE * 4,
628+
MEMCACHED_MEM_SIZE_MB * 2,
629+
testutils::helpers::SHMEM_SIZE * 2,
630630
);
631631
}
632632

@@ -646,18 +646,20 @@ fn rackscale_memcached_benchmark(transport: RackscaleTransport) {
646646
500_000 + 5_000 * num_cores as u64
647647
}
648648

649-
fn mem_fn(num_cores: usize, is_smoke: bool) -> usize {
649+
fn mem_fn(num_cores: usize, num_clients: usize, is_smoke: bool) -> usize {
650+
let base_memory = if num_cores > 64 { 8192 } else { 4096 };
651+
650652
if is_smoke {
651-
8192
653+
base_memory
652654
} else {
653655
// Memory must also be divisible by number of nodes, which could be 1, 2, 3, or 4
654656
// memory = result of this function / num_clients - shmem_size
655-
(8192
657+
(base_memory
656658
+ std::cmp::max(
657-
MEMCACHED_MEM_SIZE_MB * 8,
658-
testutils::helpers::SHMEM_SIZE * 4,
659+
MEMCACHED_MEM_SIZE_MB * 2,
660+
testutils::helpers::SHMEM_SIZE * 2,
659661
))
660-
* (((((num_cores + 1) / 2) + 3 - 1) / 3) * 3)
662+
* num_clients
661663
}
662664
}
663665

@@ -852,7 +854,7 @@ fn s11_rackscale_memcached_benchmark_sharded_linux() {
852854
mem_size: 16,
853855
protocol: "tcp",
854856
is_local_host: true,
855-
num_threads: 4,
857+
num_threads: 8,
856858
path: out_dir_path,
857859
}
858860
} else {
@@ -863,7 +865,7 @@ fn s11_rackscale_memcached_benchmark_sharded_linux() {
863865
mem_size: MEMCACHED_MEM_SIZE_MB,
864866
protocol: "tcp",
865867
is_local_host: true,
866-
num_threads: 4,
868+
num_threads: 8,
867869
path: out_dir_path,
868870
}
869871
};
@@ -984,7 +986,7 @@ fn s11_rackscale_memcached_benchmark_sharded_linux() {
984986
config.num_servers = num_nodes;
985987

986988
for num_threads in 1..=max_threads_per_node {
987-
if (num_threads != 1 || num_threads != max_threads_per_node) && (num_threads % 4 != 0) {
989+
if (num_threads != 1 || num_threads != max_threads_per_node) && (num_threads % 8 != 0) {
988990
continue;
989991
}
990992

@@ -1335,7 +1337,7 @@ fn s11_rackscale_memcached_benchmark_sharded_nros() {
13351337
600_000 + 60_000 * num_cores as u64
13361338
}
13371339

1338-
fn mem_fn(num_cores: usize, is_smoke: bool) -> usize {
1340+
fn mem_fn(num_cores: usize, _num_clients: usize, is_smoke: bool) -> usize {
13391341
if is_smoke {
13401342
8192
13411343
} else {
@@ -1423,7 +1425,7 @@ fn rackscale_monetdb_benchmark(transport: RackscaleTransport) {
14231425
180_000 + 500 * num_cores as u64
14241426
}
14251427

1426-
fn mem_fn(num_cores: usize, is_smoke: bool) -> usize {
1428+
fn mem_fn(num_cores: usize, _num_clients: usize, is_smoke: bool) -> usize {
14271429
if is_smoke {
14281430
8192
14291431
} else {

kernel/testutils/src/configs.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright © 2021 VMware, Inc. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
pub const MEMCACHED_MEM_SIZE_MB: usize = 8 * 1024;
5+
pub const MEMCACHED_NUM_QUERIES: usize = 1_000_000;

kernel/testutils/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ extern crate rexpect;
99
extern crate serde;
1010

1111
pub mod builder;
12+
pub mod configs;
1213
pub mod helpers;
1314
pub mod rackscale_runner;
1415
pub mod redis;

kernel/testutils/src/rackscale_runner.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ pub struct RackscaleBench<T: Clone + Send + 'static> {
786786
// Function to calculate the timeout. Takes as argument number of application cores
787787
pub baseline_timeout_fn: fn(usize) -> u64,
788788
// Function to calculate memory (excpeting controller memory). Takes as argument number of application cores and is_smoke
789-
pub mem_fn: fn(usize, bool) -> usize,
789+
pub mem_fn: fn(usize, usize, bool) -> usize,
790790
}
791791

792792
impl<T: Clone + Send + 'static> RackscaleBench<T> {
@@ -877,11 +877,12 @@ impl<T: Clone + Send + 'static> RackscaleBench<T> {
877877

878878
// Caclulate memory for each component
879879
if !is_baseline {
880-
test_run.memory = ((self.mem_fn)(total_cores, is_smoke) / test_run.num_clients)
880+
test_run.memory = ((self.mem_fn)(total_cores, test_run.num_clients, is_smoke)
881+
/ test_run.num_clients)
881882
- test_run.shmem_size;
882883
assert!(test_run.memory > 0);
883884
} else {
884-
test_run.memory = (self.mem_fn)(total_cores, is_smoke);
885+
test_run.memory = (self.mem_fn)(total_cores, test_run.num_clients, is_smoke);
885886
}
886887

887888
if is_baseline {

0 commit comments

Comments
 (0)