~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

bench: the firehose part measures its lag, not the write path

Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:bench-firehose-lag
bench/README.md+10−6
@@ -114,13 +114,17 @@ order:
| listRecords | 1000 | 16 | `limit=50` |
| getRepo | 100 | 8 | ~75 records per repo |
| uploadBlob | 100 | 8 | 64 KiB, `application/octet-stream` |
| firehose | 100 writes | 20 subscribers | `putRecord`s one after another; latency is write sent → commit received |
| firehose | 100 writes | 20 subscribers | `putRecord`s one after another; latency is the firehose's lag, write answered → commit received |
Per part: throughput (requests answered per second; for the firehose,
commits delivered to subscribers per second), p50 and p99 of request times,
as the best and the median of the rounds. Per server: start time (spawning
the server, or `docker start` of its container, to the first answered
`describeServer`), its RSS 2 s after start (idle) and the most sampled
Per part: throughput (requests answered per second), p50 and p99 of request
times, as the best and the median of the rounds. The firehose has no
throughput: with one write at a time it would be the write path's, which
createRecord and applyWrites measure; its times are its lag, from a write's
answer to a subscriber having its commit, 0 when the commit came first.
Per server: start time (spawning the server, or `docker start` of its
container, to the first answered `describeServer`), its RSS 2 s after start
(idle) and the most sampled
through the round (peak): `ps` for a native process, `docker top` inside the
container for vlpds and zds (the `vlpds` process, not its `tini`; the `zds` process).
vlpds's store's RSS is sampled the same way and reported in a table of its
bench/results.json+331−340
671 lines changed: not loaded until asked for.
bench/RESULTS.md+80−77
@@ -20,11 +20,13 @@ The workload is `harness/perf.mjs`'s, plus `applyWrites` and `listRecords`:
| listRecords | 1000 | 16 | `limit=50` |
| getRepo | 100 | 8 | each repo holds ~25 records from createRecord plus ~50 from applyWrites |
| uploadBlob | 100 | 8 | 64 KiB, `application/octet-stream` |
| firehose | 100 writes | 20 subscribers | `putRecord`s one after another; latency is write sent → commit received by a subscriber |
| firehose | 100 writes | 20 subscribers | `putRecord`s one after another; latency is the firehose's lag, write answered → commit received by a subscriber |
Throughput is requests answered per second over the part (for the firehose,
commits delivered to all subscribers per second, bounded by the sequential
writes). p50/p99 are of the round's request times. "Best" is each column's
Throughput is requests answered per second over the part. The firehose has
none: with one write at a time it would be the write path's, which
createRecord and applyWrites measure; its times are its lag, from a write's
answer to a subscriber having its commit, 0 when the commit came first.
p50/p99 are of the round's request times. "Best" is each column's
best round (most per second, least ms); "median" is the median round.
## Machine and versions
@@ -33,9 +35,9 @@ best round (most per second, least ms); "median" is the median round.
SSD. Docker Desktop 28.0.1, its Linux VM given 8 CPUs and 7.7 GiB.
- Node v24.22.1 (bench client and the reference); rustc 1.99.1 (spec-pds).
- Pins, as `bench/impls.json` has them and `results.json` records:
- **spec-pds**: this repository at `01e1909` (branch `bench`; the server
as at that commit, the bench's own changes for zds on top),
`cargo build --release -p pds`; workspace version 0.0.0.
- **spec-pds**: this repository at `f15eaf4` (the server as at that
commit, the bench's firehose part as described above on top),
`cargo build --release -p pds`; workspace version 0.1.0.
- **reference**: `@atproto/pds` 0.5.55 from npm, started through
`@atproto/dev-env` 0.6.26's `TestPds` as `perf.mjs` does, pinned by
`harness/package-lock.json`.
@@ -105,21 +107,21 @@ handler, so the bench kills it rather than wait out `docker stop`.
### Summary
Each part's requests per second (the firehose: commits delivered per second), start time and memory; each the best round. Detail follows.
Each part's requests per second, start time and memory, each the best round; for the firehose, the p50 of its lag, the best round. Detail follows.
| | reference | spec-pds | vlpds | zds |
|---|--:|--:|--:|--:|
| createAccount per s | 70 | 55 | 48 | 7 |
| createRecord per s | 309 | 378 | 718 | 539 |
| applyWrites per s | 159 | 294 | 409 | 390 |
| getRecord per s | 1085 | 16465 | 4991 | 3149 |
| listRecords per s | 720 | 7715 | 4175 | 2115 |
| getRepo per s | 512 | 4276 | 1926 | 815 |
| uploadBlob per s | 395 | 419 | 167 | 356 |
| firehose per s | 4324 | 3570 | 2448 | 1087 |
| start ms | 2386 | 37 | 1184 | 228 |
| idle RSS MiB (median) | 398.9 | 13.6 | 165.4 | 16.7 |
| peak RSS MiB | 608.4 | 73.7 | 384.7 | 49.2 |
| createAccount per s | 57 | 46 | 32 | 5 |
| createRecord per s | 247 | 373 | 529 | 321 |
| applyWrites per s | 130 | 284 | 272 | 224 |
| getRecord per s | 883 | 13632 | 2985 | 2423 |
| listRecords per s | 575 | 6797 | 2020 | 1472 |
| getRepo per s | 396 | 3860 | 904 | 603 |
| uploadBlob per s | 306 | 315 | 83 | 226 |
| firehose lag p50 ms | 78.5 | 0.4 | 2.3 | 15.0 |
| start ms | 2211 | 49 | 1375 | 435 |
| idle RSS MiB (median) | 397.4 | 18.2 | 169.8 | 16.5 |
| peak RSS MiB | 643.0 | 71.6 | 370.9 | 50.2 |
### createAccount
@@ -127,10 +129,10 @@ Each part's requests per second (the firehose: commits delivered per second), st
| impl | per s (best) | per s (median) | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |
|---|--:|--:|--:|--:|--:|--:|
| reference | 70 | 70 | 51.9 | 52.2 | 73.8 | 74.5 |
| spec-pds | 55 | 53 | 66.7 | 68.6 | 95.9 | 104.5 |
| vlpds | 48 | 42 | 79.5 | 91.3 | 116.5 | 135.3 |
| zds | 7 | 7 | 467.8 | 486.9 | 1186.3 | 1375.5 |
| reference | 57 | 53 | 63.5 | 66.9 | 96.5 | 98.0 |
| spec-pds | 46 | 43 | 83.9 | 87.6 | 118.3 | 126.5 |
| vlpds | 32 | 28 | 118.6 | 135.6 | 184.3 | 228.2 |
| zds | 5 | 5 | 855.9 | 871.0 | 1554.4 | 2163.1 |
### createRecord
@@ -138,10 +140,10 @@ Each part's requests per second (the firehose: commits delivered per second), st
| impl | per s (best) | per s (median) | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |
|---|--:|--:|--:|--:|--:|--:|
| reference | 309 | 306 | 51.5 | 51.9 | 60.7 | 62.4 |
| spec-pds | 378 | 369 | 42.1 | 42.7 | 69.7 | 72.9 |
| vlpds | 718 | 681 | 16.7 | 17.6 | 56.2 | 59.7 |
| zds | 539 | 535 | 22.1 | 23.6 | 98.4 | 101.7 |
| reference | 247 | 238 | 63.7 | 65.2 | 79.7 | 99.1 |
| spec-pds | 373 | 346 | 43.0 | 45.4 | 81.4 | 91.6 |
| vlpds | 529 | 506 | 23.6 | 24.5 | 65.9 | 66.0 |
| zds | 321 | 287 | 31.3 | 43.4 | 188.6 | 192.6 |
### applyWrites
@@ -149,10 +151,10 @@ Each part's requests per second (the firehose: commits delivered per second), st
| impl | per s (best) | per s (median) | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |
|---|--:|--:|--:|--:|--:|--:|
| reference | 159 | 157 | 49.8 | 50.9 | 56.0 | 59.9 |
| spec-pds | 294 | 281 | 26.2 | 27.9 | 42.3 | 47.1 |
| vlpds | 409 | 361 | 15.7 | 17.3 | 45.3 | 48.9 |
| zds | 390 | 389 | 16.6 | 17.9 | 49.5 | 51.7 |
| reference | 130 | 127 | 61.8 | 62.6 | 72.3 | 72.7 |
| spec-pds | 284 | 274 | 27.0 | 27.5 | 44.9 | 49.6 |
| vlpds | 272 | 257 | 22.1 | 22.4 | 58.9 | 67.3 |
| zds | 224 | 215 | 29.1 | 31.4 | 89.8 | 99.5 |
### getRecord
@@ -160,10 +162,10 @@ Each part's requests per second (the firehose: commits delivered per second), st
| impl | per s (best) | per s (median) | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |
|---|--:|--:|--:|--:|--:|--:|
| reference | 1085 | 1081 | 14.4 | 14.6 | 18.3 | 22.5 |
| spec-pds | 16465 | 15315 | 0.8 | 0.9 | 4.9 | 5.4 |
| vlpds | 4991 | 4802 | 2.2 | 2.2 | 22.5 | 24.4 |
| zds | 3149 | 3052 | 3.7 | 3.8 | 23.7 | 28.7 |
| reference | 883 | 858 | 17.6 | 18.0 | 24.4 | 24.6 |
| spec-pds | 13632 | 12253 | 1.0 | 1.1 | 5.4 | 5.7 |
| vlpds | 2985 | 2922 | 3.3 | 3.5 | 40.8 | 43.4 |
| zds | 2423 | 2063 | 4.7 | 5.2 | 41.2 | 44.0 |
### listRecords
@@ -171,10 +173,10 @@ Each part's requests per second (the firehose: commits delivered per second), st
| impl | per s (best) | per s (median) | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |
|---|--:|--:|--:|--:|--:|--:|
| reference | 720 | 712 | 21.2 | 22.1 | 29.4 | 32.9 |
| spec-pds | 7715 | 7362 | 1.6 | 1.7 | 10.3 | 10.3 |
| vlpds | 4175 | 2759 | 3.6 | 4.4 | 9.7 | 25.3 |
| zds | 2115 | 2111 | 5.7 | 5.8 | 28.1 | 28.3 |
| reference | 575 | 567 | 26.5 | 27.6 | 42.5 | 58.9 |
| spec-pds | 6797 | 5035 | 1.8 | 2.3 | 11.7 | 14.8 |
| vlpds | 2020 | 1722 | 5.6 | 6.5 | 37.4 | 40.7 |
| zds | 1472 | 1376 | 7.9 | 8.5 | 50.3 | 51.6 |
### getRepo
@@ -182,10 +184,10 @@ Each part's requests per second (the firehose: commits delivered per second), st
| impl | per s (best) | per s (median) | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |
|---|--:|--:|--:|--:|--:|--:|
| reference | 512 | 498 | 15.3 | 15.5 | 18.3 | 19.0 |
| spec-pds | 4276 | 4072 | 1.8 | 1.9 | 2.5 | 2.7 |
| vlpds | 1926 | 1750 | 3.7 | 4.1 | 6.6 | 10.4 |
| zds | 815 | 745 | 7.8 | 8.4 | 27.9 | 28.7 |
| reference | 396 | 393 | 19.1 | 19.2 | 24.8 | 25.3 |
| spec-pds | 3860 | 3700 | 2.0 | 2.0 | 3.1 | 3.4 |
| vlpds | 904 | 738 | 6.2 | 6.7 | 31.9 | 39.6 |
| zds | 603 | 572 | 10.3 | 10.4 | 42.1 | 47.8 |
### uploadBlob
@@ -193,21 +195,21 @@ Each part's requests per second (the firehose: commits delivered per second), st
| impl | per s (best) | per s (median) | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |
|---|--:|--:|--:|--:|--:|--:|
| reference | 395 | 378 | 17.0 | 17.3 | 26.1 | 31.3 |
| spec-pds | 419 | 383 | 14.8 | 16.1 | 38.1 | 40.1 |
| vlpds | 167 | 142 | 38.4 | 50.5 | 82.9 | 86.2 |
| zds | 356 | 326 | 15.4 | 17.8 | 44.1 | 52.4 |
| reference | 306 | 278 | 21.3 | 25.6 | 41.0 | 55.0 |
| spec-pds | 315 | 256 | 18.9 | 20.8 | 53.7 | 69.1 |
| vlpds | 83 | 56 | 93.5 | 114.0 | 173.4 | 378.7 |
| zds | 226 | 208 | 26.2 | 29.3 | 80.4 | 85.8 |
### firehose
100 putRecords one after another, 20 subscribers; times from sending a write to a subscriber having its commit, throughput in commits delivered per second.
100 putRecords one after another, 20 subscribers; each time is the firehose's lag, from a write's answer to a subscriber having its commit, 0 when the commit came first. No rate: with one write at a time it would be the write path's, which createRecord and applyWrites measure.
| impl | per s (best) | per s (median) | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |
|---|--:|--:|--:|--:|--:|--:|
| reference | 4324 | 4179 | 131.7 | 140.6 | 316.3 | 326.4 |
| spec-pds | 3570 | 3226 | 5.8 | 6.2 | 8.6 | 11.9 |
| vlpds | 2448 | 1643 | 9.5 | 11.9 | 34.0 | 36.9 |
| zds | 1087 | 944 | 27.0 | 30.9 | 75.3 | 89.7 |
| impl | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |
|---|--:|--:|--:|--:|
| reference | 78.5 | 113.0 | 304.9 | 333.7 |
| spec-pds | 0.4 | 0.4 | 0.9 | 1.0 |
| vlpds | 2.3 | 2.8 | 31.9 | 37.7 |
| zds | 15.0 | 15.1 | 75.3 | 90.3 |
### Start time and memory
@@ -215,16 +217,16 @@ Start: from spawning the server to its first answered `describeServer`, on an em
| impl | start ms (best) | start ms (median) | idle RSS MiB (median) | peak RSS MiB (best) | peak RSS MiB (median) |
|---|--:|--:|--:|--:|--:|
| reference | 2386 | 2432 | 398.9 | 608.4 | 644.5 |
| spec-pds | 37 | 39 | 13.6 | 73.7 | 79.0 |
| vlpds | 1184 | 1235 | 165.4 | 384.7 | 392.9 |
| zds | 228 | 302 | 16.7 | 49.2 | 49.9 |
| reference | 2211 | 2246 | 397.4 | 643.0 | 647.7 |
| spec-pds | 49 | 50 | 18.2 | 71.6 | 83.3 |
| vlpds | 1375 | 1464 | 169.8 | 370.9 | 388.1 |
| zds | 435 | 490 | 16.5 | 50.2 | 50.5 |
Not in the table above: what a server needs running beside it, its RSS sampled apart (the sum over its container's processes, from `docker top`, as fast as that answers).
| impl | beside it | idle MiB (median) | peak MiB (best) | peak MiB (median) |
|---|---|--:|--:|--:|
| vlpds | RustFS | 176.6 | 248.9 | 250.0 |
| vlpds | RustFS | 168.3 | 245.8 | 249.5 |
vlpds's and zds's RSS are those of their `vlpds` and `zds` processes inside
their containers, from `docker top` (ps in Docker's VM); RustFS's is counted
@@ -247,11 +249,11 @@ All four servers served every part.
forwarding from the host into the VM, and both reach the PLC directory back
through `host.docker.internal` (vlpds its store over a Docker network too).
That adds latency the native servers don't pay, most visible on the small,
fast reads (getRecord p50 2.2 ms for vlpds and 3.7 ms for zds against
spec-pds's 0.8 ms) [INFERENCE: the forwarding cost was not measured
fast reads (getRecord p50 3.3 ms for vlpds and 4.7 ms for zds against
spec-pds's 1.0 ms) [INFERENCE: the forwarding cost was not measured
apart]. Their start times are from `docker start` of an already created
container to the first answered `describeServer`; vlpds's includes the
~1 s its log shows it waits to acquire its shard's lease, zds's (228–323 ms)
~1 s its log shows it waits to acquire its shard's lease, zds's (435–490 ms)
its SQLite migrations on an empty database.
- **Durability differs, and differently for each.**
- spec-pds syncs every answered write before answering (group-committed,
@@ -282,24 +284,25 @@ All four servers served every part.
- **vlpds's writes are batched across requests.** Every write on the node goes
into one log, group-committed into segments; with 16 or 8 requests in
flight one segment PUT (7–11 ms to RustFS here) answers many. That is likely
where its createRecord and applyWrites lead comes from (p50 16–18 ms
against spec-pds's 42 ms); spec-pds group-commits too, but pays a
`F_FULLFSYNC` per group [INFERENCE from the two designs; not profiled].
- **zds's createAccount is slow and serial** (7 per second, p50 468–588 ms
where its createRecord lead comes from (p50 23.6 ms against spec-pds's
43.0 ms); at applyWrites' 8 at once the two are level (272 and 284 per
second). spec-pds group-commits too, but pays a `F_FULLFSYNC` per group
[INFERENCE from the two designs; not profiled].
- **zds's createAccount is slow and serial** (5 per second, p50 856–871 ms
with 4 at once). One at a time, outside the bench, each took ~140–180 ms;
four at once queue behind each other, as if account creation (a
100,000-round PBKDF2-SHA256 password hash, the signing key, the PLC
genesis operation, the first commit) ran one at a time under its store
lock [INFERENCE from the timings and its source; not profiled]. Its
writes after that (createRecord p50 22 ms, applyWrites 17 ms) are close to
vlpds's.
writes after that (createRecord p50 31 ms, applyWrites 29 ms) are a little
behind vlpds's.
- **zds's limit raised.** Its default cap of 4 full `getRepo` exports at once
answers the workload's 8 at once with 429 `RateLimitExceeded`; it was
raised to 8 (`ZDS_MAX_CONCURRENT_REPO_EXPORTS`), as rate limits are off for
the others. Its other caps (32 subscribeRepos connections, 4 cursor
backfills) are above what the workload uses.
- **vlpds's uploadBlob varied** (167 and 142 per second best and median):
each 64 KiB blob is one PUT to RustFS, and its p99 (83–86 ms) is the
- **vlpds's uploadBlob varied** (83 and 56 per second best and median):
each 64 KiB blob is one PUT to RustFS, and its p99 (173–379 ms) is the
store's, under the load below.
- **Storage engines.** spec-pds: its own append-only logs and files in
`PDS_DATA_DIR` (`spec/STORE.md`), blobs as files. The reference: SQLite
@@ -316,7 +319,7 @@ All four servers served every part.
- **Memory is not like-for-like.** spec-pds's and the reference's RSS are
from `ps` on macOS; vlpds's and zds's from `ps` inside Docker's Linux VM,
vlpds's under a 2560 MiB container limit its caches size themselves from,
zds's with no limit. RustFS's 177–250 MiB is on top of vlpds's. The PLC
zds's with no limit. RustFS's 168–250 MiB is on top of vlpds's. The PLC
directory runs in the bench's process and is counted for none. The
reference's RSS includes the Node runtime and dev-env's module graph; its
start time is a cold Node start importing `@atproto/dev-env`.
@@ -329,11 +332,11 @@ All four servers served every part.
the build took ~25 s and produced the same image
(`sha256:124944cb…`); built without that cache it took ~4 minutes here.
- **The machine was not idle.** Other agents' work was running on it (load
average ~16 at the start of the run, ~12 at its end, on 8 cores); every
round ran under it, so absolute numbers are lower and noisier than on an
idle machine. Best-of-three is reported for that reason, as `perf.mjs`
does. The reference's firehose shows it: p50 131–141 ms in this run, against
5.8 ms in a round of the last one.
average 89 over the minute before the run, just after `--setup`'s build,
~14 at its end, on 8 cores); every round ran under it, so absolute numbers
are lower and noisier than on an idle machine. Best-of-three is reported
for that reason, as `perf.mjs` does. The reference's firehose lag shows it:
p50 78.5 ms in its best round and 113.0 ms in its median.
- One client process drives every server; at spec-pds's read rates
(getRecord ~15–16k/s) the Node client is likely part of the bottleneck
(getRecord ~12–14k/s) the Node client is likely part of the bottleneck
[INFERENCE].
harness/bench.mjs+25−18
@@ -396,7 +396,10 @@ async function main() {
uploadBlob: [100, 8, (srv, st, n, at) => load(n, at, async (i) => (await call(srv, 'com.atproto.repo.uploadBlob', { bytes: blob(i), type: 'application/octet-stream', token: st.accounts[i % st.accounts.length].token })).ms)],
// 20 subscribers, each from an address of its own (spec-pds holds 16 at
// most from one, spec/LIMITS.md), and `n` putRecords one after another:
// each time is from sending a write to a subscriber having its commit.
// each time is the firehose's lag, from a write's answer to a subscriber
// having its commit, 0 when the commit came first. No rate: one write at
// a time makes it the write path's, which createRecord and applyWrites
// measure.
firehose: [100, 20, async (srv, st, n, subsN) => {
const subs = await Promise.all(Array.from({ length: subsN }, (_, k) => new Promise((ok, fail) => {
const ws = new WebSocket(`${srv.url.replace(/^http/, 'ws')}/xrpc/com.atproto.sync.subscribeRepos`, { headers: { 'x-forwarded-for': `198.18.0.${k + 1}` } })
@@ -413,25 +416,21 @@ async function main() {
ws.onopen = () => ok(sub)
ws.onerror = () => fail(new Error(`${srv.name}: subscribeRepos`))
})))
const sentAt = []
const answeredAt = []
const a = st.accounts[0]
const t = performance.now()
for (let i = 0; i < n; i++) {
sentAt[i] = performance.now()
await call(srv, 'com.atproto.repo.putRecord', { body: { repo: a.did, collection: 'com.example.note', rkey: `${st.tag}fh${i}x`, record: { $type: 'com.example.note', text: 'fan-out', n: i } }, token: a.token })
answeredAt[i] = performance.now()
}
for (let w = 0; w < 100 && subs.some((s) => s.got.size < n); w++) await new Promise((ok) => setTimeout(ok, 100))
for (const s of subs) s.ws.close()
const times = []
let last = t
for (const s of subs) for (let i = 0; i < n; i++) {
const at = s.got.get(i)
if (at === undefined) throw new Error(`${srv.name}: a subscriber did not get the commit of write ${i} within 10 s`)
times.push(at - sentAt[i])
last = Math.max(last, at)
times.push(Math.max(0, at - answeredAt[i]))
}
// Throughput: commits delivered to subscribers per second.
return { times, total: last - t }
return { times }
}],
}
@@ -524,7 +523,7 @@ async function main() {
for (const [part, [n, at, fn]] of Object.entries(PARTS)) {
if (adapter.unsupported[part]) continue
const { times, total } = await fn(srv, st, n, at)
parts[part] = { p50: pct(times, 50), p99: pct(times, 99), rate: (times.length / total) * 1000, n: times.length }
parts[part] = { p50: pct(times, 50), p99: pct(times, 99), ...(total !== undefined && { rate: (times.length / total) * 1000 }), n: times.length }
}
sampling = false
await sampler
@@ -591,14 +590,17 @@ function markdown(results) {
const names = Object.keys(results.impls).sort((a, b) => (b === 'reference') - (a === 'reference'))
const lines = []
const partsOf = Object.keys(results.workload)
lines.push('### Summary', '', "Each part's requests per second (the firehose: commits delivered per second), start time and memory; each the best round. Detail follows.", '')
lines.push('### Summary', '', "Each part's requests per second, start time and memory, each the best round; for the firehose, the p50 of its lag, the best round. Detail follows.", '')
lines.push(`| | ${names.join(' | ')} |`, `|---|${names.map(() => '--:').join('|')}|`)
for (const part of partsOf) {
const lag = part === 'firehose'
const cell = (name) => {
const r = results.impls[name]
return r.unsupported[part] ? 'not served' : Math.max(...r.rounds.map((x) => x.parts[part].rate)).toFixed(0)
if (r.unsupported[part]) return 'not served'
const xs = r.rounds.map((x) => x.parts[part])
return lag ? Math.min(...xs.map((x) => x.p50)).toFixed(1) : Math.max(...xs.map((x) => x.rate)).toFixed(0)
}
lines.push(`| ${part} per s | ${names.map(cell).join(' | ')} |`)
lines.push(`| ${lag ? 'firehose lag p50 ms' : `${part} per s`} | ${names.map(cell).join(' | ')} |`)
}
const each = (f) => names.map((name) => f(results.impls[name].rounds)).join(' | ')
lines.push(`| start ms | ${each((rs) => Math.min(...rs.map((x) => x.startMs)).toFixed(0))} |`)
@@ -606,19 +608,24 @@ function markdown(results) {
lines.push(`| peak RSS MiB | ${each((rs) => mib(Math.min(...rs.map((x) => x.peakKiB))).toFixed(1))} |`, '')
for (const part of partsOf) {
const { n, at } = results.workload[part]
lines.push(`### ${part}`, '', part === 'firehose'
? `${n} putRecords one after another, ${at} subscribers; times from sending a write to a subscriber having its commit, throughput in commits delivered per second.`
const lag = part === 'firehose'
lines.push(`### ${part}`, '', lag
? `${n} putRecords one after another, ${at} subscribers; each time is the firehose's lag, from a write's answer to a subscriber having its commit, 0 when the commit came first. No rate: with one write at a time it would be the write path's, which createRecord and applyWrites measure.`
: `${n} requests, ${at} at once.`, '')
lines.push('| impl | per s (best) | per s (median) | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |', '|---|--:|--:|--:|--:|--:|--:|')
lines.push(
lag ? '| impl | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |' : '| impl | per s (best) | per s (median) | p50 ms (best) | p50 ms (median) | p99 ms (best) | p99 ms (median) |',
lag ? '|---|--:|--:|--:|--:|' : '|---|--:|--:|--:|--:|--:|--:|',
)
for (const name of names) {
const r = results.impls[name]
if (r.unsupported[part]) {
lines.push(`| ${name} | not served: ${r.unsupported[part]} ||||||`)
lines.push(`| ${name} | not served: ${r.unsupported[part]} |${lag ? '|||' : '|||||'}`)
continue
}
const xs = r.rounds.map((x) => x.parts[part])
const g = (k) => xs.map((x) => x[k])
lines.push(`| ${name} | ${Math.max(...g('rate')).toFixed(0)} | ${med(g('rate')).toFixed(0)} | ${Math.min(...g('p50')).toFixed(1)} | ${med(g('p50')).toFixed(1)} | ${Math.min(...g('p99')).toFixed(1)} | ${med(g('p99')).toFixed(1)} |`)
const rate = lag ? '' : `${Math.max(...g('rate')).toFixed(0)} | ${med(g('rate')).toFixed(0)} | `
lines.push(`| ${name} | ${rate}${Math.min(...g('p50')).toFixed(1)} | ${med(g('p50')).toFixed(1)} | ${Math.min(...g('p99')).toFixed(1)} | ${med(g('p99')).toFixed(1)} |`)
}
lines.push('')
}