Record the before and after comparison of track 1

8x1 with the image of edc091d (before) and the one-statement write
(after), alternating per repeat, three repeats at 3 600, 5 400 and
8 100 rps. At 3 600 rps, below the knee, p95 falls from 64.5 ms
(35.7..142.5) to 3.7 ms (2.8..5.4) and p99 from 122 to 13 ms; the API
spends 391 instead of 457 % CPU and PostgreSQL 102 instead of 137 %;
connections waiting for a chat lock drop from 12.8 to 0.15 and none is
idle in transaction any more. Past the knee the peak rises from 4 252
(4 054..4 396) to 4 894 rps (4 494..5 104), +15 %, and at 8 100 rps
from 4 104 to 4 841 (+18 %); the ranges do not overlap. Saturated, the
lock holders now wait for the WAL flush (LWLock WALWrite) instead of
the application.

The switch to the after image for the third repeat failed in compose
while another lab was running tests on the shared VM, so that repeat
was run alone with --first-repeat 3 on the same database; apply now
retries compose up twice and prints its stderr. Two after rows were
still marked disturbed after three reruns and are kept; they are the
lower ones.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
Artyom
2026-10-29 01:37:34 +03:00
co-authored by Claude Opus 5.5
parent 296e070eba
commit dde113b4ed
131 changed files with 20158 additions and 3 deletions
@@ -0,0 +1,21 @@
calls,total_ms,mean_ms,rows,shared_blks_hit,shared_blks_read,query
81558,32030.449,0.393,81558,3784546,85,"WITH chat AS ( SELECT c.id, GREATEST($5::timestamptz, c.last_message_at + interval $9) AS stamp FROM chats c JOIN chat_members m ON m.chat_id = c.id AND m.user_id = $3 WHERE c.id = $2 FOR UPDATE OF c "
33338,7316.416,0.219,33338,1521144,0,"WITH chat AS ( SELECT c.id, GREATEST($5::timestamptz, c.last_message_at + interval $9) AS stamp FROM chats c JOIN chat_members m ON m.chat_id = c.id AND m.user_id = $3 WHERE c.id = $2 FOR UPDATE OF c "
28952,952.987,0.033,1474818,1278146,0,"SELECT id, chat_id, sender_id, text, created_at FROM messages WHERE chat_id = $1 ORDER BY created_at, id LIMIT $2"
28952,841.844,0.029,28952,265974,0,"SELECT c.id, c.title, c.created_at, ARRAY(SELECT user_id FROM chat_members WHERE chat_id = c.id ORDER BY position) AS member_ids FROM chat_members m JOIN chats c ON c.id = m.chat_id WHERE m.chat_id = "
173317,358.244,0.002,0,0,0,RESET ALL
173317,190.351,0.001,173317,0,0,SELECT pg_advisory_unlock_all()
173317,28.336,0.000,0,0,0,CLOSE ALL
173317,17.398,0.000,0,0,0,UNLISTEN *
64,9.712,0.152,128,2293,11,"WITH RECURSIVE typeinfo_tree( oid, ns, name, kind, basetype, elemtype, elemdelim, range_subtype, attrtypoids, attrnames, depth) AS ( SELECT ti.oid, ti.ns, ti.name, ti.kind, ti.basetype, ti.elemtype, t"
20,3.921,0.196,20,282,14,"INSERT INTO users (id, username, display_name, password_hash, created_at) VALUES ($1, $2, $3, $4, $5) ON CONFLICT (username) DO NOTHING RETURNING $6"
20,2.801,0.140,20,328,12,"WITH expired AS (DELETE FROM sessions WHERE user_id = $2 AND expires_at <= $3) INSERT INTO sessions (token_hash, user_id, created_at, expires_at) VALUES ($1, $2, $3, $4)"
10,2.637,0.264,20,835,9,"INSERT INTO chat_members (chat_id, user_id, position, chat_created_at) SELECT $1, member.user_id, member.position, $3 FROM unnest($2::uuid[]) WITH ORDINALITY AS member (user_id, position)"
10,0.569,0.057,10,195,15,"INSERT INTO chats (id, title, created_at) VALUES ($1, $2, $3)"
401,0.455,0.001,401,0,0,SELECT 1
46,0.382,0.008,46,138,0,"SELECT token_hash, user_id, created_at, expires_at FROM sessions WHERE token_hash = $1 AND expires_at > $2"
20,0.277,0.014,20,60,0,"SELECT id, username, display_name, password_hash, created_at FROM users WHERE username = $1"
64,0.181,0.003,64,0,0,"SELECT current_setting($1) AS cur, set_config($2, $3, $4) AS new"
64,0.133,0.002,64,0,0,"SELECT set_config($2, $1, $3)"
50,0.018,0.000,0,0,0,COMMIT
50,0.015,0.000,0,0,0,BEGIN
1 calls total_ms mean_ms rows shared_blks_hit shared_blks_read query
2 81558 32030.449 0.393 81558 3784546 85 WITH chat AS ( SELECT c.id, GREATEST($5::timestamptz, c.last_message_at + interval $9) AS stamp FROM chats c JOIN chat_members m ON m.chat_id = c.id AND m.user_id = $3 WHERE c.id = $2 FOR UPDATE OF c
3 33338 7316.416 0.219 33338 1521144 0 WITH chat AS ( SELECT c.id, GREATEST($5::timestamptz, c.last_message_at + interval $9) AS stamp FROM chats c JOIN chat_members m ON m.chat_id = c.id AND m.user_id = $3 WHERE c.id = $2 FOR UPDATE OF c
4 28952 952.987 0.033 1474818 1278146 0 SELECT id, chat_id, sender_id, text, created_at FROM messages WHERE chat_id = $1 ORDER BY created_at, id LIMIT $2
5 28952 841.844 0.029 28952 265974 0 SELECT c.id, c.title, c.created_at, ARRAY(SELECT user_id FROM chat_members WHERE chat_id = c.id ORDER BY position) AS member_ids FROM chat_members m JOIN chats c ON c.id = m.chat_id WHERE m.chat_id =
6 173317 358.244 0.002 0 0 0 RESET ALL
7 173317 190.351 0.001 173317 0 0 SELECT pg_advisory_unlock_all()
8 173317 28.336 0.000 0 0 0 CLOSE ALL
9 173317 17.398 0.000 0 0 0 UNLISTEN *
10 64 9.712 0.152 128 2293 11 WITH RECURSIVE typeinfo_tree( oid, ns, name, kind, basetype, elemtype, elemdelim, range_subtype, attrtypoids, attrnames, depth) AS ( SELECT ti.oid, ti.ns, ti.name, ti.kind, ti.basetype, ti.elemtype, t
11 20 3.921 0.196 20 282 14 INSERT INTO users (id, username, display_name, password_hash, created_at) VALUES ($1, $2, $3, $4, $5) ON CONFLICT (username) DO NOTHING RETURNING $6
12 20 2.801 0.140 20 328 12 WITH expired AS (DELETE FROM sessions WHERE user_id = $2 AND expires_at <= $3) INSERT INTO sessions (token_hash, user_id, created_at, expires_at) VALUES ($1, $2, $3, $4)
13 10 2.637 0.264 20 835 9 INSERT INTO chat_members (chat_id, user_id, position, chat_created_at) SELECT $1, member.user_id, member.position, $3 FROM unnest($2::uuid[]) WITH ORDINALITY AS member (user_id, position)
14 10 0.569 0.057 10 195 15 INSERT INTO chats (id, title, created_at) VALUES ($1, $2, $3)
15 401 0.455 0.001 401 0 0 SELECT 1
16 46 0.382 0.008 46 138 0 SELECT token_hash, user_id, created_at, expires_at FROM sessions WHERE token_hash = $1 AND expires_at > $2
17 20 0.277 0.014 20 60 0 SELECT id, username, display_name, password_hash, created_at FROM users WHERE username = $1
18 64 0.181 0.003 64 0 0 SELECT current_setting($1) AS cur, set_config($2, $3, $4) AS new
19 64 0.133 0.002 64 0 0 SELECT set_config($2, $1, $3)
20 50 0.018 0.000 0 0 0 COMMIT
21 50 0.015 0.000 0 0 0 BEGIN