From 6f3c18d1b221d5603fa526334b90609d06d952f0 Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:17:04 +0000 Subject: [PATCH 1/4] Fix Stress Test --- stress/src/throughput.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stress/src/throughput.rs b/stress/src/throughput.rs index 1d54e70e06..5a2cda63b5 100644 --- a/stress/src/throughput.rs +++ b/stress/src/throughput.rs @@ -69,8 +69,8 @@ where let worker_stats_shared_monitor = Arc::clone(&worker_stats_shared); let handle_main_thread = thread::spawn(move || { - let mut start_time = Instant::now(); - let mut end_time = start_time; + let mut last_run = Instant::now(); + let mut current_time: Instant; let mut total_count_old: u64 = 0; #[cfg(feature = "stats")] @@ -79,7 +79,8 @@ where let mut system = System::new_all(); loop { - let elapsed = end_time.duration_since(start_time).as_secs(); + current_time = Instant::now(); + let elapsed = current_time.duration_since(last_run).as_secs(); // Calculate the time elapsed (in seconds) since the last collect if elapsed >= SLIDING_WINDOW_SIZE { let total_count_u64: u64 = worker_stats_shared_monitor .iter() @@ -112,14 +113,13 @@ where } println!("\n"); - start_time = Instant::now(); + last_run = Instant::now(); } if STOP.load(Ordering::SeqCst) { break; } - end_time = Instant::now(); thread::sleep(Duration::from_millis(5000)); } }); From 9bc60e910198668e0fc9936d4d2d7d54be6127e1 Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:23:52 +0000 Subject: [PATCH 2/4] Code changes --- stress/src/throughput.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stress/src/throughput.rs b/stress/src/throughput.rs index 5a2cda63b5..87474d96c2 100644 --- a/stress/src/throughput.rs +++ b/stress/src/throughput.rs @@ -69,7 +69,7 @@ where let worker_stats_shared_monitor = Arc::clone(&worker_stats_shared); let handle_main_thread = thread::spawn(move || { - let mut last_run = Instant::now(); + let mut last_collect_time = Instant::now(); let mut current_time: Instant; let mut total_count_old: u64 = 0; @@ -80,12 +80,13 @@ where loop { current_time = Instant::now(); - let elapsed = current_time.duration_since(last_run).as_secs(); // Calculate the time elapsed (in seconds) since the last collect + let elapsed = current_time.duration_since(last_collect_time).as_secs(); if elapsed >= SLIDING_WINDOW_SIZE { let total_count_u64: u64 = worker_stats_shared_monitor .iter() .map(|worker_stat| worker_stat.count.load(Ordering::Relaxed)) .sum(); + last_collect_time = Instant::now(); let current_count = total_count_u64 - total_count_old; total_count_old = total_count_u64; let throughput = current_count / elapsed; @@ -113,7 +114,6 @@ where } println!("\n"); - last_run = Instant::now(); } if STOP.load(Ordering::SeqCst) { From 628216e68ae9f068b8d216345eb668736ecaf9a5 Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com> Date: Mon, 15 Jul 2024 17:09:57 +0000 Subject: [PATCH 3/4] Address PR comments --- stress/src/throughput.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stress/src/throughput.rs b/stress/src/throughput.rs index 87474d96c2..41d790eea4 100644 --- a/stress/src/throughput.rs +++ b/stress/src/throughput.rs @@ -70,7 +70,6 @@ where let handle_main_thread = thread::spawn(move || { let mut last_collect_time = Instant::now(); - let mut current_time: Instant; let mut total_count_old: u64 = 0; #[cfg(feature = "stats")] @@ -79,7 +78,7 @@ where let mut system = System::new_all(); loop { - current_time = Instant::now(); + let current_time = Instant::now(); let elapsed = current_time.duration_since(last_collect_time).as_secs(); if elapsed >= SLIDING_WINDOW_SIZE { let total_count_u64: u64 = worker_stats_shared_monitor From b10bb79fc2745c399d6621e763a3c8bf33aa98e1 Mon Sep 17 00:00:00 2001 From: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com> Date: Mon, 15 Jul 2024 17:45:10 +0000 Subject: [PATCH 4/4] Update stress test results --- stress/src/logs.rs | 6 +++--- stress/src/metrics_counter.rs | 6 +++--- stress/src/metrics_histogram.rs | 6 +++--- stress/src/metrics_overflow.rs | 6 +++--- stress/src/random.rs | 6 +++--- stress/src/traces.rs | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/stress/src/logs.rs b/stress/src/logs.rs index caba1eb1cd..e13c88f85c 100644 --- a/stress/src/logs.rs +++ b/stress/src/logs.rs @@ -1,9 +1,9 @@ /* Stress test results: - OS: Ubuntu 22.04.3 LTS (5.15.146.1-microsoft-standard-WSL2) - Hardware: AMD EPYC 7763 64-Core Processor - 2.44 GHz, 16vCPUs, + OS: Ubuntu 22.04.4 LTS (5.15.153.1-microsoft-standard-WSL2) + Hardware: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz, 16vCPUs, RAM: 64.0 GB - 69 M/sec + ~31 M/sec */ use opentelemetry_appender_tracing::layer; diff --git a/stress/src/metrics_counter.rs b/stress/src/metrics_counter.rs index 7a38bb2938..6cde5ed9cb 100644 --- a/stress/src/metrics_counter.rs +++ b/stress/src/metrics_counter.rs @@ -1,9 +1,9 @@ /* Stress test results: - OS: Ubuntu 22.04.3 LTS (5.15.146.1-microsoft-standard-WSL2) - Hardware: AMD EPYC 7763 64-Core Processor - 2.44 GHz, 16vCPUs, + OS: Ubuntu 22.04.4 LTS (5.15.153.1-microsoft-standard-WSL2) + Hardware: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz, 16vCPUs, RAM: 64.0 GB - 35 M /sec + ~9.5 M /sec */ use lazy_static::lazy_static; diff --git a/stress/src/metrics_histogram.rs b/stress/src/metrics_histogram.rs index 321deb57ec..d65160af22 100644 --- a/stress/src/metrics_histogram.rs +++ b/stress/src/metrics_histogram.rs @@ -1,9 +1,9 @@ /* Stress test results: - OS: Ubuntu 22.04.3 LTS (5.15.146.1-microsoft-standard-WSL2) - Hardware: AMD EPYC 7763 64-Core Processor - 2.44 GHz, 16vCPUs, + OS: Ubuntu 22.04.4 LTS (5.15.153.1-microsoft-standard-WSL2) + Hardware: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz, 16vCPUs, RAM: 64.0 GB - 4.6M /sec + ~1.8 M/sec */ use lazy_static::lazy_static; diff --git a/stress/src/metrics_overflow.rs b/stress/src/metrics_overflow.rs index dfb13170a8..d2e552ed67 100644 --- a/stress/src/metrics_overflow.rs +++ b/stress/src/metrics_overflow.rs @@ -1,9 +1,9 @@ /* Stress test results: - OS: Ubuntu 22.04.3 LTS (5.15.146.1-microsoft-standard-WSL2) - Hardware: AMD EPYC 7763 64-Core Processor - 2.44 GHz, 16vCPUs, + OS: Ubuntu 22.04.4 LTS (5.15.153.1-microsoft-standard-WSL2) + Hardware: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz, 16vCPUs, RAM: 64.0 GB - 4.5M /sec + ~1.9 M/sec */ use lazy_static::lazy_static; diff --git a/stress/src/random.rs b/stress/src/random.rs index 8b08aa8b0d..9d4b7f997e 100644 --- a/stress/src/random.rs +++ b/stress/src/random.rs @@ -1,9 +1,9 @@ /* Stress test results: - OS: Ubuntu 22.04.3 LTS (5.15.146.1-microsoft-standard-WSL2) - Hardware: AMD EPYC 7763 64-Core Processor - 2.44 GHz, 16vCPUs, + OS: Ubuntu 22.04.4 LTS (5.15.153.1-microsoft-standard-WSL2) + Hardware: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz, 16vCPUs, RAM: 64.0 GB - 1.25 B/sec + ~540 M/sec */ use rand::{ diff --git a/stress/src/traces.rs b/stress/src/traces.rs index 3924dc9e2b..14a5c756c0 100644 --- a/stress/src/traces.rs +++ b/stress/src/traces.rs @@ -1,9 +1,9 @@ /* Stress test results: - OS: Ubuntu 22.04.3 LTS (5.15.146.1-microsoft-standard-WSL2) - Hardware: AMD EPYC 7763 64-Core Processor - 2.44 GHz, 16vCPUs, + OS: Ubuntu 22.04.4 LTS (5.15.153.1-microsoft-standard-WSL2) + Hardware: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz, 16vCPUs, RAM: 64.0 GB - 9 M/sec + ~6.5 M/sec */ use lazy_static::lazy_static;