Add a tool to track eBPF map performance

New tool: lqos_map_perf is included in the distribution. It
runs the two map iterators that pound the lqosd/eBPF system
with map iterations, counts the number of entries returned
and reports on overall performance (in µs).

This is intended to help with diagnosing map reading
performance issues and act as a bench-test to see if
using eBPF iterators actually helps.
This commit is contained in:
Herbert Wolverson 2023-04-17 13:28:09 +00:00
parent b4feb920b0
commit 5cd5b44496
6 changed files with 41 additions and 2 deletions

View File

@ -22,7 +22,7 @@ ETC_DIR=$DPKG_DIR/etc
MOTD_DIR=$DPKG_DIR/etc/update-motd.d
LQOS_FILES="graphInfluxDB.py influxDBdashboardTemplate.json integrationCommon.py integrationRestHttp.py integrationSplynx.py integrationUISP.py ispConfig.example.py LibreQoS.py lqos.example lqTools.py mikrotikFindIPv6.py network.example.json pythonCheck.py README.md scheduler.py ShapedDevices.example.csv"
LQOS_BIN_FILES="lqos_scheduler.service.example lqosd.service.example lqos_node_manager.service.example"
RUSTPROGS="lqosd lqtop xdp_iphash_to_cpu_cmdline xdp_pping lqos_node_manager lqusers lqos_setup"
RUSTPROGS="lqosd lqtop xdp_iphash_to_cpu_cmdline xdp_pping lqos_node_manager lqusers lqos_setup lqos_map_perf"
####################################################
# Clean any previous dist build

View File

@ -52,7 +52,7 @@ rustup update
# Start building
echo "Please wait while the system is compiled. Service will not be interrupted during this stage."
PROGS="lqosd lqtop xdp_iphash_to_cpu_cmdline xdp_pping lqos_node_manager lqusers"
PROGS="lqosd lqtop xdp_iphash_to_cpu_cmdline xdp_pping lqos_node_manager lqusers lqos_map_perf"
mkdir -p bin/static
pushd rust > /dev/null
#cargo clean

7
src/rust/Cargo.lock generated
View File

@ -1445,6 +1445,13 @@ dependencies = [
"zerocopy",
]
[[package]]
name = "lqos_map_perf"
version = "0.1.0"
dependencies = [
"lqos_sys",
]
[[package]]
name = "lqos_node_manager"
version = "0.1.0"

View File

@ -26,4 +26,5 @@ members = [
"lqos_setup", # A quick CLI setup for first-time users
"lqos_anonymous_stats_server", # The server for gathering anonymous usage data.
"lqos_heimdall", # Library for managing Heimdall flow watching
"lqos_map_perf", # A CLI tool for testing eBPF map performance
]

View File

@ -0,0 +1,7 @@
[package]
name = "lqos_map_perf"
version = "0.1.0"
edition = "2021"
[dependencies]
lqos_sys = { path = "../lqos_sys" }

View File

@ -0,0 +1,24 @@
use std::time::Instant;
use lqos_sys::{rtt_for_each, throughput_for_each};
fn main() {
println!("LibreQoS Map Performance Tool");
// Test the RTT map
let mut rtt_count = 0;
let now = Instant::now();
rtt_for_each(&mut |_rtt, _tracker| {
rtt_count += 1;
});
let elapsed = now.elapsed();
println!("RTT map: {} entries in {} µs", rtt_count, elapsed.as_micros());
let mut tp_count = 0;
let now = Instant::now();
throughput_for_each(&mut |_ip, _hosts| {
tp_count += 1;
});
let elapsed = now.elapsed();
println!("TP map: {} entries in {} µs", tp_count, elapsed.as_micros());
}