Skip to content

testsuite: Add a new shaped-network performance harness#3203

Open
andylemin wants to merge 1 commit into
mainfrom
testsuite-decimal-sizes
Open

testsuite: Add a new shaped-network performance harness#3203
andylemin wants to merge 1 commit into
mainfrom
testsuite-decimal-sizes

Conversation

@andylemin

@andylemin andylemin commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Adds a shaped-network performance test rig under distrib/docker/perftest/: a container harness that runs afpd in the container's root network namespace, and runs the CI perfgraph speedtest (or lantest) from a separate client namespace in the same container across a tc-netem shaped veth pair.

The CI Performance Dashboard charts can now be reproduced locally with configurable network properties; link rates (100mbit/1gbit/10gbit), RTT delay and MTU — providing a static, repeatable network environment instead of the CPU-bound loopback the CI runners use, so framing and alignment effects (runt packets, segment fill) show consistently and the number of packets exchanged is measurable.

Every sweep size runs as its own afp_speedtest invocation with the client veth's packet/byte counters sampled before and after the test, giving exact per-test-size network statistics in both directions (segmentation offloads disabled so counters see exact on-wire sized packets).

The per-size fragments are merged into one CSV identical in layout to a CI sweep run and rendered through the same plot scripts; network statistics stay in separate files and a per-size table, never in the CSV.

At 10gbit/MTU 1500 the average packet size gradient runs ~420 bytes at the smallest sweep size to ~1503 at 256 MB (shown as MTU not MSS), and back-to-back runs reproduce totals within 0.03% — precise enough to measure framing changes per size.

ServerCopy is excluded from the default operation set (server-side copy, never crosses the shaped link, visually dwarfs the wire-bound curves); OPS=Read,Write,Copy,ServerCopy restores the CI set.
File sizes stay in binary KiB/MiB, matching macOS rx_quantum, netatalk-client, and other AFP/SMB testing tools.

Other fixes in this PR

  • speedtest -d sentinel: -d 64 equalled the built-in default, so the tool silently ran the default size sweep instead of the single given value; an explicit flag now always selects single-size mode (SizeFlagSeen).
  • Portable size formatting: size_t (Quantum) and off_t (rwsize) are printed with %ju and (uintmax_t) casts instead of %ld/%lu, which are wrong on platforms where those types are not long.
  • Usage clarity: the -q help text says KiB (it multiplies by 1024).
  • OPS knob: forwarded from run_perftest.sh into the container so ServerCopy and custom operation sets work from the host.

Example Execution

./distrib/docker/perftest/run_perftest.sh RATE=10gbit DELAY=2ms

Every knob at its default:
afp_speedtest sweep, 5 iterations + 1 warmup, ops Read/Write/Copy
rate limit 10gbit, forced delay 2ms (RTT 4ms), MTU 1500, MSS 1448, output to perftest-results/

Runs the whole pipeline: rebuilds netatalk-testsuite from the working tree, layers netatalk-perftest on top, runs the container with --privileged (one per-size speedtest invocation per sweep point over the shaped veth), merges the CSV, renders speed-10gbit-2ms.png via plot_speedtest.pl on the host, and prints the summary plus per-size table.

Results

NOTE; the recent performance regression have not been fixed here, and continue to be shown below (does not get up to speed until 16MB)

speed-10gbit

Summary

run mss mtu tx-packets rx-packets avg-tx avg-rx plot
speed-10gbit 1448 1500 5,233,961 4,493,082 1502 1500 perftest-results/speed-10gbit.png

Per-size network statistics

Client veth: tx = client sends, rx = client receives.

size (MB) tx packets tx bytes rx packets rx bytes avg tx avg rx
0.00390625 170 71,776 165 62,064 422 376
0.0078125 212 131,894 207 113,960 622 551
0.015625 296 252,122 261 215,824 852 827
0.03125 486 494,014 442 424,354 1016 960
0.0625 875 978,440 752 838,030 1118 1114
0.125 1,559 1,941,092 1,310 1,661,294 1245 1268
0.25 2,790 3,857,342 2,517 3,313,816 1383 1317
0.5 5,544 7,709,122 4,841 6,612,928 1391 1366
1 10,481 15,375,772 9,153 13,189,432 1467 1441
2 20,709 30,731,612 18,049 26,359,952 1484 1460
4 41,138 61,441,558 35,434 52,674,130 1494 1487
8 81,963 122,859,448 70,626 105,330,370 1499 1491
16 164,184 245,732,714 140,642 210,618,494 1497 1498
32 327,351 491,394,524 281,028 421,218,870 1501 1499
64 653,940 982,735,906 561,273 842,383,648 1503 1501
128 1,307,542 1,965,445,922 1,122,157 1,684,739,188 1503 1501
256 2,614,721 3,930,865,520 2,244,225 3,369,468,712 1503 1501

Totals: 4,991,286 tx packets / 4,284,970 rx packets; whole-run averages 1,502 / 1,500 bytes (MTU) per packet. Average packet size includes TCP/IP headers and ACK-only packets: the on-wire maximum at MTU 1500 with ethernet framing is ~1,514, so the large-size rows are effectively wire-full, while the small and mid sizes carry the command round-trip and partial-frame overhead — the region where DSI framing changes will show.


Relationship to #3196

This harness was created to analyse and baseline the current codebase before fix #3196 (the DSI quantum / framing fixes) are merged, to provide a true before/after analysis using static network properties.

Ie, On binary file sizes against the current server (with regression), transfers that straddle the sub-quantum boundary still trail a runt frame.

I have run this new test harness on the #3196 branch and the results below validate the fixes;

This shows the same performance test as above on the fixed branch;
speed-10gbit-2ms

The green and yellow lines show the percentage increase in average packet size as a result of the new Quantum/MSS auto-scaling;
packet-size-compare

@andylemin
andylemin requested a review from a team July 22, 2026 00:52
@andylemin
andylemin requested a review from rdmark as a code owner July 22, 2026 00:52
@augmentcode

augmentcode Bot commented Jul 22, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Adds a Docker-based performance test harness that runs the AFP testsuite over a Linux tc-netem shaped veth link, and aligns testsuite output/flags so CI-style perfgraphs can be reproduced locally.

Changes:

  • Adds distrib/docker/perftest/ with a privileged in-container rig (netns + veth + tc) and a host wrapper to build/run and render plots.
  • Runs afp_speedtest once per sweep size (or afp_lantest once) and records exact per-size interface counter deltas into separate net-stats artifacts.
  • Merges per-size CSV fragments into a single CI-compatible perfgraph CSV for plotting with existing plot_*.pl scripts.
  • Updates testsuite headers/usage text to use KiB/MiB wording and fixes -d handling so an explicit -d always selects single-size mode.
  • Updates documentation/manpage text and excludes the privileged perftest harness from Sonar analysis.

Technical Notes: The harness disables segmentation offloads so veth counters reflect on-wire sized packets, and captures MSS via ss for run metadata.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 5 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread distrib/docker/perftest/perftest.Dockerfile
Comment thread distrib/docker/perftest/run_perftest.sh Outdated
Comment thread test/testsuite/speedtest.c Outdated
Comment thread test/testsuite/speedtest.c Outdated
Comment thread test/testsuite/lantest.c Outdated
Comment thread distrib/docker/perftest/perftest.Dockerfile Fixed
@andylemin andylemin changed the title testsuite: decimal KB/MB file sizes; and added a new shaped-network performance harness testsuite: Add a new shaped-network performance harness Jul 22, 2026
@andylemin
andylemin force-pushed the testsuite-decimal-sizes branch from db9f986 to 58a314e Compare July 22, 2026 12:52
@andylemin

Copy link
Copy Markdown
Contributor Author

augment review

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 4 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread contrib/scripts/plot_speedtest.pl Outdated
Comment thread distrib/docker/perftest/entrypoint_perftest.sh
Comment thread doc/manpages/man1/afp_speedtest.1.md Outdated
Comment thread test/testsuite/speedtest.c
@andylemin
andylemin force-pushed the testsuite-decimal-sizes branch 3 times, most recently from ccc80f6 to 354b331 Compare July 22, 2026 14:25
@andylemin

andylemin commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@rdmark Ready for review and merge.

This tool is proving very useful/fun - it is fascinating to see what happens when you reduce and increase quantum and RTT. It shows well how AFP performance reacts as a request/response protocol - and I proves how powerful compound commands are going to be 🙂 The most significant impact by far is changing the RTT (so removing round trips will be 🚀)

Try running ./distrib/docker/perftest/run_perftest.sh DELAY=0.5ms,1ms,1.5ms,2ms for yourself.

Running with Quantum 2MB (whilst the performance regression exists) shows how it improves performance for 1MB, but the moment you cross the runt boundary it collapses back down - showing the impact concretely..

Reducing the Quantum benefits small files slightly at the expense of maximum speed for large files - but this is easier to see after the #3196 fix is in place.

@andylemin
andylemin force-pushed the testsuite-decimal-sizes branch 3 times, most recently from f14006e to cc86862 Compare July 23, 2026 02:46
Add distrib/docker/perftest/: a privileged-container harness that runs
afpd in the container's root network namespace and drives the CI
perfgraph speedtest (or lantest) from a client namespace across a
tc-netem shaped veth pair.  Rate (default 10gbit), one-way delay, and
MTU are configurable; it emits the CI-identical CSV, renders the same
plots via contrib/scripts/plot_*.pl, and collects out-of-band TCP
statistics (MSS, per-connection segs/bytes, namespace OutSegs, average
segment payload per direction) in a cross-rate summary table.  Per-run
outputs are <name>.csv, <name>-stderr.log (test-program stderr; empty
on a clean run), <name>-net.csv, and <name>-net.txt.

The harness also exposes QUANTUM (bytes or K/M/G suffix, e.g. 1M, 512K)
and READAHEAD knobs that set the server's afp.conf 'server quantum' and
'dsireadbuf' for the run, so the quantum/read-ahead sweep can be driven
end to end; the container entrypoint's afp.conf template gains those two
options (AFP_SERVER_QUANTUM / AFP_DSIREADBUF, defaulting to afpd's
built-in values).  The plot's quantum label tracks the configured
value instead of a hardcoded 1024, and reads KiB.

Also fix the speedtest -d sentinel: -d 64 equalled the built-in
default so the tool silently ran the default sweep; an explicit flag
now always selects single-size mode (SizeFlagSeen).  File sizes stay
binary KiB/MiB, matching other AFP/SMB testing tools.  Print size_t
and off_t values with %ju/(uintmax_t) instead of %ld/%lu, clarify -q
is KiB, forward the OPS knob from run_perftest.sh, and exclude the
privileged harness from SonarQube analysis.
@andylemin
andylemin force-pushed the testsuite-decimal-sizes branch from cc86862 to 7333b66 Compare July 23, 2026 03:43
@github-actions

Copy link
Copy Markdown
Contributor

📊 Performance Dashboard

Commit: 7333b66f5576b2ac2d7d7dfb5531c5c4a11feb93

🔥 Spectest (AFP 3.4) - FlameGraph

Netatalk Code-time: 2.0% · Runtime: 67s · Stacks: 1162

🔥 Click the preview to open the interactive flamegraph (zoom + search).

Flamegraph preview

🔝 Top 10 leaf functions
Function Samples
_raw_spin_unlock_irqrestore 342888385
do_syscall_64 134509270
__cp_end 82690125
srso_alias_safe_ret 47409005
afpd 45203935
x64_sys_call 41896330
tcp_clean_rtx_queue.constprop.0 28665910
find_get_block_common 26460840
memcmp 25358305
__syscall_cp_c 23153235

📈 Speedtest (AFP 3.4) - PerfGraph

Speedtest throughput

🔝 Peak throughput per operation
Operation Peak mean (MB/s)
Read 5711
Write 1403
Copy 1977
ServerCopy 3273

⏱️ Lantest (AFP 3.4) - LatencyGraph

Lantest latency

Avg total runtime: 6432 ms · Avg time per AFP op: 0.100 ms

🐢 All operations (avg runtime, in test order)
Test Avg (ms)
Writing one large file 37
Reading one large file 15
Creating 2000 files 715
Open, write 1024 bytes, close 2000 files 367
Open, read 512 bytes, close 2000 files 314
Copying 2000 files client-side 1371
Copying 2000 files server-side 924
Stat 2000 files 277
Enumerate dir with 2000 files 5
Lock then unlock 2000 open forks 147
Deleting 2000 files 624
Byte-range lock/unlock 2000 ranges in one fork 158
Create directory tree with 1000 dirs 387
Directory cache hits (20 dirs x 100 files) 91
Mixed cache operations (create/stat/enum/delete) on 1000 files 643
Deep path traversal (20 levels x 100 walks) 97
Cache validation (2000 files x 3 lookups) 260

@sonarqubecloud

Copy link
Copy Markdown

@andylemin

Copy link
Copy Markdown
Contributor Author

@rdmark with and without 3196 fixes added to summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants