From f1160381110ce6a362b0dd9a946f44976812b1f0 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 30 Mar 2026 11:43:32 +0200 Subject: [PATCH] tests: Increase rate limiter refill time The rate limiter token bucket has a fixed 100 ms cool down time that pauses I/O whenever the bucket empties. With a 100 ms refill time, the actual throughput drops to roughly half of the target rate and causes the tests to miss their target. Increase the net and single block refill time from 100 ms to 1000 ms and scale the bucket sizes by 10x to preserve the target rate. Set the one time burst to 0 to avoid overshooting the upper bound, and raise the runtime constants from 10 s to 20 s for steadier measurements. Signed-off-by: Anatol Belski --- cloud-hypervisor/tests/integration.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cloud-hypervisor/tests/integration.rs b/cloud-hypervisor/tests/integration.rs index 4360f7127..f7f4e5554 100644 --- a/cloud-hypervisor/tests/integration.rs +++ b/cloud-hypervisor/tests/integration.rs @@ -10475,8 +10475,8 @@ mod aarch64_acpi { mod rate_limiter { use super::*; - const NET_RATE_LIMITER_RUNTIME: u32 = 10; - const BLOCK_RATE_LIMITER_RUNTIME: u32 = 10; + const NET_RATE_LIMITER_RUNTIME: u32 = 20; + const BLOCK_RATE_LIMITER_RUNTIME: u32 = 20; // Check if the 'measured' rate is within the expected 'difference' (in percentage) // compared to given 'limit' rate. @@ -10503,12 +10503,12 @@ mod rate_limiter { let num_queues = 2; let queue_size = 256; - let bw_size = 10485760_u64; // bytes - let bw_refill_time = 100; // ms + let bw_size = 104857600_u64; // bytes + let bw_refill_time = 1000; // ms let limit_bps = (bw_size * 8 * 1000) as f64 / bw_refill_time as f64; let net_params = format!( - "tap=,mac={},ip={},mask=255.255.255.128,num_queues={},queue_size={},bw_size={},bw_refill_time={}", + "tap=,mac={},ip={},mask=255.255.255.128,num_queues={},queue_size={},bw_size={},bw_one_time_burst=0,bw_refill_time={}", guest.network.guest_mac0, guest.network.host_ip0, num_queues, @@ -10560,11 +10560,11 @@ mod rate_limiter { let fio_ops = FioOps::RandRW; let bw_size = if bandwidth { - 10485760_u64 // bytes + 104857600_u64 // bytes } else { - 100_u64 // I/O + 1000_u64 // I/O }; - let bw_refill_time = 100; // ms + let bw_refill_time = 1000; // ms let limit_rate = (bw_size * 1000) as f64 / bw_refill_time as f64; let disk_config = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string()); @@ -10585,11 +10585,11 @@ mod rate_limiter { let test_blk_params = if bandwidth { format!( - "path={blk_rate_limiter_test_img},num_queues={num_queues},bw_size={bw_size},bw_refill_time={bw_refill_time},image_type=raw" + "path={blk_rate_limiter_test_img},num_queues={num_queues},bw_size={bw_size},bw_one_time_burst=0,bw_refill_time={bw_refill_time},image_type=raw" ) } else { format!( - "path={blk_rate_limiter_test_img},num_queues={num_queues},ops_size={bw_size},ops_refill_time={bw_refill_time},image_type=raw" + "path={blk_rate_limiter_test_img},num_queues={num_queues},ops_size={bw_size},ops_one_time_burst=0,ops_refill_time={bw_refill_time},image_type=raw" ) };