peppa/bench/sqlite/RESULTS.md
Асель eeb326cc4f PEP-36: PM decision — Node 26 + node:sqlite; drizzle shim and check
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:28:59 +05:00

6.3 KiB
Raw Permalink Blame History

PEP-36: результаты замера (2026-11-13, Mac Пеппы, Bun 1.4.4, Node 26.8.1, Postgres 17.11)

Сгенерировано node report.ts после ./matrix.sh; потолок — contention.ts.

Записи и доставка

раннеры нагрузка вариант записей p50 мс p95 p99 max BUSY-повторы ошибки хук целиком p50/p95 старт хука p50 доставка боту p50/p95/p99
10 ×1 bun:sqlite 126 0.32 1.61 2.34 2.68 0 0 35.77 / 38.68 31.94 459 / 974 / 993 (poll:1000)
10 ×1 node:sqlite 192 0.20 0.70 1.18 1.27 0 0 98.08 / 9112 96.21 421 / 906 / 950 (poll:1000)
10 ×1 better-sqlite3 169 0.19 0.95 2.02 2.21 0 0 103 / 6117 97.01 556 / 981 / 987 (poll:1000)
10 ×1 один писатель (Bun) 140 1.21 2.35 3.89 8.19 0 0 31.10 / 6036 22.56 0.97 / 3.20 / 1547 (push)
10 ×1 Postgres (Node) 177 9.60 18.11 36.05 38.15 0 0 132 / 6156 92.00 13.32 / 23.25 / 39.90 (pg)
10 ×10 bun:sqlite 728 0.24 0.78 1.22 5.96 0 0 30.37 / 7535 24.86 478 / 937 / 992 (poll:1000)
10 ×10 node:sqlite 696 0.14 0.38 0.94 1.76 0 0 77.71 / 7573 74.67 519 / 960 / 996 (poll:1000)
10 ×10 better-sqlite3 698 0.17 0.49 1.41 2.51 0 0 81.82 / 6091 73.97 508 / 951 / 987 (poll:1000)
10 ×10 один писатель (Bun) 719 1.16 2.12 2.60 6.55 0 0 30.22 / 7530 23.42 0.81 / 2.05 / 3.50 (push)
10 ×10 Postgres (Node) 691 8.03 12.61 16.25 24.60 0 0 114 / 7628 74.03 11.21 / 16.51 / 19.12 (pg)
20 ×1 bun:sqlite 327 0.29 1.34 2.21 3.06 0 0 33.67 / 6035 28.45 454 / 925 / 991 (poll:1000)
20 ×1 node:sqlite 324 0.16 0.71 1.33 2.00 0 0 73.96 / 7562 71.88 553 / 982 / 1013 (poll:1000)
20 ×1 better-sqlite3 314 0.19 0.82 1.53 2.20 0 0 96.47 / 9084 87.91 497 / 944 / 985 (poll:1000)
20 ×1 один писатель (Bun) 305 1.34 2.38 4.16 7.41 0 0 31.33 / 6050 25.39 1.11 / 2.94 / 5.29 (push)
20 ×1 Postgres (Node) 306 8.06 17.16 29.14 36.39 0 0 121 / 7621 85.12 11.42 / 20.32 / 32.03 (pg)
20 ×10 bun:sqlite 1510 0.20 0.46 1.75 6.17 0 0 23.34 / 6035 19.45 503 / 945 / 991 (poll:1000)
20 ×10 node:sqlite 1424 0.13 0.24 1.32 2.29 0 0 70.15 / 6074 68.68 480 / 941 / 993 (poll:1000)
20 ×10 better-sqlite3 1471 0.16 0.27 1.17 7.86 0 0 75.04 / 6085 68.83 509 / 946 / 993 (poll:1000)
20 ×10 один писатель (Bun) 1438 1.07 2.02 2.63 8.42 0 0 24.81 / 6033 19.62 0.71 / 1.30 / 2.35 (push)
20 ×10 Postgres (Node) 1345 6.98 11.89 17.85 43.83 0 0 102 / 6120 67.98 9.76 / 15.06 / 17.73 (pg)
20 ×50 bun:sqlite 3172 0.15 0.35 1.83 7.48 0 0 18.78 / 6029 15.53 515 / 949 / 994 (poll:1000)
20 ×50 один писатель (Bun) 3093 0.30 1.58 2.23 9.16 0 0 19.89 / 6032 15.64 0.39 / 0.85 / 1.48 (push)
20 ×50 Postgres (Node) 2910 4.58 9.19 12.13 29.31 0 0 96.66 / 6116 68.14 6.17 / 11.37 / 14.30 (pg)

Замена LISTEN/NOTIFY (bun:sqlite, 20 раннеров, ×10)

способ доставка боту p50 p95 p99 max веб p50 p95
fswatch 26.29 192 300 508 26.29 193
poll:1000 503 945 991 1002 509 947
poll:200 100 192 200 204 103 192
push 0.80 1.42 2.48 46.85 0.83 1.47
Postgres LISTEN/NOTIFY (для сравнения) 9.76 15.06 17.73 28.17 9.72 14.71

Самые медленные операции записи (p99, мс) при 20 раннерах ×10

операция bun:sqlite node:sqlite better-sqlite3 один писатель (Bun) Postgres (Node)
bot.answer 0.50 0.49 0.14 5.32 9.32
bot.enqueue 5.15 1.32 0.13 0.93 9.33
bot.heartbeat 2.93 0.15 0.71 7.01 43.83
bot.sent 0.18 0.91 0.08 1.10 10.21
bot.update 0.45 0.48 0.52 1.56 9.55
hook.answered 6.17 2.29 7.86 4.07 30.26
hook.event 0.64 0.30 1.47 2.47 14.20
hook.question 5.43 0.33 1.06 2.40 14.27
mcp.progress 1.71 0.81 0.60 2.75 19.55
wd.heartbeat 0.15 0.07 0.06 0.92 5.60
wd.stalled 5.48 0.66 0.20 8.42 17.87

Потолок (contention.ts, 10 с, без пауз)

{"backend":"bun","procs":20,"seconds":10,"txPerSec":33537,"p50":"0.02","p95":"0.08","p99":"4.24","max":"2710.8","busyRetries":0,"errors":0}
{"backend":"bun","procs":40,"seconds":10,"txPerSec":27223,"p50":"0.03","p95":"0.31","p99":"21.96","max":"2930.6","busyRetries":0,"errors":0}
{"backend":"node","procs":20,"seconds":10,"txPerSec":48578,"p50":"0.02","p95":"0.03","p99":"0.05","max":"5405.9","busyRetries":1,"errors":0}
{"backend":"node","procs":40,"seconds":10,"txPerSec":47694,"p50":"0.02","p95":"0.03","p99":"0.06","max":"6413.2","busyRetries":3,"errors":0}
{"backend":"better","procs":20,"seconds":10,"txPerSec":47456,"p50":"0.02","p95":"0.03","p99":"0.05","max":"5359.5","busyRetries":1,"errors":0}
{"backend":"better","procs":40,"seconds":10,"txPerSec":45076,"p50":"0.02","p95":"0.03","p99":"0.06","max":"5937.5","busyRetries":2,"errors":0}
{"backend":"pg","procs":20,"seconds":10,"txPerSec":4890,"p50":"3.88","p95":"6.82","p99":"9.01","max":"97.1","busyRetries":0,"errors":0}
{"backend":"pg","procs":40,"seconds":10,"txPerSec":7555,"p50":"5.47","p95":"6.95","p99":"8.33","max":"210.2","busyRetries":0,"errors":0}

drizzle на node:sqlite и bun:sqlite (schema-port/drizzle-check.ts)

Транзакция хука (update sessions + insert events) через drizzle, 20 000 подряд в одном процессе:

драйвер мкс на транзакцию
node:sqlite (Node 26.8, прослойка node-sqlite-driver.ts) 53.0
bun:sqlite (Bun 1.4.4, drizzle-orm/bun-sqlite) 62.9