tests/e2e: iteration-to-iteration benchmark harness

compare-run.sh answers "how do we compare to MongoDB"; it says nothing
about whether a change made things better or worse than last week. Add a
harness that records each run and diffs it against the previous one.

bench-run.sh wraps compare-run.sh, adds a concurrent durable-write
comparison (concurrent.js: N clients each doing sequential insertOne with
{w:1, j:true}, exercising the group-commit path under real contention),
writes a versioned name<TAB>value report to results/bench-<timestamp>.txt,
and prints a diff of our numbers against results/bench-latest.txt.

Also:
- compare-run.sh polled with fixed sleeps, which are flaky once earlier
  benchmark phases have warmed the machine; both servers now wait on a
  real driver connection instead.
- a dispatch error only reached the client as a generic InternalError,
  with nothing on the server side naming the failing command; log the
  connection, command and error name before replacing the reply.
This commit is contained in:
2026-08-03 12:33:28 +03:00
parent 720540860a
commit ac464f2b92
10 changed files with 441 additions and 3 deletions

View File

@@ -0,0 +1,34 @@
# mongo-lite vs MongoDB benchmark
# date: 2026-08-03T08:26:46Z git: c8d547f+dirty
# args: size=128m doc-size=8k wc=j clients=1 2 4 per-client=2000
# reproduce: bash tests/e2e/bench-run.sh 128m 8k "1 2 4"
[main]
insertOne (sequential) ×200 0.20 ms 5.9 ms
bulk insert throughput 664.4 MB/s 357.9 MB/s
docs loaded 16,384 16,384
createIndex({k: 1}) 10.4 ms 45.2 ms
countDocuments({}) 0.73 ms 8.6 ms
findOne({_id: <ObjectId>}) 0.35 ms 0.62 ms
findOne({k: 500}) (indexed) 0.36 ms 1.2 ms
find({p: {$gte,$lt}}).count() (scan) 2.4 ms 3.2 ms
find({}).sort({_id:-1}).limit(20) 2.0 ms 2.2 ms
find({}, {proj}).limit(1000) — 4.6 ms
aggregate $group by k — 4.6 ms
updateOne({_id}) ×50 — 0.26 ms
updateMany({k: 7}, {$inc}) — 5.7 ms
deleteOne({_id}) + insertOne — 4.8 ms
node client RSS — 136 MB
[concurrency]
clients 1 8117 175 46.4x
clients 2 17102 230 74.4x
clients 4 21967 352 62.4x
[meta]
ml_rss_mb 158
md_rss_mb 251
ml_reopen 0.3s
md_reopen 0.4s
ml_disk_mb 7MB
md_disk_mb 7MB