research: measure track2 A/A noise with unchanged application
This commit is contained in:
@@ -89,6 +89,11 @@ def restore(label: str) -> dict:
|
||||
or not all(row["ok"] for row in data["checks"])
|
||||
):
|
||||
raise SystemExit(f"analyze: restore {label} did not pass all checks")
|
||||
if (
|
||||
data["profile"]["name"] != "skew"
|
||||
or data["before"]["counts"]["messages"] < 100_000
|
||||
):
|
||||
raise SystemExit(f"analyze: restore {label} does not cover the full track")
|
||||
return {
|
||||
"label": label,
|
||||
"counts": data["before"]["counts"],
|
||||
@@ -154,6 +159,8 @@ def main() -> None:
|
||||
}
|
||||
for data in runs:
|
||||
memory = next(iter(data["memory"].values()))
|
||||
with (ROOT / "evidence" / "bench" / data["label"] / "fill.csv").open() as file:
|
||||
fill = list(csv.DictReader(file))
|
||||
result["variants"][data["label"]] = {
|
||||
"duration_s": data["meta"]["duration_s"],
|
||||
"cells": [
|
||||
@@ -162,11 +169,7 @@ def main() -> None:
|
||||
],
|
||||
"plans": data["meta"]["plans"],
|
||||
"memory": memory,
|
||||
"fill": list(
|
||||
csv.DictReader(
|
||||
(ROOT / "evidence" / "bench" / data["label"] / "fill.csv").open()
|
||||
)
|
||||
),
|
||||
"fill": fill,
|
||||
}
|
||||
for before, after in ((base, chat_only), (chat_only, no_index), (base, no_index)):
|
||||
for key in sorted(base["stats"]):
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
# Сравнение меток: `t2-keyset` → `t2-keyset-2`
|
||||
|
||||
- «До»: `t2-keyset`, снято 2026-10-02T01:17:32Z, src_sha256 `8a7e256c540af433`, commit `6d2240ce9fec2531f8141e1331db37d36388d082`, вариант индекса `keyset`
|
||||
- «После»: `t2-keyset-2`, снято 2026-10-02T01:26:22Z, src_sha256 `8a7e256c540af433`, commit `8e7d4183e32cfe8174e2be3da50209faf5f8eb6f`, вариант индекса `keyset`
|
||||
- Шум (A/A): `t2-keyset` против `t2-keyset-2` — один и тот же код; read: ±3.1% RPS, write: ±1.3% RPS
|
||||
|
||||
**Проверка сравнимости:**
|
||||
|
||||
- код и вариант индекса «до» и «после» одинаковы: это A/A
|
||||
|
||||
Значения — медиана повторов (min–max). Δ — сдвиг медианы.
|
||||
|
||||
## Чтение
|
||||
|
||||
| История | Клиенты | RPS до | RPS после | Δ RPS | p95, мс | p99, мс | CPU API, мкс/запрос | CPU БД, мкс/запрос | Вывод по RPS |
|
||||
|---|---|---|---|---|---|---|---|---|---|
|
||||
| 10 (tiny) | 1 | 684 (682–686) | 675 (674–679) | -1.3% | 1.55 → 1.56 (+0.9%) | 1.66 → 1.67 (+0.6%) | 1123 → 1127 (+0.3%) | 227 → 230 (+1.5%) | в пределах шума |
|
||||
| 10 (tiny) | 8 | 1158 (1157–1184) | 1173 (1129–1193) | +1.3% | 7.29 → 7.14 (-2.0%) | 7.82 → 7.63 (-2.3%) | 860 → 856 (-0.5%) | 206 → 207 (+0.0%) | разбросы пересекаются |
|
||||
| 10 (tiny) | 32 | 1217 (1212–1232) | 1224 (1174–1231) | +0.6% | 29.34 → 29.09 (-0.8%) | 32.37 → 37.24 (+15.0%) | 830 → 825 (-0.5%) | 212 → 213 (+0.3%) | разбросы пересекаются |
|
||||
| 200 (small) | 1 | 597 (591–597) | 584 (583–587) | -2.2% | 1.78 → 1.80 (+1.2%) | 1.99 → 1.99 (-0.1%) | 1329 → 1356 (+2.0%) | 246 → 249 (+1.2%) | в пределах шума |
|
||||
| 200 (small) | 8 | 927 (882–933) | 929 (929–935) | +0.3% | 9.18 → 9.08 (-1.0%) | 10.32 → 9.92 (-3.9%) | 1078 → 1082 (+0.4%) | 228 → 229 (+0.6%) | разбросы пересекаются |
|
||||
| 200 (small) | 32 | 902 (898–910) | 900 (893–903) | -0.2% | 47.42 → 47.34 (-0.2%) | 55.86 → 57.13 (+2.3%) | 1111 → 1118 (+0.7%) | 259 → 262 (+1.3%) | разбросы пересекаются |
|
||||
| 6k (medium) | 1 | 593 (591–593) | 580 (576–581) | -2.2% | 1.80 → 1.81 (+0.3%) | 2.00 → 2.00 (-0.3%) | 1333 → 1361 (+2.1%) | 248 → 254 (+2.3%) | в пределах шума |
|
||||
| 6k (medium) | 8 | 916 (915–919) | 916 (913–918) | -0.0% | 9.20 → 9.23 (+0.3%) | 10.45 → 10.26 (-1.8%) | 1090 → 1097 (+0.6%) | 234 → 235 (+0.5%) | разбросы пересекаются |
|
||||
| 6k (medium) | 32 | 893 (886–897) | 898 (872–898) | +0.5% | 48.22 → 47.88 (-0.7%) | 55.94 → 57.67 (+3.1%) | 1136 → 1130 (-0.6%) | 276 → 278 (+0.5%) | разбросы пересекаются |
|
||||
| 60k (big) | 1 | 600 (598–606) | 581 (579–585) | -3.1% | 1.77 → 1.80 (+1.9%) | 1.95 → 1.97 (+1.2%) | 1318 → 1361 (+3.3%) | 240 → 251 (+4.5%) | в пределах шума |
|
||||
| 60k (big) | 8 | 922 (914–931) | 916 (910–922) | -0.6% | 9.17 → 9.21 (+0.5%) | 10.07 → 10.43 (+3.6%) | 1087 → 1097 (+0.9%) | 231 → 232 (+0.3%) | разбросы пересекаются |
|
||||
| 60k (big) | 32 | 895 (888–910) | 897 (883–899) | +0.2% | 47.86 → 47.39 (-1.0%) | 54.44 → 56.39 (+3.6%) | 1121 → 1121 (-0.0%) | 261 → 260 (-0.2%) | разбросы пересекаются |
|
||||
|
||||
Сдвиг RPS по ячейкам: медиана -0.1%, от -3.1% до +1.3%; шум сценария ±3.1%
|
||||
|
||||
## Запись
|
||||
|
||||
| История | Клиенты | RPS до | RPS после | Δ RPS | p95, мс | p99, мс | CPU API, мкс/запрос | CPU БД, мкс/запрос | Вывод по RPS |
|
||||
|---|---|---|---|---|---|---|---|---|---|
|
||||
| 126k | 1 | 800 (791–806) | 789 (784–800) | -1.3% | 1.31 → 1.34 (+2.2%) | 1.56 → 1.54 (-1.0%) | 952 → 958 (+0.6%) | 216 → 214 (-0.5%) | разбросы пересекаются |
|
||||
| 126k | 8 | 1305 (1276–1319) | 1297 (1281–1299) | -0.6% | 6.50 → 6.65 (+2.4%) | 7.27 → 7.15 (-1.7%) | 773 → 782 (+1.2%) | 228 → 230 (+1.0%) | разбросы пересекаются |
|
||||
| 126k | 32 | 1257 (1238–1276) | 1256 (1228–1261) | -0.1% | 30.53 → 30.43 (-0.3%) | 39.28 → 41.66 (+6.1%) | 812 → 818 (+0.8%) | 246 → 250 (+1.6%) | разбросы пересекаются |
|
||||
|
||||
Сдвиг RPS по ячейкам: медиана -0.6%, от -1.3% до -0.1%; шум сценария ±1.3%
|
||||
|
||||
## Объём БД и память API
|
||||
|
||||
| История | Таблица до → после, байт | Индексы до → после, байт | Байт на сообщение в БД | RSS API после наполнения, МиБ |
|
||||
|---|---|---|---|---|
|
||||
| 126k | 30900224 → 30834688 | 17620992 → 17661952 | 385 → 385 | 100.8 → 98.8 |
|
||||
|
||||
## Планы запроса истории (одна выборка на страницу, не медиана)
|
||||
|
||||
| История | Страница | Источник | Узел до → после | shared hit до → после | read до → после | Время до → после, мс |
|
||||
|---|---|---|---|---|---|---|
|
||||
| 10 (tiny) | first | app | Bitmap Heap Scan on messages | 19 → 19 | 0 → 0 | 0.052 → 0.048 |
|
||||
| 10 (tiny) | first | psql | Bitmap Heap Scan on messages | 19 → 19 | 0 → 0 | 0.197 → 0.126 |
|
||||
| 10 (tiny) | first | psql, no index | Seq Scan on messages | 3767 → 3759 | 0 → 0 | 20.451 → 13.635 |
|
||||
| 200 (small) | first | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 54 → 54 | 0 → 0 | 0.096 → 0.131 |
|
||||
| 200 (small) | last | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 52 → 54 | 0 → 0 | 0.062 → 0.063 |
|
||||
| 200 (small) | middle | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 54 → 53 | 0 → 0 | 0.079 → 0.067 |
|
||||
| 200 (small) | middle | psql | Index Scan using ix_messages_chat_id_created_at_id on messages | 54 → 53 | 0 → 0 | 0.307 → 0.308 |
|
||||
| 200 (small) | middle | psql, no index | Parallel Seq Scan on messages | 3797 → 3789 | 0 → 0 | 6.147 → 6.889 |
|
||||
| 6k (medium) | first | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 47 → 51 | 0 → 0 | 0.057 → 0.057 |
|
||||
| 6k (medium) | last | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 52 → 53 | 0 → 0 | 0.05 → 0.054 |
|
||||
| 6k (medium) | middle | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 50 → 51 | 0 → 0 | 0.052 → 0.055 |
|
||||
| 6k (medium) | middle | psql | Index Scan using ix_messages_chat_id_created_at_id on messages | 50 → 51 | 0 → 0 | 0.145 → 0.24 |
|
||||
| 6k (medium) | middle | psql, no index | Parallel Seq Scan on messages | 3797 → 3789 | 0 → 0 | 6.032 → 6.51 |
|
||||
| 60k (big) | first | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 31 → 31 | 0 → 0 | 0.049 → 0.053 |
|
||||
| 60k (big) | last | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 53 → 53 | 0 → 0 | 0.057 → 0.045 |
|
||||
| 60k (big) | middle | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 54 → 54 | 0 → 0 | 0.05 → 0.046 |
|
||||
| 60k (big) | middle | psql | Index Scan using ix_messages_chat_id_created_at_id on messages | 54 → 54 | 0 → 0 | 0.092 → 0.072 |
|
||||
| 60k (big) | middle | psql, no index | Parallel Seq Scan on messages | 3797 → 3789 | 0 → 0 | 6.628 → 6.094 |
|
||||
@@ -0,0 +1,100 @@
|
||||
# План запроса истории: класс big, чат 60k
|
||||
|
||||
Код: src_sha256 8a7e256c540af433, commit 8e7d4183e32c; вариант индекса: keyset
|
||||
Страница истории читаемого чата (limit 50); позиция — сколько
|
||||
сообщений истории до страницы:
|
||||
- first: после 0
|
||||
- middle: после 30000
|
||||
- last: после 59950
|
||||
|
||||
## Планы приложения
|
||||
|
||||
auto_explain (ANALYZE, BUFFERS, TIMING): запрос, параметры и план,
|
||||
с которыми его выполнило приложение (prepared statement asyncpg).
|
||||
|
||||
### first
|
||||
|
||||
duration: 0.053 ms plan:
|
||||
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
||||
FROM messages
|
||||
WHERE messages.chat_id = $1::UUID ORDER BY messages.created_at, messages.id
|
||||
LIMIT $2::INTEGER
|
||||
Query Parameters: $1 = '739e4777-e10b-4ffd-9b51-8e0259933691', $2 = '51'
|
||||
Limit (cost=0.42..16.18 rows=51 width=204) (actual time=0.013..0.029 rows=51.00 loops=1)
|
||||
Buffers: shared hit=31
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..18607.33 rows=60190 width=204) (actual time=0.013..0.025 rows=51.00 loops=1)
|
||||
Index Cond: (chat_id = '739e4777-e10b-4ffd-9b51-8e0259933691'::uuid)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=31
|
||||
|
||||
### middle
|
||||
|
||||
duration: 0.046 ms plan:
|
||||
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
||||
FROM messages
|
||||
WHERE messages.chat_id = $1::UUID AND (messages.created_at, messages.id) > ($2::TIMESTAMP WITH TIME ZONE, $3::UUID) ORDER BY messages.created_at, messages.id
|
||||
LIMIT $4::INTEGER
|
||||
Query Parameters: $1 = '739e4777-e10b-4ffd-9b51-8e0259933691', $2 = '2026-10-02 01:27:27.383878+00', $3 = '5beb2261-fb86-4c93-88f8-ff9bda33c36a', $4 = '51'
|
||||
Limit (cost=0.42..24.15 rows=6 width=204) (actual time=0.009..0.027 rows=51.00 loops=1)
|
||||
Buffers: shared hit=54
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..241.72 rows=61 width=204) (actual time=0.009..0.024 rows=51.00 loops=1)
|
||||
Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=54
|
||||
|
||||
### last
|
||||
|
||||
duration: 0.045 ms plan:
|
||||
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
||||
FROM messages
|
||||
WHERE messages.chat_id = $1::UUID AND (messages.created_at, messages.id) > ($2::TIMESTAMP WITH TIME ZONE, $3::UUID) ORDER BY messages.created_at, messages.id
|
||||
LIMIT $4::INTEGER
|
||||
Query Parameters: $1 = '739e4777-e10b-4ffd-9b51-8e0259933691', $2 = '2026-10-02 01:28:24.647927+00', $3 = '85336a9f-a392-418a-b5c4-5007b05290c7', $4 = '51'
|
||||
Limit (cost=0.42..24.15 rows=6 width=204) (actual time=0.009..0.025 rows=50.00 loops=1)
|
||||
Buffers: shared hit=53
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..241.72 rows=61 width=204) (actual time=0.009..0.023 rows=50.00 loops=1)
|
||||
Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=53
|
||||
|
||||
## Страница middle в psql: с индексом и без
|
||||
|
||||
Тот же текст запроса и те же параметры, что у плана middle.
|
||||
psql планирует их заново (custom plan). DROP INDEX — внутри
|
||||
транзакции, затем ROLLBACK: индекс остаётся в базе.
|
||||
|
||||
### С индексом ix_messages_chat_id_created_at_id
|
||||
|
||||
Limit (cost=0.42..28.72 rows=51 width=204) (actual time=0.023..0.050 rows=51.00 loops=1)
|
||||
Buffers: shared hit=54
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..16643.92 rows=29988 width=204) (actual time=0.022..0.046 rows=51.00 loops=1)
|
||||
Index Cond: ((chat_id = '739e4777-e10b-4ffd-9b51-8e0259933691'::uuid) AND (ROW(created_at, id) > ROW('2026-10-02 01:27:27.383878+00'::timestamp with time zone, '5beb2261-fb86-4c93-88f8-ff9bda33c36a'::uuid)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=54
|
||||
Planning:
|
||||
Buffers: shared hit=141
|
||||
Planning Time: 0.261 ms
|
||||
Execution Time: 0.072 ms
|
||||
|
||||
### Без индекса ix_messages_chat_id_created_at_id
|
||||
|
||||
Limit (cost=6094.63..6100.57 rows=51 width=204) (actual time=5.007..6.068 rows=51.00 loops=1)
|
||||
Buffers: shared hit=3789
|
||||
-> Gather Merge (cost=6094.63..9587.23 rows=29988 width=204) (actual time=5.006..6.062 rows=51.00 loops=1)
|
||||
Workers Planned: 2
|
||||
Workers Launched: 2
|
||||
Buffers: shared hit=3789
|
||||
-> Sort (cost=5094.61..5125.85 rows=12495 width=204) (actual time=3.972..3.974 rows=39.67 loops=3)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: top-N heapsort Memory: 50kB
|
||||
Buffers: shared hit=3789
|
||||
Worker 0: Sort Method: top-N heapsort Memory: 49kB
|
||||
Worker 1: Sort Method: top-N heapsort Memory: 45kB
|
||||
-> Parallel Seq Scan on messages (cost=0.00..4677.75 rows=12495 width=204) (actual time=0.737..3.364 rows=10000.00 loops=3)
|
||||
Filter: ((chat_id = '739e4777-e10b-4ffd-9b51-8e0259933691'::uuid) AND (ROW(created_at, id) > ROW('2026-10-02 01:27:27.383878+00'::timestamp with time zone, '5beb2261-fb86-4c93-88f8-ff9bda33c36a'::uuid)))
|
||||
Rows Removed by Filter: 32000
|
||||
Buffers: shared hit=3759
|
||||
Planning:
|
||||
Buffers: shared hit=17
|
||||
Planning Time: 0.070 ms
|
||||
Execution Time: 6.094 ms
|
||||
@@ -0,0 +1,100 @@
|
||||
# План запроса истории: класс medium, чат 6k
|
||||
|
||||
Код: src_sha256 8a7e256c540af433, commit 8e7d4183e32c; вариант индекса: keyset
|
||||
Страница истории читаемого чата (limit 50); позиция — сколько
|
||||
сообщений истории до страницы:
|
||||
- first: после 0
|
||||
- middle: после 3000
|
||||
- last: после 5950
|
||||
|
||||
## Планы приложения
|
||||
|
||||
auto_explain (ANALYZE, BUFFERS, TIMING): запрос, параметры и план,
|
||||
с которыми его выполнило приложение (prepared statement asyncpg).
|
||||
|
||||
### first
|
||||
|
||||
duration: 0.057 ms plan:
|
||||
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
||||
FROM messages
|
||||
WHERE messages.chat_id = $1::UUID ORDER BY messages.created_at, messages.id
|
||||
LIMIT $2::INTEGER
|
||||
Query Parameters: $1 = 'e2fe65c1-a220-4f07-9043-7c9e30a2b5f1', $2 = '51'
|
||||
Limit (cost=0.42..113.73 rows=51 width=204) (actual time=0.013..0.034 rows=51.00 loops=1)
|
||||
Buffers: shared hit=51
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..13297.62 rows=5985 width=204) (actual time=0.012..0.031 rows=51.00 loops=1)
|
||||
Index Cond: (chat_id = 'e2fe65c1-a220-4f07-9043-7c9e30a2b5f1'::uuid)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=51
|
||||
|
||||
### middle
|
||||
|
||||
duration: 0.055 ms plan:
|
||||
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
||||
FROM messages
|
||||
WHERE messages.chat_id = $1::UUID AND (messages.created_at, messages.id) > ($2::TIMESTAMP WITH TIME ZONE, $3::UUID) ORDER BY messages.created_at, messages.id
|
||||
LIMIT $4::INTEGER
|
||||
Query Parameters: $1 = 'e2fe65c1-a220-4f07-9043-7c9e30a2b5f1', $2 = '2026-10-02 01:27:26.631796+00', $3 = '3a11cc86-3863-4ab8-9a96-cb1bc7c75b98', $4 = '51'
|
||||
Limit (cost=0.42..24.15 rows=6 width=204) (actual time=0.008..0.033 rows=51.00 loops=1)
|
||||
Buffers: shared hit=51
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..241.72 rows=61 width=204) (actual time=0.008..0.031 rows=51.00 loops=1)
|
||||
Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=51
|
||||
|
||||
### last
|
||||
|
||||
duration: 0.054 ms plan:
|
||||
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
||||
FROM messages
|
||||
WHERE messages.chat_id = $1::UUID AND (messages.created_at, messages.id) > ($2::TIMESTAMP WITH TIME ZONE, $3::UUID) ORDER BY messages.created_at, messages.id
|
||||
LIMIT $4::INTEGER
|
||||
Query Parameters: $1 = 'e2fe65c1-a220-4f07-9043-7c9e30a2b5f1', $2 = '2026-10-02 01:28:23.799856+00', $3 = 'e33a3148-3666-492b-a5d5-84828089eae7', $4 = '51'
|
||||
Limit (cost=0.42..24.15 rows=6 width=204) (actual time=0.009..0.034 rows=50.00 loops=1)
|
||||
Buffers: shared hit=53
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..241.72 rows=61 width=204) (actual time=0.008..0.031 rows=50.00 loops=1)
|
||||
Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=53
|
||||
|
||||
## Страница middle в psql: с индексом и без
|
||||
|
||||
Тот же текст запроса и те же параметры, что у плана middle.
|
||||
psql планирует их заново (custom plan). DROP INDEX — внутри
|
||||
транзакции, затем ROLLBACK: индекс остаётся в базе.
|
||||
|
||||
### С индексом ix_messages_chat_id_created_at_id
|
||||
|
||||
Limit (cost=0.42..144.79 rows=51 width=204) (actual time=0.039..0.111 rows=51.00 loops=1)
|
||||
Buffers: shared hit=51
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..8558.23 rows=3023 width=204) (actual time=0.038..0.104 rows=51.00 loops=1)
|
||||
Index Cond: ((chat_id = 'e2fe65c1-a220-4f07-9043-7c9e30a2b5f1'::uuid) AND (ROW(created_at, id) > ROW('2026-10-02 01:27:26.631796+00'::timestamp with time zone, '3a11cc86-3863-4ab8-9a96-cb1bc7c75b98'::uuid)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=51
|
||||
Planning:
|
||||
Buffers: shared hit=141
|
||||
Planning Time: 0.436 ms
|
||||
Execution Time: 0.240 ms
|
||||
|
||||
### Без индекса ix_messages_chat_id_created_at_id
|
||||
|
||||
Limit (cost=5742.66..5748.60 rows=51 width=204) (actual time=5.437..6.485 rows=51.00 loops=1)
|
||||
Buffers: shared hit=3789
|
||||
-> Gather Merge (cost=5742.66..6094.74 rows=3023 width=204) (actual time=5.437..6.481 rows=51.00 loops=1)
|
||||
Workers Planned: 2
|
||||
Workers Launched: 2
|
||||
Buffers: shared hit=3789
|
||||
-> Sort (cost=4742.64..4745.79 rows=1260 width=204) (actual time=4.114..4.115 rows=38.67 loops=3)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: top-N heapsort Memory: 49kB
|
||||
Buffers: shared hit=3789
|
||||
Worker 0: Sort Method: top-N heapsort Memory: 50kB
|
||||
Worker 1: Sort Method: top-N heapsort Memory: 51kB
|
||||
-> Parallel Seq Scan on messages (cost=0.00..4677.75 rows=1260 width=204) (actual time=1.293..4.021 rows=1000.00 loops=3)
|
||||
Filter: ((chat_id = 'e2fe65c1-a220-4f07-9043-7c9e30a2b5f1'::uuid) AND (ROW(created_at, id) > ROW('2026-10-02 01:27:26.631796+00'::timestamp with time zone, '3a11cc86-3863-4ab8-9a96-cb1bc7c75b98'::uuid)))
|
||||
Rows Removed by Filter: 41000
|
||||
Buffers: shared hit=3759
|
||||
Planning:
|
||||
Buffers: shared hit=17
|
||||
Planning Time: 0.140 ms
|
||||
Execution Time: 6.510 ms
|
||||
@@ -0,0 +1,100 @@
|
||||
# План запроса истории: класс small, чат 200
|
||||
|
||||
Код: src_sha256 8a7e256c540af433, commit 8e7d4183e32c; вариант индекса: keyset
|
||||
Страница истории читаемого чата (limit 50); позиция — сколько
|
||||
сообщений истории до страницы:
|
||||
- first: после 0
|
||||
- middle: после 100
|
||||
- last: после 150
|
||||
|
||||
## Планы приложения
|
||||
|
||||
auto_explain (ANALYZE, BUFFERS, TIMING): запрос, параметры и план,
|
||||
с которыми его выполнило приложение (prepared statement asyncpg).
|
||||
|
||||
### first
|
||||
|
||||
duration: 0.131 ms plan:
|
||||
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
||||
FROM messages
|
||||
WHERE messages.chat_id = $1::UUID ORDER BY messages.created_at, messages.id
|
||||
LIMIT $2::INTEGER
|
||||
Query Parameters: $1 = 'd83c4273-021f-4c3b-9fa7-4ab244b7e31e', $2 = '51'
|
||||
Limit (cost=0.42..197.70 rows=51 width=204) (actual time=0.013..0.056 rows=51.00 loops=1)
|
||||
Buffers: shared hit=54
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..731.51 rows=189 width=204) (actual time=0.012..0.053 rows=51.00 loops=1)
|
||||
Index Cond: (chat_id = 'd83c4273-021f-4c3b-9fa7-4ab244b7e31e'::uuid)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=54
|
||||
|
||||
### middle
|
||||
|
||||
duration: 0.067 ms plan:
|
||||
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
||||
FROM messages
|
||||
WHERE messages.chat_id = $1::UUID AND (messages.created_at, messages.id) > ($2::TIMESTAMP WITH TIME ZONE, $3::UUID) ORDER BY messages.created_at, messages.id
|
||||
LIMIT $4::INTEGER
|
||||
Query Parameters: $1 = 'd83c4273-021f-4c3b-9fa7-4ab244b7e31e', $2 = '2026-10-02 01:27:36.624396+00', $3 = '90118262-ca69-4669-ab86-35c58766c377', $4 = '51'
|
||||
Limit (cost=0.42..24.15 rows=6 width=204) (actual time=0.009..0.047 rows=51.00 loops=1)
|
||||
Buffers: shared hit=53
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..241.72 rows=61 width=204) (actual time=0.008..0.044 rows=51.00 loops=1)
|
||||
Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=53
|
||||
|
||||
### last
|
||||
|
||||
duration: 0.063 ms plan:
|
||||
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
||||
FROM messages
|
||||
WHERE messages.chat_id = $1::UUID AND (messages.created_at, messages.id) > ($2::TIMESTAMP WITH TIME ZONE, $3::UUID) ORDER BY messages.created_at, messages.id
|
||||
LIMIT $4::INTEGER
|
||||
Query Parameters: $1 = 'd83c4273-021f-4c3b-9fa7-4ab244b7e31e', $2 = '2026-10-02 01:28:04.858109+00', $3 = 'c3668122-9cd2-478d-a1c4-b769d73d6a94', $4 = '51'
|
||||
Limit (cost=0.42..24.15 rows=6 width=204) (actual time=0.006..0.045 rows=50.00 loops=1)
|
||||
Buffers: shared hit=54
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..241.72 rows=61 width=204) (actual time=0.005..0.043 rows=50.00 loops=1)
|
||||
Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=54
|
||||
|
||||
## Страница middle в psql: с индексом и без
|
||||
|
||||
Тот же текст запроса и те же параметры, что у плана middle.
|
||||
psql планирует их заново (custom plan). DROP INDEX — внутри
|
||||
транзакции, затем ROLLBACK: индекс остаётся в базе.
|
||||
|
||||
### С индексом ix_messages_chat_id_created_at_id
|
||||
|
||||
Limit (cost=0.42..201.43 rows=51 width=204) (actual time=0.041..0.273 rows=51.00 loops=1)
|
||||
Buffers: shared hit=53
|
||||
-> Index Scan using ix_messages_chat_id_created_at_id on messages (cost=0.42..307.84 rows=78 width=204) (actual time=0.040..0.268 rows=51.00 loops=1)
|
||||
Index Cond: ((chat_id = 'd83c4273-021f-4c3b-9fa7-4ab244b7e31e'::uuid) AND (ROW(created_at, id) > ROW('2026-10-02 01:27:36.624396+00'::timestamp with time zone, '90118262-ca69-4669-ab86-35c58766c377'::uuid)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=53
|
||||
Planning:
|
||||
Buffers: shared hit=141
|
||||
Planning Time: 0.396 ms
|
||||
Execution Time: 0.308 ms
|
||||
|
||||
### Без индекса ix_messages_chat_id_created_at_id
|
||||
|
||||
Limit (cost=5678.57..5684.51 rows=51 width=204) (actual time=5.735..6.866 rows=51.00 loops=1)
|
||||
Buffers: shared hit=3789
|
||||
-> Gather Merge (cost=5678.57..5687.54 rows=77 width=204) (actual time=5.735..6.860 rows=51.00 loops=1)
|
||||
Workers Planned: 2
|
||||
Workers Launched: 2
|
||||
Buffers: shared hit=3789
|
||||
-> Sort (cost=4678.55..4678.63 rows=32 width=204) (actual time=4.405..4.409 rows=28.33 loops=3)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: quicksort Memory: 34kB
|
||||
Buffers: shared hit=3789
|
||||
Worker 0: Sort Method: quicksort Memory: 32kB
|
||||
Worker 1: Sort Method: quicksort Memory: 34kB
|
||||
-> Parallel Seq Scan on messages (cost=0.00..4677.75 rows=32 width=204) (actual time=2.434..4.383 rows=33.33 loops=3)
|
||||
Filter: ((chat_id = 'd83c4273-021f-4c3b-9fa7-4ab244b7e31e'::uuid) AND (ROW(created_at, id) > ROW('2026-10-02 01:27:36.624396+00'::timestamp with time zone, '90118262-ca69-4669-ab86-35c58766c377'::uuid)))
|
||||
Rows Removed by Filter: 41967
|
||||
Buffers: shared hit=3759
|
||||
Planning:
|
||||
Buffers: shared hit=17
|
||||
Planning Time: 0.089 ms
|
||||
Execution Time: 6.889 ms
|
||||
@@ -0,0 +1,78 @@
|
||||
# План запроса истории: класс tiny, чат 10
|
||||
|
||||
Код: src_sha256 8a7e256c540af433, commit 8e7d4183e32c; вариант индекса: keyset
|
||||
Страница истории читаемого чата (limit 50); позиция — сколько
|
||||
сообщений истории до страницы:
|
||||
- first: после 0
|
||||
|
||||
## Планы приложения
|
||||
|
||||
auto_explain (ANALYZE, BUFFERS, TIMING): запрос, параметры и план,
|
||||
с которыми его выполнило приложение (prepared statement asyncpg).
|
||||
|
||||
### first
|
||||
|
||||
duration: 0.048 ms plan:
|
||||
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
||||
FROM messages
|
||||
WHERE messages.chat_id = $1::UUID ORDER BY messages.created_at, messages.id
|
||||
LIMIT $2::INTEGER
|
||||
Query Parameters: $1 = '65fe5cdf-444f-4ee9-aaa1-210aed8d75cd', $2 = '51'
|
||||
Limit (cost=73.42..73.47 rows=18 width=204) (actual time=0.044..0.045 rows=10.00 loops=1)
|
||||
Buffers: shared hit=19
|
||||
-> Sort (cost=73.42..73.47 rows=18 width=204) (actual time=0.043..0.044 rows=10.00 loops=1)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: quicksort Memory: 27kB
|
||||
Buffers: shared hit=19
|
||||
-> Bitmap Heap Scan on messages (cost=4.56..73.05 rows=18 width=204) (actual time=0.010..0.017 rows=10.00 loops=1)
|
||||
Recheck Cond: (chat_id = '65fe5cdf-444f-4ee9-aaa1-210aed8d75cd'::uuid)
|
||||
Heap Blocks: exact=10
|
||||
Buffers: shared hit=13
|
||||
-> Bitmap Index Scan on ix_messages_chat_id_created_at_id (cost=0.00..4.55 rows=18 width=0) (actual time=0.005..0.005 rows=10.00 loops=1)
|
||||
Index Cond: (chat_id = '65fe5cdf-444f-4ee9-aaa1-210aed8d75cd'::uuid)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=3
|
||||
|
||||
## Страница first в psql: с индексом и без
|
||||
|
||||
Тот же текст запроса и те же параметры, что у плана first.
|
||||
psql планирует их заново (custom plan). DROP INDEX — внутри
|
||||
транзакции, затем ROLLBACK: индекс остаётся в базе.
|
||||
|
||||
### С индексом ix_messages_chat_id_created_at_id
|
||||
|
||||
Limit (cost=73.42..73.47 rows=18 width=204) (actual time=0.100..0.102 rows=10.00 loops=1)
|
||||
Buffers: shared hit=19
|
||||
-> Sort (cost=73.42..73.47 rows=18 width=204) (actual time=0.099..0.099 rows=10.00 loops=1)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: quicksort Memory: 27kB
|
||||
Buffers: shared hit=19
|
||||
-> Bitmap Heap Scan on messages (cost=4.56..73.05 rows=18 width=204) (actual time=0.032..0.082 rows=10.00 loops=1)
|
||||
Recheck Cond: (chat_id = '65fe5cdf-444f-4ee9-aaa1-210aed8d75cd'::uuid)
|
||||
Heap Blocks: exact=10
|
||||
Buffers: shared hit=13
|
||||
-> Bitmap Index Scan on ix_messages_chat_id_created_at_id (cost=0.00..4.55 rows=18 width=0) (actual time=0.021..0.021 rows=10.00 loops=1)
|
||||
Index Cond: (chat_id = '65fe5cdf-444f-4ee9-aaa1-210aed8d75cd'::uuid)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=3
|
||||
Planning:
|
||||
Buffers: shared hit=142
|
||||
Planning Time: 0.338 ms
|
||||
Execution Time: 0.126 ms
|
||||
|
||||
### Без индекса ix_messages_chat_id_created_at_id
|
||||
|
||||
Limit (cost=5334.38..5334.42 rows=18 width=204) (actual time=13.622..13.624 rows=10.00 loops=1)
|
||||
Buffers: shared hit=3759
|
||||
-> Sort (cost=5334.38..5334.42 rows=18 width=204) (actual time=13.620..13.622 rows=10.00 loops=1)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: quicksort Memory: 27kB
|
||||
Buffers: shared hit=3759
|
||||
-> Seq Scan on messages (cost=0.00..5334.00 rows=18 width=204) (actual time=1.689..13.613 rows=10.00 loops=1)
|
||||
Filter: (chat_id = '65fe5cdf-444f-4ee9-aaa1-210aed8d75cd'::uuid)
|
||||
Rows Removed by Filter: 125990
|
||||
Buffers: shared hit=3759
|
||||
Planning:
|
||||
Buffers: shared hit=17
|
||||
Planning Time: 0.067 ms
|
||||
Execution Time: 13.635 ms
|
||||
@@ -0,0 +1,6 @@
|
||||
size,messages_total,rps,p50_ms,p99_ms,max_ms,rss_mib,app_cpu_cores,db_cpu_cores
|
||||
126000,25200,1151.46,13.0164,25.8041,215.2539,92.9,1.0,0.282
|
||||
126000,50400,1133.73,13.138,30.9948,91.1298,94.5,1.0,0.285
|
||||
126000,75600,1151.7,13.0577,28.8755,92.7717,97.6,1.0,0.285
|
||||
126000,100800,1110.99,13.4348,30.7425,97.8796,98.0,0.993,0.281
|
||||
126000,126000,1169.24,13.0743,25.2007,85.855,98.8,0.999,0.285
|
||||
|
@@ -0,0 +1,2 @@
|
||||
size,rss_empty_mib,rss_filled_mib,rss_peak_mib,oom_killed,messages_rows,table_bytes,indexes_bytes,db_bytes_per_message
|
||||
126000,81.1,98.8,144.1,False,126000,30834688,17661952,385
|
||||
|
@@ -0,0 +1,407 @@
|
||||
{
|
||||
"label": "t2-keyset-2",
|
||||
"started_utc": "2026-10-02T01:26:22Z",
|
||||
"profile": {
|
||||
"name": "skew",
|
||||
"sizes": [
|
||||
126000
|
||||
],
|
||||
"clients": [
|
||||
1,
|
||||
8,
|
||||
32
|
||||
],
|
||||
"repeats": 3,
|
||||
"read_warmup_s": 2.0,
|
||||
"read_duration_s": 6.0,
|
||||
"write_warmup_requests": 300,
|
||||
"write_requests": 3000,
|
||||
"fill_clients": 16,
|
||||
"fill_batch_max": 50000,
|
||||
"fill_batches_min": 5,
|
||||
"cursor_pool": 200,
|
||||
"gen_procs": 4,
|
||||
"seed": 20261002,
|
||||
"app_cpus": "1",
|
||||
"app_memory": "1g",
|
||||
"db_cpus": "2",
|
||||
"db_memory": "2g",
|
||||
"cache_cpus": "1",
|
||||
"cache_memory": "256m",
|
||||
"session_ttl": 21600,
|
||||
"gen_cpu_flag": 0.8,
|
||||
"classes": [
|
||||
[
|
||||
"big",
|
||||
1,
|
||||
60000
|
||||
],
|
||||
[
|
||||
"medium",
|
||||
6,
|
||||
6000
|
||||
],
|
||||
[
|
||||
"small",
|
||||
120,
|
||||
200
|
||||
],
|
||||
[
|
||||
"tiny",
|
||||
600,
|
||||
10
|
||||
]
|
||||
],
|
||||
"explain_cursor_version": 2
|
||||
},
|
||||
"host": {
|
||||
"platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
|
||||
"machine": "arm64",
|
||||
"cpu_model": "Apple M4",
|
||||
"cpu_count": 10,
|
||||
"ram_gb": 16.0,
|
||||
"swap_used_mib": 0.0,
|
||||
"power": "AC Power",
|
||||
"loadavg_1m": 2.9
|
||||
},
|
||||
"docker": {
|
||||
"ServerVersion": "28.0.4",
|
||||
"OperatingSystem": "Docker Desktop",
|
||||
"KernelVersion": "6.10.14-linuxkit",
|
||||
"Architecture": "aarch64",
|
||||
"NCPU": 10,
|
||||
"MemTotal": 8218034176,
|
||||
"CgroupVersion": "2",
|
||||
"LoggingDriver": "json-file",
|
||||
"other_running_containers": 0
|
||||
},
|
||||
"image": {
|
||||
"tag": "mtusi-messenger-vladimirceva:bench-t2-keyset-2",
|
||||
"id": "sha256:e670ace82a784e82a5fe617e6c60e3a651cea6c446be8c42bc586d2f359881d0",
|
||||
"created": "2026-10-02T00:39:00.104485709Z",
|
||||
"versions": {
|
||||
"python": "3.13.15",
|
||||
"fastapi": "0.142.1",
|
||||
"starlette": "1.7.0",
|
||||
"uvicorn": "0.54.0",
|
||||
"pydantic": "2.13.5",
|
||||
"sqlalchemy": "2.1.1",
|
||||
"asyncpg": "0.31.0",
|
||||
"alembic": "1.20.0",
|
||||
"redis": "8.1.0",
|
||||
"argon2-cffi": "25.1.0"
|
||||
},
|
||||
"src_sha256": "8a7e256c540af433de47704437294adafd98dcfecf2f3200354454ee717cd2a3"
|
||||
},
|
||||
"image_reused": false,
|
||||
"code": {
|
||||
"src_sha256": "8a7e256c540af433de47704437294adafd98dcfecf2f3200354454ee717cd2a3",
|
||||
"git_commit": "8e7d4183e32cfe8174e2be3da50209faf5f8eb6f",
|
||||
"git_dirty": false
|
||||
},
|
||||
"generator_image": "python:3.13.15-slim-trixie@sha256:7c61056e61ac89e852de05f3dc6fa51a6dd2181797bceed46aa725dd7cb2cd3b",
|
||||
"variant": "keyset",
|
||||
"variant_sql": [],
|
||||
"host_warnings": [],
|
||||
"stand": {
|
||||
"postgres": {
|
||||
"image": "postgres:18.6-trixie@sha256:5a5a84b19854a9ffaa54082c166ff4ec27473a361e496e5ea167f298f2da9722",
|
||||
"version": "18.6 (Debian 18.6-1.pgdg13+2)",
|
||||
"settings": {
|
||||
"autovacuum": "on",
|
||||
"checkpoint_timeout": "5min",
|
||||
"effective_cache_size": "4GB",
|
||||
"fsync": "on",
|
||||
"jit": "on",
|
||||
"maintenance_work_mem": "64MB",
|
||||
"max_connections": "100",
|
||||
"max_wal_size": "1GB",
|
||||
"plan_cache_mode": "auto",
|
||||
"random_page_cost": "4",
|
||||
"shared_buffers": "128MB",
|
||||
"shared_preload_libraries": "auto_explain",
|
||||
"synchronous_commit": "on",
|
||||
"wal_level": "replica",
|
||||
"work_mem": "4MB"
|
||||
}
|
||||
},
|
||||
"valkey": {
|
||||
"image": "valkey/valkey:9.1.2-trixie@sha256:418652cfb58ef879d4978c33553735d7147016032d5aefaa14c828e611eb9dfd",
|
||||
"version": "9.1.2",
|
||||
"maxmemory": "67108864",
|
||||
"maxmemory-clients": "0",
|
||||
"maxmemory-eviction-tenacity": "10",
|
||||
"maxmemory-policy": "allkeys-lru",
|
||||
"maxmemory-samples": "5"
|
||||
},
|
||||
"limits": {
|
||||
"api": {
|
||||
"nano_cpus": 1000000000,
|
||||
"memory": 1073741824,
|
||||
"memory_swap": 1073741824,
|
||||
"published_ports": {}
|
||||
},
|
||||
"postgres": {
|
||||
"nano_cpus": 2000000000,
|
||||
"memory": 2147483648,
|
||||
"memory_swap": 2147483648,
|
||||
"published_ports": {}
|
||||
},
|
||||
"valkey": {
|
||||
"nano_cpus": 1000000000,
|
||||
"memory": 268435456,
|
||||
"memory_swap": 268435456,
|
||||
"published_ports": {}
|
||||
}
|
||||
},
|
||||
"app_env": {
|
||||
"CACHE_HOST": "valkey",
|
||||
"CACHE_PORT": "6379",
|
||||
"DB_HOST": "postgres",
|
||||
"DB_NAME": "bench",
|
||||
"DB_PORT": "5432",
|
||||
"DB_USER": "bench",
|
||||
"LOG_LEVEL": "INFO",
|
||||
"SESSION_TTL_SECONDS": "21600",
|
||||
"SHUTDOWN_TIMEOUT": "5"
|
||||
}
|
||||
},
|
||||
"finished_utc": "2026-10-02T01:34:48Z",
|
||||
"duration_s": 506,
|
||||
"plans": [
|
||||
{
|
||||
"size": 60000,
|
||||
"chat_class": "big",
|
||||
"page": "first",
|
||||
"after": 0,
|
||||
"source": "app",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 31,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 0.053,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 60000,
|
||||
"chat_class": "big",
|
||||
"page": "middle",
|
||||
"after": 30000,
|
||||
"source": "app",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 54,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 0.046,
|
||||
"kind": "generic"
|
||||
},
|
||||
{
|
||||
"size": 60000,
|
||||
"chat_class": "big",
|
||||
"page": "last",
|
||||
"after": 59950,
|
||||
"source": "app",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 53,
|
||||
"shared_read": 0,
|
||||
"rows": 50.0,
|
||||
"time_ms": 0.045,
|
||||
"kind": "generic"
|
||||
},
|
||||
{
|
||||
"size": 60000,
|
||||
"chat_class": "big",
|
||||
"page": "middle",
|
||||
"after": 30000,
|
||||
"source": "psql",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 54,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 0.072,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 60000,
|
||||
"chat_class": "big",
|
||||
"page": "middle",
|
||||
"after": 30000,
|
||||
"source": "psql, no index",
|
||||
"node": "Parallel Seq Scan on messages",
|
||||
"shared_hit": 3789,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 6.094,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 6000,
|
||||
"chat_class": "medium",
|
||||
"page": "first",
|
||||
"after": 0,
|
||||
"source": "app",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 51,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 0.057,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 6000,
|
||||
"chat_class": "medium",
|
||||
"page": "middle",
|
||||
"after": 3000,
|
||||
"source": "app",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 51,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 0.055,
|
||||
"kind": "generic"
|
||||
},
|
||||
{
|
||||
"size": 6000,
|
||||
"chat_class": "medium",
|
||||
"page": "last",
|
||||
"after": 5950,
|
||||
"source": "app",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 53,
|
||||
"shared_read": 0,
|
||||
"rows": 50.0,
|
||||
"time_ms": 0.054,
|
||||
"kind": "generic"
|
||||
},
|
||||
{
|
||||
"size": 6000,
|
||||
"chat_class": "medium",
|
||||
"page": "middle",
|
||||
"after": 3000,
|
||||
"source": "psql",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 51,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 0.24,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 6000,
|
||||
"chat_class": "medium",
|
||||
"page": "middle",
|
||||
"after": 3000,
|
||||
"source": "psql, no index",
|
||||
"node": "Parallel Seq Scan on messages",
|
||||
"shared_hit": 3789,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 6.51,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 200,
|
||||
"chat_class": "small",
|
||||
"page": "first",
|
||||
"after": 0,
|
||||
"source": "app",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 54,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 0.131,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 200,
|
||||
"chat_class": "small",
|
||||
"page": "middle",
|
||||
"after": 100,
|
||||
"source": "app",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 53,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 0.067,
|
||||
"kind": "generic"
|
||||
},
|
||||
{
|
||||
"size": 200,
|
||||
"chat_class": "small",
|
||||
"page": "last",
|
||||
"after": 150,
|
||||
"source": "app",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 54,
|
||||
"shared_read": 0,
|
||||
"rows": 50.0,
|
||||
"time_ms": 0.063,
|
||||
"kind": "generic"
|
||||
},
|
||||
{
|
||||
"size": 200,
|
||||
"chat_class": "small",
|
||||
"page": "middle",
|
||||
"after": 100,
|
||||
"source": "psql",
|
||||
"node": "Index Scan using ix_messages_chat_id_created_at_id on messages",
|
||||
"shared_hit": 53,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 0.308,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 200,
|
||||
"chat_class": "small",
|
||||
"page": "middle",
|
||||
"after": 100,
|
||||
"source": "psql, no index",
|
||||
"node": "Parallel Seq Scan on messages",
|
||||
"shared_hit": 3789,
|
||||
"shared_read": 0,
|
||||
"rows": 51.0,
|
||||
"time_ms": 6.889,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 10,
|
||||
"chat_class": "tiny",
|
||||
"page": "first",
|
||||
"after": 0,
|
||||
"source": "app",
|
||||
"node": "Bitmap Heap Scan on messages",
|
||||
"shared_hit": 19,
|
||||
"shared_read": 0,
|
||||
"rows": 10.0,
|
||||
"time_ms": 0.048,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 10,
|
||||
"chat_class": "tiny",
|
||||
"page": "first",
|
||||
"after": 0,
|
||||
"source": "psql",
|
||||
"node": "Bitmap Heap Scan on messages",
|
||||
"shared_hit": 19,
|
||||
"shared_read": 0,
|
||||
"rows": 10.0,
|
||||
"time_ms": 0.126,
|
||||
"kind": "custom"
|
||||
},
|
||||
{
|
||||
"size": 10,
|
||||
"chat_class": "tiny",
|
||||
"page": "first",
|
||||
"after": 0,
|
||||
"source": "psql, no index",
|
||||
"node": "Seq Scan on messages",
|
||||
"shared_hit": 3759,
|
||||
"shared_read": 0,
|
||||
"rows": 10.0,
|
||||
"time_ms": 13.635,
|
||||
"kind": "custom"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
scenario,size,clients,repeat,requests,errors,rps,p50_ms,p90_ms,p95_ms,p99_ms,max_ms,mean_ms,cpu_us_per_req,app_cpu_cores,rss_mib,store_messages_start,gen_cpu_cores,window_s,flags,db_cpu_cores,db_cpu_us_per_req,chat_class
|
||||
read,60000,1,1,3487,0,581.21,1.7049,1.7865,1.8705,2.065,7.0324,1.719,1351.5,0.787,98.8,126000,0.022,5.9995,,0.146,251.1,big
|
||||
read,60000,8,1,5500,0,915.95,8.6502,9.0806,9.2657,10.5578,25.8011,8.7227,1096.6,1.0,99.0,126000,0.038,6.0047,,0.211,231.7,big
|
||||
read,60000,32,1,5411,0,896.65,33.6164,40.4729,46.6755,56.3909,89.8483,35.4947,1121.2,1.001,100.3,126000,0.04,6.0347,,0.232,260.1,big
|
||||
read,60000,1,2,3474,0,578.91,1.7155,1.7773,1.8021,1.9747,18.9363,1.7258,1360.9,0.787,100.3,126000,0.022,6.0009,,0.144,249.9,big
|
||||
read,60000,8,2,5534,0,921.78,8.6316,8.982,9.1189,9.5885,25.12,8.6699,1089.6,1.0,100.3,126000,0.038,6.0036,,0.214,233.1,big
|
||||
read,60000,32,2,5321,0,883.48,33.5815,44.7942,48.8077,55.3911,70.6443,36.0505,1139.5,1.0,100.4,126000,0.039,6.0228,,0.236,268.5,big
|
||||
read,60000,1,3,3509,0,584.9,1.7104,1.7643,1.7811,1.8706,2.9531,1.7083,1362.9,0.79,100.4,126000,0.022,5.9993,,0.146,251.4,big
|
||||
read,60000,8,3,5462,0,909.78,8.6848,9.0493,9.2105,10.433,35.9166,8.7855,1101.6,1.0,100.4,126000,0.038,6.0036,,0.208,229.4,big
|
||||
read,60000,32,3,5410,0,898.75,33.2724,41.5612,47.3949,60.3494,74.1853,35.4644,1114.0,1.0,100.4,126000,0.04,6.0194,,0.233,259.4,big
|
||||
read,6000,1,1,3455,0,575.81,1.727,1.7922,1.8191,1.995,7.1042,1.735,1375.1,0.79,100.4,126000,0.023,6.0002,,0.146,253.8,medium
|
||||
read,6000,8,1,5479,0,913.08,8.6698,9.0448,9.2347,10.2576,36.6397,8.7541,1100.1,0.999,100.4,126000,0.038,6.0006,,0.215,236.7,medium
|
||||
read,6000,32,1,5261,0,872.35,34.1812,43.5866,48.6626,57.667,78.4974,36.5062,1146.6,0.991,100.4,126000,0.04,6.0308,,0.243,280.9,medium
|
||||
read,6000,1,2,3484,0,580.65,1.7072,1.7775,1.8068,1.9963,9.1971,1.7207,1357.7,0.787,100.5,126000,0.022,6.0002,,0.149,257.4,medium
|
||||
read,6000,8,2,5499,0,916.0,8.6522,9.067,9.2607,10.4181,26.589,8.7267,1097.1,0.998,100.5,126000,0.038,6.0033,,0.214,235.0,medium
|
||||
read,6000,32,2,5401,0,897.55,33.3894,41.7818,47.8783,56.8479,66.219,35.5021,1129.7,1.001,100.8,126000,0.039,6.0175,,0.246,277.5,medium
|
||||
read,6000,1,3,3477,0,579.55,1.7171,1.7854,1.808,1.9641,5.2552,1.7239,1361.3,0.788,100.8,126000,0.023,5.9994,,0.146,253.1,medium
|
||||
read,6000,8,3,5515,0,918.49,8.6487,8.9938,9.1177,9.838,26.0341,8.6997,1096.5,1.0,100.8,126000,0.038,6.0044,,0.214,235.1,medium
|
||||
read,6000,32,3,5405,0,897.54,33.4092,42.2958,47.1541,60.3212,79.5342,35.502,1124.5,1.0,101.0,126000,0.039,6.022,,0.244,274.2,medium
|
||||
read,200,1,1,3522,0,587.01,1.7014,1.7622,1.7819,1.8702,3.2947,1.702,1355.8,0.79,101.0,126000,0.023,5.9999,,0.146,251.3,small
|
||||
read,200,8,1,5610,0,934.65,8.5057,8.8449,8.9845,9.5687,26.0273,8.5497,1080.8,1.0,101.0,126000,0.039,6.0023,,0.211,227.9,small
|
||||
read,200,32,1,5383,0,893.49,33.2346,42.7163,47.8953,57.1281,76.3454,35.6513,1125.1,1.0,101.1,126000,0.039,6.0247,,0.233,262.1,small
|
||||
read,200,1,2,3502,0,583.61,1.704,1.7721,1.8002,1.9897,6.6569,1.7121,1356.4,0.79,101.1,126000,0.022,6.0006,,0.144,247.3,small
|
||||
read,200,8,2,5576,0,928.61,8.534,8.9177,9.0887,9.924,28.0423,8.6044,1081.8,1.0,101.1,126000,0.038,6.0047,,0.212,228.9,small
|
||||
read,200,32,2,5406,0,900.44,33.1067,42.0339,47.1724,58.7743,78.65,35.3789,1118.1,1.0,101.6,126000,0.04,6.0037,,0.235,262.4,small
|
||||
read,200,1,3,3499,0,583.29,1.7012,1.7677,1.7986,2.0303,10.2185,1.713,1355.8,0.789,101.6,126000,0.023,5.9987,,0.145,249.1,small
|
||||
read,200,8,3,5579,0,929.07,8.57,8.9249,9.0815,10.0225,19.2173,8.6025,1085.4,1.001,101.6,126000,0.039,6.0049,,0.211,229.2,small
|
||||
read,200,32,3,5448,0,903.18,33.0162,42.2731,47.3395,54.3912,65.4198,35.2706,1111.6,1.0,101.8,126000,0.039,6.032,,0.232,257.9,small
|
||||
read,10,1,1,4044,0,674.03,1.476,1.5481,1.5728,1.704,6.0635,1.4829,1137.9,0.767,101.8,126000,0.024,5.9998,,0.155,230.0,tiny
|
||||
read,10,8,1,7162,0,1193.09,6.688,6.9755,7.0562,7.4056,11.6504,6.7,848.9,0.999,101.8,126000,0.042,6.0029,,0.241,204.9,tiny
|
||||
read,10,32,1,7408,0,1231.47,25.1114,28.5595,28.9047,30.8383,46.7421,25.9095,818.2,0.998,101.8,126000,0.044,6.0156,,0.257,210.5,tiny
|
||||
read,10,1,2,4075,0,679.12,1.4683,1.5306,1.5493,1.6481,6.8599,1.4718,1127.2,0.762,101.8,126000,0.023,6.0005,,0.156,230.6,tiny
|
||||
read,10,8,2,6776,0,1128.73,7.062,7.3407,7.4642,8.4202,19.8165,7.083,881.5,0.999,101.8,126000,0.041,6.0032,,0.234,206.6,tiny
|
||||
read,10,32,2,7362,0,1223.64,25.2196,28.714,29.0905,37.2395,47.4853,26.0682,825.4,1.001,101.9,126000,0.046,6.0165,,0.258,212.9,tiny
|
||||
read,10,1,3,4053,0,675.41,1.4735,1.5413,1.561,1.6748,5.4489,1.4798,1125.3,0.761,101.9,126000,0.023,6.0008,,0.156,230.1,tiny
|
||||
read,10,8,3,7043,0,1173.44,6.7976,7.0597,7.143,7.6328,18.3751,6.8132,856.2,1.001,101.9,126000,0.042,6.002,,0.243,207.8,tiny
|
||||
read,10,32,3,7068,0,1174.15,26.2656,29.9244,30.6055,42.157,49.7659,27.1681,838.4,0.977,101.9,126000,0.044,6.0197,,0.249,213.6,tiny
|
||||
write,126000,1,1,3000,0,784.19,1.2447,1.3542,1.3996,1.5649,6.7272,1.2743,957.6,0.742,101.9,126000,0.028,3.8256,,0.166,214.4,
|
||||
write,126000,8,1,3000,0,1299.46,6.0586,6.486,6.7247,7.661,17.3089,6.1406,778.8,1.001,101.9,129300,0.047,2.3087,,0.301,234.1,
|
||||
write,126000,32,1,3000,0,1255.7,24.4768,29.2075,30.4326,41.6614,51.5655,25.2552,818.2,1.003,101.9,132600,0.047,2.3891,,0.297,241.9,
|
||||
write,126000,1,2,3000,0,788.95,1.2487,1.3125,1.3434,1.5444,7.4164,1.2666,966.7,0.757,101.9,135900,0.029,3.8025,,0.171,219.0,
|
||||
write,126000,8,2,3000,0,1297.2,6.1598,6.4422,6.522,6.6939,7.882,6.1452,781.8,1.003,101.9,139200,0.046,2.3127,,0.295,229.8,
|
||||
write,126000,32,2,3000,0,1261.03,24.4474,28.9029,30.0073,35.3274,55.3426,25.0752,815.2,1.0,101.9,142500,0.048,2.379,,0.311,253.8,
|
||||
write,126000,1,3,3000,0,799.66,1.2353,1.2905,1.3125,1.5189,7.0006,1.2497,957.6,0.759,101.9,145800,0.027,3.7516,,0.169,213.1,
|
||||
write,126000,8,3,3000,0,1281.0,6.2115,6.5242,6.6486,7.1491,9.2012,6.2307,787.9,1.001,101.9,149100,0.046,2.3419,,0.288,226.6,
|
||||
write,126000,32,3,3000,0,1228.13,24.6735,29.7287,33.3068,45.9154,57.1706,25.6766,827.3,1.001,101.9,152400,0.048,2.4427,,0.303,250.3,
|
||||
|
@@ -0,0 +1,83 @@
|
||||
# Стенд: метка `t2-keyset-2`
|
||||
|
||||
- Снято: 2026-10-02T01:26:22Z — 2026-10-02T01:34:48Z (506 с), профиль `skew`, вариант индекса `keyset`
|
||||
- Хост: Apple M4, 10 CPU, 16.0 ГБ, macOS-26.6.2-arm64-arm-64bit-Mach-O; питание: AC Power, swap: 0.0 МиБ
|
||||
- Docker: 28.0.4 (Docker Desktop), 10 CPU, 7.7 ГБ, cgroup v2; посторонних контейнеров: 0
|
||||
- Образ: `mtusi-messenger-vladimirceva:bench-t2-keyset-2` (e670ace82a78), python 3.13.15, fastapi 0.142.1, starlette 1.7.0, uvicorn 0.54.0, pydantic 2.13.5, sqlalchemy 2.1.1, asyncpg 0.31.0, alembic 1.20.0, redis 8.1.0, argon2-cffi 25.1.0
|
||||
- Код: src_sha256 `8a7e256c540af433`, commit `8e7d4183e32c`
|
||||
- Лимиты: API `--cpus=1 --memory=1g`, PostgreSQL `2 CPU / 2g`, Valkey `1 CPU / 256m`, без swap; API без healthcheck, порты не публикуются
|
||||
- PostgreSQL: 18.6 (Debian 18.6-1.pgdg13+2), shared_buffers 128MB, настройки образа + auto_explain (выключен вне этапа плана); свежий volume на каждый размер; после наполнения VACUUM (ANALYZE) и CHECKPOINT
|
||||
- Генератор: `bench/loadgen.py` в той же docker-сети, образ `python:3.13.15-slim-trixie`, до 4 процессов; вход по Basic, запросы с Bearer
|
||||
- Чтение: 6.0 с после 2.0 с прогрева, страница limit=50 со случайным курсором пула; запись: 3000 запросов после 300 прогрева в отдельный чат; повторов: 3
|
||||
- Чаты: big — 1 × 60k, medium — 6 × 6k, small — 120 × 200, tiny — 600 × 10; наполнение по перемешанному плану (сообщения чатов чередуются), читается первый чат класса, страницы — все, включая неполные
|
||||
|
||||
|
||||
Значения — медиана повторов, в скобках min–max.
|
||||
|
||||
## Чтение: `GET .../messages?limit=50&cursor=...`
|
||||
|
||||
| История | Клиенты | RPS | p50, мс | p95, мс | p99, мс | CPU API, мкс/запрос | CPU API, ядер | CPU БД, ядер | CPU БД, мкс/запрос | Пометки |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 10 (tiny) | 1 | 675 (674–679) | 1.47 (1.47–1.48) | 1.56 (1.55–1.57) | 1.67 (1.65–1.70) | 1127 (1125–1138) | 0.76 (0.76–0.77) | 0.16 (0.15–0.16) | 230 (230–231) | — |
|
||||
| 10 (tiny) | 8 | 1173 (1129–1193) | 6.80 (6.69–7.06) | 7.14 (7.06–7.46) | 7.63 (7.41–8.42) | 856 (849–882) | 1.00 (1.00–1.00) | 0.24 (0.23–0.24) | 207 (205–208) | — |
|
||||
| 10 (tiny) | 32 | 1224 (1174–1231) | 25.22 (25.11–26.27) | 29.09 (28.90–30.61) | 37.24 (30.84–42.16) | 825 (818–838) | 1.00 (0.98–1.00) | 0.26 (0.25–0.26) | 213 (210–214) | — |
|
||||
| 200 (small) | 1 | 584 (583–587) | 1.70 (1.70–1.70) | 1.80 (1.78–1.80) | 1.99 (1.87–2.03) | 1356 (1356–1356) | 0.79 (0.79–0.79) | 0.14 (0.14–0.15) | 249 (247–251) | — |
|
||||
| 200 (small) | 8 | 929 (929–935) | 8.53 (8.51–8.57) | 9.08 (8.98–9.09) | 9.92 (9.57–10.02) | 1082 (1081–1085) | 1.00 (1.00–1.00) | 0.21 (0.21–0.21) | 229 (228–229) | — |
|
||||
| 200 (small) | 32 | 900 (893–903) | 33.11 (33.02–33.23) | 47.34 (47.17–47.90) | 57.13 (54.39–58.77) | 1118 (1112–1125) | 1.00 (1.00–1.00) | 0.23 (0.23–0.23) | 262 (258–262) | — |
|
||||
| 6k (medium) | 1 | 580 (576–581) | 1.72 (1.71–1.73) | 1.81 (1.81–1.82) | 2.00 (1.96–2.00) | 1361 (1358–1375) | 0.79 (0.79–0.79) | 0.15 (0.15–0.15) | 254 (253–257) | — |
|
||||
| 6k (medium) | 8 | 916 (913–918) | 8.65 (8.65–8.67) | 9.23 (9.12–9.26) | 10.26 (9.84–10.42) | 1097 (1096–1100) | 1.00 (1.00–1.00) | 0.21 (0.21–0.21) | 235 (235–237) | — |
|
||||
| 6k (medium) | 32 | 898 (872–898) | 33.41 (33.39–34.18) | 47.88 (47.15–48.66) | 57.67 (56.85–60.32) | 1130 (1124–1147) | 1.00 (0.99–1.00) | 0.24 (0.24–0.25) | 278 (274–281) | — |
|
||||
| 60k (big) | 1 | 581 (579–585) | 1.71 (1.70–1.72) | 1.80 (1.78–1.87) | 1.97 (1.87–2.06) | 1361 (1352–1363) | 0.79 (0.79–0.79) | 0.15 (0.14–0.15) | 251 (250–251) | — |
|
||||
| 60k (big) | 8 | 916 (910–922) | 8.65 (8.63–8.68) | 9.21 (9.12–9.27) | 10.43 (9.59–10.56) | 1097 (1090–1102) | 1.00 (1.00–1.00) | 0.21 (0.21–0.21) | 232 (229–233) | — |
|
||||
| 60k (big) | 32 | 897 (883–899) | 33.58 (33.27–33.62) | 47.39 (46.68–48.81) | 56.39 (55.39–60.35) | 1121 (1114–1140) | 1.00 (1.00–1.00) | 0.23 (0.23–0.24) | 260 (259–268) | — |
|
||||
|
||||
## Запись: `POST .../messages` в отдельный чат
|
||||
|
||||
| История | Клиенты | RPS | p50, мс | p95, мс | p99, мс | CPU API, мкс/запрос | CPU API, ядер | CPU БД, ядер | CPU БД, мкс/запрос | Пометки |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 126k | 1 | 789 (784–800) | 1.24 (1.24–1.25) | 1.34 (1.31–1.40) | 1.54 (1.52–1.56) | 958 (958–967) | 0.76 (0.74–0.76) | 0.17 (0.17–0.17) | 214 (213–219) | — |
|
||||
| 126k | 8 | 1297 (1281–1299) | 6.16 (6.06–6.21) | 6.65 (6.52–6.72) | 7.15 (6.69–7.66) | 782 (779–788) | 1.00 (1.00–1.00) | 0.29 (0.29–0.30) | 230 (227–234) | — |
|
||||
| 126k | 32 | 1256 (1228–1261) | 24.48 (24.45–24.67) | 30.43 (30.01–33.31) | 41.66 (35.33–45.92) | 818 (815–827) | 1.00 (1.00–1.00) | 0.30 (0.30–0.31) | 250 (242–254) | — |
|
||||
|
||||
## Планы запроса истории
|
||||
|
||||
Страница истории читаемого чата (limit 50). `app` — план, с которым запрос выполнило приложение (auto_explain); `psql` — тот же текст и параметры средней (у маленького чата — первой) страницы, с индексом и без него (DROP INDEX в откатываемой транзакции). Полностью — `explain-*.txt`.
|
||||
|
||||
| История | Страница | После | Источник | Узел | shared hit | read | Строк | Время, мс | План |
|
||||
|---|---|---|---|---|---|---|---|---|---|
|
||||
| 60k (big) | first | 0 | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 31 | 0 | 51.0 | 0.053 | custom |
|
||||
| 60k (big) | middle | 30000 | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 54 | 0 | 51.0 | 0.046 | generic |
|
||||
| 60k (big) | last | 59950 | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 53 | 0 | 50.0 | 0.045 | generic |
|
||||
| 60k (big) | middle | 30000 | psql | Index Scan using ix_messages_chat_id_created_at_id on messages | 54 | 0 | 51.0 | 0.072 | custom |
|
||||
| 60k (big) | middle | 30000 | psql, no index | Parallel Seq Scan on messages | 3789 | 0 | 51.0 | 6.094 | custom |
|
||||
| 6k (medium) | first | 0 | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 51 | 0 | 51.0 | 0.057 | custom |
|
||||
| 6k (medium) | middle | 3000 | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 51 | 0 | 51.0 | 0.055 | generic |
|
||||
| 6k (medium) | last | 5950 | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 53 | 0 | 50.0 | 0.054 | generic |
|
||||
| 6k (medium) | middle | 3000 | psql | Index Scan using ix_messages_chat_id_created_at_id on messages | 51 | 0 | 51.0 | 0.24 | custom |
|
||||
| 6k (medium) | middle | 3000 | psql, no index | Parallel Seq Scan on messages | 3789 | 0 | 51.0 | 6.51 | custom |
|
||||
| 200 (small) | first | 0 | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 54 | 0 | 51.0 | 0.131 | custom |
|
||||
| 200 (small) | middle | 100 | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 53 | 0 | 51.0 | 0.067 | generic |
|
||||
| 200 (small) | last | 150 | app | Index Scan using ix_messages_chat_id_created_at_id on messages | 54 | 0 | 50.0 | 0.063 | generic |
|
||||
| 200 (small) | middle | 100 | psql | Index Scan using ix_messages_chat_id_created_at_id on messages | 53 | 0 | 51.0 | 0.308 | custom |
|
||||
| 200 (small) | middle | 100 | psql, no index | Parallel Seq Scan on messages | 3789 | 0 | 51.0 | 6.889 | custom |
|
||||
| 10 (tiny) | first | 0 | app | Bitmap Heap Scan on messages | 19 | 0 | 10.0 | 0.048 | custom |
|
||||
| 10 (tiny) | first | 0 | psql | Bitmap Heap Scan on messages | 19 | 0 | 10.0 | 0.126 | custom |
|
||||
| 10 (tiny) | first | 0 | psql, no index | Seq Scan on messages | 3759 | 0 | 10.0 | 13.635 | custom |
|
||||
|
||||
## Память и объём
|
||||
|
||||
| История | RSS API пустой, МиБ | RSS API после наполнения, МиБ | Пик RSS, МиБ | OOM | Строк messages | Таблица, МиБ | Индексы, МиБ | Байт на сообщение в БД |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| 126k | 81.1 | 98.8 | 144.1 | нет | 126000 | 29.4 | 16.8 | 385 |
|
||||
|
||||
## Наполнение истории (запись при росте таблицы)
|
||||
|
||||
| Цель | Сообщений | RPS | p50, мс | p99, мс | max, мс | RSS, МиБ | CPU API | CPU БД |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| 126k | 25200 | 1151 | 13.02 | 25.80 | 215.3 | 92.9 | 1.0 | 0.282 |
|
||||
| 126k | 50400 | 1134 | 13.14 | 30.99 | 91.1 | 94.5 | 1.0 | 0.285 |
|
||||
| 126k | 75600 | 1152 | 13.06 | 28.88 | 92.8 | 97.6 | 1.0 | 0.285 |
|
||||
| 126k | 100800 | 1111 | 13.43 | 30.74 | 97.9 | 98.0 | 0.993 | 0.281 |
|
||||
| 126k | 126000 | 1169 | 13.07 | 25.20 | 85.9 | 98.8 | 0.999 | 0.285 |
|
||||
|
||||
Пометки: `errors` — были неуспешные запросы; `generator` — генератор занял больше порога CPU на процесс, предел мог быть в нём; `short` — измерено меньше запросов, чем задано; `stand_down` — PostgreSQL или Valkey упали или перезапускались.
|
||||
Reference in New Issue
Block a user