forked from mtusi2026/mtusi2026lab2
TypeScript/Node API на PostgreSQL с сессиями в Valkey (AOF), миграции, compose-стенд, restart hook, тесты уровня 4 и эксперимент трека 2 (планы запроса на 240k сообщений, стоимость записи, backup/restore).
496 lines
15 KiB
JSON
496 lines
15 KiB
JSON
{
|
|
"env": {
|
|
"postgres": "17.6",
|
|
"shared_buffers": "128MB",
|
|
"synchronous_commit": "on",
|
|
"docker": "OrbStack, 11 CPU, 9434726400 B RAM"
|
|
},
|
|
"dataset": {
|
|
"messages_total": 239717,
|
|
"track2_chats": 300,
|
|
"chat_size_max": 60000,
|
|
"chat_size_p50": 146,
|
|
"chat_size_min": 64,
|
|
"top10_share": 0.618,
|
|
"messages_table_bytes": 73785344,
|
|
"pk_index_bytes": 9633792
|
|
},
|
|
"chats": {
|
|
"large": {
|
|
"size": 60000,
|
|
"offset": 30000
|
|
},
|
|
"medium": {
|
|
"size": 1013,
|
|
"offset": 506
|
|
},
|
|
"small": {
|
|
"size": 64,
|
|
"offset": 32
|
|
}
|
|
},
|
|
"variants": {
|
|
"V0 PK only": {
|
|
"index_build_s": 0.0,
|
|
"index_bytes": 0,
|
|
"queries": {
|
|
"first page (API) / large": {
|
|
"median_ms": 25.559,
|
|
"min_ms": 22.098,
|
|
"buffers": 9030,
|
|
"rows_touched": 239718,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"first page (API) / medium": {
|
|
"median_ms": 25.16,
|
|
"min_ms": 21.963,
|
|
"buffers": 9030,
|
|
"rows_touched": 239718,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"first page (API) / small": {
|
|
"median_ms": 29.764,
|
|
"min_ms": 23.438,
|
|
"buffers": 9030,
|
|
"rows_touched": 239715,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"middle page keyset (API) / large": {
|
|
"median_ms": 25.172,
|
|
"min_ms": 23.475,
|
|
"buffers": 9030,
|
|
"rows_touched": 239718,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"middle page keyset (API) / medium": {
|
|
"median_ms": 23.408,
|
|
"min_ms": 19.072,
|
|
"buffers": 9030,
|
|
"rows_touched": 239718,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"middle page keyset (API) / small": {
|
|
"median_ms": 21.248,
|
|
"min_ms": 18.796,
|
|
"buffers": 9030,
|
|
"rows_touched": 239715,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"middle page keyset + created_at >= / large": {
|
|
"median_ms": 28.129,
|
|
"min_ms": 26.33,
|
|
"buffers": 9030,
|
|
"rows_touched": 239718,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"middle page keyset + created_at >= / medium": {
|
|
"median_ms": 26.974,
|
|
"min_ms": 23.012,
|
|
"buffers": 9030,
|
|
"rows_touched": 239718,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"middle page keyset + created_at >= / small": {
|
|
"median_ms": 24.638,
|
|
"min_ms": 23.061,
|
|
"buffers": 9030,
|
|
"rows_touched": 239715,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"middle page OFFSET / large": {
|
|
"median_ms": 81.353,
|
|
"min_ms": 64.787,
|
|
"buffers": 9088,
|
|
"rows_touched": 239718,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"middle page OFFSET / medium": {
|
|
"median_ms": 25.937,
|
|
"min_ms": 25.476,
|
|
"buffers": 9088,
|
|
"rows_touched": 239718,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"middle page OFFSET / small": {
|
|
"median_ms": 32.843,
|
|
"min_ms": 25.142,
|
|
"buffers": 9088,
|
|
"rows_touched": 239715,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
}
|
|
},
|
|
"write": {
|
|
"bulk_50k_ms_median": 2158.3,
|
|
"bulk_50k_ms": [
|
|
1779.713,
|
|
2495.609,
|
|
2158.347
|
|
],
|
|
"pgbench_tps_median": 2237.1,
|
|
"pgbench_tps": [
|
|
717.137925,
|
|
2237.08345,
|
|
2524.645924
|
|
],
|
|
"pgbench_latency_ms_median": 3.576
|
|
}
|
|
},
|
|
"V1 (chat_id)": {
|
|
"index_build_s": 0.299,
|
|
"index_bytes": 1744896,
|
|
"queries": {
|
|
"first page (API) / large": {
|
|
"median_ms": 35.605,
|
|
"min_ms": 31.245,
|
|
"buffers": 9055,
|
|
"rows_touched": 60000,
|
|
"plan": "Limit > Gather Merge > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"first page (API) / medium": {
|
|
"median_ms": 4.349,
|
|
"min_ms": 4.113,
|
|
"buffers": 965,
|
|
"rows_touched": 1013,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"first page (API) / small": {
|
|
"median_ms": 0.547,
|
|
"min_ms": 0.416,
|
|
"buffers": 72,
|
|
"rows_touched": 64,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"middle page keyset (API) / large": {
|
|
"median_ms": 24.591,
|
|
"min_ms": 22.198,
|
|
"buffers": 9055,
|
|
"rows_touched": 60000,
|
|
"plan": "Limit > Gather Merge > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"middle page keyset (API) / medium": {
|
|
"median_ms": 3.597,
|
|
"min_ms": 2.878,
|
|
"buffers": 965,
|
|
"rows_touched": 1013,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"middle page keyset (API) / small": {
|
|
"median_ms": 0.638,
|
|
"min_ms": 0.396,
|
|
"buffers": 72,
|
|
"rows_touched": 64,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"middle page keyset + created_at >= / large": {
|
|
"median_ms": 35.804,
|
|
"min_ms": 32.3,
|
|
"buffers": 9031,
|
|
"rows_touched": 60000,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"middle page keyset + created_at >= / medium": {
|
|
"median_ms": 3.128,
|
|
"min_ms": 2.654,
|
|
"buffers": 965,
|
|
"rows_touched": 1013,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"middle page keyset + created_at >= / small": {
|
|
"median_ms": 0.437,
|
|
"min_ms": 0.35,
|
|
"buffers": 72,
|
|
"rows_touched": 64,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"middle page OFFSET / large": {
|
|
"median_ms": 42.147,
|
|
"min_ms": 36.78,
|
|
"buffers": 9055,
|
|
"rows_touched": 60000,
|
|
"plan": "Limit > Gather Merge > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"middle page OFFSET / medium": {
|
|
"median_ms": 3.011,
|
|
"min_ms": 2.724,
|
|
"buffers": 965,
|
|
"rows_touched": 1013,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"middle page OFFSET / small": {
|
|
"median_ms": 0.399,
|
|
"min_ms": 0.367,
|
|
"buffers": 72,
|
|
"rows_touched": 64,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
}
|
|
},
|
|
"write": {
|
|
"bulk_50k_ms_median": 1173.6,
|
|
"bulk_50k_ms": [
|
|
1173.602,
|
|
1115.078,
|
|
1515.873
|
|
],
|
|
"pgbench_tps_median": 1820.2,
|
|
"pgbench_tps": [
|
|
1820.161379,
|
|
2070.254695,
|
|
915.294613
|
|
],
|
|
"pgbench_latency_ms_median": 4.395
|
|
}
|
|
},
|
|
"V2 (chat_id, created_at)": {
|
|
"index_build_s": 0.345,
|
|
"index_bytes": 9756672,
|
|
"queries": {
|
|
"first page (API) / large": {
|
|
"median_ms": 0.143,
|
|
"min_ms": 0.134,
|
|
"buffers": 25,
|
|
"rows_touched": 52,
|
|
"plan": "Limit > Incremental Sort > Index Scan exp_idx"
|
|
},
|
|
"first page (API) / medium": {
|
|
"median_ms": 0.344,
|
|
"min_ms": 0.299,
|
|
"buffers": 63,
|
|
"rows_touched": 52,
|
|
"plan": "Limit > Incremental Sort > Index Scan exp_idx"
|
|
},
|
|
"first page (API) / small": {
|
|
"median_ms": 0.386,
|
|
"min_ms": 0.342,
|
|
"buffers": 63,
|
|
"rows_touched": 52,
|
|
"plan": "Limit > Incremental Sort > Index Scan exp_idx"
|
|
},
|
|
"middle page keyset (API) / large": {
|
|
"median_ms": 0.193,
|
|
"min_ms": 0.151,
|
|
"buffers": 21,
|
|
"rows_touched": 53,
|
|
"plan": "Limit > Incremental Sort > Index Scan exp_idx"
|
|
},
|
|
"middle page keyset (API) / medium": {
|
|
"median_ms": 0.604,
|
|
"min_ms": 0.307,
|
|
"buffers": 66,
|
|
"rows_touched": 53,
|
|
"plan": "Limit > Incremental Sort > Index Scan exp_idx"
|
|
},
|
|
"middle page keyset (API) / small": {
|
|
"median_ms": 0.37,
|
|
"min_ms": 0.279,
|
|
"buffers": 44,
|
|
"rows_touched": 32,
|
|
"plan": "Limit > Incremental Sort > Index Scan exp_idx"
|
|
},
|
|
"middle page keyset + created_at >= / large": {
|
|
"median_ms": 0.345,
|
|
"min_ms": 0.203,
|
|
"buffers": 21,
|
|
"rows_touched": 53,
|
|
"plan": "Limit > Incremental Sort > Index Scan exp_idx"
|
|
},
|
|
"middle page keyset + created_at >= / medium": {
|
|
"median_ms": 0.488,
|
|
"min_ms": 0.365,
|
|
"buffers": 66,
|
|
"rows_touched": 53,
|
|
"plan": "Limit > Incremental Sort > Index Scan exp_idx"
|
|
},
|
|
"middle page keyset + created_at >= / small": {
|
|
"median_ms": 0.425,
|
|
"min_ms": 0.389,
|
|
"buffers": 41,
|
|
"rows_touched": 32,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx"
|
|
},
|
|
"middle page OFFSET / large": {
|
|
"median_ms": 80.175,
|
|
"min_ms": 70.332,
|
|
"buffers": 9088,
|
|
"rows_touched": 239718,
|
|
"plan": "Limit > Gather Merge > Sort > Seq Scan"
|
|
},
|
|
"middle page OFFSET / medium": {
|
|
"median_ms": 2.533,
|
|
"min_ms": 2.31,
|
|
"buffers": 554,
|
|
"rows_touched": 558,
|
|
"plan": "Limit > Incremental Sort > Index Scan exp_idx"
|
|
},
|
|
"middle page OFFSET / small": {
|
|
"median_ms": 0.738,
|
|
"min_ms": 0.45,
|
|
"buffers": 75,
|
|
"rows_touched": 64,
|
|
"plan": "Limit > Incremental Sort > Index Scan exp_idx"
|
|
}
|
|
},
|
|
"write": {
|
|
"bulk_50k_ms_median": 1747.7,
|
|
"bulk_50k_ms": [
|
|
2169.21,
|
|
1747.667,
|
|
1210.19
|
|
],
|
|
"pgbench_tps_median": 1337.9,
|
|
"pgbench_tps": [
|
|
1337.947649,
|
|
1265.008351,
|
|
1626.184355
|
|
],
|
|
"pgbench_latency_ms_median": 5.979
|
|
}
|
|
},
|
|
"V3 (chat_id, created_at, id)": {
|
|
"index_build_s": 0.485,
|
|
"index_bytes": 14139392,
|
|
"queries": {
|
|
"first page (API) / large": {
|
|
"median_ms": 0.223,
|
|
"min_ms": 0.129,
|
|
"buffers": 15,
|
|
"rows_touched": 51,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"first page (API) / medium": {
|
|
"median_ms": 0.422,
|
|
"min_ms": 0.242,
|
|
"buffers": 53,
|
|
"rows_touched": 51,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"first page (API) / small": {
|
|
"median_ms": 0.541,
|
|
"min_ms": 0.322,
|
|
"buffers": 53,
|
|
"rows_touched": 51,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"middle page keyset (API) / large": {
|
|
"median_ms": 0.262,
|
|
"min_ms": 0.115,
|
|
"buffers": 11,
|
|
"rows_touched": 51,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"middle page keyset (API) / medium": {
|
|
"median_ms": 0.454,
|
|
"min_ms": 0.433,
|
|
"buffers": 55,
|
|
"rows_touched": 51,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"middle page keyset (API) / small": {
|
|
"median_ms": 0.491,
|
|
"min_ms": 0.455,
|
|
"buffers": 35,
|
|
"rows_touched": 31,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"middle page keyset + created_at >= / large": {
|
|
"median_ms": 0.116,
|
|
"min_ms": 0.097,
|
|
"buffers": 11,
|
|
"rows_touched": 51,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"middle page keyset + created_at >= / medium": {
|
|
"median_ms": 0.233,
|
|
"min_ms": 0.194,
|
|
"buffers": 55,
|
|
"rows_touched": 51,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"middle page keyset + created_at >= / small": {
|
|
"median_ms": 0.35,
|
|
"min_ms": 0.237,
|
|
"buffers": 41,
|
|
"rows_touched": 31,
|
|
"plan": "Limit > Sort > Bitmap Heap Scan > Bitmap Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"middle page OFFSET / large": {
|
|
"median_ms": 15.321,
|
|
"min_ms": 13.814,
|
|
"buffers": 6145,
|
|
"rows_touched": 30051,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"middle page OFFSET / medium": {
|
|
"median_ms": 1.883,
|
|
"min_ms": 1.576,
|
|
"buffers": 545,
|
|
"rows_touched": 557,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
},
|
|
"middle page OFFSET / small": {
|
|
"median_ms": 0.377,
|
|
"min_ms": 0.248,
|
|
"buffers": 67,
|
|
"rows_touched": 64,
|
|
"plan": "Limit > Index Scan messages_chat_created_id_idx"
|
|
}
|
|
},
|
|
"write": {
|
|
"bulk_50k_ms_median": 1061.7,
|
|
"bulk_50k_ms": [
|
|
899.73,
|
|
1367.955,
|
|
1061.711
|
|
],
|
|
"pgbench_tps_median": 1659.2,
|
|
"pgbench_tps": [
|
|
1851.131479,
|
|
981.989419,
|
|
1659.177954
|
|
],
|
|
"pgbench_latency_ms_median": 4.822
|
|
}
|
|
}
|
|
},
|
|
"backup_restore": {
|
|
"dump_bytes": 16135498,
|
|
"dump_s": 3.37,
|
|
"restore_s": {
|
|
"jobs_1": 3.76,
|
|
"jobs_4": 4.01
|
|
},
|
|
"messages_before_dump": 239717,
|
|
"during_dump_committed_in_source": 13,
|
|
"during_dump_in_restore": 1,
|
|
"fingerprint_equal": true,
|
|
"api_page_equal": true,
|
|
"fingerprint": [
|
|
[
|
|
"users",
|
|
"1019",
|
|
"42d7e548b2d4ee91736961faca386d0a"
|
|
],
|
|
[
|
|
"chats",
|
|
"306",
|
|
"d2541ecae4fa59a1f1192498d0f5b4e0"
|
|
],
|
|
[
|
|
"chat_members",
|
|
"3295",
|
|
"4f1cf6a7c65e7a56c072c20877d7d28f"
|
|
],
|
|
[
|
|
"messages",
|
|
"239717",
|
|
"1c0251c775eecc3ffc43c28b81084eea"
|
|
],
|
|
[
|
|
"schema_migrations",
|
|
"1",
|
|
"550e0a1f7ef8568bdbe21b29ffb5399b"
|
|
]
|
|
],
|
|
"restored_plan_middle_page_large": "Limit > Index Scan messages_chat_created_id_idx"
|
|
}
|
|
}
|