lab4: исправления по ревью (парсеры image/text только на upload, rejected-статус прямой загрузки, диапазон 64 KiB, отчёт)

This commit is contained in:
2026-10-22 23:04:05 +03:00
parent f048a37df9
commit 830e5811fc
20 changed files with 933 additions and 805 deletions
+51 -38
View File
@@ -91,9 +91,14 @@ ATTACHMENT_SWEEP_INTERVAL_MS=1000 docker compose --env-file .env up -d --no-deps
`content-length` и `x-amz-checksum-sha256`: S3 сам отвергает тело другого размера (403
`SignatureDoesNotMatch`) или с другим SHA-256 (400 `XAmzContentChecksumMismatch`), объект при этом
не создаётся (`evidence/lab4/presign-spike.txt`). `POST /api/v1/attachments/{id}/complete`
(только владелец): `HEAD` (размер + подписанный checksum), чтение заголовка изображения (диапазон
до 1 MiB, поток обрывается после получения заголовка), сверка типа и пикселей, `markReady`.
Любое несоответствие → компенсация и 409/413/415; повторный `complete` готового — 200. Лимит
(только владелец): `HEAD` (размер + подписанный checksum), чтение заголовка изображения (первый
диапазон 64 KiB, при необходимости расширяется до 1 MiB; объект, целиком попавший в диапазон,
проверяется до конца, включая CRC/EOI), сверка типа и пикселей, `markReady`. Несоответствие
(размер/checksum/тип/пиксели) → 409/413/415, объект удаляется, а строка получает статус
`rejected` и сохраняет `expires_at`: подписанный URL ещё может быть использован, и повторный PUT
оставил бы объект без строки; уборщик удаляет `rejected` после `expires_at` + grace, пока же строка
занимает слот лимита, а повторный `complete` даёт 404. «Upload has not been received» (409)
строку не трогает — клиент может доотправить. Повторный `complete` готового — 200. Лимит
незавершённых заявок на пользователя: `DIRECT_UPLOAD_MAX_PENDING_PER_USER` (429 с `Retry-After`).
Перезапись по тому же URL до истечения TTL возможна только теми же байтами (checksum подписан).
Расширение контракта: `contracts/extensions.openapi.json`; обязательный proxy endpoint не менялся.
@@ -160,14 +165,14 @@ ATTACHMENT_SWEEP_INTERVAL_MS=1000 docker compose --env-file .env up -d --no-deps
| --- | --- | --- | --- |
| Публичный smoke | `make test` | `PASS: lab4 public API scenario` (upload 201 ready, сообщение с `''` и `attachment_ids`, download bob = байты, eve 404) | `make-test.txt` |
| Контракт offline | `make check` | PASS, `contracts/extensions.openapi.json` — валидный JSON | `make-check.txt` |
| 3: S3 в общем стенде, приватный bucket, метаданные в PG, байты в bucket | `make stand-up`; `docker compose ps`; `make consistency` | `s3` healthy, `s3-init` завершён с 0; bucket приватный (`mc anonymous set none`); число объектов в bucket = числу `ready`-строк (1308 после серии `make bench` и e2e), orphans/missing = 0 | `bootstrap-rerun.txt`, `consistency.txt` |
| 3: S3 в общем стенде, приватный bucket, метаданные в PG, байты в bucket | `make stand-up`; `docker compose ps`; `make consistency` | `s3` healthy, `s3-init` завершён с 0; bucket приватный (`mc anonymous set none`); число объектов в bucket = числу `ready`-строк (2577 после серий `make bench` и e2e; ещё 33 `pending` без объектов и 6 `rejected` ждут истечения + grace), orphans/missing = 0 | `bootstrap-rerun.txt`, `consistency.txt` |
| 3: 201 ready, побайтный download, `attachment_ids` | `make test-e2e` (`attachments.e2e-spec.ts`) | sha256 в ответе = sha256 файла; content = байты, `nosniff`, `Content-Length` | `make-test-e2e.txt` |
| 3: PNG/JPEG ≤10 MiB и ≤40 млн px; MIME по содержимому; опасные filename; лимиты до чтения | e2e: 10485760 → 201, 10485761 → 413, pixel bomb 8000×5001 → 413 сразу после IHDR, PNG как `image/jpeg` → 415, `a/b.png`, `\u202E`, NUL, 256 символов → 400, 255×😀 → 201 | все кейсы зелёные, пользовательских 500 нет | `make-test-e2e.txt`, `unit-tests.txt` (`image-inspector.spec.ts`) |
| 3: PNG/JPEG ≤10 MiB и ≤40 млн px; MIME по содержимому; опасные filename; лимиты до чтения | e2e: 10485760 → 201, 10485761 → 413, pixel bomb 8000×5001 → 413 сразу после IHDR, PNG как `image/jpeg` → 415, `a/b.png`, `\u202E`, NUL, 256 символов → 400, 255×😀 → 201 | кейсы перечислены в `app/test/attachments.e2e-spec.ts` (в evidence — итог: 34 passed, 8 skipped opt-in); raw image/text тело на JSON-маршрутах → 415/400, не 500 | `make-test-e2e.txt`, `unit-tests.txt` (`image-inspector.spec.ts`) |
| 3: другая реплика отдаёт файл после остановки загрузившей; restart сохраняет данные | `scripts/stop-one.sh` (обе реплики по очереди), `make test-failover`; `make test-persistence ACTION_SCRIPT=scripts/restart.sh` | failover: 0 неуспешных попыток, восстановление ≈3.3 с; download с тем же sha256 после остановки api-1 и api-2; persistence: `StartedAt` у postgres, redis, s3, api×2, haproxy изменился, данные и сессия сохранены | `failover.txt`, `failover-attachment.txt`, `persistence.txt` |
| 3: на API нет локального файла оригинала | `touch` в корне контейнера | `Read-only file system` | `readonly-api.txt` |
| 4: тесты: большой файл, повреждённое изображение, подмена MIME, чужое `attachment_id`, вложение другого чата, нет 500 | `make test-e2e` | 413; усечённый PNG, флип байта (CRC), сигнатура+мусор, пустое тело → 415; подмена MIME → 415; чужое/неизвестное/незавершённое → 404; вложение чата eve в чате alice → 404 | `make-test-e2e.txt` |
| 4: прерывание загрузки и отказ между S3/БД не оставляют вечных объектов | e2e «client drops the connection»; `make test-dependencies` | обрыв клиента → строк 0 за ≤10 с; S3 down → одна `pending`, после старта и sweep — 0; PG down между PUT и ready → 503, объекта в S3 нет, `pending` убрана sweep; затем `orphans: 0, missing: 0` | `make-test-e2e.txt`, `make-test-dependencies.txt`, `consistency.txt` |
| 4: лимиты, таймауты, потоковая обработка; эксперимент ≥10 загрузок с пиком памяти | `make bench` (proxy, C=10 и C=20, 9.5 MiB) | max Δrss реплики 10.7 MiB при C=10 и 17.9 MiB при C=20 против 95/190 MiB тел в полёте — см. «Эксперименты» | `summary.md`, `bench/*.json` |
| 4: лимиты, таймауты, потоковая обработка; эксперимент ≥10 загрузок с пиком памяти | `make bench` (proxy, C=10 и C=20, 9.5 MiB) | max Δrss реплики 15.7 MiB при C=10 и 16.5 MiB при C=20 против 95/190 MiB тел в полёте — см. «Эксперименты» | `summary.md`, `bench/*.json` |
| 4: идемпотентный bootstrap; отдельные ограниченные credentials; консоль закрыта; private bucket вне API | `docker compose run s3-init` дважды; `make s3-security` | повтор → `bootstrap ok`; анонимные GET/list/PUT → 403; API-credentials не создают bucket, не вызывают admin, не пишут вне `attachments/`, читают `attachments/*`; порт 9001 не опубликован и не отвечает | `bootstrap-rerun.txt`, `s3-security.txt` |
| 5 / трек 1: presigned flow (короткая подпись, уникальный ключ, принадлежность, размер/checksum на complete, незавершённые) | `direct-upload.e2e-spec.ts`; спайк подписи | init → PUT мимо API → complete → metadata/content → сообщение; чужой/посторонний complete → 404; подмена байта → S3 400, затем complete 409; JPEG под видом PNG → 415, затем 404; pixel bomb → 413; 11-я заявка → 429 + `Retry-After` | `make-test-e2e.txt`, `presign-spike.txt` |
| 5 / трек 1: истёкший URL и уборка | `E2E_DIRECT_TTL_SHORT=1` на стенде с TTL 5 с | PUT после `expires_at` → 403, строка убрана уборщиком, complete → 404 | `direct-ttl-short.txt` |
@@ -184,8 +189,8 @@ ATTACHMENT_SWEEP_INTERVAL_MS=1000 docker compose --env-file .env up -d --no-deps
**Методика.** Хост: 8 логических CPU, 16 GiB RAM, один Docker-хост. Лимиты: API 1.5 CPU / 768 MiB на
реплику (2 реплики), MinIO 1 CPU / 512 MiB, PG 1.5 CPU / 512 MiB. Версии — см. «Запуск». Нагрузка:
`scripts/lab4/attachments_bench.py`, closed-loop: C потоков × 5 загрузок несжимаемых PNG
(`noise_png`, разные seed), R = 3 повтора, перед каждым повтором — прогрев (не измеряется) и
`POST /internal/metrics/reset` на каждой реплике. Трафик API — дельта `eth0` rx/tx из `/proc/net/dev`
(`noise_png`, разные seed), R = 3 повтора; один прогрев на конфигурацию (2 × число реплик загрузок,
не измеряется), перед каждым повтором — `POST /internal/metrics/reset` на каждой реплике. Трафик API — дельта `eth0` rx/tx из `/proc/net/dev`
контейнера; RAM — пик `process.memoryUsage().rss` с шагом 50 мс минус RSS в момент reset (Δrss);
в таблицу идёт медиана по повторам, для Δrss — максимум по репликам. Команда: `make bench`
(`scripts/lab4/run_matrix.sh`); raw — `evidence/lab4/bench/*.json` (без токенов и URL).
@@ -201,34 +206,36 @@ S3) до малой величины, не зависящей от размер
| mode | size, MiB | C | API rx/upload, MiB | API tx/upload, MiB | max Δrss, MiB | p50, ms | p95, ms |
| --- | --- | --- | --- | --- | --- | --- | --- |
| direct | 0.12 | 10 | 0.13 | 0.01 | 0.62 | 42 | 62 |
| proxy | 0.12 | 10 | 0.13 | 0.13 | 3.75 | 26 | 53 |
| direct | 1.00 | 10 | 1.01 | 0.01 | 3.88 | 69 | 100 |
| proxy | 1.00 | 10 | 1.01 | 1.01 | 5.12 | 44 | 79 |
| direct | 9.50 | 10 | 0.14 | 0.01 | 0.25 | 377 | 493 |
| proxy | 9.50 | 10 | 9.53 | 9.53 | 10.65 | 212 | 374 |
| proxy | 9.50 | 20 | 9.53 | 9.53 | 17.92 | 414 | 802 |
| direct | 0.12 | 10 | 0.07 | 0.01 | 0.40 | 45 | 65 |
| proxy | 0.12 | 10 | 0.13 | 0.13 | 3.78 | 32 | 62 |
| direct | 1.00 | 10 | 0.07 | 0.01 | 0.75 | 75 | 137 |
| proxy | 1.00 | 10 | 1.01 | 1.01 | 4.38 | 59 | 110 |
| direct | 9.50 | 10 | 0.07 | 0.01 | 0.88 | 346 | 571 |
| proxy | 9.50 | 10 | 9.52 | 9.53 | 15.70 | 239 | 394 |
| proxy | 9.50 | 20 | 9.53 | 9.53 | 16.46 | 409 | 812 |
Выводы:
- **H1 подтверждена с оговоркой.** При C=10 и 9.5 MiB пик Δrss — 10.7 MiB при ≈95 MiB тел в полёте; при
C=20 — 17.9 MiB при ≈190 MiB. Память не пропорциональна размеру файла (размер ×76: 0.12 → 9.5 MiB
дал Δrss 3.75 → 10.65 MiB, ×2.8), но и не строго постоянна: растёт слабо с размером и с
concurrency (буферы сокетов, чанки в полёте, аллокатор). Δrss — шумная величина (между повторами одной
конфигурации 9.0–13.4 MiB для proxy 9.5 MiB C=10 и 2.0–5.5 MiB для proxy 1 MiB).
- **H2 подтверждена частично.** Для proxy tx ≈ rx ≈ size (≈2 × size суммарно: вход от клиента и выход
в S3). Для direct при size > 1 MiB API видит ≈0.14 MiB rx (заголовок изображения) и ≈0.01 MiB tx
независимо от размера, Δrss ≈ 0. **Для size ≤ 1 MiB direct не снижает входящий трафик API:**
`complete` читает диапазон до `IMAGE_HEADER_MAX_BYTES` = 1 MiB, и если он покрывает весь объект,
файл дочитывается до конца для `finish()` (структурная проверка) — rx = size (0.13 и 1.01 MiB);
выигрыш только по tx (≈0.01 против size). Латентность direct выше при малых/средних файлах
(p50 42 против 26 мс, 69 против 44 мс — три запроса вместо одного) и выше на 9.5 MiB
(377 против 212 мс): клиент заливает через loopback в MinIO с лимитом 1 CPU, а не через API; прирост
не объясняется в эксперименте и остаётся гипотезой (вероятно, проверка подписи и checksum в MinIO).
- **H1 подтверждена с оговоркой.** При C=10 и 9.5 MiB пик Δrss — 15.7 MiB (по повторам 14.5–18.1) при
≈95 MiB тел в полёте; при C=20 — 16.5 MiB (12.1–21.0) при ≈190 MiB: удвоение concurrency в пределах
шума не изменило пик. Память не пропорциональна размеру файла (размер ×76: 0.12 → 9.5 MiB дал Δrss
3.78 → 15.7 MiB, ×4.2), но и не постоянна: растёт с размером (буферы сокетов, чанки в полёте,
аллокатор), оставаясь на порядок меньше тел в полёте. Δrss — шумная величина (между повторами одной
конфигурации 1.9–6.3 MiB для proxy 0.12/1 MiB), поэтому разница между C=10 и C=20 не интерпретируется.
- **H2 подтверждена.** Для proxy tx ≈ rx ≈ size (≈2 × size суммарно: вход от клиента и выход в S3).
Для direct при любом из трёх размеров API видит ≈0.07 MiB rx (первый диапазон 64 KiB + служебные
запросы) и ≈0.01 MiB tx, Δrss ≤ 0.9 MiB. Для размера 0.12 MiB выигрыш по rx вдвое (0.13 → 0.07),
по tx — на порядок. Латентность direct выше (p50 45 против 32 мс, 75 против 59 мс — три запроса
вместо одного) и на 9.5 MiB (346 против 239 мс): клиент заливает через loopback в MinIO с лимитом
1 CPU, а не через API; причина прироста в эксперименте не выяснялась и остаётся гипотезой (вероятно,
проверка подписи и checksum в MinIO). Первая версия `complete` читала диапазон до 1 MiB и
останавливалась по заголовку: сокет к этому моменту уже вычитывал 110–176 KB (read-ahead), а для файлов
≤ 1 MiB объект читался целиком (rx = size). Это нашло ревью; диапазон 64 KiB убрал оба эффекта.
**Ограничения измерений.** Один Docker-хост: клиент, LB, API и MinIO делят 8 CPU, без реальной сети;
`/proc/net/dev` реплики включает трафик PG/Redis и служебные запросы метрик (≈7–8 KiB на загрузку,
видно в tx у direct); closed-loop клиент не моделирует arrival rate; выборка RSS 50 мс может
видно в tx у direct; метрики и конфигурация берутся прогонами `docker exec`, но их трафик в
измеряемое окно не входит, кроме двух чтений метрик); closed-loop клиент не моделирует arrival rate; выборка RSS 50 мс может
пропустить короткий пик; нет TLS (до lab7); Python-клиент сам ограничен по CPU, поэтому абсолютные
латентности не переносимы.
@@ -238,9 +245,9 @@ S3) до малой величины, не зависящей от размер
| --- | --- | --- | --- |
| S3 остановлен (`compose stop s3`) | вложения → bounded 503; текст, история, метаданные, `/health/ready` работают | upload → 503 `unavailable` без утечки деталей; метаданные 200; content 503; текстовое сообщение 201; readiness 200; одна `pending`-строка неудачной загрузки | после `start s3` и healthy download старого файла 200 с теми же байтами, новый upload 201; `pending` убрана sweep; потерь нет |
| PostgreSQL остановлен между S3 PUT и `ready` | 503; объект не должен остаться | ответ 503; объект в S3 компенсирован (`mc stat` — нет), `pending`-строка осталась (БД недоступна) | после старта PG и `waitForReadiness`; строка убрана sweep после `expires_at`; `orphans: 0` |
| Обрыв клиента посреди загрузки (512 KiB из 2 MiB) | не остаётся ни строки, ни объекта | `AbortError` у PUT (без ожидания тайм-аута), компенсация, строк в чате 0 | ≤10 с (предел ожидания теста; точное время не измерялось) |
| Обрыв клиента посреди загрузки (512 KiB из 2 MiB) | не остаётся ни строки, ни объекта | PUT прерывается (`S3 put failed: AbortError` в логе API, в evidence не сохранён) без ожидания тайм-аута, компенсация, строк в чате 0 | ≤10 с (предел ожидания теста; точное время не измерялось) |
| Остановка обслужившей реплики | другая реплика отдаёт тот же файл | download 200, тот же sha256, другой `X-Instance-Id` для api-1 и api-2 | ≈3.3 с до первого успешного запроса, 0 неуспешных записей из 134–140 |
| Restart стенда (`scripts/restart.sh`) | метаданные и оригиналы сохраняются, сессия жива | persistence PASS; `StartedAt` всех сервисов изменился | весь прогон `make test-persistence` — 11 с; потерь нет |
| Restart стенда (`scripts/restart.sh`) | метаданные и оригиналы сохраняются, сессия жива | persistence PASS; `StartedAt` всех сервисов изменился | потерь нет (время до готовности отдельно не измерялось) |
| Истёкший presigned URL | PUT отвергается, заявка убирается | PUT → 403; строка убрана уборщиком; complete → 404 | TTL (5 с в прогоне) + grace 0 + период уборщика 1 с |
| Подмена байтов / размера при прямой загрузке | S3 отвергает, объект не создаётся | 400 `XAmzContentChecksumMismatch` / 403 `SignatureDoesNotMatch`; complete → 409 | заявка остаётся до TTL, клиент может доотправить |
@@ -249,22 +256,28 @@ S3) до малой величины, не зависящей от размер
- **MinIO:** закреплён образ `RELEASE.2025-09-07T16-13-09Z`; по данным, использованным при планировании,
репозиторий `minio/minio` архивирован — новых образов и исправлений не будет *(в этой сессии не
перепроверялось)*. Для продакшена потребуется замена (SeaweedFS/RustFS) или форк.
- **Прямой путь не проверяет структуру хвоста файла** при size > 1 MiB: только заголовок (до 1 MiB) и
- **Прямой путь не проверяет структуру хвоста файла** при size > 64 KiB: только заголовок (первые 64 KiB, при необходимости до 1 MiB) и
подписанный SHA-256/размер. Байты гарантированно те, что заявил клиент, но заявил он их сам;
усечённый или «склеенный» файл с корректным заголовком пройдёт `complete`. В proxy-режиме проверяется
весь поток (CRC чанков PNG, EOI JPEG). Для size ≤ 1 MiB direct проверяет всё, ценой входящего
весь поток (CRC чанков PNG, EOI JPEG). Для size ≤ 64 KiB direct проверяет всё, ценой входящего
трафика API.
- **Гонка лимита заявок:** `countPendingDirect` и `insertPending` не атомарны — параллельные `init`
одного пользователя могут превысить лимит на число параллельных запросов; для лабораторной принято.
- **Загрузка, не доставленная до `ready`, видна уборщику только через grace (по умолчанию 15 мин):**
до этого объект занимает место; для быстрой очистки в тестах grace уменьшается переменной окружения.
- **Недоступность S3 при `compensate`** оставляет объект, если сам `DeleteObject` не прошёл; его
убирает уборщик, но объект без строки (если строка уже удалена вручную) обнаружит только
`make consistency` — автоматического reconciler'а для orphan-объектов без строки нет (это трек 2).
убирает уборщик по строке. Объект без строки (например, строку удалили вручную) обнаружит только
`make consistency` — автоматического reconciler'а для orphan-объектов нет (это трек 2).
- **Порядок компенсации proxy:** сначала удаляется объект, затем строка. Если `markReady` на самом деле
зафиксирован, а клиент БД увидел обрыв соединения, объект будет удалён у строки `ready` (потеря данных;
`object_missing` → 500 на download). Обратный порядок противоречил бы требованию «объекта не должно
остаться при отказе PG»; окно — доли секунды между commit и обрывом, принято как ограничение.
- **Таймаут загрузки** уничтожает тело (и сокет) — клиент может получить обрыв соединения вместо
ожидаемого 400 «Upload was interrupted»; строка и объект при этом компенсируются.
- **TLS нет** до lab7: presigned URL и токены ходят по HTTP; консоль MinIO отключена полностью, поэтому
администрирование — только через `mc` из контейнера.
- **Не реализовано:** варианты вложений (`variants` всегда `[]`; `variant=thumbnail|crop|optimized` → 404),
delete-API вложений, WebP.
- **Подтверждено измерением:** потоковый proxy ограничивает память, direct уменьшает tx API и rx API для
файлов > 1 MiB. **Остаётся гипотезой:** причина роста латентности direct на 9.5 MiB; зависимость Δrss от
- **Подтверждено измерением:** потоковый proxy ограничивает память, direct уменьшает tx и rx API для
любого из проверенных размеров. **Остаётся гипотезой:** причина роста латентности direct на 9.5 MiB; зависимость Δrss от
concurrency за пределами C=20.
+1 -1
View File
@@ -20,7 +20,7 @@ export type AttachmentRow = {
filename: string;
content_type: 'image/png' | 'image/jpeg';
upload_mode: 'proxy' | 'direct';
status: 'pending' | 'ready' | 'deleting';
status: 'pending' | 'ready' | 'deleting' | 'rejected';
object_key: string;
size_bytes: string | number | null;
sha256: string | null;
+12 -2
View File
@@ -75,6 +75,15 @@ export class AttachmentsRepository {
);
}
async rejectPending(id: string): Promise<void> {
await this.database.query(
'attachments.reject_pending',
`UPDATE attachments SET status = 'rejected', updated_at = now()
WHERE id = $1 AND status = 'pending'`,
[id],
);
}
async findVisible(
id: string,
userId: string,
@@ -106,7 +115,8 @@ export class AttachmentsRepository {
const result = await this.database.query<{ count: string }>(
'attachments.count_pending_direct',
`SELECT count(*) AS count FROM attachments
WHERE owner_id = $1 AND status = 'pending' AND upload_mode = 'direct'`,
WHERE owner_id = $1 AND status IN ('pending', 'rejected')
AND upload_mode = 'direct' AND expires_at > now()`,
[ownerId],
);
return Number(result.rows[0].count);
@@ -134,7 +144,7 @@ export class AttachmentsRepository {
`UPDATE attachments SET status = 'deleting', updated_at = now()
WHERE id IN (
SELECT id FROM attachments
WHERE (status = 'pending'
WHERE (status IN ('pending', 'rejected')
AND expires_at < now() - make_interval(secs => $1::double precision))
OR (status = 'deleting' AND updated_at < now() - interval '1 minute')
ORDER BY expires_at NULLS FIRST
+66 -31
View File
@@ -13,15 +13,20 @@ import { ChatsService } from '../chats/chats.service.js';
import { MetricsService } from '../metrics/metrics.service.js';
import { ObjectStorage } from '../storage/object-storage.js';
import type { User } from '../users/user.js';
import { toAttachment, type Attachment } from './attachment.js';
import {
toAttachment,
type Attachment,
type AttachmentRow,
} from './attachment.js';
import { AttachmentsRepository } from './attachments.repository.js';
import { AttachmentsService, imageRejection } from './attachments.service.js';
import { imageRejection } from './attachments.service.js';
import type { CreateDirectUploadDto } from './dto/create-direct-upload.dto.js';
import { validateFilename } from './filename.js';
import {
IMAGE_HEADER_MAX_BYTES,
ImageInspector,
ImageRejectedError,
type ImageHeader,
} from './image/image-inspector.js';
export type DirectUpload = {
@@ -32,6 +37,7 @@ export type DirectUpload = {
expires_at: string;
};
const FIRST_RANGE_BYTES = 65_536;
const MEDIA_TYPES = new Set(['image/png', 'image/jpeg']);
@Injectable()
@@ -47,7 +53,6 @@ export class DirectUploadsService {
private readonly storage: ObjectStorage,
private readonly chats: ChatsService,
private readonly metrics: MetricsService,
private readonly attachments: AttachmentsService,
) {
this.maxUploadBytes = config.getOrThrow('MAX_UPLOAD_BYTES');
this.maxPixels = config.getOrThrow('MAX_IMAGE_PIXELS');
@@ -141,47 +146,25 @@ export class DirectUploadsService {
if (head === null)
throw new ConflictException('Upload has not been received');
if (head.size !== size || head.checksumSha256 !== expectedChecksum) {
await this.attachments.compensate(row.id, row.object_key);
await this.reject(row);
throw new ConflictException(
'Uploaded object does not match the declaration',
);
}
// Only the header is read: the signed checksum already pins every byte.
const inspector = new ImageInspector(this.maxPixels);
const covered = size <= IMAGE_HEADER_MAX_BYTES;
const stream = await this.storage.getStream(
row.object_key,
`bytes=0-${Math.min(size, IMAGE_HEADER_MAX_BYTES) - 1}`,
);
if (stream === null)
throw new ConflictException('Upload has not been received');
let verified = 0;
let header: ImageHeader;
try {
for await (const chunk of stream as AsyncIterable<Buffer>) {
verified += chunk.length;
inspector.push(chunk);
if (!covered && inspector.header !== undefined) break;
}
if (covered) inspector.finish();
else if (inspector.header === undefined)
throw new ImageRejectedError(
'unsupported_media_type',
'Image header is missing',
);
header = await this.readHeader(row.object_key, size);
} catch (error) {
if (error instanceof ImageRejectedError) {
await this.attachments.compensate(row.id, row.object_key);
await this.reject(row);
throw imageRejection(error);
}
throw error;
} finally {
stream.destroy();
this.metrics.add('attachments.direct.verify_bytes', verified);
}
const header = inspector.header;
if (header === undefined || header.contentType !== row.content_type) {
await this.attachments.compensate(row.id, row.object_key);
if (header.contentType !== row.content_type) {
await this.reject(row);
throw new UnsupportedMediaTypeException(
'Image content does not match content_type',
);
@@ -196,4 +179,56 @@ export class DirectUploadsService {
this.metrics.increment('attachments.direct.completed');
return toAttachment(ready);
}
/**
* Reads a small first range and widens it only when the header is not in it,
* so the usual `complete` costs one short ranged GET. A range that covers the
* whole object is also checked for structural completeness.
*/
private async readHeader(key: string, size: number): Promise<ImageHeader> {
const ceiling = Math.min(size, IMAGE_HEADER_MAX_BYTES);
let range = Math.min(size, FIRST_RANGE_BYTES);
for (;;) {
const inspector = new ImageInspector(this.maxPixels);
const stream = await this.storage.getStream(
key,
`bytes=0-${range - 1}`,
);
if (stream === null)
throw new ConflictException('Upload has not been received');
let verified = 0;
try {
for await (const chunk of stream as AsyncIterable<Buffer>) {
verified += chunk.length;
inspector.push(chunk);
}
} finally {
stream.destroy();
this.metrics.add('attachments.direct.verify_bytes', verified);
}
if (range === size) return inspector.finish();
if (inspector.header !== undefined) return inspector.header;
if (range >= ceiling)
throw new ImageRejectedError(
'unsupported_media_type',
'Image header is missing',
);
range = ceiling;
}
}
/**
* A rejected claim keeps its row (status `rejected`, original expiry) while
* the signed URL may still be used: a later re-PUT would otherwise leave an
* object that no row refers to. The sweeper removes both after expiry + grace.
*/
private async reject(row: AttachmentRow): Promise<void> {
await this.repository.rejectPending(row.id);
try {
await this.storage.delete(row.object_key);
} catch {
// The sweeper deletes the object again after expiry.
}
this.metrics.increment('attachments.direct.rejected');
}
}
@@ -0,0 +1,8 @@
-- Rejected direct uploads keep their row until the signed URL can no longer be
-- used, so an object re-PUT after rejection is still found by the sweeper.
ALTER TABLE attachments DROP CONSTRAINT attachments_status_check;
ALTER TABLE attachments ADD CONSTRAINT attachments_status_check
CHECK (status IN ('pending', 'ready', 'deleting', 'rejected'));
DROP INDEX attachments_owner_direct_pending_idx;
CREATE INDEX attachments_owner_direct_pending_idx ON attachments (owner_id)
WHERE status IN ('pending', 'rejected') AND upload_mode = 'direct';
+42 -9
View File
@@ -1,7 +1,12 @@
import { NestFactory } from '@nestjs/core';
import { HttpAdapterHost } from '@nestjs/core';
import { ConfigService } from '@nestjs/config';
import { ValidationPipe } from '@nestjs/common';
import {
PayloadTooLargeException,
UnsupportedMediaTypeException,
ValidationPipe,
} from '@nestjs/common';
import type { Readable } from 'node:stream';
import {
FastifyAdapter,
NestFastifyApplication,
@@ -11,24 +16,52 @@ import { HealthService } from './health/health.service.js';
import { MetricsService } from './metrics/metrics.service.js';
import { RequestIdInterceptor } from './common/http/request-id.interceptor.js';
const TEXT_BODY_LIMIT = 1_048_576;
const UPLOAD_ROUTE = '/api/v1/chats/:chatId/attachments';
async function bootstrap(): Promise<void> {
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter({ logger: true }),
);
// Raw image bodies reach the controller as an unread stream: the upload is
// bounded by our own checks, not by Fastify's bodyLimit.
// bounded by our own checks, not by Fastify's bodyLimit. A stream may reach
// only the upload route: on JSON routes it would hit the ValidationPipe and
// overflow the stack there, so other routes keep the pre-upload behavior.
const fastify = app.getHttpAdapter().getInstance();
type ParserRequest = { method: string; routeOptions?: { url?: string } };
type Done = (error: Error | null, body?: unknown) => void;
const isUpload = (request: ParserRequest) =>
request.method === 'POST' && request.routeOptions?.url === UPLOAD_ROUTE;
fastify.addContentTypeParser(
['image/png', 'image/jpeg'],
(request: ParserRequest, payload: unknown, done: Done) =>
isUpload(request)
? done(null, payload)
: done(new UnsupportedMediaTypeException()),
);
// Fastify's built-in text/plain parser buffers the body and fails binary
// input with 400; the upload service answers 415 for it instead.
// input with 400; on the upload route the service answers 415 instead.
// Elsewhere text/plain keeps being buffered as a string (1 MiB cap).
fastify.removeContentTypeParser('text/plain');
fastify.addContentTypeParser(
['image/png', 'image/jpeg', 'text/plain'],
(
_request: unknown,
payload: unknown,
done: (error: Error | null, body?: unknown) => void,
) => done(null, payload),
'text/plain',
(request: ParserRequest, payload: Readable, done: Done) => {
if (isUpload(request)) return done(null, payload);
const chunks: Buffer[] = [];
let size = 0;
payload.on('data', (chunk: Buffer) => {
size += chunk.length;
if (size > TEXT_BODY_LIMIT) {
payload.destroy();
done(new PayloadTooLargeException());
} else chunks.push(chunk);
});
payload.on('end', () =>
done(null, Buffer.concat(chunks).toString('utf8')),
);
payload.on('error', (error: Error) => done(error));
},
);
app.useGlobalInterceptors(
new RequestIdInterceptor(
+15
View File
@@ -325,6 +325,21 @@ describe('attachments (proxy upload)', () => {
expectError(await variant('bogus'), 400, 'invalid_request');
});
it('answers 4xx, not 500, for raw image or text bodies on JSON routes', async () => {
for (const [type, status, code] of [
['image/png', 415, 'unsupported_media_type'],
['image/jpeg', 415, 'unsupported_media_type'],
['text/plain', 400, 'invalid_request'],
] as const) {
const result = await http<ApiErrorBody>('/api/v1/users', {
method: 'POST',
headers: { 'content-type': type },
body: 'x',
});
expectError(result, status, code);
}
});
it('removes the pending row when the client drops the connection', async () => {
const data = noisePng(2 * 1024 * 1024);
const url = new URL(baseUrl);
+13
View File
@@ -228,6 +228,19 @@ describe('direct upload (presigned PUT)', () => {
404,
'not_found',
);
// The URL is still valid: a re-PUT must stay tracked so the sweeper
// removes the new object too.
expect((await put(ticket, jpeg)).status).toBe(200);
const row = await db.query<{ status: string }>(
'SELECT status FROM attachments WHERE id = $1',
[ticket.attachment_id],
);
expect(row.rows[0]?.status).toBe('rejected');
expectError(
await complete(alice.token, ticket.attachment_id),
404,
'not_found',
);
});
it('rejects a pixel bomb on complete', async () => {
+124 -124
View File
@@ -1,6 +1,6 @@
{
"date": "2026-10-22T19:43:37+00:00",
"git": "39a6df8",
"date": "2026-10-22T20:02:21+00:00",
"git": "f048a37",
"params": {
"mode": "direct",
"size_bytes": 1048576,
@@ -21,147 +21,169 @@
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.472,
"duration_s": 0.542,
"latency_ms": {
"p50": 68.8,
"p95": 100.5,
"p99": 116.7
"p50": 69.2,
"p95": 101.4,
"p99": 125.5
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 24305156,
"delta_tx_bytes": 190336,
"baseline_rss_bytes": 196403200,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 1732876,
"delta_tx_bytes": 185102,
"baseline_rss_bytes": 192851968,
"peak_memory_bytes": {
"rss": 196403200,
"heap_used": 54520056,
"external": 19317560,
"array_buffers": 15527216
"rss": 192983040,
"heap_used": 51764168,
"external": 7874039,
"array_buffers": 4083695
},
"delta_rss_bytes": 0,
"delta_rss_bytes": 131072,
"counters": {
"attachments.count_pending_direct": 27,
"attachments.insert_pending": 27,
"attachments.direct.initiated": 27,
"attachments.find_for_complete": 23,
"attachments.direct.verify_bytes": 24117248,
"attachments.mark_ready": 23,
"attachments.direct.completed": 23
"attachments.count_pending_direct": 26,
"attachments.insert_pending": 26,
"attachments.direct.initiated": 26,
"attachments.find_for_complete": 24,
"attachments.direct.verify_bytes": 1572864,
"attachments.mark_ready": 24,
"attachments.direct.completed": 24
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 28515385,
"delta_tx_bytes": 191536,
"baseline_rss_bytes": 192991232,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 1868893,
"delta_tx_bytes": 186494,
"baseline_rss_bytes": 181489664,
"peak_memory_bytes": {
"rss": 192991232,
"heap_used": 50609288,
"external": 23827415,
"array_buffers": 13323225
"rss": 182013952,
"heap_used": 53099792,
"external": 7642630,
"array_buffers": 3852254
},
"delta_rss_bytes": 0,
"delta_rss_bytes": 524288,
"counters": {
"attachments.count_pending_direct": 23,
"attachments.insert_pending": 23,
"attachments.direct.initiated": 23,
"attachments.find_for_complete": 27,
"attachments.direct.verify_bytes": 28311552,
"attachments.mark_ready": 27,
"attachments.direct.completed": 27
"attachments.count_pending_direct": 24,
"attachments.insert_pending": 24,
"attachments.direct.initiated": 24,
"attachments.find_for_complete": 26,
"attachments.direct.verify_bytes": 1703936,
"attachments.mark_ready": 26,
"attachments.direct.completed": 26
}
}
],
"total_delta_rx_bytes": 52820541,
"total_delta_tx_bytes": 381872,
"rx_bytes_per_upload": 1056411,
"tx_bytes_per_upload": 7637,
"max_delta_rss_bytes": 0
"total_delta_rx_bytes": 3601769,
"total_delta_tx_bytes": 371596,
"rx_bytes_per_upload": 72035,
"tx_bytes_per_upload": 7432,
"max_delta_rss_bytes": 524288
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.526,
"duration_s": 0.685,
"latency_ms": {
"p50": 73.9,
"p95": 109.6,
"p99": 127.7
"p50": 111.1,
"p95": 137.0,
"p99": 142.2
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 28515174,
"delta_tx_bytes": 193117,
"baseline_rss_bytes": 193875968,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 1800815,
"delta_tx_bytes": 186876,
"baseline_rss_bytes": 192983040,
"peak_memory_bytes": {
"rss": 203390976,
"heap_used": 57046056,
"external": 29834167,
"array_buffers": 26043823
"rss": 193507328,
"heap_used": 51579728,
"external": 6754919,
"array_buffers": 2800370
},
"delta_rss_bytes": 9515008,
"delta_rss_bytes": 524288,
"counters": {
"attachments.count_pending_direct": 23,
"attachments.insert_pending": 23,
"attachments.direct.initiated": 23,
"attachments.find_for_complete": 27,
"attachments.direct.verify_bytes": 28311552,
"attachments.mark_ready": 27,
"attachments.direct.completed": 27
"attachments.count_pending_direct": 25,
"attachments.insert_pending": 25,
"attachments.direct.initiated": 25,
"attachments.find_for_complete": 25,
"attachments.direct.verify_bytes": 1638400,
"attachments.mark_ready": 25,
"attachments.direct.completed": 25
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 24304620,
"delta_tx_bytes": 183249,
"baseline_rss_bytes": 187240448,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 1800709,
"delta_tx_bytes": 185964,
"baseline_rss_bytes": 182013952,
"peak_memory_bytes": {
"rss": 193400832,
"heap_used": 55168312,
"external": 23469861,
"array_buffers": 19679517
"rss": 182800384,
"heap_used": 53017320,
"external": 7914245,
"array_buffers": 4123869
},
"delta_rss_bytes": 6160384,
"delta_rss_bytes": 786432,
"counters": {
"attachments.count_pending_direct": 27,
"attachments.insert_pending": 27,
"attachments.direct.initiated": 27,
"attachments.find_for_complete": 23,
"attachments.direct.verify_bytes": 24117248,
"attachments.mark_ready": 23,
"attachments.direct.completed": 23
"attachments.count_pending_direct": 25,
"attachments.insert_pending": 25,
"attachments.direct.initiated": 25,
"attachments.find_for_complete": 25,
"attachments.direct.verify_bytes": 1638400,
"attachments.mark_ready": 25,
"attachments.direct.completed": 25
}
}
],
"total_delta_rx_bytes": 52819794,
"total_delta_tx_bytes": 376366,
"rx_bytes_per_upload": 1056396,
"tx_bytes_per_upload": 7527,
"max_delta_rss_bytes": 9515008
"total_delta_rx_bytes": 3601524,
"total_delta_tx_bytes": 372840,
"rx_bytes_per_upload": 72030,
"tx_bytes_per_upload": 7457,
"max_delta_rss_bytes": 786432
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.466,
"duration_s": 0.552,
"latency_ms": {
"p50": 64.7,
"p95": 93.7,
"p99": 107.8
"p50": 75.4,
"p95": 147.0,
"p99": 157.9
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 26412041,
"delta_tx_bytes": 186281,
"baseline_rss_bytes": 195010560,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 1801291,
"delta_tx_bytes": 185886,
"baseline_rss_bytes": 193396736,
"peak_memory_bytes": {
"rss": 195010560,
"heap_used": 51614528,
"external": 19277639,
"array_buffers": 15487295
"rss": 194314240,
"heap_used": 52852056,
"external": 6737214,
"array_buffers": 2946870
},
"delta_rss_bytes": 917504,
"counters": {
"attachments.count_pending_direct": 25,
"attachments.insert_pending": 25,
"attachments.direct.initiated": 25,
"attachments.find_for_complete": 25,
"attachments.direct.verify_bytes": 1638400,
"attachments.mark_ready": 25,
"attachments.direct.completed": 25
}
},
{
"instance_id": "d49b799653d6",
"delta_rx_bytes": 1800711,
"delta_tx_bytes": 185106,
"baseline_rss_bytes": 182374400,
"peak_memory_bytes": {
"rss": 182374400,
"heap_used": 53283160,
"external": 7898022,
"array_buffers": 3970019
},
"delta_rss_bytes": 0,
"counters": {
@@ -169,39 +191,17 @@
"attachments.insert_pending": 25,
"attachments.direct.initiated": 25,
"attachments.find_for_complete": 25,
"attachments.direct.verify_bytes": 26214400,
"attachments.mark_ready": 25,
"attachments.direct.completed": 25
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 26410201,
"delta_tx_bytes": 187551,
"baseline_rss_bytes": 190717952,
"peak_memory_bytes": {
"rss": 194781184,
"heap_used": 53366896,
"external": 19243061,
"array_buffers": 15452717
},
"delta_rss_bytes": 4063232,
"counters": {
"attachments.count_pending_direct": 25,
"attachments.insert_pending": 25,
"attachments.direct.initiated": 25,
"attachments.find_for_complete": 25,
"attachments.direct.verify_bytes": 26214400,
"attachments.direct.verify_bytes": 1638400,
"attachments.mark_ready": 25,
"attachments.direct.completed": 25
}
}
],
"total_delta_rx_bytes": 52822242,
"total_delta_tx_bytes": 373832,
"rx_bytes_per_upload": 1056445,
"tx_bytes_per_upload": 7477,
"max_delta_rss_bytes": 4063232
"total_delta_rx_bytes": 3602002,
"total_delta_tx_bytes": 370992,
"rx_bytes_per_upload": 72040,
"tx_bytes_per_upload": 7420,
"max_delta_rss_bytes": 917504
}
]
}
+124 -124
View File
@@ -1,6 +1,6 @@
{
"date": "2026-10-22T19:43:26+00:00",
"git": "39a6df8",
"date": "2026-10-22T20:02:09+00:00",
"git": "f048a37",
"params": {
"mode": "direct",
"size_bytes": 131072,
@@ -21,187 +21,187 @@
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.265,
"duration_s": 0.242,
"latency_ms": {
"p50": 48.2,
"p95": 62.4,
"p99": 72.8
"p50": 43.2,
"p95": 56.1,
"p99": 59.7
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 3306431,
"delta_tx_bytes": 182851,
"baseline_rss_bytes": 182366208,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 1869074,
"delta_tx_bytes": 185920,
"baseline_rss_bytes": 182263808,
"peak_memory_bytes": {
"rss": 184594432,
"heap_used": 61323144,
"external": 8848467,
"array_buffers": 5055973
"rss": 182898688,
"heap_used": 53275328,
"external": 9220810,
"array_buffers": 5428348
},
"delta_rss_bytes": 2228224,
"delta_rss_bytes": 634880,
"counters": {
"attachments.count_pending_direct": 24,
"attachments.insert_pending": 24,
"attachments.direct.initiated": 24,
"attachments.find_for_complete": 26,
"attachments.direct.verify_bytes": 1703936,
"attachments.mark_ready": 26,
"attachments.direct.completed": 26
}
},
{
"instance_id": "d49b799653d6",
"delta_rx_bytes": 1732185,
"delta_tx_bytes": 183862,
"baseline_rss_bytes": 173453312,
"peak_memory_bytes": {
"rss": 173862912,
"heap_used": 51776512,
"external": 7372259,
"array_buffers": 3579797
},
"delta_rss_bytes": 409600,
"counters": {
"attachments.count_pending_direct": 26,
"attachments.insert_pending": 26,
"attachments.direct.initiated": 26,
"attachments.find_for_complete": 24,
"attachments.direct.verify_bytes": 3145728,
"attachments.direct.verify_bytes": 1572864,
"attachments.mark_ready": 24,
"attachments.direct.completed": 24
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 3573839,
"delta_tx_bytes": 184939,
"baseline_rss_bytes": 182042624,
"peak_memory_bytes": {
"rss": 182796288,
"heap_used": 60727960,
"external": 8999631,
"array_buffers": 5207169
},
"delta_rss_bytes": 753664,
"counters": {
"attachments.count_pending_direct": 24,
"attachments.insert_pending": 24,
"attachments.direct.initiated": 24,
"attachments.find_for_complete": 26,
"attachments.direct.verify_bytes": 3407872,
"attachments.mark_ready": 26,
"attachments.direct.completed": 26
}
}
],
"total_delta_rx_bytes": 6880270,
"total_delta_tx_bytes": 367790,
"rx_bytes_per_upload": 137605,
"tx_bytes_per_upload": 7356,
"max_delta_rss_bytes": 2228224
"total_delta_rx_bytes": 3601259,
"total_delta_tx_bytes": 369782,
"rx_bytes_per_upload": 72025,
"tx_bytes_per_upload": 7396,
"max_delta_rss_bytes": 634880
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.211,
"duration_s": 0.254,
"latency_ms": {
"p50": 36.7,
"p95": 50.0,
"p99": 54.8
"p50": 44.9,
"p95": 64.9,
"p99": 74.0
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 3574513,
"delta_tx_bytes": 184486,
"baseline_rss_bytes": 184594432,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 1663798,
"delta_tx_bytes": 181411,
"baseline_rss_bytes": 182898688,
"peak_memory_bytes": {
"rss": 184987648,
"heap_used": 60934432,
"external": 9389278,
"array_buffers": 5596784
"rss": 183029760,
"heap_used": 52623040,
"external": 9199397,
"array_buffers": 5406935
},
"delta_rss_bytes": 393216,
"delta_rss_bytes": 131072,
"counters": {
"attachments.count_pending_direct": 24,
"attachments.insert_pending": 24,
"attachments.direct.initiated": 24,
"attachments.find_for_complete": 26,
"attachments.direct.verify_bytes": 3407872,
"attachments.mark_ready": 26,
"attachments.direct.completed": 26
"attachments.count_pending_direct": 27,
"attachments.insert_pending": 27,
"attachments.direct.initiated": 27,
"attachments.find_for_complete": 23,
"attachments.direct.verify_bytes": 1507328,
"attachments.mark_ready": 23,
"attachments.direct.completed": 23
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 3306277,
"delta_tx_bytes": 181456,
"baseline_rss_bytes": 182796288,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 1936597,
"delta_tx_bytes": 185873,
"baseline_rss_bytes": 173862912,
"peak_memory_bytes": {
"rss": 183058432,
"heap_used": 59419712,
"external": 8997869,
"array_buffers": 5205407
"rss": 174125056,
"heap_used": 53719328,
"external": 7649562,
"array_buffers": 3857100
},
"delta_rss_bytes": 262144,
"counters": {
"attachments.count_pending_direct": 26,
"attachments.insert_pending": 26,
"attachments.direct.initiated": 26,
"attachments.find_for_complete": 24,
"attachments.direct.verify_bytes": 3145728,
"attachments.mark_ready": 24,
"attachments.direct.completed": 24
"attachments.count_pending_direct": 23,
"attachments.insert_pending": 23,
"attachments.direct.initiated": 23,
"attachments.find_for_complete": 27,
"attachments.direct.verify_bytes": 1769472,
"attachments.mark_ready": 27,
"attachments.direct.completed": 27
}
}
],
"total_delta_rx_bytes": 6880790,
"total_delta_tx_bytes": 365942,
"rx_bytes_per_upload": 137616,
"tx_bytes_per_upload": 7319,
"max_delta_rss_bytes": 393216
"total_delta_rx_bytes": 3600395,
"total_delta_tx_bytes": 367284,
"rx_bytes_per_upload": 72008,
"tx_bytes_per_upload": 7346,
"max_delta_rss_bytes": 262144
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.241,
"duration_s": 0.441,
"latency_ms": {
"p50": 41.6,
"p95": 64.6,
"p99": 72.2
"p50": 80.3,
"p95": 124.0,
"p99": 127.6
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 3574028,
"delta_tx_bytes": 183565,
"baseline_rss_bytes": 184987648,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 2007125,
"delta_tx_bytes": 186925,
"baseline_rss_bytes": 183029760,
"peak_memory_bytes": {
"rss": 185643008,
"heap_used": 62756424,
"external": 9669133,
"array_buffers": 5876639
"rss": 183447552,
"heap_used": 56507192,
"external": 9369635,
"array_buffers": 5577173
},
"delta_rss_bytes": 655360,
"delta_rss_bytes": 417792,
"counters": {
"attachments.count_pending_direct": 24,
"attachments.insert_pending": 24,
"attachments.direct.initiated": 24,
"attachments.find_for_complete": 26,
"attachments.direct.verify_bytes": 3407872,
"attachments.mark_ready": 26,
"attachments.direct.completed": 26
"attachments.count_pending_direct": 22,
"attachments.insert_pending": 22,
"attachments.direct.initiated": 22,
"attachments.find_for_complete": 28,
"attachments.direct.verify_bytes": 1835008,
"attachments.mark_ready": 28,
"attachments.direct.completed": 28
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 3306617,
"delta_tx_bytes": 181349,
"baseline_rss_bytes": 183058432,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 1596449,
"delta_tx_bytes": 182757,
"baseline_rss_bytes": 174125056,
"peak_memory_bytes": {
"rss": 183713792,
"heap_used": 62301928,
"external": 9312649,
"array_buffers": 5520187
"rss": 174387200,
"heap_used": 54337704,
"external": 7649635,
"array_buffers": 3857173
},
"delta_rss_bytes": 655360,
"delta_rss_bytes": 262144,
"counters": {
"attachments.count_pending_direct": 26,
"attachments.insert_pending": 26,
"attachments.direct.initiated": 26,
"attachments.find_for_complete": 24,
"attachments.direct.verify_bytes": 3145728,
"attachments.mark_ready": 24,
"attachments.direct.completed": 24
"attachments.count_pending_direct": 28,
"attachments.insert_pending": 28,
"attachments.direct.initiated": 28,
"attachments.find_for_complete": 22,
"attachments.direct.verify_bytes": 1441792,
"attachments.mark_ready": 22,
"attachments.direct.completed": 22
}
}
],
"total_delta_rx_bytes": 6880645,
"total_delta_tx_bytes": 364914,
"rx_bytes_per_upload": 137613,
"tx_bytes_per_upload": 7298,
"max_delta_rss_bytes": 655360
"total_delta_rx_bytes": 3603574,
"total_delta_tx_bytes": 369682,
"rx_bytes_per_upload": 72071,
"tx_bytes_per_upload": 7394,
"max_delta_rss_bytes": 417792
}
]
}
+124 -125
View File
@@ -1,6 +1,6 @@
{
"date": "2026-10-22T19:44:02+00:00",
"git": "39a6df8",
"date": "2026-10-22T20:02:47+00:00",
"git": "f048a37",
"params": {
"mode": "direct",
"size_bytes": 9961472,
@@ -21,188 +21,187 @@
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 2.977,
"duration_s": 3.048,
"latency_ms": {
"p50": 373.6,
"p95": 580.2,
"p99": 606.3
"p50": 346.0,
"p95": 575.3,
"p99": 581.2
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 5859769,
"delta_tx_bytes": 204758,
"baseline_rss_bytes": 206934016,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 1669140,
"delta_tx_bytes": 194261,
"baseline_rss_bytes": 189468672,
"peak_memory_bytes": {
"rss": 207065088,
"heap_used": 59528520,
"external": 23734700,
"array_buffers": 19944356
"rss": 189468672,
"heap_used": 59441184,
"external": 6250789,
"array_buffers": 2449996
},
"delta_rss_bytes": 131072,
"delta_rss_bytes": 0,
"counters": {
"attachments.count_pending_direct": 24,
"attachments.insert_pending": 24,
"attachments.direct.initiated": 24,
"attachments.find_for_complete": 26,
"attachments.direct.verify_bytes": 573886,
"attachments.mark_ready": 26,
"attachments.direct.completed": 26
"attachments.count_pending_direct": 27,
"attachments.insert_pending": 27,
"attachments.direct.initiated": 27,
"attachments.find_for_complete": 23,
"attachments.direct.verify_bytes": 1507328,
"attachments.mark_ready": 23,
"attachments.direct.completed": 23
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 2941745,
"delta_tx_bytes": 201620,
"baseline_rss_bytes": 204890112,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 1940713,
"delta_tx_bytes": 195885,
"baseline_rss_bytes": 179376128,
"peak_memory_bytes": {
"rss": 205152256,
"heap_used": 58915888,
"external": 11971121,
"array_buffers": 8180777
"rss": 180293632,
"heap_used": 59568768,
"external": 6672150,
"array_buffers": 2881806
},
"delta_rss_bytes": 262144,
"delta_rss_bytes": 917504,
"counters": {
"attachments.count_pending_direct": 26,
"attachments.insert_pending": 26,
"attachments.direct.initiated": 26,
"attachments.find_for_complete": 24,
"attachments.direct.verify_bytes": 454808,
"attachments.mark_ready": 24,
"attachments.direct.completed": 24
"attachments.count_pending_direct": 23,
"attachments.insert_pending": 23,
"attachments.direct.initiated": 23,
"attachments.find_for_complete": 27,
"attachments.direct.verify_bytes": 1769472,
"attachments.mark_ready": 27,
"attachments.direct.completed": 27
}
}
],
"total_delta_rx_bytes": 8801514,
"total_delta_tx_bytes": 406378,
"rx_bytes_per_upload": 176030,
"tx_bytes_per_upload": 8128,
"max_delta_rss_bytes": 262144
"total_delta_rx_bytes": 3609853,
"total_delta_tx_bytes": 390146,
"rx_bytes_per_upload": 72197,
"tx_bytes_per_upload": 7803,
"max_delta_rss_bytes": 917504
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 3.016,
"duration_s": 2.948,
"latency_ms": {
"p50": 377.9,
"p95": 493.4,
"p99": 534.7
"p50": 350.2,
"p95": 570.8,
"p99": 608.6
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 3426165,
"delta_tx_bytes": 205333,
"baseline_rss_bytes": 207065088,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 1803498,
"delta_tx_bytes": 194370,
"baseline_rss_bytes": 189468672,
"peak_memory_bytes": {
"rss": 210079744,
"heap_used": 59538608,
"external": 12156543,
"array_buffers": 8366167
"rss": 189861888,
"heap_used": 59295328,
"external": 6363945,
"array_buffers": 2573569
},
"delta_rss_bytes": 3014656,
"delta_rss_bytes": 393216,
"counters": {
"attachments.count_pending_direct": 24,
"attachments.insert_pending": 24,
"attachments.direct.initiated": 24,
"attachments.find_for_complete": 26,
"attachments.direct.verify_bytes": 553814,
"attachments.mark_ready": 26,
"attachments.direct.completed": 26
"attachments.count_pending_direct": 25,
"attachments.insert_pending": 25,
"attachments.direct.initiated": 25,
"attachments.find_for_complete": 25,
"attachments.direct.verify_bytes": 1638400,
"attachments.mark_ready": 25,
"attachments.direct.completed": 25
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 2100305,
"delta_tx_bytes": 201255,
"baseline_rss_bytes": 205152256,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 1804525,
"delta_tx_bytes": 194742,
"baseline_rss_bytes": 179740672,
"peak_memory_bytes": {
"rss": 208429056,
"heap_used": 59913256,
"external": 9769093,
"array_buffers": 5978717
"rss": 179740672,
"heap_used": 59420128,
"external": 6260844,
"array_buffers": 2470500
},
"delta_rss_bytes": 3276800,
"delta_rss_bytes": 0,
"counters": {
"attachments.count_pending_direct": 26,
"attachments.insert_pending": 26,
"attachments.direct.initiated": 26,
"attachments.find_for_complete": 24,
"attachments.direct.verify_bytes": 258704,
"attachments.mark_ready": 24,
"attachments.direct.completed": 24
"attachments.count_pending_direct": 25,
"attachments.insert_pending": 25,
"attachments.direct.initiated": 25,
"attachments.find_for_complete": 25,
"attachments.direct.verify_bytes": 1638400,
"attachments.mark_ready": 25,
"attachments.direct.completed": 25
}
}
],
"total_delta_rx_bytes": 5526470,
"total_delta_tx_bytes": 406588,
"rx_bytes_per_upload": 110529,
"tx_bytes_per_upload": 8132,
"max_delta_rss_bytes": 3276800
"total_delta_rx_bytes": 3608023,
"total_delta_tx_bytes": 389112,
"rx_bytes_per_upload": 72160,
"tx_bytes_per_upload": 7782,
"max_delta_rss_bytes": 393216
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 3.128,
"duration_s": 2.556,
"latency_ms": {
"p50": 376.7,
"p95": 483.1,
"p99": 546.2
"p50": 314.1,
"p95": 425.2,
"p99": 453.1
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 3752711,
"delta_tx_bytes": 204356,
"baseline_rss_bytes": 207192064,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 1531515,
"delta_tx_bytes": 190497,
"baseline_rss_bytes": 189861888,
"peak_memory_bytes": {
"rss": 207192064,
"heap_used": 59773496,
"external": 12099081,
"array_buffers": 8308705
"rss": 190910464,
"heap_used": 60034376,
"external": 6373249,
"array_buffers": 2582873
},
"delta_rss_bytes": 0,
"delta_rss_bytes": 1048576,
"counters": {
"attachments.claim_expired": 1,
"attachments.count_pending_direct": 24,
"attachments.insert_pending": 24,
"attachments.direct.initiated": 24,
"attachments.find_for_complete": 26,
"attachments.direct.verify_bytes": 458246,
"attachments.mark_ready": 26,
"attachments.direct.completed": 26
"attachments.count_pending_direct": 29,
"attachments.insert_pending": 29,
"attachments.direct.initiated": 29,
"attachments.find_for_complete": 21,
"attachments.direct.verify_bytes": 1376256,
"attachments.mark_ready": 21,
"attachments.direct.completed": 21
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 3511316,
"delta_tx_bytes": 203010,
"baseline_rss_bytes": 205549568,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 2076238,
"delta_tx_bytes": 196531,
"baseline_rss_bytes": 179740672,
"peak_memory_bytes": {
"rss": 205549568,
"heap_used": 59832920,
"external": 10075786,
"array_buffers": 6285218
"rss": 179740672,
"heap_used": 59642168,
"external": 6672708,
"array_buffers": 2755498
},
"delta_rss_bytes": 0,
"counters": {
"attachments.count_pending_direct": 26,
"attachments.insert_pending": 26,
"attachments.direct.initiated": 26,
"attachments.find_for_complete": 24,
"attachments.direct.verify_bytes": 477352,
"attachments.mark_ready": 24,
"attachments.direct.completed": 24
"attachments.count_pending_direct": 21,
"attachments.insert_pending": 21,
"attachments.direct.initiated": 21,
"attachments.find_for_complete": 29,
"attachments.direct.verify_bytes": 1900544,
"attachments.mark_ready": 29,
"attachments.direct.completed": 29
}
}
],
"total_delta_rx_bytes": 7264027,
"total_delta_tx_bytes": 407366,
"rx_bytes_per_upload": 145281,
"tx_bytes_per_upload": 8147,
"max_delta_rss_bytes": 0
"total_delta_rx_bytes": 3607753,
"total_delta_tx_bytes": 387028,
"rx_bytes_per_upload": 72155,
"tx_bytes_per_upload": 7741,
"max_delta_rss_bytes": 1048576
}
]
}
+83 -83
View File
@@ -1,6 +1,6 @@
{
"date": "2026-10-22T19:43:32+00:00",
"git": "39a6df8",
"date": "2026-10-22T20:02:15+00:00",
"git": "f048a37",
"params": {
"mode": "proxy",
"size_bytes": 1048576,
@@ -21,25 +21,25 @@
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.391,
"duration_s": 0.369,
"latency_ms": {
"p50": 44.5,
"p95": 80.1,
"p99": 85.9
"p50": 46.4,
"p95": 68.3,
"p99": 72.8
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 26377008,
"delta_tx_bytes": 26400949,
"baseline_rss_bytes": 185679872,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 26390991,
"delta_tx_bytes": 26399463,
"baseline_rss_bytes": 183496704,
"peak_memory_bytes": {
"rss": 191053824,
"heap_used": 54312648,
"external": 18076371,
"array_buffers": 14283909
"rss": 188407808,
"heap_used": 58350032,
"external": 15612927,
"array_buffers": 11820465
},
"delta_rss_bytes": 5373952,
"delta_rss_bytes": 4911104,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 26214400,
@@ -49,17 +49,17 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 26381521,
"delta_tx_bytes": 26398219,
"baseline_rss_bytes": 183795712,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 26389902,
"delta_tx_bytes": 26401063,
"baseline_rss_bytes": 172593152,
"peak_memory_bytes": {
"rss": 187359232,
"heap_used": 62541304,
"external": 18146585,
"array_buffers": 9966050
"rss": 179159040,
"heap_used": 51726640,
"external": 10983870,
"array_buffers": 7191408
},
"delta_rss_bytes": 3563520,
"delta_rss_bytes": 6565888,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 26214400,
@@ -69,35 +69,35 @@
}
}
],
"total_delta_rx_bytes": 52758529,
"total_delta_tx_bytes": 52799168,
"rx_bytes_per_upload": 1055171,
"tx_bytes_per_upload": 1055983,
"max_delta_rss_bytes": 5373952
"total_delta_rx_bytes": 52780893,
"total_delta_tx_bytes": 52800526,
"rx_bytes_per_upload": 1055618,
"tx_bytes_per_upload": 1056011,
"max_delta_rss_bytes": 6565888
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.387,
"duration_s": 0.55,
"latency_ms": {
"p50": 47.1,
"p95": 78.9,
"p99": 92.5
"p50": 59.3,
"p95": 210.6,
"p99": 226.6
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 26389036,
"delta_tx_bytes": 26402274,
"baseline_rss_bytes": 191053824,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 26377432,
"delta_tx_bytes": 26403430,
"baseline_rss_bytes": 188645376,
"peak_memory_bytes": {
"rss": 196558848,
"heap_used": 56457808,
"external": 23809883,
"array_buffers": 20017421
"rss": 193232896,
"heap_used": 52490432,
"external": 19098493,
"array_buffers": 15306617
},
"delta_rss_bytes": 5505024,
"delta_rss_bytes": 4587520,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 26214400,
@@ -107,17 +107,17 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 26383409,
"delta_tx_bytes": 26401615,
"baseline_rss_bytes": 187490304,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 26383216,
"delta_tx_bytes": 26401660,
"baseline_rss_bytes": 179159040,
"peak_memory_bytes": {
"rss": 187490304,
"heap_used": 49941720,
"external": 17342677,
"array_buffers": 13550957
"rss": 179486720,
"heap_used": 49462912,
"external": 15506324,
"array_buffers": 11714604
},
"delta_rss_bytes": 0,
"delta_rss_bytes": 327680,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 26214400,
@@ -127,35 +127,35 @@
}
}
],
"total_delta_rx_bytes": 52772445,
"total_delta_tx_bytes": 52803889,
"rx_bytes_per_upload": 1055449,
"tx_bytes_per_upload": 1056078,
"max_delta_rss_bytes": 5505024
"total_delta_rx_bytes": 52760648,
"total_delta_tx_bytes": 52805090,
"rx_bytes_per_upload": 1055213,
"tx_bytes_per_upload": 1056102,
"max_delta_rss_bytes": 4587520
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.361,
"duration_s": 0.461,
"latency_ms": {
"p50": 42.5,
"p95": 64.3,
"p99": 77.5
"p50": 67.3,
"p95": 109.8,
"p99": 118.7
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 26387499,
"delta_tx_bytes": 26400516,
"baseline_rss_bytes": 195969024,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 26385813,
"delta_tx_bytes": 26399597,
"baseline_rss_bytes": 193232896,
"peak_memory_bytes": {
"rss": 197935104,
"heap_used": 51834416,
"external": 25755964,
"array_buffers": 16217341
"rss": 194363392,
"heap_used": 51280880,
"external": 19455489,
"array_buffers": 15663613
},
"delta_rss_bytes": 1966080,
"delta_rss_bytes": 1130496,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 26214400,
@@ -165,17 +165,17 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 26383525,
"delta_tx_bytes": 26400510,
"baseline_rss_bytes": 185294848,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 26391095,
"delta_tx_bytes": 26404143,
"baseline_rss_bytes": 178298880,
"peak_memory_bytes": {
"rss": 187260928,
"heap_used": 49345096,
"external": 15398018,
"array_buffers": 11607674
"rss": 181444608,
"heap_used": 50462384,
"external": 17515725,
"array_buffers": 13659712
},
"delta_rss_bytes": 1966080,
"delta_rss_bytes": 3145728,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 26214400,
@@ -185,11 +185,11 @@
}
}
],
"total_delta_rx_bytes": 52771024,
"total_delta_tx_bytes": 52801026,
"rx_bytes_per_upload": 1055420,
"tx_bytes_per_upload": 1056021,
"max_delta_rss_bytes": 1966080
"total_delta_rx_bytes": 52776908,
"total_delta_tx_bytes": 52803740,
"rx_bytes_per_upload": 1055538,
"tx_bytes_per_upload": 1056075,
"max_delta_rss_bytes": 3145728
}
]
}
+83 -83
View File
@@ -1,6 +1,6 @@
{
"date": "2026-10-22T19:43:22+00:00",
"git": "39a6df8",
"date": "2026-10-22T20:02:04+00:00",
"git": "f048a37",
"params": {
"mode": "proxy",
"size_bytes": 131072,
@@ -21,25 +21,25 @@
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.203,
"duration_s": 0.221,
"latency_ms": {
"p50": 32.4,
"p95": 56.7,
"p99": 62.2
"p50": 32.5,
"p95": 61.7,
"p99": 75.6
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 3381217,
"delta_tx_bytes": 3397557,
"baseline_rss_bytes": 171487232,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 3382582,
"delta_tx_bytes": 3398177,
"baseline_rss_bytes": 172421120,
"peak_memory_bytes": {
"rss": 177647616,
"heap_used": 58529080,
"external": 7415675,
"array_buffers": 3621869
"rss": 177926144,
"heap_used": 50033192,
"external": 7706616,
"array_buffers": 3914122
},
"delta_rss_bytes": 6160384,
"delta_rss_bytes": 5505024,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 3276800,
@@ -49,17 +49,17 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 3382121,
"delta_tx_bytes": 3397761,
"baseline_rss_bytes": 169697280,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 3380734,
"delta_tx_bytes": 3397755,
"baseline_rss_bytes": 164986880,
"peak_memory_bytes": {
"rss": 176513024,
"heap_used": 56215752,
"external": 6720398,
"array_buffers": 2926784
"rss": 170360832,
"heap_used": 49897896,
"external": 7704663,
"array_buffers": 3911977
},
"delta_rss_bytes": 6815744,
"delta_rss_bytes": 5373952,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 3276800,
@@ -69,35 +69,35 @@
}
}
],
"total_delta_rx_bytes": 6763338,
"total_delta_tx_bytes": 6795318,
"rx_bytes_per_upload": 135267,
"tx_bytes_per_upload": 135906,
"max_delta_rss_bytes": 6815744
"total_delta_rx_bytes": 6763316,
"total_delta_tx_bytes": 6795932,
"rx_bytes_per_upload": 135266,
"tx_bytes_per_upload": 135919,
"max_delta_rss_bytes": 5505024
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.147,
"duration_s": 0.178,
"latency_ms": {
"p50": 24.3,
"p95": 37.7,
"p99": 48.6
"p50": 30.3,
"p95": 39.9,
"p99": 40.8
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 3376685,
"delta_tx_bytes": 3395659,
"baseline_rss_bytes": 177647616,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 3378937,
"delta_tx_bytes": 3395467,
"baseline_rss_bytes": 177926144,
"peak_memory_bytes": {
"rss": 181579776,
"heap_used": 58637216,
"external": 10920677,
"array_buffers": 7128215
"rss": 181886976,
"heap_used": 51028472,
"external": 10337544,
"array_buffers": 6545050
},
"delta_rss_bytes": 3932160,
"delta_rss_bytes": 3960832,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 3276800,
@@ -107,17 +107,17 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 3378833,
"delta_tx_bytes": 3397177,
"baseline_rss_bytes": 176250880,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 3380009,
"delta_tx_bytes": 3397063,
"baseline_rss_bytes": 170360832,
"peak_memory_bytes": {
"rss": 179134464,
"heap_used": 60877184,
"external": 11462611,
"array_buffers": 7669957
"rss": 171278336,
"heap_used": 50939136,
"external": 8430160,
"array_buffers": 4637666
},
"delta_rss_bytes": 2883584,
"delta_rss_bytes": 917504,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 3276800,
@@ -127,35 +127,35 @@
}
}
],
"total_delta_rx_bytes": 6755518,
"total_delta_tx_bytes": 6792836,
"rx_bytes_per_upload": 135110,
"tx_bytes_per_upload": 135857,
"max_delta_rss_bytes": 3932160
"total_delta_rx_bytes": 6758946,
"total_delta_tx_bytes": 6792530,
"rx_bytes_per_upload": 135179,
"tx_bytes_per_upload": 135851,
"max_delta_rss_bytes": 3960832
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 0.161,
"duration_s": 0.291,
"latency_ms": {
"p50": 26.4,
"p95": 52.8,
"p99": 56.1
"p50": 41.2,
"p95": 87.2,
"p99": 93.6
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 3377664,
"delta_tx_bytes": 3397060,
"baseline_rss_bytes": 181579776,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 3377137,
"delta_tx_bytes": 3395161,
"baseline_rss_bytes": 181886976,
"peak_memory_bytes": {
"rss": 182104064,
"heap_used": 56837496,
"external": 12815773,
"array_buffers": 9023311
"rss": 182149120,
"heap_used": 51984832,
"external": 9554628,
"array_buffers": 5762166
},
"delta_rss_bytes": 524288,
"delta_rss_bytes": 262144,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 3276800,
@@ -165,17 +165,17 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 3375364,
"delta_tx_bytes": 3395107,
"baseline_rss_bytes": 179134464,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 3377713,
"delta_tx_bytes": 3396473,
"baseline_rss_bytes": 171278336,
"peak_memory_bytes": {
"rss": 182018048,
"heap_used": 61048680,
"external": 12510518,
"array_buffers": 8718024
"rss": 173244416,
"heap_used": 52256384,
"external": 10276505,
"array_buffers": 6484011
},
"delta_rss_bytes": 2883584,
"delta_rss_bytes": 1966080,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 3276800,
@@ -185,11 +185,11 @@
}
}
],
"total_delta_rx_bytes": 6753028,
"total_delta_tx_bytes": 6792167,
"rx_bytes_per_upload": 135061,
"tx_bytes_per_upload": 135843,
"max_delta_rss_bytes": 2883584
"total_delta_rx_bytes": 6754850,
"total_delta_tx_bytes": 6791634,
"rx_bytes_per_upload": 135097,
"tx_bytes_per_upload": 135833,
"max_delta_rss_bytes": 1966080
}
]
}
+85 -83
View File
@@ -1,6 +1,6 @@
{
"date": "2026-10-22T19:43:49+00:00",
"git": "39a6df8",
"date": "2026-10-22T20:02:34+00:00",
"git": "f048a37",
"params": {
"mode": "proxy",
"size_bytes": 9961472,
@@ -21,25 +21,25 @@
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 2.888,
"duration_s": 2.923,
"latency_ms": {
"p50": 212.3,
"p95": 379.1,
"p99": 447.0
"p50": 217.7,
"p95": 393.7,
"p99": 469.2
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 249726853,
"delta_tx_bytes": 249832292,
"baseline_rss_bytes": 201834496,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 249719999,
"delta_tx_bytes": 249864966,
"baseline_rss_bytes": 193277952,
"peak_memory_bytes": {
"rss": 207208448,
"heap_used": 48318768,
"external": 33637892,
"array_buffers": 24213167
"rss": 208244736,
"heap_used": 49103680,
"external": 38092148,
"array_buffers": 31938886
},
"delta_rss_bytes": 5373952,
"delta_rss_bytes": 14966784,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 249036800,
@@ -49,17 +49,17 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 249652918,
"delta_tx_bytes": 249806626,
"baseline_rss_bytes": 194772992,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 249670108,
"delta_tx_bytes": 249826185,
"baseline_rss_bytes": 178913280,
"peak_memory_bytes": {
"rss": 208158720,
"heap_used": 48256584,
"external": 27701797,
"array_buffers": 23911453
"rss": 195375104,
"heap_used": 48823672,
"external": 30056217,
"array_buffers": 26265873
},
"delta_rss_bytes": 13385728,
"delta_rss_bytes": 16461824,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 249036800,
@@ -69,57 +69,59 @@
}
}
],
"total_delta_rx_bytes": 499379771,
"total_delta_tx_bytes": 499638918,
"rx_bytes_per_upload": 9987595,
"tx_bytes_per_upload": 9992778,
"max_delta_rss_bytes": 13385728
"total_delta_rx_bytes": 499390107,
"total_delta_tx_bytes": 499691151,
"rx_bytes_per_upload": 9987802,
"tx_bytes_per_upload": 9993823,
"max_delta_rss_bytes": 16461824
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 2.74,
"duration_s": 3.32,
"latency_ms": {
"p50": 188.3,
"p95": 357.0,
"p99": 439.5
"p50": 277.4,
"p95": 513.9,
"p99": 548.1
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 249720677,
"delta_tx_bytes": 249833753,
"baseline_rss_bytes": 198889472,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 249653538,
"delta_tx_bytes": 249812864,
"baseline_rss_bytes": 193380352,
"peak_memory_bytes": {
"rss": 207929344,
"heap_used": 48141072,
"external": 34434837,
"array_buffers": 24758541
"rss": 208535552,
"heap_used": 49665920,
"external": 36105007,
"array_buffers": 32313340
},
"delta_rss_bytes": 9039872,
"delta_rss_bytes": 15155200,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 249036800,
"attachments.claim_expired": 1,
"attachments.proxy.bytes_to_s3": 249036800,
"attachments.mark_ready": 25,
"attachments.upload.created": 25
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 249698838,
"delta_tx_bytes": 249844044,
"baseline_rss_bytes": 195190784,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 249644423,
"delta_tx_bytes": 249817785,
"baseline_rss_bytes": 194199552,
"peak_memory_bytes": {
"rss": 202661888,
"heap_used": 48064416,
"external": 26063110,
"array_buffers": 21189095
"rss": 208871424,
"heap_used": 50742312,
"external": 43475182,
"array_buffers": 39684838
},
"delta_rss_bytes": 7471104,
"delta_rss_bytes": 14671872,
"counters": {
"attachments.insert_pending": 25,
"attachments.claim_expired": 1,
"attachments.proxy.bytes_in": 249036800,
"attachments.proxy.bytes_to_s3": 249036800,
"attachments.mark_ready": 25,
@@ -127,35 +129,35 @@
}
}
],
"total_delta_rx_bytes": 499419515,
"total_delta_tx_bytes": 499677797,
"rx_bytes_per_upload": 9988390,
"tx_bytes_per_upload": 9993556,
"max_delta_rss_bytes": 9039872
"total_delta_rx_bytes": 499297961,
"total_delta_tx_bytes": 499630649,
"rx_bytes_per_upload": 9985959,
"tx_bytes_per_upload": 9992613,
"max_delta_rss_bytes": 15155200
},
{
"uploads": 50,
"succeeded": 50,
"failed": 0,
"duration_s": 2.786,
"duration_s": 3.07,
"latency_ms": {
"p50": 226.6,
"p95": 373.9,
"p99": 483.8
"p50": 238.9,
"p95": 391.0,
"p99": 423.1
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 249712459,
"delta_tx_bytes": 249847251,
"baseline_rss_bytes": 199180288,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 249690323,
"delta_tx_bytes": 249843279,
"baseline_rss_bytes": 193445888,
"peak_memory_bytes": {
"rss": 207888384,
"heap_used": 48883976,
"external": 33646702,
"array_buffers": 29856358
"rss": 212447232,
"heap_used": 48981896,
"external": 28322088,
"array_buffers": 24531744
},
"delta_rss_bytes": 8708096,
"delta_rss_bytes": 19001344,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 249036800,
@@ -165,17 +167,17 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 249713568,
"delta_tx_bytes": 249832760,
"baseline_rss_bytes": 193859584,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 249684428,
"delta_tx_bytes": 249830235,
"baseline_rss_bytes": 200146944,
"peak_memory_bytes": {
"rss": 205029376,
"heap_used": 49053528,
"external": 28839619,
"array_buffers": 25049275
"rss": 200146944,
"heap_used": 48496592,
"external": 26712221,
"array_buffers": 22921877
},
"delta_rss_bytes": 11169792,
"delta_rss_bytes": 0,
"counters": {
"attachments.insert_pending": 25,
"attachments.proxy.bytes_in": 249036800,
@@ -185,11 +187,11 @@
}
}
],
"total_delta_rx_bytes": 499426027,
"total_delta_tx_bytes": 499680011,
"rx_bytes_per_upload": 9988521,
"tx_bytes_per_upload": 9993600,
"max_delta_rss_bytes": 11169792
"total_delta_rx_bytes": 499374751,
"total_delta_tx_bytes": 499673514,
"rx_bytes_per_upload": 9987495,
"tx_bytes_per_upload": 9993470,
"max_delta_rss_bytes": 19001344
}
]
}
+84 -85
View File
@@ -1,6 +1,6 @@
{
"date": "2026-10-22T19:44:24+00:00",
"git": "39a6df8",
"date": "2026-10-22T20:03:09+00:00",
"git": "f048a37",
"params": {
"mode": "proxy",
"size_bytes": 9961472,
@@ -21,25 +21,25 @@
"uploads": 100,
"succeeded": 100,
"failed": 0,
"duration_s": 6.29,
"duration_s": 5.789,
"latency_ms": {
"p50": 424.1,
"p95": 796.0,
"p99": 937.9
"p50": 409.2,
"p95": 812.5,
"p99": 959.0
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 499638310,
"delta_tx_bytes": 499870304,
"baseline_rss_bytes": 192036864,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 499859990,
"delta_tx_bytes": 500110302,
"baseline_rss_bytes": 189095936,
"peak_memory_bytes": {
"rss": 210829312,
"heap_used": 49626176,
"external": 34069726,
"array_buffers": 30279382
"rss": 209506304,
"heap_used": 49551104,
"external": 37459480,
"array_buffers": 28998398
},
"delta_rss_bytes": 18792448,
"delta_rss_bytes": 20410368,
"counters": {
"attachments.insert_pending": 50,
"attachments.proxy.bytes_in": 498073600,
@@ -49,56 +49,55 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 499750187,
"delta_tx_bytes": 500007552,
"baseline_rss_bytes": 194543616,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 499688844,
"delta_tx_bytes": 499961376,
"baseline_rss_bytes": 179896320,
"peak_memory_bytes": {
"rss": 210604032,
"heap_used": 48759736,
"external": 32187556,
"array_buffers": 28397212
"rss": 201883648,
"heap_used": 48903104,
"external": 30171785,
"array_buffers": 23259151
},
"delta_rss_bytes": 16060416,
"delta_rss_bytes": 21987328,
"counters": {
"attachments.insert_pending": 50,
"attachments.proxy.bytes_in": 498073600,
"attachments.proxy.bytes_to_s3": 498073600,
"attachments.mark_ready": 50,
"attachments.upload.created": 50,
"attachments.claim_expired": 1
"attachments.upload.created": 50
}
}
],
"total_delta_rx_bytes": 999388497,
"total_delta_tx_bytes": 999877856,
"rx_bytes_per_upload": 9993885,
"tx_bytes_per_upload": 9998779,
"max_delta_rss_bytes": 18792448
"total_delta_rx_bytes": 999548834,
"total_delta_tx_bytes": 1000071678,
"rx_bytes_per_upload": 9995488,
"tx_bytes_per_upload": 10000717,
"max_delta_rss_bytes": 21987328
},
{
"uploads": 100,
"succeeded": 100,
"failed": 0,
"duration_s": 5.824,
"duration_s": 5.789,
"latency_ms": {
"p50": 403.2,
"p95": 802.4,
"p99": 987.2
"p50": 406.7,
"p95": 756.8,
"p99": 1110.8
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 499452630,
"delta_tx_bytes": 499737912,
"baseline_rss_bytes": 197160960,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 499409660,
"delta_tx_bytes": 499704231,
"baseline_rss_bytes": 204034048,
"peak_memory_bytes": {
"rss": 223768576,
"heap_used": 50330816,
"external": 46988209,
"array_buffers": 43197865
"rss": 216682496,
"heap_used": 50958080,
"external": 42044393,
"array_buffers": 38254049
},
"delta_rss_bytes": 26607616,
"delta_rss_bytes": 12648448,
"counters": {
"attachments.insert_pending": 50,
"attachments.proxy.bytes_in": 498073600,
@@ -108,17 +107,17 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 499486574,
"delta_tx_bytes": 499756038,
"baseline_rss_bytes": 197701632,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 499385236,
"delta_tx_bytes": 499657364,
"baseline_rss_bytes": 196177920,
"peak_memory_bytes": {
"rss": 215396352,
"heap_used": 49478224,
"external": 43102012,
"array_buffers": 30263688
"rss": 208781312,
"heap_used": 49416712,
"external": 29886702,
"array_buffers": 26096358
},
"delta_rss_bytes": 17694720,
"delta_rss_bytes": 12603392,
"counters": {
"attachments.insert_pending": 50,
"attachments.proxy.bytes_in": 498073600,
@@ -128,35 +127,35 @@
}
}
],
"total_delta_rx_bytes": 998939204,
"total_delta_tx_bytes": 999493950,
"rx_bytes_per_upload": 9989392,
"tx_bytes_per_upload": 9994940,
"max_delta_rss_bytes": 26607616
"total_delta_rx_bytes": 998794896,
"total_delta_tx_bytes": 999361595,
"rx_bytes_per_upload": 9987949,
"tx_bytes_per_upload": 9993616,
"max_delta_rss_bytes": 12648448
},
{
"uploads": 100,
"succeeded": 100,
"failed": 0,
"duration_s": 5.757,
"duration_s": 6.222,
"latency_ms": {
"p50": 413.8,
"p95": 866.6,
"p99": 1090.4
"p50": 452.3,
"p95": 913.7,
"p99": 1284.1
},
"replicas": [
{
"instance_id": "b50bb8514a7b",
"delta_rx_bytes": 499421823,
"delta_tx_bytes": 499732729,
"baseline_rss_bytes": 195944448,
"instance_id": "01e84e9e9e38",
"delta_rx_bytes": 499462554,
"delta_tx_bytes": 499707805,
"baseline_rss_bytes": 208515072,
"peak_memory_bytes": {
"rss": 214212608,
"heap_used": 50078520,
"external": 38151413,
"array_buffers": 34361069
"rss": 213237760,
"heap_used": 50201400,
"external": 39684000,
"array_buffers": 35893464
},
"delta_rss_bytes": 18268160,
"delta_rss_bytes": 4722688,
"counters": {
"attachments.insert_pending": 50,
"attachments.proxy.bytes_in": 498073600,
@@ -166,17 +165,17 @@
}
},
{
"instance_id": "fc61f806b880",
"delta_rx_bytes": 499373397,
"delta_tx_bytes": 499664859,
"baseline_rss_bytes": 196259840,
"instance_id": "d49b799653d6",
"delta_rx_bytes": 499435292,
"delta_tx_bytes": 499704897,
"baseline_rss_bytes": 192315392,
"peak_memory_bytes": {
"rss": 207290368,
"heap_used": 49133976,
"external": 31644969,
"array_buffers": 27854625
"rss": 209580032,
"heap_used": 50343440,
"external": 38677040,
"array_buffers": 34886696
},
"delta_rss_bytes": 11030528,
"delta_rss_bytes": 17264640,
"counters": {
"attachments.insert_pending": 50,
"attachments.proxy.bytes_in": 498073600,
@@ -186,11 +185,11 @@
}
}
],
"total_delta_rx_bytes": 998795220,
"total_delta_tx_bytes": 999397588,
"rx_bytes_per_upload": 9987952,
"tx_bytes_per_upload": 9993976,
"max_delta_rss_bytes": 18268160
"total_delta_rx_bytes": 998897846,
"total_delta_tx_bytes": 999412702,
"rx_bytes_per_upload": 9988978,
"tx_bytes_per_upload": 9994127,
"max_delta_rss_bytes": 17264640
}
]
}
+4 -3
View File
@@ -1,8 +1,9 @@
scripts/lab4/consistency_check.sh
bucket: messenger-attachments
objects: 1308
objects: 2580
rows by status:
11 pending
1308 ready
33 pending
2577 ready
6 rejected
orphans: 0
missing: 0
+2 -2
View File
@@ -4,5 +4,5 @@ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths r
RUN v4.1.11 /home/tomato/Projects/VP/mtusi2026lab4/app
Test Files 1 passed (1)
Tests 7 passed (7)
Start at 22:45:08
Duration 8.14s (transform 44ms, setup 0ms, import 75ms, tests 7.94s, environment 0ms)
Start at 23:00:12
Duration 8.41s (transform 64ms, setup 0ms, import 94ms, tests 8.16s, environment 0ms)
+2 -2
View File
@@ -5,5 +5,5 @@ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths r
RUN v4.1.11 /home/tomato/Projects/VP/mtusi2026lab4/app
Test Files 1 passed (1)
Tests 6 passed (6)
Start at 22:45:26
Duration 89.83s (transform 52ms, setup 0ms, import 69ms, tests 89.66s, environment 0ms)
Start at 23:00:31
Duration 88.83s (transform 48ms, setup 0ms, import 73ms, tests 88.65s, environment 0ms)
+3 -3
View File
@@ -3,6 +3,6 @@
The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
RUN v4.1.11 /home/tomato/Projects/VP/mtusi2026lab4/app
Test Files 3 passed | 1 skipped (4)
Tests 33 passed | 8 skipped (41)
Start at 22:44:49
Duration 3.73s (transform 239ms, setup 0ms, import 536ms, tests 7.77s, environment 0ms)
Tests 34 passed | 8 skipped (42)
Start at 22:59:53
Duration 4.87s (transform 409ms, setup 0ms, import 764ms, tests 9.39s, environment 0ms)
+7 -7
View File
@@ -1,9 +1,9 @@
| mode | size, MiB | C | ok | API rx/upload, MiB | API tx/upload, MiB | max Δrss, MiB | p50, ms | p95, ms |
|---|---|---|---|---|---|---|---|---|
| direct | 0.12 | 10 | 150/150 | 0.13 | 0.01 | 0.62 | 42 | 62 |
| proxy | 0.12 | 10 | 150/150 | 0.13 | 0.13 | 3.75 | 26 | 53 |
| direct | 1.00 | 10 | 150/150 | 1.01 | 0.01 | 3.88 | 69 | 100 |
| proxy | 1.00 | 10 | 150/150 | 1.01 | 1.01 | 5.12 | 44 | 79 |
| direct | 9.50 | 10 | 150/150 | 0.14 | 0.01 | 0.25 | 377 | 493 |
| proxy | 9.50 | 10 | 150/150 | 9.53 | 9.53 | 10.65 | 212 | 374 |
| proxy | 9.50 | 20 | 300/300 | 9.53 | 9.53 | 17.92 | 414 | 802 |
| direct | 0.12 | 10 | 150/150 | 0.07 | 0.01 | 0.40 | 45 | 65 |
| proxy | 0.12 | 10 | 150/150 | 0.13 | 0.13 | 3.78 | 32 | 62 |
| direct | 1.00 | 10 | 150/150 | 0.07 | 0.01 | 0.75 | 75 | 137 |
| proxy | 1.00 | 10 | 150/150 | 1.01 | 1.01 | 4.38 | 59 | 110 |
| direct | 9.50 | 10 | 150/150 | 0.07 | 0.01 | 0.88 | 346 | 571 |
| proxy | 9.50 | 10 | 150/150 | 9.52 | 9.53 | 15.70 | 239 | 394 |
| proxy | 9.50 | 20 | 300/300 | 9.53 | 9.53 | 16.46 | 409 | 812 |