From 9a1abd3d5f493a16a0b8ee24b3bae83f652f120c Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Sun, 22 Nov 2026 08:12:34 -0800 Subject: [PATCH] M6 follow-up: baseline.sh reports failed runs; reword the CPU finding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - tools/perf/baseline.sh: each tool's output went through `grep -o 'Aggregated.*'`, so a failed run lost what the tool printed, and under `set -e` and `pipefail` the script stopped without a word. A run that ends without its summary line now prints the tool's last lines and says so, and the script still stops. - docs/8 §6.1 and PLAN.md: the CPU the 1 KiB runs measured is the client side's, the producer's and that of `perf` driving it, not the producer's alone. --- PLAN.md | 7 ++++--- docs/8-quality.md | 10 +++++----- tools/perf/baseline.sh | 15 +++++++++++++-- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/PLAN.md b/PLAN.md index 1191997..f114843 100644 --- a/PLAN.md +++ b/PLAN.md @@ -156,9 +156,10 @@ with each codec, the ZLIB ones finished streams. A first round of benchmarks, and a baseline against Java's V5 client on a 5.0.1 broker ([8](docs/8-quality.md) §6): micro-benchmarks of the producer's state machine and of the codecs, and `tools/perf`, which measures the producer's and -the Queue consumer's throughput and latency against a broker as Java's `pulsar-perf` does. The producer is bound by -its own CPU, most of a send's spent outside the state machine, and the thread-safe consumer's receives and acks each -cross threads: the next rounds look for where a send's time goes, and measure loops. +the Queue consumer's throughput and latency against a broker as Java's `pulsar-perf` does. The client side, the +producer and `perf` driving it, is bound by its CPU, most of a send's spent outside the state machine, and the +thread-safe consumer's receives and acks each cross threads: the next rounds look for where a send's time goes, and +measure loops. ## M7: Conformance and a first release diff --git a/docs/8-quality.md b/docs/8-quality.md index b71d5bb..0936548 100644 --- a/docs/8-quality.md +++ b/docs/8-quality.md @@ -145,11 +145,11 @@ reaches, 1 KiB messages of uppercase letters, batches of up to 1 ms, one segment What it shows: -- **The producer is bound by its own CPU.** In a separate 1 KiB run, sampled with `docker stats`, this client used - 150–180% of a core, its loop's thread and the one making the load, for about 500k msg/s, and 100% on the local - client, both on one thread, for about 400k. Java's used under one core for about 990k, and the broker had room every - time. The state machine takes under 0.3 µs of a message, the micro-benchmarks say, out of about 3 µs of CPU in all: - the next round looks for where the rest goes. +- **The client side is bound by its CPU, the producer and `perf` driving it.** In a separate 1 KiB run, sampled with + `docker stats`, this client used 150–180% of a core, its loop's thread and the one making the load, for about 500k + msg/s, and 100% on the local client, both on one thread, for about 400k. Java's used under one core for about 990k, + and the broker had room every time. The state machine takes under 0.3 µs of a message, the micro-benchmarks say, + out of about 3 µs of CPU in all, `perf`'s share included: the next round looks for where the rest goes. - **Large messages are bound by the broker:** at 10 KiB both clients store about 1 GB/s. - **At a fixed rate, the latencies match**, this client's a little lower. - **The thread-safe consumer's receives and acks each cross to its loop's thread**, so a loop receiving and diff --git a/tools/perf/baseline.sh b/tools/perf/baseline.sh index 347d209..cfe7600 100755 --- a/tools/perf/baseline.sh +++ b/tools/perf/baseline.sh @@ -70,12 +70,23 @@ topic() { echo "topic://public/default/$name" } +# The summary lines a tool prints at the end of a run. A run that ends without them stops the script, after the last +# lines the tool printed. +summary() { + local out + out=$(cat) + grep -o 'Aggregated.*' <<<"$out" && return + tail -n 20 <<<"$out" >&2 + echo "baseline.sh: the run ended without its summary line" >&2 + return 1 +} + rust() { - docker run --rm --network "$NET" -v "$BIN:/perf:ro" "$RUST_IMAGE" /perf/perf "$@" 2>&1 | grep -o 'Aggregated.*' + docker run --rm --network "$NET" -v "$BIN:/perf:ro" "$RUST_IMAGE" /perf/perf "$@" 2>&1 | summary } java() { - docker run --rm --network "$NET" "$IMAGE" bin/pulsar-perf "$@" 2>&1 | grep -o 'Aggregated.*' + docker run --rm --network "$NET" "$IMAGE" bin/pulsar-perf "$@" 2>&1 | summary } # The rate over a run of `$1` seconds, from the records its summary line counts.