feat: run load bench on PostgreSQL with query plans

- bench stand is a separate compose project mtusi-bench (API, Postgres,
  Valkey) with fixed limits, fresh volume per size and migrations
- k6 registers with a password, logs in with Basic and sends Bearer
- VACUUM (ANALYZE) and CHECKPOINT after prefill
- EXPLAIN (ANALYZE, BUFFERS) of the app's history query via auto_explain,
  plus the same query without the index in a rolled back transaction
- Postgres CPU, table and index size in results; storages in passport
- bench_compare checks storage limits, images and settings
- remove inproc.py and make bench_inproc

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 01:21:15 +03:00
co-authored by Claude Opus 5.5
parent 5582302d68
commit e76eed789f
23 changed files with 2443 additions and 1084 deletions
+15 -8
View File
@@ -1,5 +1,7 @@
// Пользователи и два чата стенда: читаемый (сценарий read) и чат записи
// (сценарий write). Итог — fixture.json в рабочем каталоге.
// (сценарий write). Каждый пользователь регистрируется с паролем и входит по
// Basic; в фикстуру идут id и Bearer-токены, пароли — нет. Итог —
// fixture.json в рабочем каталоге: оркестратор удаляет его в конце прогона.
import { WORK_DIR, createChat, register } from "./lib.js";
const MEMBERS = Number(__ENV.MEMBERS || 10);
@@ -11,19 +13,24 @@ export const options = {
};
export function setup() {
// размер начинается с пустого процесса, поэтому имени хватает времени
// размер начинается с пустой базы, поэтому имени хватает времени
const stamp = Date.now().toString(36);
const readerId = register(`b${stamp}_reader`, "Bench reader");
const tokens = {};
const reader = register(`b${stamp}_reader`, "Bench reader");
tokens[reader.id] = reader.token;
const memberIds = [];
for (let i = 0; i < MEMBERS; i++) {
memberIds.push(register(`b${stamp}_m${i}`, `Bench member ${i}`));
const member = register(`b${stamp}_m${i}`, `Bench member ${i}`);
tokens[member.id] = member.token;
memberIds.push(member.id);
}
const everyone = [readerId, ...memberIds];
const everyone = [reader.id, ...memberIds];
return {
readerId,
readerId: reader.id,
memberIds,
readChatId: createChat(readerId, "bench read", everyone),
writeChatId: createChat(readerId, "bench write", everyone),
tokens,
readChatId: createChat(reader.token, "bench read", everyone),
writeChatId: createChat(reader.token, "bench write", everyone),
};
}