Skip to content

Commit

Permalink
Merge pull request #168 from greatest-ape/udp-bench-fixes
Browse files Browse the repository at this point in the history
udp and bencher tweaks
  • Loading branch information
greatest-ape authored Jan 7, 2024
2 parents 2d959ee + d48deef commit 1ee08bf
Show file tree
Hide file tree
Showing 19 changed files with 686 additions and 513 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#### Changed

* Index peers by packet source IP and provided port, instead of by peer_id.
This prevents users from impersonating others and is likely also slightly
faster for IPv4 peers.
* Remove support for unbounded worker channels
* Add backpressure in socket workers. They will postpone reading from the
socket if sending a request to a swarm worker failed
Expand Down
9 changes: 8 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

## High priority

* aquatic_bench
* Opentracker "slow to get up to speed", is it due to getting faster once
inserts are rarely needed since most ip-port combinations have been sent?
In that case, a shorter duration (e.g., 30 seconds) would be a good idea.
* Maybe investigate aquatic memory use.
* Would it use significantly less memory to store peers in an ArrayVec if
there are only, say, 2 of them?

* CI transfer test
* add udp with io_uring
* add HTTP without TLS

* http
Expand Down
25 changes: 23 additions & 2 deletions crates/bencher/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@ use std::{fmt::Display, ops::Range, thread::available_parallelism};

use itertools::Itertools;

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)]
pub enum Priority {
Low,
Medium,
High,
}

impl Display for Priority {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Low => f.write_str("low"),
Self::Medium => f.write_str("medium"),
Self::High => f.write_str("high"),
}
}
}

#[derive(Debug, Clone)]
pub struct TaskSetCpuList(pub Vec<TaskSetCpuIndicator>);

Expand Down Expand Up @@ -141,13 +158,17 @@ pub enum CpuDirection {
Desc,
}

pub fn simple_load_test_runs(cpu_mode: CpuMode, workers: &[usize]) -> Vec<(usize, TaskSetCpuList)> {
pub fn simple_load_test_runs(
cpu_mode: CpuMode,
workers: &[(usize, Priority)],
) -> Vec<(usize, Priority, TaskSetCpuList)> {
workers
.into_iter()
.copied()
.map(|workers| {
.map(|(workers, priority)| {
(
workers,
priority,
TaskSetCpuList::new(cpu_mode, CpuDirection::Desc, workers).unwrap(),
)
})
Expand Down
36 changes: 32 additions & 4 deletions crates/bencher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ pub mod run;
pub mod set;

use clap::{Parser, Subcommand};
use common::CpuMode;
use common::{CpuMode, Priority};
use set::run_sets;

#[derive(Parser)]
#[command(author, version, about)]
Expand All @@ -20,6 +21,20 @@ struct Args {
/// Maximum number of tracker cpu cores to run benchmarks for
#[arg(long)]
max_cores: Option<usize>,
/// Minimum benchmark priority
#[arg(long, default_value_t = Priority::Medium)]
min_priority: Priority,
/// How long to run each load test for
#[arg(long, default_value_t = 90)]
duration: usize,
/// Only include data for last N seconds of load test runs.
///
/// Useful if the tracker/load tester combination is slow at reaching
/// maximum throughput
///
/// 0 = use data for whole run
#[arg(long, default_value_t = 30)]
summarize_last: usize,
#[command(subcommand)]
command: Command,
}
Expand All @@ -36,8 +51,21 @@ fn main() {

match args.command {
#[cfg(feature = "udp")]
Command::Udp(command) => command
.run(args.cpu_mode, args.min_cores, args.max_cores)
.unwrap(),
Command::Udp(command) => {
let sets = command.sets(args.cpu_mode);
let load_test_gen = protocols::udp::UdpCommand::load_test_gen;

run_sets(
&command,
args.cpu_mode,
args.min_cores,
args.max_cores,
args.min_priority,
args.duration,
args.summarize_last,
sets,
load_test_gen,
);
}
}
}
Loading

0 comments on commit 1ee08bf

Please sign in to comment.