fix: cold benchmark cache-busting with PID prefix and flush
Re-runs of --vs-unbound-cold were hitting stale cache entries from
prior runs. The static COUNTER reset to 0 each process, generating
the same c0.example.com subdomains. With the 1-hour stale window,
entries from 10 minutes ago served as stale hits.
Fix: prefix with PID (r{pid}-c{n}.domain) and flush Numa's cache
before cold benchmarks.
This commit is contained in:
@@ -403,6 +403,8 @@ fn run_server_comparison(
|
|||||||
) {
|
) {
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
static COUNTER: AtomicU64 = AtomicU64::new(0);
|
static COUNTER: AtomicU64 = AtomicU64::new(0);
|
||||||
|
// Unique prefix per process so re-runs don't hit stale cache entries
|
||||||
|
let run_id = std::process::id();
|
||||||
|
|
||||||
let numa_addr: SocketAddr = NUMA_BENCH.parse().unwrap();
|
let numa_addr: SocketAddr = NUMA_BENCH.parse().unwrap();
|
||||||
let other: SocketAddr = other_addr.parse().unwrap();
|
let other: SocketAddr = other_addr.parse().unwrap();
|
||||||
@@ -414,6 +416,10 @@ fn run_server_comparison(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cold {
|
||||||
|
flush_cache(); // flush Numa's record cache
|
||||||
|
}
|
||||||
|
|
||||||
println!("Warming up...");
|
println!("Warming up...");
|
||||||
for _ in 0..5 {
|
for _ in 0..5 {
|
||||||
let _ = rt.block_on(query_udp(numa_addr, "example.com"));
|
let _ = rt.block_on(query_udp(numa_addr, "example.com"));
|
||||||
@@ -433,7 +439,12 @@ fn run_server_comparison(
|
|||||||
other_name,
|
other_name,
|
||||||
&|domain| {
|
&|domain| {
|
||||||
let d = if cold {
|
let d = if cold {
|
||||||
format!("c{}.{}", COUNTER.fetch_add(1, Ordering::Relaxed), domain)
|
format!(
|
||||||
|
"r{}-c{}.{}",
|
||||||
|
run_id,
|
||||||
|
COUNTER.fetch_add(1, Ordering::Relaxed),
|
||||||
|
domain
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
domain.to_string()
|
domain.to_string()
|
||||||
};
|
};
|
||||||
@@ -443,7 +454,12 @@ fn run_server_comparison(
|
|||||||
},
|
},
|
||||||
&|domain| {
|
&|domain| {
|
||||||
let d = if cold {
|
let d = if cold {
|
||||||
format!("c{}.{}", COUNTER.fetch_add(1, Ordering::Relaxed), domain)
|
format!(
|
||||||
|
"r{}-c{}.{}",
|
||||||
|
run_id,
|
||||||
|
COUNTER.fetch_add(1, Ordering::Relaxed),
|
||||||
|
domain
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
domain.to_string()
|
domain.to_string()
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user