- 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>
42 lines
1.5 KiB
JavaScript
42 lines
1.5 KiB
JavaScript
// Пользователи и два чата стенда: читаемый (сценарий read) и чат записи
|
|
// (сценарий write). Каждый пользователь регистрируется с паролем и входит по
|
|
// Basic; в фикстуру идут id и Bearer-токены, пароли — нет. Итог —
|
|
// fixture.json в рабочем каталоге: оркестратор удаляет его в конце прогона.
|
|
import { WORK_DIR, createChat, register } from "./lib.js";
|
|
|
|
const MEMBERS = Number(__ENV.MEMBERS || 10);
|
|
|
|
export const options = {
|
|
vus: 1,
|
|
iterations: 1,
|
|
setupTimeout: "60s",
|
|
};
|
|
|
|
export function setup() {
|
|
// размер начинается с пустой базы, поэтому имени хватает времени
|
|
const stamp = Date.now().toString(36);
|
|
const tokens = {};
|
|
const reader = register(`b${stamp}_reader`, "Bench reader");
|
|
tokens[reader.id] = reader.token;
|
|
const memberIds = [];
|
|
for (let i = 0; i < MEMBERS; i++) {
|
|
const member = register(`b${stamp}_m${i}`, `Bench member ${i}`);
|
|
tokens[member.id] = member.token;
|
|
memberIds.push(member.id);
|
|
}
|
|
const everyone = [reader.id, ...memberIds];
|
|
return {
|
|
readerId: reader.id,
|
|
memberIds,
|
|
tokens,
|
|
readChatId: createChat(reader.token, "bench read", everyone),
|
|
writeChatId: createChat(reader.token, "bench write", everyone),
|
|
};
|
|
}
|
|
|
|
export default function () {}
|
|
|
|
export function handleSummary(data) {
|
|
return { [`${WORK_DIR}/fixture.json`]: JSON.stringify(data.setup_data) };
|
|
}
|