Commit Graph
9 Commits
Author SHA1 Message Date
ricoromaandClaude Opus 5.5 67cb4d7d9a fix: keep the host awake during bench runs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 07:25:20 +03:00
ricoromaandClaude Opus 5.5 8bc42720d7 feat: add backup and restore stage to bench
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 05:17:41 +03:00
ricoromaandClaude Opus 5.5 a44a576bbc fix: reset app history index per bench size
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 05:04:08 +03:00
ricoromaandClaude Opus 5.5 d2656ab986 feat: compare history indexes on uneven chats in bench
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 04:24:59 +03:00
ricoromaandClaude Opus 5.5 23ceedb954 fix: compare Valkey maxmemory settings between bench labels
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 04:04:15 +03:00
ricoromaandClaude Opus 5.5 e61a0e59e4 refactor: shorten bench matrix to 500k and prefill chunks to 25k
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 03:20:54 +03:00
ricoromaandClaude Opus 5.5 e76eed789f 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>
2026-10-02 01:21:15 +03:00
ricoromaandClaude Opus 5.5 4921afa39d feat: store messenger data in PostgreSQL
Replace the in-memory store with PostgreSQL 18.6: SQLAlchemy 2.1 async
engine on asyncpg, alembic migrations with an async env.py, repos on
AsyncSession and services that own the transaction. Username
uniqueness is enforced by the database (ON CONFLICT), a chat and its
members are created in one transaction, member order is kept in
chat_members.position, and a composite foreign key makes the sender a
member of the chat. History and chat lists use keyset pagination on
(chat_id, created_at, id) and (user_id, created_at, chat_id).

The compose stand runs postgres, a one-shot migrate service on the
API image and the API. All Postgres addresses come from .env without
literals; only the 127.0.0.1 publish address stays literal. make
run_dev starts Postgres and applies migrations before the server, and
make env_setup generates a random Postgres password.

Unavailable PostgreSQL yields 503: get_db_session bounds the request
with asyncio and classifies driver errors. BoundedCloseConnection
limits asyncpg's graceful close, which otherwise waited without limit
on a frozen server and held the request until it was resumed.

Add scripts/restart.sh for make test-persistence and make
test_isolated, which runs the image on a throwaway test database.
Remove make run_no_compose. X-User-Id identification is unchanged
until the session-auth change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 15:33:49 +03:00
ricoromaandClaude Opus 5.5 7b775a29a9 chore: carry over lab 1 solution into lab 2 skeleton
Copy the committed lab 1 sources as-is: src/, student-tests/, bench/,
Dockerfile, docker-compose.yml, pyproject.toml, uv.lock,
.python-version, config_example.toml, AGENTS.md, CLAUDE.md, .claude/,
openspec/, .graphifyignore and KNOWN_ISSUES.md. Lab 1 evidence stays
in the lab 1 repository.

Merge the new skeleton files with own sections: Makefile (lab 2
targets plus own run, docker, bench and common targets), .gitignore,
.dockerignore and .env.example. Rename the image to
mtusi-messenger:lab2 and point AGENTS.md at lab 2.

The application is still the in-memory lab 1 implementation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:11:46 +03:00