diff --git a/.dockerignore b/.dockerignore index bc16e556..a4397ed5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,20 +1,8 @@ -.git -.github -.env -.env.* -!.env.example -secrets -certs -volumes -data -backups -*.key -*.pem -*.p12 -*.pfx -*.jks -.venv -__pycache__ -node_modules -evidence -.DS_Store +* +!go.mod +!go.sum +!cmd/ +!cmd/** +!internal/ +!internal/** +!Dockerfile diff --git a/.env.example b/.env.example index d32b9be0..6dfa3d3a 100644 --- a/.env.example +++ b/.env.example @@ -1,13 +1,27 @@ -# Copy to .env for your LOCAL synthetic test environment; never commit .env. -# These are logical interface suggestions; map actual framework names in REPORT.md. +# Synthetic isolated environment only. Never commit the local .env. APP_HOST=0.0.0.0 APP_PORT=8080 -APP_ENV=lab +DATABASE_URL=postgres://messenger:REPLACE_LOCALLY@127.0.0.1:5432/messenger?sslmode=disable +VALKEY_SHARDS=shard0=127.0.0.1:6379,shard1=127.0.0.1:6380 +VALKEY_COORDINATOR=shard0 SESSION_TTL_SECONDS=3600 -# Choose credentials locally. File paths contain no secret values. -DATABASE_URL_FILE=/run/secrets/database_url -# Optional on 3, required use on 4 in lab2; Redis OR Valkey: -SESSION_STORE=postgres -CACHE_URL_FILE=/run/secrets/cache_url -API_REPLICAS=2 -IDEMPOTENCY_TTL_SECONDS=86400 +DEPENDENCY_POOL_SIZE=8 +DEPENDENCY_TIMEOUT_MS=1000 +REQUEST_TIMEOUT_SECONDS=3 +SHUTDOWN_TIMEOUT_SECONDS=5 +MAX_IN_FLIGHT=32 +REQUESTS_PER_SECOND=1000 +AUTH_RATE=100 +AUTH_SLOTS=4 +USER_RATE=100 +USER_SLOTS=8 +USER_WRITE_RATE=50 +USER_WRITE_SLOTS=4 +USER_AUTH_RATE=20 +USER_AUTH_SLOTS=2 +LOG_LEVEL=info + +# Lab3: common 32-byte base64 secret for every replica; generate with openssl rand -base64 32. +CURSOR_SIGNING_KEY= +# Stable pod name supplied by the Downward API; local processes use a random alias if omitted. +INSTANCE_ID= diff --git a/.github/workflows/application.yml b/.github/workflows/application.yml new file mode 100644 index 00000000..3fefacd8 --- /dev/null +++ b/.github/workflows/application.yml @@ -0,0 +1,50 @@ +name: Application +on: [push, pull_request] +permissions: + contents: read +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 15 + services: + postgres: + image: postgres:17.6-alpine + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: isolated-ci-password + POSTGRES_DB: messenger + ports: ['5432:5432'] + options: >- + --health-cmd "pg_isready -U postgres -d messenger" + --health-interval 2s --health-timeout 2s --health-retries 20 + valkey0: + image: valkey/valkey:8.1.3-alpine + ports: ['6379:6379'] + valkey1: + image: valkey/valkey:8.1.3-alpine + ports: ['6380:6379'] + valkey2: + image: valkey/valkey:8.1.3-alpine + ports: ['6381:6379'] + env: + DATABASE_URL: postgres://postgres:isolated-ci-password@localhost:5432/messenger?sslmode=disable + TEST_DATABASE_URL: postgres://postgres:isolated-ci-password@localhost:5432/messenger?sslmode=disable + VALKEY_SHARDS: shard0=localhost:6379,shard1=localhost:6380,shard2=localhost:6381 + TEST_VALKEY_ADDRESS: localhost:6381 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.26.1' + - run: make check + - run: make vet + - uses: golangci/golangci-lint-action@v8 + with: + version: v2.12.2 + - run: make coverage + - run: scripts/test-faults.sh + - uses: actions/upload-artifact@v4 + if: always() + with: + name: coverage + path: coverage/ diff --git a/.gitignore b/.gitignore index b5a71896..b72f046b 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ coverage/ .vscode/ # Keep small, sanitized evidence summaries in evidence/ under version control. # Inspect git diff --cached: ignore rules are not a secret scanner. +/server + +/key.json diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..c00b9409 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,21 @@ +version: "2" +run: + timeout: 3m +linters: + default: none + enable: + - errcheck + - govet + - ineffassign + - staticcheck + - unused + - revive + - gocritic +formatters: + enable: + - gofmt + - goimports + settings: + goimports: + local-prefixes: + - gitea.privcloud.tech/vlad_marlo/mtusi2026lab2 diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md new file mode 100644 index 00000000..b87a772b --- /dev/null +++ b/ARCHITECTURE.md @@ -0,0 +1,19 @@ +# Архитектура лабораторной 3 + +Fiber/Fx/Zap, HTTP models → DTO → service → store. PostgreSQL — источник истины для данных, сессий и результатов идемпотентных записей. Valkey хранит профильный кэш и распределённые лимиты. Ключ подписи cursor общий, хранится в Secret. + +Повтор сообщения сначала заново проходит аутентификацию, авторизацию и валидацию. Store блокирует строку чата, проверяет запись идемпотентности, затем в одной транзакции создаёт сообщение и результат. Ключ ограничен парой пользователь/чат (метод POST и endpoint сообщений фиксированы). Изменение body даёт конфликт; неуспешная транзакция не сохраняет результат. После 24 часов ключ допускает новую запись. Изоляция чатов предотвращает общий последовательный bottleneck всех записей. + +Миграции выполняются командой `server migrate` в отдельном Kubernetes Job. API при старте проверяет версию схемы. Изменения схемы аддитивны. Job и API создаются одним Helm release; до завершения миграции новая API-реплика не готова, Kubernetes повторяет её запуск. При обновлении старая готовая реплика сохраняется благодаря maxUnavailable=0. + +Образы хранятся в Timeweb Cloud Registry и закреплены digest. Локальный токен передаётся Docker через stdin; `make init` создаёт переносимый imagePullSecret вне Helm release и обновляет его при смене токена. Пароль PostgreSQL и ключ cursor при повторной инициализации сохраняются. + +Traefik Ingress hl.agapov.space направляет запросы в Service api и отслеживает EndpointSlice без sticky sessions. Readiness проверяется каждые 2 секунды, timeout 2 секунды, исключение после двух ошибок. PreStop 3 секунды, shutdown timeout 5 секунд, terminationGracePeriodSeconds=20. TLS выдаёт letsencrypt-prod. Kubernetes управляет EndpointSlice, Deployment, rolling update и HPA. HPA использует CPU из metrics-server и не зависит от Grafana. Метрики HTTP имеют ограниченный набор route/method/status labels без user/chat/request ID. + +Один namespace `highload-applications`; существующий release lab2 обновляется на реализацию lab3. Имена api/postgres/valkey, три шарда, PVC и пароль БД сохраняются. Один LB, PostgreSQL и координатор Valkey остаются точками отказа; трек отказа узла не заявляется. + +Источники: [HPA](https://kubernetes.io/docs/concepts/workloads/autoscaling/horizontal-pod-autoscale/), [metrics-server](https://github.com/kubernetes-sigs/metrics-server), [PostgreSQL locking](https://www.postgresql.org/docs/17/explicit-locking.html). + +Ошибки парсера Fiber (например превышение BodyLimit) могут возникать до middleware. Общий handleErr самостоятельно устанавливает X-Instance-Id и при необходимости создаёт X-Request-Id; поэтому контракт заголовков не зависит от того, был ли вызван route handler. + +Параметры readiness вынесены в api.readiness для воспроизводимого A/B. Штатные timeoutSeconds=2 и failureThreshold=2 сохранены: эксперимент с 5 с / 1 ошибкой не подтвердил устойчивого выигрыша. Необязательный api.nodeSelector используется только для контроля аппаратной платформы эксперимента; в рабочем релизе его нет. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..5a479560 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM golang:1.26.1-alpine3.23 AS build +WORKDIR /src +COPY go.mod go.sum ./ +RUN go mod download +COPY cmd/ ./cmd/ +COPY internal/ ./internal/ +RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/server ./cmd/server + +FROM scratch AS runtime +COPY --from=build /out/server /server +USER 65532:65532 +ENV APP_HOST=0.0.0.0 APP_PORT=8080 GOMEMLIMIT=160MiB +EXPOSE 8080 +STOPSIGNAL SIGTERM +HEALTHCHECK --interval=5s --timeout=3s --start-period=3s --retries=3 CMD ["/server", "healthcheck"] +ENTRYPOINT ["/server"] diff --git a/Makefile b/Makefile index 5d86d171..b5ffcf3d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ PYTHON ?= python3 -BASE_URL ?= http://localhost:8080 +BASE_URL ?= https://hl.agapov.space CA_FILE ?= ACTION_SCRIPT ?= TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",) @@ -28,3 +28,65 @@ test-persistence: test-failover: @test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2) $(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS) + +GO ?= go +.PHONY: build test-student coverage vet lint fmt research +build: + $(GO) build -trimpath -o bin/server ./cmd/server +test-student: + $(GO) test -race ./... +coverage: + GO="$(GO)" scripts/coverage.sh +vet: + $(GO) vet ./... +lint: + golangci-lint run ./... +fmt: + golangci-lint fmt +research: + scripts/experiment.sh + +REGISTRY ?= asisti.registry.twcstorage.ru +IMAGE := $(REGISTRY)/mtusi2026lab3 +IMAGE_TAG ?= dev-$(shell date -u +%Y%m%d%H%M%S) +PLATFORM ?= linux/amd64 +REGISTRY_USER ?= token +REGISTRY_TOKEN_FILE ?= $(HOME)/.secrets/twc-registry-token +KUBE_CONTEXT ?= dev +NAMESPACE ?= highload-applications +RELEASE ?= lab2 +CHART := charts/messenger +VALUES ?= $(CHART)/values.yaml +HELM_ARGS := --kube-context "$(KUBE_CONTEXT)" -n "$(NAMESPACE)" +export KUBE_CONTEXT NAMESPACE RELEASE REGISTRY REGISTRY_USER REGISTRY_TOKEN_FILE + +.PHONY: registry-login build-push init deploy chart-check reload port-forward ready reshard +registry-login: + docker login "$(REGISTRY)" --username "$(REGISTRY_USER)" --password-stdin < "$(REGISTRY_TOKEN_FILE)" +build-push: registry-login + docker buildx build --platform "$(PLATFORM)" --target runtime --tag "$(IMAGE):$(IMAGE_TAG)" --metadata-file evidence/image-build.json --push . +init: + scripts/init-secrets.sh +chart-check: + helm lint $(CHART) -f "$(VALUES)" + helm template "$(RELEASE)" $(CHART) -n "$(NAMESPACE)" -f "$(VALUES)" > /dev/null +deploy: + helm upgrade --install "$(RELEASE)" $(CHART) $(HELM_ARGS) --create-namespace -f "$(VALUES)" $(if $(IMAGE_DIGEST),--set-string image.digest=$(IMAGE_DIGEST),) --wait --wait-for-jobs --timeout 240s +reload: + kubectl --context "$(KUBE_CONTEXT)" -n "$(NAMESPACE)" rollout restart deployment/api + kubectl --context "$(KUBE_CONTEXT)" -n "$(NAMESPACE)" rollout status deployment/api --timeout=180s +port-forward: + scripts/port-forward.sh +ready: + @for attempt in $$(seq 1 60); do curl --fail --silent --max-time 1 "$(BASE_URL)/health/ready" >/dev/null && exit 0; sleep 1; done; echo 'API readiness timeout' >&2; exit 1 +reshard: + SHARDS="$(SHARDS)" scripts/scale-shards.sh + +.PHONY: metrics-install test-idempotency load-cluster +metrics-install: + kubectl --context "$(KUBE_CONTEXT)" apply -k infra/metrics-server + kubectl --context "$(KUBE_CONTEXT)" -n "$(NAMESPACE)" rollout status deployment/metrics-server --timeout=180s +test-idempotency: + RUN="idempotency-$$(date -u +%Y%m%d%H%M%S)" LOAD_SCRIPT=idempotency.js scripts/run-load.sh +load-cluster: + scripts/run-load.sh diff --git a/REPORT.md b/REPORT.md index c2679005..f0a9a06c 100644 --- a/REPORT.md +++ b/REPORT.md @@ -1,37 +1,54 @@ -# Отчёт — лабораторная 3 +# Лабораторная 3 -- Автор, группа: TODO -- Целевая оценка; выбранный трек 5, если нужен: TODO -- Commit/PR: TODO после публикации -- Использованные источники, библиотеки и помощь ИИ: TODO +Агапов Владислав, БПИ2303. База: текущая lab2 (8173f70), отдельный базовый коммит lab3 a57cbcf. Требования и статус: [SPEC](docs/SPEC.md), [PLAN](docs/PLAN.md). -## Запуск из чистого clone +## Запуск -TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных. +Основной стенд: Kubernetes dev, namespace highload-applications, существующий release lab2. Публичная точка входа: https://hl.agapov.space через установленный Traefik. TLS: cert-manager ClusterIssuer letsencrypt-prod. PostgreSQL и три Valkey сохраняют прежние PVC. Новый release lab3 не требуется. -## Архитектура и решения +Нужны Helm, kubectl, Docker buildx, jq, OpenSSL, curl. Для проверки: Go 1.26.1+, golangci-lint; Python 3 используется публичными тестами и построением графиков (matplotlib); управление стендом — shell/Helm. В кластере нужны Traefik, cert-manager, default StorageClass и metrics-server. Образы PostgreSQL 17.6-alpine, Valkey 8.1.3-alpine, k6 1.3.0 закреплены в chart. -TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab2, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации. +```sh +make init +make chart-check +make deploy +make ready +make test +make test-idempotency +make test-failover ACTION_SCRIPT=scripts/stop-one.sh +make test-persistence ACTION_SCRIPT=scripts/restart.sh +``` -## Доказательства критериев +make init читает ~/.secrets/twc-registry-token, обновляет registry-pull и сохраняет пароль messenger-secrets. При отсутствии добавляет общий cursor-key. При bootstrap создаёт пароль БД. Chart описывает API, PostgreSQL, Valkey, миграции, HPA, NetworkPolicy и Ingress. -| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства | -| --- | --- | --- | --- | -| Публичный smoke | make test | TODO | TODO | -| Остальные пункты уровня 3 | TODO | TODO | TODO | -| Все пункты уровня 4, если заявлен | TODO | TODO | TODO | -| Выбранный трек 5, если заявлен | TODO | TODO | TODO | +```sh +make build-push +make deploy IMAGE_DIGEST="$(jq -r '."containerimage.digest"' evidence/image-build.json)" +``` -TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены. +Для повторяемого запуска новой версии записать digest в charts/messenger/values.yaml. Не удалять PVC и не создавать параллельный release для обновления. -## Эксперименты и отказы +## Поведение -TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения. +Две и более взаимозаменяемые API-реплики, X-Instance-Id равен имени pod. Общие сессии PostgreSQL и ключ cursor позволяют переключать реплики без повторного входа. POST сообщения требует Idempotency-Key; повтор возвращает исходное сообщение, другой текст — 409. Запись и ключ фиксируются атомарно. Миграции выполняет отдельный Job, API проверяет схему. Отказ БД возвращает 503 без раскрытия внутренних деталей. -| Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных | -| --- | --- | --- | --- | -| TODO | TODO | TODO | TODO | +[Архитектура](ARCHITECTURE.md) описывает readiness, graceful shutdown и HPA. Подготовлены [scrape](infra/monitoring/prometheus-scrape.yaml) и [dashboard](infra/monitoring/grafana-dashboard.json); импорт в Grafana не заявляется. -## Ограничения и следующие шаги +## Проверки исправлений 29.10.2026 -TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза. +- 413 при превышении BodyLimit содержит X-Instance-Id и согласованный X-Request-Id. Проверены настоящий TCP listener и публичный HTTPS: [результаты](evidence/review-20261029/README.md). +- Последовательно остановлены обе исходные API: восстановление 0.190 с и 2.547 с, подтверждённые сообщения и прежние сессии сохранены. Краткие ошибки операций (5 и 7) измерены, а не скрыты. Имена/UID целей, события записи и Kubernetes delete сохранены. +- После восстановления публичный smoke прошёл. Race, интеграционные PostgreSQL/Valkey и настоящий процесс/SIGTERM прошли; каждый из 59 исполняемых Go-файлов имеет не менее 90% покрытия. Lint, vet и контракт проверены. +- Исследование масштабирования, насыщение и повторные A/B описаны в [RESEARCH](docs/RESEARCH.md). Таблицы и графики получены из raw k6, фактические replicas проверены по Deployment. Несостоявшиеся и некорректные прогоны исключены с сохранением причин. + +Ранее подтверждённые конкурентная идемпотентность, persistence и stop/pause PostgreSQL/Valkey находятся в evidence/shared-*. Это исторические проверки 16.10.2026, а не новые прогоны. Файлы старых экспериментальных стендов не заменяют свежие доказательства. + +## Ограничения + +Используется Kubernetes вместо перечисленных в задании Compose/Swarm; принятие этой замены преподавателем отдельно не подтверждено. PostgreSQL и Valkey не реплицированы: отказ узла с локальным PVC не покрывается. Метрики и подготовленный dashboard не означают, что Grafana настроена. + +Результаты получены на общем dev-кластере с неоднородными нодами и сетевыми сбоями. Пределы и исключённые точки указаны в исследовании; оценку определяет преподаватель. + +Источники: README, COURSE, contracts текущей лабораторной, собственная lab2. Codex использован для реализации, проверки и документации. + +Финальная проверка после всех экспериментов: rollout завершился, но два внешних smoke получили connection/TLS failure. Их логи сохранены в evidence/review-20261029/final-smoke*.txt. Успешный smoke-after относится к более раннему состоянию после проверки обоих отказов; текущая стабильность внешнего доступа не подтверждена. diff --git a/charts/messenger/Chart.yaml b/charts/messenger/Chart.yaml new file mode 100644 index 00000000..b6f6d1f4 --- /dev/null +++ b/charts/messenger/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: messenger +description: Учебный мессенджер с PostgreSQL и шардированным Valkey +version: 0.1.0 +appVersion: lab3 +type: application diff --git a/charts/messenger/templates/_helpers.tpl b/charts/messenger/templates/_helpers.tpl new file mode 100644 index 00000000..2fcf3714 --- /dev/null +++ b/charts/messenger/templates/_helpers.tpl @@ -0,0 +1,7 @@ +{{- define "messenger.shards" -}} +{{- $nodes := list -}} +{{- range $i := until (int .Values.valkey.shards) -}} +{{- $nodes = append $nodes (printf "shard%d=valkey-%d.valkey:6379" $i $i) -}} +{{- end -}} +{{- join "," $nodes -}} +{{- end -}} diff --git a/charts/messenger/templates/api.yaml b/charts/messenger/templates/api.yaml new file mode 100644 index 00000000..4f61f62c --- /dev/null +++ b/charts/messenger/templates/api.yaml @@ -0,0 +1,123 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: messenger-config + namespace: {{ .Release.Namespace }} +data: + APP_PORT: '8080' + VALKEY_COORDINATOR: shard0 + VALKEY_SHARDS: {{ include "messenger.shards" . | quote }} +{{- range $key, $value := .Values.api.env }} + {{ $key }}: {{ $value | quote }} +{{- end }} +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: api + name: api + namespace: {{ .Release.Namespace }} +spec: + selector: + app: api + ports: + - name: http + port: 8080 + targetPort: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: api + namespace: {{ .Release.Namespace }} +spec: +{{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.api.replicas }} +{{- end }} + strategy: + rollingUpdate: + maxUnavailable: 0 + maxSurge: 1 + selector: + matchLabels: + app: api + template: + metadata: + annotations: + checksum/config: {{ printf "%s%s" (include "messenger.shards" .) (toJson .Values.api.env) | sha256sum }} + labels: + app: api + spec: + {{- with .Values.api.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + imagePullSecrets: + - name: {{ .Values.imagePullSecret }} + terminationGracePeriodSeconds: 20 + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: ScheduleAnyway + labelSelector: + matchLabels: + app: api + securityContext: + runAsNonRoot: true + runAsUser: 65532 + seccompProfile: + type: RuntimeDefault + containers: + - name: api + image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}" + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + envFrom: + - configMapRef: + name: messenger-config + env: + - name: INSTANCE_ID + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: CURSOR_SIGNING_KEY + valueFrom: + secretKeyRef: + name: {{ .Values.databaseSecret }} + key: cursor-key + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: {{ .Values.databaseSecret }} + key: database-url + resources: + {{- toYaml .Values.api.resources | nindent 12 }} + lifecycle: + preStop: + sleep: + seconds: 3 + startupProbe: + httpGet: + path: /health/ready + port: 8080 + periodSeconds: 2 + failureThreshold: 30 + readinessProbe: + timeoutSeconds: {{ .Values.api.readiness.timeoutSeconds }} + failureThreshold: {{ .Values.api.readiness.failureThreshold }} + httpGet: + path: /health/ready + port: 8080 + periodSeconds: 2 + livenessProbe: + httpGet: + path: /health/live + port: 8080 + periodSeconds: 5 + securityContext: + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + capabilities: + drop: [ALL] diff --git a/charts/messenger/templates/guard.yaml b/charts/messenger/templates/guard.yaml new file mode 100644 index 00000000..313b843e --- /dev/null +++ b/charts/messenger/templates/guard.yaml @@ -0,0 +1,7 @@ +{{- $live := lookup "v1" "ConfigMap" .Release.Namespace "messenger-config" -}} +{{- if and $live (ne (index $live.data "VALKEY_SHARDS") (include "messenger.shards" .)) -}} +{{- $api := lookup "apps/v1" "Deployment" .Release.Namespace "api" -}} +{{- if or (gt (int .Values.api.replicas) 0) (and $api (gt (int $api.spec.replicas) 0)) -}} +{{- fail "Changing shards requires drained API: use make reshard SHARDS=2 or SHARDS=3" -}} +{{- end -}} +{{- end -}} diff --git a/charts/messenger/templates/hpa.yaml b/charts/messenger/templates/hpa.yaml new file mode 100644 index 00000000..a6b8d722 --- /dev/null +++ b/charts/messenger/templates/hpa.yaml @@ -0,0 +1,33 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: api +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: api + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.cpuPercent }} + behavior: + scaleUp: + stabilizationWindowSeconds: 15 + policies: + - type: Pods + value: 1 + periodSeconds: 30 + scaleDown: + stabilizationWindowSeconds: 120 + policies: + - type: Pods + value: 1 + periodSeconds: 60 +{{- end }} diff --git a/charts/messenger/templates/ingress.yaml b/charts/messenger/templates/ingress.yaml new file mode 100644 index 00000000..3bc3d8aa --- /dev/null +++ b/charts/messenger/templates/ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: messenger + annotations: + cert-manager.io/cluster-issuer: {{ .Values.ingress.clusterIssuer | quote }} +spec: + ingressClassName: {{ .Values.ingress.className }} + tls: + - hosts: + - {{ .Values.ingress.host | quote }} + secretName: messenger-tls + rules: + - host: {{ .Values.ingress.host | quote }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: api + port: + number: 8080 diff --git a/charts/messenger/templates/load.yaml b/charts/messenger/templates/load.yaml new file mode 100644 index 00000000..b9a5f133 --- /dev/null +++ b/charts/messenger/templates/load.yaml @@ -0,0 +1,39 @@ +{{- if .Values.load.enabled }} +apiVersion: batch/v1 +kind: Job +metadata: + name: load-{{ .Values.load.run }} +spec: + backoffLimit: 0 + activeDeadlineSeconds: 300 + ttlSecondsAfterFinished: 86400 + template: + metadata: + labels: + app: load + spec: + restartPolicy: Never + containers: + - name: k6 + image: grafana/k6:1.3.0 + args: [run, --quiet, /scripts/{{ .Values.load.script }}] + env: + - name: BASE_URL + value: "https://{{ .Values.ingress.host }}" + - name: TARGET_INSTANCE_ID + value: {{ .Values.load.target | default "" | quote }} + - name: DURATION + value: {{ .Values.load.duration | quote }} + - name: VUS + value: {{ .Values.load.vus | quote }} + resources: + requests: {cpu: 250m, memory: 128Mi} + limits: {cpu: '2', memory: 256Mi} + volumeMounts: + - name: scripts + mountPath: /scripts + volumes: + - name: scripts + configMap: + name: load-scripts +{{- end }} diff --git a/charts/messenger/templates/migrate.yaml b/charts/messenger/templates/migrate.yaml new file mode 100644 index 00000000..db5f3722 --- /dev/null +++ b/charts/messenger/templates/migrate.yaml @@ -0,0 +1,32 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: migrate-{{ .Release.Revision }} +spec: + activeDeadlineSeconds: 180 + backoffLimit: 3 + ttlSecondsAfterFinished: 86400 + template: + metadata: + labels: + app: migrate + spec: + restartPolicy: OnFailure + imagePullSecrets: + - name: {{ .Values.imagePullSecret }} + containers: + - name: migrate + image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}" + args: [migrate] + envFrom: + - configMapRef: + name: messenger-config + env: + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: {{ .Values.databaseSecret }} + key: database-url + resources: + requests: {cpu: 50m, memory: 32Mi} + limits: {cpu: 500m, memory: 128Mi} diff --git a/charts/messenger/templates/monitoring.yaml b/charts/messenger/templates/monitoring.yaml new file mode 100644 index 00000000..57db5d55 --- /dev/null +++ b/charts/messenger/templates/monitoring.yaml @@ -0,0 +1,19 @@ +{{- if .Values.monitoring.serviceMonitor }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: api + labels: + app: api +spec: + namespaceSelector: + matchNames: [{{ .Release.Namespace }}] + selector: + matchLabels: + app: api + endpoints: + - port: http + path: /metrics + interval: 15s + scrapeTimeout: 3s +{{- end }} diff --git a/charts/messenger/templates/network-policy.yaml b/charts/messenger/templates/network-policy.yaml new file mode 100644 index 00000000..3ad21b20 --- /dev/null +++ b/charts/messenger/templates/network-policy.yaml @@ -0,0 +1,54 @@ +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: private-databases + namespace: {{ .Release.Namespace }} +spec: + podSelector: + matchExpressions: + - key: app + operator: In + values: [postgres, valkey] + policyTypes: [Ingress] + ingress: + - from: + - podSelector: + matchLabels: + app: api + ports: + - protocol: TCP + port: 5432 + - protocol: TCP + port: 6379 + - from: + - podSelector: + matchLabels: + app: migrate + ports: + - protocol: TCP + port: 5432 +--- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: private-api +spec: + podSelector: + matchLabels: + app: api + policyTypes: [Ingress] + ingress: + - from: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: traefik + ports: + - protocol: TCP + port: 8080 + - from: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: monitoring + ports: + - protocol: TCP + port: 8080 diff --git a/charts/messenger/templates/postgres.yaml b/charts/messenger/templates/postgres.yaml new file mode 100644 index 00000000..8d8704a2 --- /dev/null +++ b/charts/messenger/templates/postgres.yaml @@ -0,0 +1,66 @@ +apiVersion: v1 +kind: Service +metadata: + name: postgres + namespace: {{ .Release.Namespace }} +spec: + selector: + app: postgres + ports: + - port: 5432 + targetPort: 5432 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: postgres + namespace: {{ .Release.Namespace }} +spec: + serviceName: postgres + replicas: 1 + selector: + matchLabels: + app: postgres + template: + metadata: + labels: + app: postgres + spec: + terminationGracePeriodSeconds: 30 + containers: + - name: postgres + image: {{ .Values.postgres.image | quote }} + ports: + - containerPort: 5432 + env: + - name: POSTGRES_DB + value: messenger + - name: POSTGRES_USER + value: messenger + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.databaseSecret }} + key: postgres-password + - name: PGDATA + value: /var/lib/postgresql/data/pgdata + resources: + {{- toYaml .Values.postgres.resources | nindent 12 }} + readinessProbe: + exec: + command: [pg_isready, -U, messenger, -d, messenger] + initialDelaySeconds: 3 + volumeMounts: + - name: data + mountPath: /var/lib/postgresql/data + volumeClaimTemplates: + - metadata: + name: data + spec: +{{- if .Values.storageClass }} + storageClassName: {{ .Values.storageClass | quote }} +{{- end }} + accessModes: [ReadWriteOnce] + resources: + requests: + storage: {{ .Values.postgres.storage }} diff --git a/charts/messenger/templates/valkey.yaml b/charts/messenger/templates/valkey.yaml new file mode 100644 index 00000000..5c996cc7 --- /dev/null +++ b/charts/messenger/templates/valkey.yaml @@ -0,0 +1,57 @@ +apiVersion: v1 +kind: Service +metadata: + name: valkey + namespace: {{ .Release.Namespace }} +spec: + clusterIP: None + selector: + app: valkey + ports: + - port: 6379 + targetPort: 6379 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: valkey + namespace: {{ .Release.Namespace }} +spec: + serviceName: valkey + replicas: {{ .Values.valkey.shards }} + podManagementPolicy: Parallel + selector: + matchLabels: + app: valkey + template: + metadata: + labels: + app: valkey + spec: + terminationGracePeriodSeconds: 30 + containers: + - name: valkey + image: {{ .Values.valkey.image | quote }} + args: [valkey-server, --appendonly, 'yes', --appendfsync, always, --maxmemory, {{ .Values.valkey.maxmemory | quote }}, --maxmemory-policy, noeviction] + ports: + - containerPort: 6379 + resources: + {{- toYaml .Values.valkey.resources | nindent 12 }} + readinessProbe: + exec: + command: [valkey-cli, ping] + initialDelaySeconds: 2 + volumeMounts: + - name: data + mountPath: /data + volumeClaimTemplates: + - metadata: + name: data + spec: +{{- if .Values.storageClass }} + storageClassName: {{ .Values.storageClass | quote }} +{{- end }} + accessModes: [ReadWriteOnce] + resources: + requests: + storage: {{ .Values.valkey.storage }} diff --git a/charts/messenger/values.schema.json b/charts/messenger/values.schema.json new file mode 100644 index 00000000..3640ffe9 --- /dev/null +++ b/charts/messenger/values.schema.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "valkey": {"type": "object", "properties": {"shards": {"type": "integer", "minimum": 2, "maximum": 3}}}, + "api": {"type": "object", "properties": {"replicas": {"type": "integer", "minimum": 0}}}, + "image": {"type": "object", "properties": {"digest": {"type": "string", "pattern": "^sha256:[a-f0-9]{64}$"}}} + } +} diff --git a/charts/messenger/values.yaml b/charts/messenger/values.yaml new file mode 100644 index 00000000..bfb3a0c9 --- /dev/null +++ b/charts/messenger/values.yaml @@ -0,0 +1,56 @@ +# Existing lab2 release; shared persistent stores and credentials. +image: + repository: asisti.registry.twcstorage.ru/mtusi2026lab3 + digest: sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 +imagePullSecret: registry-pull +databaseSecret: messenger-secrets +api: + readiness: + timeoutSeconds: 2 + failureThreshold: 2 + replicas: 2 + resources: + requests: {cpu: 250m, memory: 128Mi} + limits: {cpu: '1', memory: 256Mi} + env: + SESSION_TTL_SECONDS: '3600' + DEPENDENCY_TIMEOUT_MS: '2000' + DEPENDENCY_POOL_SIZE: '8' + REQUEST_TIMEOUT_SECONDS: '4' + SHUTDOWN_TIMEOUT_SECONDS: '5' + GOMEMLIMIT: 160MiB +postgres: + image: postgres:17.6-alpine + storage: 2Gi + resources: + requests: {cpu: 250m, memory: 256Mi} + limits: {cpu: '1', memory: 512Mi} +valkey: + image: valkey/valkey:8.1.3-alpine + shards: 3 + storage: 1Gi + maxmemory: 64mb + resources: + requests: {cpu: 100m, memory: 96Mi} + limits: {cpu: 500m, memory: 128Mi} +# Пустое значение использует default StorageClass. Задать до первой установки. +storageClass: '' + +autoscaling: + enabled: true + minReplicas: 2 + maxReplicas: 4 + cpuPercent: 60 +monitoring: + serviceMonitor: false +load: + enabled: false + run: manual + script: scaling.js + duration: 30 + vus: 32 + +ingress: + host: hl.agapov.space + className: traefik + clusterIssuer: letsencrypt-prod diff --git a/cmd/server/app.go b/cmd/server/app.go new file mode 100644 index 00000000..609d28eb --- /dev/null +++ b/cmd/server/app.go @@ -0,0 +1,102 @@ +package main + +import ( + "time" + + "go.uber.org/fx" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/admission" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/controller" + fiberctrl "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/controller/http/fiber" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/password" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service/production" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/postgres" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/valkey" +) + +const applicationStopTimeout = 9 * time.Second + +// CreateApp defines the dependency graph and Fx lifecycle for the lab2 server. +// Constructors do not open sockets; controller.RunControllerFx registers startup +// and shutdown hooks. The outer stop deadline bounds all component cleanup. +func CreateApp() fx.Option { + return fx.Options( + fx.StopTimeout(applicationStopTimeout), + fx.Supply(fx.Annotate(password.Hasher{}, fx.As(new(service.Passwords)))), + fx.Provide( + config.New, + config.NewPersistence, + newDatabase, + newValkey, + newAuthentication, + fx.Annotate(newReadiness, fx.As(new(fiberctrl.Readiness))), + httpConfig, + + loggerConfig, + newLogger, + fx.Annotate(newAdmissionLimiter, fx.As(new(admission.Distributed))), + fiberctrl.NewErrorRegistry, + fx.Annotate(databaseStore, fx.As(new(store.Interface))), + fx.Annotate(databaseAccounts, fx.As(new(service.Accounts))), + fx.Annotate(profileCache, fx.As(new(service.ProfileCache))), + fx.Annotate(newCursor, fx.As(new(service.CursorCodec))), + fx.Annotate(production.NewCached, fx.As(new(service.Service))), + fx.Annotate(fiberctrl.New, fx.As(new(controller.Controller))), + ), + fx.WithLogger(newFxLogger), + fx.Invoke(controller.RunControllerFx), + ) +} + +// httpConfig provides the HTTP configuration section to Fx. +func httpConfig(cfg *config.Config) *config.Controller { + return cfg.HTTP +} + +// loggerConfig provides the logging configuration section to Fx. +func loggerConfig(cfg *config.Config) *config.Logger { + return cfg.Logger +} + +// newAdmissionLimiter translates configured bounds into separate shared policy budgets. +func newAdmissionLimiter(cfg *config.Controller, client *valkey.Client) (*valkey.Limiter, error) { + global := valkey.Budget{Rate: cfg.Admission.RequestsPerSecond, Slots: cfg.Admission.MaxInFlight} + return valkey.NewLimiter(client, valkey.Limits{ + Global: global, + Groups: map[string]valkey.Budget{ + "auth": {Rate: cfg.Admission.AuthRate, Slots: cfg.Admission.AuthSlots}, + "read": global, + "write": global, + }, + User: valkey.Budget{Rate: cfg.Admission.UserRate, Slots: cfg.Admission.UserSlots}, + UserGroups: map[string]valkey.Budget{ + "auth": {Rate: cfg.Admission.UserAuthRate, Slots: cfg.Admission.UserAuthSlots}, + "read": {Rate: cfg.Admission.UserRate, Slots: cfg.Admission.UserSlots}, + "write": {Rate: cfg.Admission.UserWriteRate, Slots: cfg.Admission.UserWriteSlots}, + }, + }) +} + +// databaseStore exposes business persistence through its consumer interface. +func databaseStore(database *postgres.Store) store.Interface { + return database +} + +// databaseAccounts exposes account and session persistence through its consumer interface. +func databaseAccounts(database *postgres.Store) service.Accounts { + return database +} + +// profileCache exposes immutable profiles without leaking the Valkey client. +func profileCache(client *valkey.Client) service.ProfileCache { + return client +} + +// newCursor binds the shared signing secret at the composition root. +func newCursor(cfg *config.Persistence) (*cursor.Codec, error) { + return cursor.NewShared(cfg.CursorKey) +} diff --git a/cmd/server/app_test.go b/cmd/server/app_test.go new file mode 100644 index 00000000..74e32942 --- /dev/null +++ b/cmd/server/app_test.go @@ -0,0 +1,108 @@ +package main + +import ( + "context" + "net" + "os" + "testing" + "time" + + "go.uber.org/fx" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" +) + +// TestDependencyGraph ensures constructor signatures and interface bindings agree. +func TestDependencyGraph(t *testing.T) { + if err := fx.ValidateApp(CreateApp(), fx.NopLogger); err != nil { + t.Fatal(err) + } +} + +// TestInvalidConfigurationStopsStartup checks failure before a listener is acquired. +func TestInvalidConfigurationStopsStartup(t *testing.T) { + t.Setenv("APP_PORT", "0") + app := fx.New(CreateApp(), fx.NopLogger) + if err := app.Start(context.Background()); err == nil { + t.Fatal("invalid listener configuration accepted") + } +} + +// TestCommandValidation ensures unsupported arguments cannot accidentally start a server. +func TestCommandValidation(t *testing.T) { + if err := run([]string{"unknown"}); err == nil { + t.Fatal("unknown command accepted") + } +} + +// TestLoggerConfiguration checks that process logging uses its own validated section. +func TestLoggerConfiguration(t *testing.T) { + if _, err := newLogger(&config.Logger{Level: "invalid"}); err == nil { + t.Fatal("invalid logger configuration accepted") + } +} + +// TestApplicationLifecycle starts the complete Fx graph and drains its real HTTP listener. +func TestApplicationLifecycle(t *testing.T) { + requirePersistence(t) + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + cfg := config.Default() + cfg.HTTP.Host = "127.0.0.1" + cfg.HTTP.Port = listener.Addr().(*net.TCPAddr).Port + cfg.Logger.Level = "error" + if err := listener.Close(); err != nil { + t.Fatal(err) + } + app := fx.New(CreateApp(), fx.Replace(cfg)) + ctx, cancel := context.WithTimeout(t.Context(), 5*time.Second) + defer cancel() + if err := app.Start(ctx); err != nil { + t.Fatal(err) + } + t.Cleanup(func() { + stopCtx, stopCancel := context.WithTimeout(context.Background(), 5*time.Second) + defer stopCancel() + if err := app.Stop(stopCtx); err != nil { + t.Error(err) + } + }) + if err := checkReadiness(cfg.HTTP); err != nil { + t.Fatal(err) + } +} + +// TestOccupiedListenerFailsStartup ensures bind failures propagate through the Fx lifecycle. +func TestOccupiedListenerFailsStartup(t *testing.T) { + requirePersistence(t) + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + defer func() { + _ = listener.Close() + }() + cfg := config.Default() + cfg.HTTP.Host = "127.0.0.1" + cfg.HTTP.Port = listener.Addr().(*net.TCPAddr).Port + cfg.Logger.Level = "error" + app := fx.New(CreateApp(), fx.Replace(cfg), fx.NopLogger) + if err := app.Start(t.Context()); err == nil { + _ = app.Stop(t.Context()) + t.Fatal("startup succeeded on an occupied listener") + } +} + +// requirePersistence prevents infrastructure scenarios from silently passing on configuration failure. +func requirePersistence(t *testing.T) { + t.Helper() + if os.Getenv("DATABASE_URL") == "" || os.Getenv("VALKEY_SHARDS") == "" { + t.Skip("DATABASE_URL and VALKEY_SHARDS are required for real application lifecycle tests") + } + t.Setenv("CURSOR_SIGNING_KEY", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") + if err := migrate(); err != nil { + t.Fatal(err) + } +} diff --git a/cmd/server/commands.go b/cmd/server/commands.go new file mode 100644 index 00000000..c91ffc0d --- /dev/null +++ b/cmd/server/commands.go @@ -0,0 +1,41 @@ +package main + +import ( + "context" + "fmt" + "time" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/postgres" + + "go.uber.org/fx" +) + +// run dispatches the server command or the container healthcheck. +func run(args []string) error { + if len(args) == 0 { + fx.New(CreateApp()).Run() + return nil + } + if len(args) == 1 && args[0] == "migrate" { + return migrate() + } + if len(args) == 1 && args[0] == "healthcheck" { + return healthcheck() + } + return fmt.Errorf("usage: server [healthcheck|migrate]") +} + +// migrate applies versioned DDL once from an operator job, independently of the API. +func migrate() error { + cfg, err := config.NewPersistence() + if err != nil { + return err + } + database, err := postgres.New(postgres.Options{URL: cfg.DatabaseURL, MaxConnections: 1, Timeout: 30 * time.Second}) + if err != nil { + return err + } + defer database.Close() + return database.Start(context.Background()) +} diff --git a/cmd/server/healthcheck.go b/cmd/server/healthcheck.go new file mode 100644 index 00000000..a0cbf386 --- /dev/null +++ b/cmd/server/healthcheck.go @@ -0,0 +1,46 @@ +package main + +import ( + "fmt" + "net" + "net/http" + "strconv" + "time" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" +) + +const readinessProbeTimeout = 2 * time.Second + +// healthcheck loads configuration and runs the container readiness probe. +func healthcheck() error { + cfg, err := config.New() + if err != nil { + return err + } + return checkReadiness(cfg.HTTP) +} + +// checkReadiness checks the local readiness endpoint within the probe timeout. +func checkReadiness(cfg *config.Controller) error { + host := cfg.Host + if host == "0.0.0.0" { + host = "127.0.0.1" + } + if host == "::" { + host = "::1" + } + address := "http://" + net.JoinHostPort(host, strconv.Itoa(cfg.Port)) + "/health/ready" + client := http.Client{Timeout: readinessProbeTimeout} + response, err := client.Get(address) + if err != nil { + return fmt.Errorf("readiness probe: %w", err) + } + defer func() { + _ = response.Body.Close() + }() + if response.StatusCode != http.StatusOK { + return fmt.Errorf("not ready: %d", response.StatusCode) + } + return nil +} diff --git a/cmd/server/healthcheck_test.go b/cmd/server/healthcheck_test.go new file mode 100644 index 00000000..af07c237 --- /dev/null +++ b/cmd/server/healthcheck_test.go @@ -0,0 +1,111 @@ +package main + +import ( + "errors" + "net" + "net/http" + "net/http/httptest" + "net/url" + "strconv" + "testing" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" +) + +// TestRun_Healthcheck verifies command routing to the readiness endpoint. +func TestRun_Healthcheck(t *testing.T) { + // Arrange. + requests := make(chan string, 1) + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + requests <- r.Method + " " + r.URL.Path + w.WriteHeader(http.StatusOK) + })) + t.Cleanup(server.Close) + address := server.Listener.Addr().(*net.TCPAddr) + t.Setenv("APP_HOST", "0.0.0.0") + t.Setenv("APP_PORT", strconv.Itoa(address.Port)) + + // Act. + err := run([]string{"healthcheck"}) + + // Assert. + if err != nil { + t.Fatal(err) + } + select { + case got := <-requests: + if got != "GET /health/ready" { + t.Fatalf("probe=%q", got) + } + default: + t.Fatal("command returned success without probing readiness") + } +} + +// TestHealthcheck_InvalidConfig rejects invalid startup settings before attempting HTTP. +func TestHealthcheck_InvalidConfig(t *testing.T) { + // Arrange. + t.Setenv("APP_PORT", "invalid") + + // Act. + err := healthcheck() + + // Assert. + if err == nil { + t.Fatal("invalid port accepted") + } +} + +// TestCheckReadiness distinguishes unhealthy responses from connection failures. +func TestCheckReadiness(t *testing.T) { + t.Run("Negative: unhealthy response", func(t *testing.T) { + // Arrange. + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusServiceUnavailable) + })) + t.Cleanup(server.Close) + address := server.Listener.Addr().(*net.TCPAddr) + cfg := config.Default().HTTP + cfg.Host = "127.0.0.1" + cfg.Port = address.Port + + // Act. + err := checkReadiness(cfg) + + // Assert. + if err == nil { + t.Fatalf("probe accepted %s", "Negative: unhealthy response") + } + if err.Error() != "not ready: 503" { + t.Fatalf("unexpected health failure: %v", err) + } + + }) + + t.Run("Negative: server unavailable", func(t *testing.T) { + // Arrange. + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusServiceUnavailable) + })) + t.Cleanup(server.Close) + address := server.Listener.Addr().(*net.TCPAddr) + cfg := config.Default().HTTP + cfg.Host = "127.0.0.1" + cfg.Port = address.Port + + server.Close() + + // Act. + err := checkReadiness(cfg) + + // Assert. + if err == nil { + t.Fatalf("probe accepted %s", "Negative: server unavailable") + } + + if _, ok := errors.AsType[*url.Error](err); !ok { + t.Fatalf("connection failure was not preserved: %v", err) + } + + }) +} diff --git a/cmd/server/logger.go b/cmd/server/logger.go new file mode 100644 index 00000000..3aab61bb --- /dev/null +++ b/cmd/server/logger.go @@ -0,0 +1,29 @@ +package main + +import ( + "go.uber.org/fx/fxevent" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" +) + +// newLogger creates a structured logger with the configured severity threshold. +func newLogger(cfg *config.Logger) (*zap.Logger, error) { + if err := cfg.Validate(); err != nil { + return nil, err + } + level, err := zapcore.ParseLevel(cfg.Level) + if err != nil { + return nil, err + } + settings := zap.NewProductionConfig() + settings.Level = zap.NewAtomicLevelAt(level) + settings.DisableStacktrace = true + return settings.Build() +} + +// newFxLogger adapts the application logger for Fx lifecycle events. +func newFxLogger(log *zap.Logger) fxevent.Logger { + return &fxevent.ZapLogger{Logger: log.Named("fx")} +} diff --git a/cmd/server/main.go b/cmd/server/main.go new file mode 100644 index 00000000..1d1fbd58 --- /dev/null +++ b/cmd/server/main.go @@ -0,0 +1,15 @@ +// Command server runs the messenger or its container readiness probe. +package main + +import ( + "fmt" + "os" +) + +// main runs the selected command and reports failures to stderr. +func main() { + if err := run(os.Args[1:]); err != nil { + _, _ = fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } +} diff --git a/cmd/server/persistence.go b/cmd/server/persistence.go new file mode 100644 index 00000000..02f9fa5e --- /dev/null +++ b/cmd/server/persistence.go @@ -0,0 +1,77 @@ +package main + +import ( + "context" + "time" + + "go.uber.org/fx" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service/authentication" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/postgres" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/valkey" +) + +type dependencyReadiness struct { + database *postgres.Store + cache *valkey.Client +} + +// Ping checks persistence and all limiter shards under a shared deadline. +func (d *dependencyReadiness) Ping(ctx context.Context) error { + if err := d.database.Ping(ctx); err != nil { + return err + } + return d.cache.Ping(ctx) +} + +// newDatabase creates the pool and registers its migration/start and shutdown hooks. +func newDatabase(lifecycle fx.Lifecycle, cfg *config.Persistence) (*postgres.Store, error) { + database, err := postgres.New(postgres.Options{ + URL: cfg.DatabaseURL, + MaxConnections: int32(cfg.PoolSize), + Timeout: time.Duration(cfg.TimeoutMilliseconds) * time.Millisecond, + }) + if err != nil { + return nil, err + } + lifecycle.Append(fx.Hook{ + OnStart: database.CheckSchema, + OnStop: func(context.Context) error { + database.Close() + return nil + }, + }) + return database, nil +} + +// newValkey creates bounded clients and registers connectivity and cleanup hooks. +func newValkey(lifecycle fx.Lifecycle, cfg *config.Persistence) (*valkey.Client, error) { + client, err := valkey.New(valkey.Options{ + Nodes: cfg.Shards, + Coordinator: cfg.Coordinator, + PoolSize: cfg.PoolSize, + Timeout: time.Duration(cfg.TimeoutMilliseconds) * time.Millisecond, + }) + if err != nil { + return nil, err + } + lifecycle.Append(fx.Hook{ + OnStart: client.Ping, + OnStop: func(context.Context) error { + return client.Close() + }, + }) + return client, nil +} + +// newAuthentication binds credentials and KDF implementations to authentication policy. +func newAuthentication(accounts service.Accounts, passwords service.Passwords, cfg *config.Persistence) (service.Authentication, error) { + return authentication.New(accounts, passwords, time.Duration(cfg.SessionTTLSeconds)*time.Second) +} + +// newReadiness assembles infrastructure checks at the composition boundary. +func newReadiness(database *postgres.Store, cache *valkey.Client) *dependencyReadiness { + return &dependencyReadiness{database: database, cache: cache} +} diff --git a/cmd/server/persistence_test.go b/cmd/server/persistence_test.go new file mode 100644 index 00000000..56442ddc --- /dev/null +++ b/cmd/server/persistence_test.go @@ -0,0 +1,66 @@ +package main + +import ( + "testing" + "time" + + "go.uber.org/fx" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/postgres" +) + +// TestDatabaseProviderRejectsInvalidConfiguration verifies dependency errors propagate before startup. +func TestDatabaseProviderRejectsInvalidConfiguration(t *testing.T) { + var lifecycle fx.Lifecycle + app := fx.New(fx.NopLogger, fx.Populate(&lifecycle)) + if err := app.Err(); err != nil { + t.Fatal(err) + } + if _, err := newDatabase(lifecycle, &config.Persistence{}); err == nil { + t.Fatal("invalid database settings accepted") + } +} + +// TestValkeyProviderRejectsInvalidConfiguration verifies the cache constructor is a real boundary. +func TestValkeyProviderRejectsInvalidConfiguration(t *testing.T) { + var lifecycle fx.Lifecycle + app := fx.New(fx.NopLogger, fx.Populate(&lifecycle)) + if err := app.Err(); err != nil { + t.Fatal(err) + } + if _, err := newValkey(lifecycle, &config.Persistence{}); err == nil { + t.Fatal("invalid cache settings accepted") + } +} + +// TestReadinessStopsAtUnavailableDatabase checks that mandatory persistence failure is visible. +func TestReadinessStopsAtUnavailableDatabase(t *testing.T) { + database, err := postgres.New(postgres.Options{URL: "postgres://localhost/test", MaxConnections: 1, Timeout: time.Second}) + if err != nil { + t.Fatal(err) + } + database.Close() + readiness := newReadiness(database, nil) + if err := readiness.Ping(t.Context()); err == nil { + t.Fatal("closed database reported ready") + } +} + +// TestMigrationCommandRejectsMissingConfiguration fails before opening a database. +func TestMigrationCommandRejectsMissingConfiguration(t *testing.T) { + t.Setenv("DATABASE_URL", "") + t.Setenv("VALKEY_SHARDS", "shard0=localhost:6379") + if err := run([]string{"migrate"}); err == nil { + t.Fatal("missing database configuration accepted") + } +} + +// TestMigrationCommandRejectsMalformedDatabaseURL fails without logging credentials. +func TestMigrationCommandRejectsMalformedDatabaseURL(t *testing.T) { + t.Setenv("DATABASE_URL", "://invalid") + t.Setenv("VALKEY_SHARDS", "shard0=localhost:6379") + if err := run([]string{"migrate"}); err == nil { + t.Fatal("malformed database configuration accepted") + } +} diff --git a/docs/DEFENSE.md b/docs/DEFENSE.md new file mode 100644 index 00000000..1b3c46ce --- /dev/null +++ b/docs/DEFENSE.md @@ -0,0 +1,26 @@ +# Шпаргалка для защиты lab3 + +Стенд: https://hl.agapov.space. Запрос проходит через Traefik Ingress, Service api, одну из API-реплик, общие PostgreSQL и Valkey. Обновлён существующий Helm release lab2, namespace highload-applications. + +Главное отличие lab3: API взаимозаменяемы. Сессия находится в PostgreSQL, ключ подписи cursor общий. X-Instance-Id показывает pod, обслуживший запрос. Sticky sessions не нужны. + +Клиент передаёт Idempotency-Key при отправке сообщения. Область ключа — пользователь и чат, срок 24 часа. Транзакция блокирует строку чата и записывает сообщение вместе с результатом операции. Повтор после timeout возвращает исходное сообщение; другой текст с тем же ключом даёт 409. Поэтому потерянный HTTP-ответ не приводит к дублю. + +Миграции выполняются отдельной командой server migrate в Job с advisory lock. API только проверяет версию. Миграция аддитивна, старые реплики продолжают работать при обновлении. + +Readiness проверяет PostgreSQL и все Valkey. Kubernetes исключает неготовый endpoint; Traefik обновляет backend. PreStop ждёт 3 секунды, затем SIGTERM даёт приложению до 5 секунд на завершение запросов. Лимит pod termination — 20 секунд. Отказ процесса API не равен отказу узла с БД. + +HPA смотрит CPU через metrics-server: минимум 2, максимум 4, целевая утилизация 60% от requests. Grafana нужна для визуализации, а не для работы HPA. + +Показать команды: +```sh +kubectl --context dev -n highload-applications get pods,hpa,ingress,certificate +make test +make test-failover ACTION_SCRIPT=scripts/stop-one.sh +``` + +29.10 последовательно остановлены обе исходные API: восстановление 0.190 и 2.547 секунды, подтверждённые сообщения сохранены. Сценарий: scripts/test-both-replicas.sh. Ответ 413 теперь тоже содержит X-Instance-Id. + +Исследование: полная матрица 1/2/4 API при фиксированном и растущем бюджете. При фиксированном CPU дополнительные процессы не дали ускорения. Заполнены все 32 глобальных admission-слота. Удвоение ресурсов двух API повысило полезный RPS в обоих повторах, но один прогон дал много 503: рост пропускной способности не означает устойчивость. Числа, графики и ограничения — в [исследовании](RESEARCH.md). + +Ограничения: PostgreSQL и Valkey не реплицированы, hostpath PVC зависит от узла. Kubernetes вместо Compose/Swarm требует принятия преподавателем. diff --git a/docs/PLAN.md b/docs/PLAN.md new file mode 100644 index 00000000..d7287e3d --- /dev/null +++ b/docs/PLAN.md @@ -0,0 +1,12 @@ +# План лабораторной 3 + +| Требования | Работа | Статус | +| --- | --- | --- | +| L3-01–04 | База lab2, идемпотентность, cursor, миграция | Реализовано; прежние проверки отделены в REPORT | +| L3-01 | X-Instance-Id для раннего 413 | Исправлено; регрессия на TCP listener и публичный HTTPS | +| L3-05 | Последовательный отказ обеих исходных API | Проверено 29.10; recovery 0.190/2.547 с; evidence/review-20261029 | +| L3-05–07,10 | Release lab2, Traefik, TLS, HPA | Существующий release обновлён, штатные values восстановлены после исследования | +| L3-08 | Матрица, графики, насыщение и улучшение | Измерены шесть точек и повторный A/B; вырос полезный RPS, устойчивость не подтверждена. См. RESEARCH | +| L3-09 | Race/integration/coverage, lint, vet, контракт | Пройдены; 59 исполняемых файлов с покрытием не менее 90% | + +Свежие доказательства и ограничения: [REPORT](../REPORT.md), [исследование](RESEARCH.md). Исторические persistence, concurrent retry и rolling update не выдаются за повторные проверки 29.10. Принятие Kubernetes как замены учебного стенда и итоговая оценка остаются за преподавателем. diff --git a/docs/RESEARCH.md b/docs/RESEARCH.md new file mode 100644 index 00000000..5b231263 --- /dev/null +++ b/docs/RESEARCH.md @@ -0,0 +1,77 @@ +# Цена масштабирования: измерения 29.10.2026 + +## Методика + +Гипотеза: рост числа API при неизменном суммарном бюджете не гарантирует рост полезного RPS. Ограничениями могут стать CPU каждой реплики, пулы зависимостей, общий пул admission, сеть и доступность backend для Traefik. + +Основная матрица: 1/2/4 API, фиксированный общий бюджет 1000m CPU / 512Mi RAM; затем растущий бюджет по 250m / 128Mi на API. Requests равны limits во время измерений. PostgreSQL, три Valkey и Traefik не масштабируются; HPA отключён. GOMEMLIMIT=80MiB, pool=8. Существующие PVC сохраняются. + +Профиль k6 1.3.0: 16 синтетических пользователей с отдельными чатами, 32 VU, 5 секунд прогрева, 5 секунд дренирования, 30 секунд измерения. Итерация отправляет сообщение и читает историю; каждый десятый подтверждённый POST повторяется с тем же ключом. Подготовка может заново создать синтетического участника после временного отказа; эти операции исключены из измеряемых счётчиков. Частично подготовленные данные не используются в нагрузке. + +Полезный RPS = confirmed_messages / 30, а не общий http_reqs, включающий setup и быстрые отказы. Доля ошибок = application_errors / measured_operations. p50/p95/p99 относятся ко всем попыткам записи; низкая задержка при большом числе быстрых 503 не считается улучшением. События, CPU/RAM и ожидания PostgreSQL сохранены отдельно. + +## Контроль конфигурации + +Перед первой сменой replicas HPA удаляется отдельным Helm-обновлением. После завершения возможной текущей reconciliation задаётся профиль. До Job проверяется соответствие spec.replicas ожидаемому значению. Deployment, Helm values и pod/node snapshot сохраняются. Анализатор исключает прежние прогоны с несовпадением числа реплик, отсутствующим измерением или нарушенной изоляцией смены конфигурации. + +Основная матрица использует штатное распределение API по нодам; восстановленная точка growing1 закреплена на dev.asisti.tech. Ноды неоднородны, поэтому матрица описывает этот dev-стенд, а не чистый эффект числа процессов. Дополнительные A/B выполняются на одной ноде с неизменными зависимостями, образом и сценарием. + +## Насыщение + +В серии 64 VU зафиксировано заполнение всех 32 глобальных admission-слотов. Дополнительные запросы конкурируют за ограниченный общий бюджет, а не получают отдельную ёмкость при добавлении API. Readiness-события показывают также временное исключение backend; мгновенные 503 от LB способны увеличить общий http_reqs при падении полезной пропускной способности. + +Это измеренное насыщение пула допуска запросов и доступности backend. Предел CPU PostgreSQL по редким выборкам не установлен: наблюдение свободного CPU не исключает ожидания сети, диска или соединений. Изменение общего параметра pool одновременно влияет на pgxpool и Valkey; отдельный вклад этих пулов не выделен. + +## Проверенные альтернативы + +- Pool 8 → 32: повторные замеры неоднородны, отдельный прирост RPS сопровождался большой долей ошибок. Устойчивое улучшение не подтверждено, штатный pool=8 сохранён. +- Readiness 2 с / 2 ошибки → 5 с / 1 ошибка: проверка зависимостей может последовательно занять до 4 секунд, но изменение probe не устранило реальные отказы/нестабильность. Устойчивое улучшение не подтверждено; штатные 2/2 сохранены. +- Ресурсный бюджет двух API: отдельный A/B/A/B при одинаковой ноде, pool=8 и 32 VU сравнивает по 250m/128Mi и по 500m/256Mi. Результаты приведены в итоговой таблице ниже. + +## Результаты + +| Профиль | API | CPU/RAM на API | Полезный RPS | Ошибки, % | p95 записи, мс | +| --- | ---: | --- | ---: | ---: | ---: | +| fixed1 | 1 | 1000m / 512Mi | 141.40 | 0.00 | 221.84 | +| fixed2 | 2 | 500m / 256Mi | 124.17 | 0.46 | 172.74 | +| fixed4 | 4 | 250m / 128Mi | 92.77 | 0.17 | 579.48 | +| growing1 | 1 | 250m / 128Mi | 37.77 | 61.95 | 400.90 | +| growing2 | 2 | 250m / 128Mi | 39.93 | 73.19 | 347.85 | +| growing4 | 4 | 250m / 128Mi | 77.30 | 0.00 | 800.67 | +| saturation8 | 1 | 1000m / 512Mi | 66.93 | 0.00 | 119.67 | +| saturation64 | 1 | 1000m / 512Mi | 108.20 | 41.27 | 371.87 | +| resource-low-a | 2 | 250m / 128Mi | 42.70 | 4.46 | 474.74 | +| resource-high-a | 2 | 500m / 256Mi | 109.00 | 72.94 | 165.90 | +| resource-low-b | 2 | 250m / 128Mi | 38.80 | 1.00 | 427.35 | +| resource-high-b | 2 | 500m / 256Mi | 170.30 | 0.00 | 150.96 | + +Полные p50/p95/p99, CPU/RAM, ошибки и ссылки на исходные серии: [summary.csv](../evidence/research-20261029-final/summary.csv). Единый источник чисел — этот CSV. + +![Матрица масштабирования](../evidence/research-20261029-final/matrix.png) + +![Все принятые эксперименты](../evidence/research-20261029-final/results.png) + +При фиксированном бюджете увеличение числа процессов снизило полезный RPS с 141.40 до 92.77; дробление CPU не создало дополнительных ресурсов. При растущем бюджете RPS вырос с 37.77 до 77.30, но ошибки двух первых точек не позволяют считать это устойчивой линейной масштабируемостью. + +**Подтверждённое улучшение пропускной способности:** при двух API удвоение ресурсов каждой реплики повысило полезный RPS с 42.70 до 109.00 (2.55 раза) и с 38.80 до 170.30 (4.39 раза). Средние двух повторов — 40.75 и 139.65 RPS (3.43 раза). Это рост подтверждённых записей, а не числа быстрых отказов. Однако первый high-прогон дал 72.94% ошибок; улучшение надёжности под нагрузкой не подтверждено. Низкий p95 этого прогона частично объясняется быстрыми 503. Поэтому повышенный бюджет — проверенный способ увеличить полезную пропускную способность на данном стенде, но не доказательство выполнения SLO. Штатные requests/limits после эксперимента восстановлены. + +При 8 VU получено 66.93 RPS без ошибок, при 64 VU — 108.20 RPS и 41.27% ошибок. Нагрузка выросла восьмикратно, полезный RPS — только в 1.62 раза; наблюдение 32 занятых admission-слотов подтверждает ограничение общей ёмкости. Эти точки сняты в разное время; они не определяют точный порог насыщения. + +## Исходные данные и воспроизведение + +Основные принятые источники: evidence/research-20261029-final, evidence/research-20261029-pool, evidence/research-20261029-readiness, evidence/research-20261029-budget. summary.csv содержит источник каждой строки; excluded.json перечисляет автоматически исключённые точки. Исключённые прогоны и причины остаются в соответствующих README/логах. + +```sh +EVIDENCE_DIR=evidence/new-matrix scripts/experiment.sh +EVIDENCE_DIR=evidence/new-budget BENCHMARK_NODE=dev.asisti.tech \ + PROFILES='resource-low-a resource-high-a resource-low-b resource-high-b' scripts/experiment.sh +python3 scripts/plot-research.py evidence/new-matrix evidence/new-budget +``` + +Для графиков: Python 3 и matplotlib 3.10.8. Управление стендом выполняют shell, Helm и kubectl. scripts/sample-admission.sh наблюдает слоты без изменения данных. Нужны также jq, rg, Ruby 2.6+ для отчёта отказов. Helm 4 использует client-side apply во время исследований; force-replace не применяется. После каждого запуска восстанавливаются исходные values и HPA. + +## Ограничения + +Общий dev-кластер не изолирован от другой нагрузки; публичный путь включает сеть и Traefik. Есть измеренные сетевые/TLS-сбои и readiness-flapping. Короткие прогоны не дают статистической гарантии; повторный A/B служит проверкой направления эффекта, не доверительным интервалом. Новые чаты одинаково пусты в начале, но общий объём БД растёт; чужие/старые записи не удаляются. + +CPU/RAM — выборки kubectl top примерно раз в 5 секунд за весь Job, включая setup и прогрев, а не точное профилирование измерительного окна. Анализатор исключает старые API и load-поды из других прогонов, когда есть pod snapshot. PostgreSQL active включает наблюдающий запрос. Эти выборки не заменяют CPU-throttling, I/O или pgxpool wait histograms. CPU CFS quota на dev.asisti.tech включена, период 100ms. diff --git a/docs/SPEC.md b/docs/SPEC.md new file mode 100644 index 00000000..0ce6cbf0 --- /dev/null +++ b/docs/SPEC.md @@ -0,0 +1,36 @@ +# Спецификация лабораторной 3 + +Цель: уровни 3 и 4, полный трек 5.1 «Цена масштабирования». Основа — собственное решение lab2, контракт lab3 сохранён. Основной способ развёртывания — Kubernetes по требованию проекта; формальное принятие замены Compose/Swarm преподавателем не подтверждено. + +| ID | Требование и приёмка | +| --- | --- | +| L3-01 | Две и более API-реплики за LB; единая сессия, стабильный X-Instance-Id на всех ответах; smoke через LB | +| L3-02 | Идемпотентность сообщения на 24 часа: user/chat/key, валидный ASCII 1–128, 201 того же Message, 409 при другом body; конкурентные повторы и rollback в настоящей PostgreSQL | +| L3-03 | Общий ключ cursor, сессии и limiter; пагинация и повтор работают при смене реплики | +| L3-04 | Миграции отдельной командой/Job с advisory lock; API только проверяет версию схемы; повтор миграций безопасен | +| L3-05 | Readiness, SIGTERM/drain, LB health checks; остановка каждой реплики, восстановление <=10 секунд; rolling update под нагрузкой; сохранность после полного рестарта | +| L3-06 | Helm в dev / highload-applications, существующий release lab2; имена api/postgres/valkey и PVC сохраняются; Traefik Ingress hl.agapov.space, TLS letsencrypt-prod; CPU/RAM requests/limits, закрытые API-порты | +| L3-07 | HPA autoscaling/v2 по CPU metrics-server, min 2/max 4, стабилизация; /metrics и готовые настройки Prometheus/Grafana без установки Grafana | +| L3-08 | Трек 5.1: 1/2/4 реплики при фиксированном общем CPU/RAM и растущих ресурсах, одинаковый профиль, raw RPS/errors/latency/resource data, графики, измеренный предел и подтверждённое улучшение | +| L3-09 | Go conventions, DIP, gofmt/lint/vet/race, >=90% statements в каждом исполняемом файле, CI | +| L3-10 | Timeweb Cloud Registry: токен из локального файла, Docker login через stdin, Kubernetes imagePullSecret; секреты не попадают в Git или Helm values; образ фиксируется digest | + +Вне объёма: HA PostgreSQL и Valkey, отказ чужих узлов, развёртывание Grafana, реализация lab4+. Секреты не хранятся в Git. Эксперименты затрагивают учебный release lab2, обновлённый реализацией lab3. HPA отключается на время контролируемого сравнения реплик; после эксперимента возвращается. + +## Приёмка исправлений 29.10.2026 + +- L3-01: ошибки HTTP-парсера до middleware, включая 413, содержат стабильный X-Instance-Id и согласованный X-Request-Id. Проверка настоящим HTTP-запросом с превышением BodyLimit. +- L3-05: сохранить исходные имена/UID двух API; остановить каждую отдельно, восстановив две готовые реплики между отказами. Проверять через Traefik чтение, запись, повтор ключа и сохранность подтверждений; сохранить ошибки и время восстановления. +- L3-08: одинаковый профиль для шести конфигураций, ограниченный прогрев и измерение, отдельные счётчики успешных операций/ошибок/latency, CPU/RAM и ожидания PostgreSQL. Дополнительная серия интенсивности выявляет предел, A/B проверяет одно изменение при равных ресурсах. Нулевые и отрицательные результаты публикуются без подмены прогнозом. + +Методика L3-08: 16 синтетических пользователей с отдельными чатами, 32 VU; 5 секунд прогрева, 5 секунд дренирования, 30 секунд измерения без graceful-продления нагрузки. Сравнение fixed1/2/4 и growing1/2/4; затем 8/64 VU на четырёх репликах. Гипотеза улучшения: увеличение ограниченного пула зависимостей 8 → 32 уменьшит ожидание при неизменных CPU/RAM; проверка A/B/A/B, отрицательный результат также сохраняется. Данные каждого профиля — новые отдельные чаты без очистки чужих записей. + +Уточнение методики после неуспешного setup fixed4: подготовка допускает до пяти попыток на синтетического участника, каждый раз с новым именем; частично подготовленные участники не используются в нагрузке. Ошибки setup видны в raw log, измеряемые запросы не получают автоматических повторов (кроме предусмотренной проверки Idempotency-Key). Серии интенсивности и A/B пула проводятся на одной API с 1000m/512Mi, чтобы проверить именно ограничение пула 8 против 32; fixed1 служит первым A, далее B/A/B. Шесть основных профилей заново измеряются с одной версией workload. + +Контроль A/B: при необходимости повторов BENCHMARK_NODE=dev.asisti.tech фиксирует одну API на той же ноде для всех четырёх прогонов, сохраняя CPU/RAM, workload, БД и Valkey. В обычном развёртывании nodeSelector отсутствует; исходная конфигурация восстанавливается. Это устраняет смену аппаратной платформы как объяснение различия размеров пула. + +L3-05 / L3-08: проверка гипотезы readiness. PostgreSQL Ping и Valkey Ping используют отдельные последовательные бюджеты по 2 с, а прежняя readinessProbe имеет timeout 2 с. Сравнение A/B/A/B: 2 с / 2 ошибки против 5 с / 1 ошибка при неизменных 1 API, 1000m/512Mi, pool=8, 32 VU и ноде dev.asisti.tech. Новый вариант допускает завершение ограниченной проверки, сохраняя оценку обнаружения примерно до 7 с (период 2 + timeout 5), плюс распространение EndpointSlice. Выбор штатного варианта зависит от измерения и повторного failover. + +Контроль фактической конфигурации: HPA сначала отключается отдельным Helm-обновлением, затем завершается его возможная текущая reconciliation. До старта Job сравниваются ожидаемые replicas из Helm values и реальные spec.replicas Deployment. Несовпадение останавливает опыт. Анализатор также исключает ранее полученные прогоны с несовпадением; заданное значение в команде не считается доказательством фактического числа API. + +L3-08: подтверждение ресурсного улучшения проводится отдельным A/B/A/B на одной ноде: две API, pool=8, 32 VU, readiness 2 с / 2 ошибки; A — по 250m/128Mi, B — по 500m/256Mi. Меняется только бюджет API; PostgreSQL, Valkey, Traefik и сценарий одинаковые. Не считать увеличение connection pool или probe timeout улучшением, если успешный RPS вырос ценой большей доли ошибок. Штатные значения pool=8 и readiness 2/2 сохраняются. diff --git a/docs/decisions/0001-postgres-sessions-shards.md b/docs/decisions/0001-postgres-sessions-shards.md new file mode 100644 index 00000000..e982b512 --- /dev/null +++ b/docs/decisions/0001-postgres-sessions-shards.md @@ -0,0 +1,33 @@ +# ADR-0001: PostgreSQL, сессии и шардированный Valkey + +Статус: реализовано, проверено локально и развёрнуто в Kubernetes dev / highload-applications. + +## Контекст + +[Задание](../../README.md) требует устойчивого состояния и аутентификации. Дополнительные требования: общий limiter с группами, пользовательские лимиты и демонстрация consistent hashing на 2–3 шардах. + +## Решение + +PostgreSQL хранит пользователей, credentials, чаты, участников, сообщения и hash сессионного токена с абсолютным expiry. Пароли обрабатывает библиотечный Argon2id: 19 MiB, 2 прохода, один поток, salt 16 bytes, hash 32 bytes. Bearer содержит 32 случайных bytes; хранится только SHA-256 digest. Сессия проверяется по PostgreSQL на каждом запросе. Logout удаляет запись до ответа 204. + +Valkey кэширует неизменяемые профили с TTL 5 минут. Кэш не хранит историю и не определяет действительность сессии. Cache miss, повреждённая запись и ошибка чтения профиля ведут к PostgreSQL. Поскольку Valkey одновременно обслуживает обязательный limiter, отказ его узла закрывает admission; обход кэша не означает обход лимитера. + +Клиентское кольцо использует SHA-256 → 64-bit координату и 256 виртуальных узлов на стабильный ID шарда. Глобальные бюджеты имеют постоянного координатора `shard0`; пользовательские бюджеты и профили распределяются по кольцу. Недоступный шард не исключается автоматически: такое исключение сбросило бы активный пользовательский лимит. + +Lua атомарно проверяет и резервирует два бюджета на одном узле: общий и соответствующей группы. Глобальная резервация предшествует аутентификации, пользовательская следует за ней. Это последовательное консервативное резервирование, а не распределённая транзакция: отклонённый пользовательский запрос уже расходует глобальный rate budget; глобальный slot освобождается. Успешных запросов сверх лимита такой порядок не допускает. + +Rate использует фиксированное окно 1 секунда от первого запроса; на границе возможны два burst подряд. Slots представлены sorted sets с уникальными lease ID, освобождением через ZREM и expiry 30 секунд. HTTP timeout ограничен 15 секундами, по умолчанию 3. Отказ освобождения оставляет временно занятый slot до expiry. Длительная приостановка процесса свыше lease и скачки часов Valkey выходят за гарантию строгой одновременности; это не распределённая блокировка для изменения обязательных данных. + +Смена кольца: остановить все API, дождаться drain и 31 секунду, добавить шард, изменить конфигурацию, сбросить только guard topology, запустить API. Fingerprint стабильных ID проверяется при старте/readiness. Значения профилей на старых владельцах истекают; новые владельцы прогреваются из PostgreSQL. Миграция обязательных данных не нужна. В этой демонстрации расширение требует короткого окна недоступности, online resharding не заявляется. + +## Альтернативы и последствия + +Redis Cluster использует фиксированные hash slots и собственный протокол маршрутизации; это другая модель, чем реализуемое клиентское кольцо. Перенос authoritative sessions в Valkey усложнил бы проверку persistence и инвалидацию при смене кольца. Здесь PostgreSQL остаётся единственным источником истины. + +Один PostgreSQL, один глобальный координатор и локальные PVC не обеспечивают HA. Глобальный координатор ограничивает масштабирование строгого общего лимита. Для lab2 это намеренная, явно проверяемая граница. + +## Проверки и источники + +Проверки кольца, атомарности и групп находятся в `internal/hashring` и `internal/valkey`; сценарии отказов и результаты — в [REPORT](../../REPORT.md). + +Первичные материалы: [Redis rate limiter](https://redis.io/docs/latest/develop/use-cases/rate-limiter/), [pgx StrictNamedArgs](https://pkg.go.dev/github.com/jackc/pgx/v5#StrictNamedArgs). Собственные Lua-операции и ring реализованы в этом репозитории. diff --git a/docs/decisions/0002-helm.md b/docs/decisions/0002-helm.md new file mode 100644 index 00000000..5f270ed9 --- /dev/null +++ b/docs/decisions/0002-helm.md @@ -0,0 +1,15 @@ +# ADR-0002: Helm для учебного стенда + +Принято: 2026-10-07. + +API, PostgreSQL, Valkey, ConfigMap и NetworkPolicy описываются одним Helm chart. Отдельный namespace изолирует лабораторную; внутри него имена ресурсов стабильны. Values содержат изменяемые параметры. Нет параллельного набора статических манифестов и генератора Kubernetes YAML. + +Секреты создаются отдельно один раз и передаются chart по имени. Helm не хранит пароли и registry key в values. StatefulSet сохраняет существующие имена и volumeClaimTemplates. При переходе существующие ресурсы принимаются через однократный `--take-ownership`; namespace, Secret и PVC не принимаются во владение release. + +Смена topology остаётся обслуживанием с остановкой API. Команда сначала выключает API, ждёт истечения lease, обновляет шарды, удаляет только guard topology и возвращает API. Обычный upgrade отклоняется при изменении кольца с работающим API. Ошибка обслуживания оставляет API остановленным; повтор команды продолжает процедуру. + +Chart рассчитан на одну лабораторную в namespace. Он не реализует HA PostgreSQL или Redis Cluster. Следующие лабораторные могут расширить этот chart своими компонентами. + +Источник: [Helm upgrade](https://docs.helm.sh/docs/helm/helm_upgrade/) — параметры upgrade, wait и take-ownership. + +При adoption Helm 4 server-side apply встретил конфликт владельцев `volumeClaimTemplates`, созданных kubectl. Повторный upgrade с `--take-ownership --server-side=false` сохранил StatefulSet и PVC. Обычные последующие upgrade наследуют этот способ применения. Флаг принятия владения не входит в Makefile: он нужен только при переносе существующей установки. diff --git a/evidence/coverage-per-file.json b/evidence/coverage-per-file.json new file mode 100644 index 00000000..94549b6d --- /dev/null +++ b/evidence/coverage-per-file.json @@ -0,0 +1,75 @@ +{"threshold_per_file":90,"files":[ +{"file":"internal/service/cursor.go","statements":0,"covered":0,"percent":null,"sha256":"cba6026849467d3662994d59983dd0d6a5ffbe9d934ff539115fd2669b89013f"}, +{"file":"cmd/server/app.go","statements":9,"covered":9,"percent":100.00000000,"sha256":"447460bce6ad010ecc4f191873cad6980f6d7c2a7665eed756d85d40aa0fad70"}, +{"file":"internal/service/production/members.go","statements":19,"covered":19,"percent":100.00000000,"sha256":"578da47ba2567a4fc44de3e087b2e60a6da17e0585ca6215187d5aa5783bfdc7"}, +{"file":"internal/service/production/errors.go","statements":5,"covered":5,"percent":100.00000000,"sha256":"723b0824177b313746dd02fcc9809403b75be128d98520dd69b8fc7cb0244b72"}, +{"file":"internal/controller/interface.go","statements":0,"covered":0,"percent":null,"sha256":"24b6b06d6fab919cd2130697b44fd0d358265184dca0ca8362e0b4fcc2ae5a68"}, +{"file":"internal/service/interface.go","statements":0,"covered":0,"percent":null,"sha256":"1012793cc519112340ee14dac945597da411d5b9f78ce5da6a25dd73ea72d8f6"}, +{"file":"internal/admission/limiter.go","statements":16,"covered":16,"percent":100.00000000,"sha256":"a373c9539167a4b7c35d45334d35ffd4e9d124c1740c88c12094fededd9643b4"}, +{"file":"internal/service/production/service.go","statements":10,"covered":10,"percent":100.00000000,"sha256":"7b24930b8fd7342b0373d687bb775163c332e6620ccc893516f865c433b59056"}, +{"file":"internal/hashring/ring.go","statements":21,"covered":20,"percent":95.23809524,"sha256":"e205901cec2e66011ec764b70879b0eb0d28a78c4dea8913a9fb30c2d778fa8c"}, +{"file":"internal/cursor/codec.go","statements":39,"covered":37,"percent":94.87179487,"sha256":"678e197744fb2fc4b51715f51593b98761125bbaddbe4cb1b7032bd6b173ef04"}, +{"file":"internal/controller/http/fiber/headers.go","statements":0,"covered":0,"percent":null,"sha256":"d32a9a01a8b391f4d986e14947a25a0504f4363335ea1524df05e0dd8e9e61bd"}, +{"file":"internal/store/memory/capacity.go","statements":7,"covered":7,"percent":100.00000000,"sha256":"4dbced908f9d1e802ece79d2a436cbbaa2bff807a19a5fc4bc658eb3f361a5e7"}, +{"file":"cmd/server/persistence.go","statements":18,"covered":18,"percent":100.00000000,"sha256":"a9bfa3bcc68d1b045ec21c193118bb209dfd7bdcbee3cbd28efc5573dc6db3c8"}, +{"file":"internal/service/errors.go","statements":0,"covered":0,"percent":null,"sha256":"f7fd9ca5335f9119d5ed1714c39c3d19e840528a0248fda5d08f60a10d2060ac"}, +{"file":"cmd/server/main.go","statements":3,"covered":3,"percent":100.00000000,"sha256":"c22d8cdf4ce31fde29945e967d3f025e280a7dc4d2022329d51be972d2a0f495"}, +{"file":"internal/controller/http/fiber/routes.go","statements":60,"covered":60,"percent":100.00000000,"sha256":"455d0b2a3fe2f7de947d499e99e660360395338a87d9225b5f8ac525862434fe"}, +{"file":"internal/controller/http/fiber/health.go","statements":7,"covered":7,"percent":100.00000000,"sha256":"813db79a23f6b093ccc510444c883b53f7f98e7d26c927441089f57c73fea12d"}, +{"file":"internal/config/controller.go","statements":25,"covered":24,"percent":96.00000000,"sha256":"c2736f1438746ff293197e002e4352a316987fee9c1307c3cc4190120971098c"}, +{"file":"internal/controller/http/fiber/metrics.go","statements":20,"covered":18,"percent":90.00000000,"sha256":"54db82201697bdfcc65712afe61b650f8f0885fc65222dc4cc6d1c3bb07d82dd"}, +{"file":"internal/config/memory.go","statements":11,"covered":11,"percent":100.00000000,"sha256":"86cdf9e90b576f4484946bfd9605333fc52077f38d3a39c5d71ddca4cdeecda0"}, +{"file":"internal/service/production/creation.go","statements":19,"covered":19,"percent":100.00000000,"sha256":"766f920addddaccdec25fae78728af56a825ab8c57eae29cc8839d85ab5a648f"}, +{"file":"internal/controller/http/fiber/configure.go","statements":7,"covered":7,"percent":100.00000000,"sha256":"be356cf26c228958d51f5bafa4305d7325e81ab01065575acbc9b2d7a6ddd4bd"}, +{"file":"internal/service/production/pages.go","statements":17,"covered":16,"percent":94.11764706,"sha256":"d4db6f0ad1caabc66f8bbb365e56cc84930047b640619bbe5f4e58fce0644877"}, +{"file":"internal/service/authentication/service.go","statements":48,"covered":47,"percent":97.91666667,"sha256":"8300ff37fbce6ce2985375e8c42c6d1793017b36cec8f27b0c0dc80ef2671b85"}, +{"file":"internal/password/password.go","statements":18,"covered":17,"percent":94.44444444,"sha256":"fe2df6990331573bbf0202ebc81c58263a7c16a29b713eefa0f0e852e4ee4a76"}, +{"file":"internal/controller/http/fiber/lifecycle.go","statements":24,"covered":22,"percent":91.66666667,"sha256":"f39cf7a0049a2ed39d6cc1fcc66b44656d9d6120914d0e973b032e12f3d0de08"}, +{"file":"cmd/server/logger.go","statements":10,"covered":9,"percent":90.00000000,"sha256":"93cd37b8e2ec1e6088b82f348a59e6862951f8462df4cd5448562489b05dce1f"}, +{"file":"internal/valkey/client.go","statements":35,"covered":34,"percent":97.14285714,"sha256":"67f32fa5bda94388c0a5fef87e93680a77a513de3a3b7522a38659acde088357"}, +{"file":"internal/strictjson/decode.go","statements":37,"covered":36,"percent":97.29729730,"sha256":"ef9bfaf3bd684fded87c92a15b3e5c706a794caf04cc4ef711c4185e9c7fb12a"}, +{"file":"internal/store/memory/messages.go","statements":19,"covered":18,"percent":94.73684211,"sha256":"36328ae3809af4fd0d10f4ab892e32c4643ad0c6b062aa9924ffd9e51c767500"}, +{"file":"internal/service/production/messages.go","statements":18,"covered":18,"percent":100.00000000,"sha256":"f25725720d7035a688ae4c5aaad34c6e78f3336fd927469570dc8a9a262608cd"}, +{"file":"internal/service/production/pagination.go","statements":21,"covered":21,"percent":100.00000000,"sha256":"eac2861f1743b692f7a6910949dad933d52db9b0211f3422dce09b3c7de49a49"}, +{"file":"internal/store/postgres/idempotency.go","statements":21,"covered":19,"percent":90.47619048,"sha256":"24d463067d1b51eaad5f7b21013be2ab836dea78f7314469779e2336cf57cb9c"}, +{"file":"internal/store/postgres/chats.go","statements":26,"covered":24,"percent":92.30769231,"sha256":"f191cc4d00d13a1e9c46323d545f3310ac2e7d23bb93d76060e282d1fbd220f3"}, +{"file":"internal/service/production/validation.go","statements":13,"covered":13,"percent":100.00000000,"sha256":"33970978507498dbba8e599ac20f7139a10f82705f86a7e058e668742ebefba2"}, +{"file":"internal/service/production/chats.go","statements":22,"covered":22,"percent":100.00000000,"sha256":"a6fce9188c52032fbc035bb08fc06c23b59fabf1534dc0a26205de72609ffbb6"}, +{"file":"internal/config/config.go","statements":17,"covered":17,"percent":100.00000000,"sha256":"8cb675a0bef8b1645071e4cb85b79a467620e99b375db5d8d3e16a54b4c5b5fa"}, +{"file":"cmd/server/commands.go","statements":16,"covered":16,"percent":100.00000000,"sha256":"2631df45b82c7cf99626ae6fe6c5b05ef18254b487d034ad98af26792e569bc8"}, +{"file":"internal/config/environment.go","statements":14,"covered":14,"percent":100.00000000,"sha256":"027761b059b76898a84318ec1a8b43158d8bafd6e0b15b52efbe902b4d8c5ea3"}, +{"file":"internal/valkey/cache.go","statements":19,"covered":18,"percent":94.73684211,"sha256":"25d3a4a4b47fbfedb5c9b31541f8818c7cee46407ba58d1068bdcd4590e72f12"}, +{"file":"internal/service/auth.go","statements":0,"covered":0,"percent":null,"sha256":"a6b0eb6d5759bf87bb2737ae07c9c916c749a107e6acb3542b63461363eb892f"}, +{"file":"internal/valkey/admission.go","statements":45,"covered":45,"percent":100.00000000,"sha256":"d2a4a93a0cffaadb18e94292f67a20e1d5113654e2f5ad55dae5d0009d74f4bb"}, +{"file":"internal/controller/http/fiber/auth.go","statements":29,"covered":29,"percent":100.00000000,"sha256":"8a7687d7ee133290f2bbead47796830caad1439990b60e940b625fede74a6837"}, +{"file":"cmd/server/healthcheck.go","statements":19,"covered":18,"percent":94.73684211,"sha256":"c62b7a6897b300e25fdcfd6650cd256f008207146f1a45c00d77f0db1ab01575"}, +{"file":"internal/store/memory/ordering.go","statements":6,"covered":6,"percent":100.00000000,"sha256":"93ce30f07bb6f056c9a355831b0e0ae7ec5a2cb0fa817bddeb17727c96edb491"}, +{"file":"internal/service/cache.go","statements":0,"covered":0,"percent":null,"sha256":"70bcf36246dc5cff0e3a726f20859dbab85d346dc35664c9f4ae125c23d8bfc9"}, +{"file":"internal/store/memory/chats.go","statements":31,"covered":31,"percent":100.00000000,"sha256":"9404b9576e041ad1d6fa4d297245c5224b7cc6f70272b7c99e9d531e7450519a"}, +{"file":"internal/controller/http/fiber/decode.go","statements":6,"covered":6,"percent":100.00000000,"sha256":"b02e9a9118e9ad0458ae98e79d6bc4d9a65f885bc4f6734a5a84d0cd9fa954f1"}, +{"file":"internal/controller/http/fiber/controller.go","statements":13,"covered":13,"percent":100.00000000,"sha256":"e6cba36cd5cb84e0f9b5dd2f1607704d3556f12c6a9cc92caa515e6d146338a3"}, +{"file":"internal/controller/http/fiber/public_errors.go","statements":13,"covered":12,"percent":92.30769231,"sha256":"18e1bbaa5ac64311e208c23ca3eca3fc543b48f5187b22313735b7df83603ce3"}, +{"file":"internal/controller/http/fiber/handlers.go","statements":37,"covered":36,"percent":97.29729730,"sha256":"0bdd0cfe8578e0e163cfe8945c57615b91d1990770a4d46a03c88c94996a0083"}, +{"file":"internal/store/postgres/sessions.go","statements":13,"covered":13,"percent":100.00000000,"sha256":"889a63b51b29012f4ae5499d1c0577fe29f2f2959b05629f8e123715cfc1f75f"}, +{"file":"internal/admission/distributed.go","statements":0,"covered":0,"percent":null,"sha256":"41ef40897886c0878cbfe52f6716bdcb8433fb7eaddcfff298e1d54c55db423d"}, +{"file":"internal/store/interface.go","statements":0,"covered":0,"percent":null,"sha256":"15ada2fcbbb06ce210e1978b0c2aa4316e9786c6b0252ceec80e169ae08c0fe9"}, +{"file":"internal/controller/http/fiber/middleware.go","statements":39,"covered":38,"percent":97.43589744,"sha256":"af6796f95b1e89cb053d2440b803d66d1a722280b8c46dc1a99a99fa92ac824a"}, +{"file":"internal/config/logger.go","statements":7,"covered":7,"percent":100.00000000,"sha256":"3a69e20a00fa2ed816f344a990e9e0ef0077e1607d4207858b4b00e4ff5d1988"}, +{"file":"internal/controller/http/fiber/errors.go","statements":28,"covered":28,"percent":100.00000000,"sha256":"08358be6beb258bf493def317d98597997fe059afc1fa24594dd1dfd540ac253"}, +{"file":"internal/controller/http/fiber/error_codes.go","statements":0,"covered":0,"percent":null,"sha256":"3351a019c43d0360ee0fd68afabb5200422d065ae7bd908b1c0a5c02a0c1ad41"}, +{"file":"internal/store/postgres/store.go","statements":61,"covered":56,"percent":91.80327869,"sha256":"f50dbf2409c511f3b4b3cc72555a80e621e1ca1e4e314112ead35e1a34623de1"}, +{"file":"internal/store/postgres/users.go","statements":21,"covered":20,"percent":95.23809524,"sha256":"8c77a2ebc8e7cdf4bcaad173feb413fcfe2691e50bc61b0e70a5e8748f167ce6"}, +{"file":"internal/service/production/users.go","statements":19,"covered":19,"percent":100.00000000,"sha256":"b61747c3e5d7bee523ba82817a6a450e7f978fda4df10b8870d53a01bc4742d9"}, +{"file":"internal/model/http/models.go","statements":0,"covered":0,"percent":null,"sha256":"8c183b065bc3ab4cad20570eab79f334ca75a3309186fdf832fb1aa598894465"}, +{"file":"internal/model/dto/models.go","statements":0,"covered":0,"percent":null,"sha256":"23c3b9cf3de49c015a0eac85e19fb287ffdd3133de16035f74db34ec9a6df220"}, +{"file":"internal/config/persistence.go","statements":15,"covered":15,"percent":100.00000000,"sha256":"28c61d23db4ca2ef7ed952451f465318865076d2393eaa94ff5d7bb339c4c06b"}, +{"file":"internal/store/postgres/messages.go","statements":29,"covered":27,"percent":93.10344828,"sha256":"114f7f6dd12feb80e709e704a83f59d8c7f33fbd62e3a137f53219fa5f03d046"}, +{"file":"internal/model/dto/session.go","statements":0,"covered":0,"percent":null,"sha256":"896a694b0c217240343077d4287f4a6e447338c38571abbebcb3d16a519137fb"}, +{"file":"internal/controller/http/fiber/dependencies.go","statements":0,"covered":0,"percent":null,"sha256":"6ee07f110bdb29d8d2191ab8889ba60474b33a5b225739875c8a57d8434be15d"}, +{"file":"internal/store/memory/store.go","statements":3,"covered":3,"percent":100.00000000,"sha256":"973e451d35a79af4614a8727439bfdf5c72b55e03d904b59cb3f39ce0edcb83b"}, +{"file":"internal/service/production/access.go","statements":27,"covered":27,"percent":100.00000000,"sha256":"260f7c77bdbcb1913ebd487e531aa6bb1621d10cd1c4cad91ab34d11cd4fec16"}, +{"file":"internal/controller/fx.go","statements":1,"covered":1,"percent":100.00000000,"sha256":"af72da25fea9811c13a50c8133e9e8b35e070c5295069c40c0ae89cdc0aff19a"}, +{"file":"internal/store/memory/users.go","statements":22,"covered":21,"percent":95.45454545,"sha256":"494a5c8dda4d6a158bc3629f735c12cef36abfb19353d65380e0e4696de9284a"}, +{"file":"internal/controller/http/fiber/mapping.go","statements":19,"covered":19,"percent":100.00000000,"sha256":"cd79419f940868066dffbcc3cd8a024d4e0c9113785f89d7a3f2d6ff57223597"}, +{"file":"internal/controller/http/fiber/error_registry.go","statements":2,"covered":2,"percent":100.00000000,"sha256":"9d5da8d98ece2706e324cb2deca915e0811b6ad98f7aaac5805ca0f3cc0a1f9a"} +],"passed":true} diff --git a/evidence/coverage.txt b/evidence/coverage.txt new file mode 100644 index 00000000..3cf36ade --- /dev/null +++ b/evidence/coverage.txt @@ -0,0 +1,95 @@ +GO="go" scripts/coverage.sh +warning: GOCOVERDIR not set, no coverage data emitted +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/cmd/server 1.948s coverage: 32.4% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/admission (cached) coverage: 1.3% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config 1.115s coverage: 7.0% of statements in ./... + gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/controller coverage: 0.0% of statements +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/controller/http/fiber 1.559s coverage: 53.8% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor (cached) coverage: 3.1% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/hashring (cached) coverage: 1.7% of statements in ./... +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto [no test files] +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/http [no test files] +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/password (cached) coverage: 1.4% of statements in ./... +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service [no test files] +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service/authentication (cached) coverage: 4.5% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service/production (cached) coverage: 18.1% of statements in ./... +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store [no test files] +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/memory (cached) coverage: 7.7% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/postgres 1.959s coverage: 13.3% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/strictjson (cached) coverage: 3.0% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/valkey 1.246s coverage: 9.7% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/student-tests 1.207s coverage: 0.0% of statements in ./... +PASS: lab3 public API scenario; infrastructure and grading evidence remain separate. + N/A internal/service/cursor.go + 100.00% cmd/server/app.go + 100.00% internal/service/production/members.go + 100.00% internal/service/production/errors.go + N/A internal/controller/interface.go + N/A internal/service/interface.go + 100.00% internal/admission/limiter.go + 100.00% internal/service/production/service.go + 95.24% internal/hashring/ring.go + 94.87% internal/cursor/codec.go + N/A internal/controller/http/fiber/headers.go + 100.00% internal/store/memory/capacity.go + 100.00% cmd/server/persistence.go + N/A internal/service/errors.go + 100.00% cmd/server/main.go + 100.00% internal/controller/http/fiber/routes.go + 100.00% internal/controller/http/fiber/health.go + 96.00% internal/config/controller.go + 90.00% internal/controller/http/fiber/metrics.go + 100.00% internal/config/memory.go + 100.00% internal/service/production/creation.go + 100.00% internal/controller/http/fiber/configure.go + 94.12% internal/service/production/pages.go + 97.92% internal/service/authentication/service.go + 94.44% internal/password/password.go + 91.67% internal/controller/http/fiber/lifecycle.go + 90.00% cmd/server/logger.go + 97.14% internal/valkey/client.go + 97.30% internal/strictjson/decode.go + 94.74% internal/store/memory/messages.go + 100.00% internal/service/production/messages.go + 100.00% internal/service/production/pagination.go + 90.48% internal/store/postgres/idempotency.go + 92.31% internal/store/postgres/chats.go + 100.00% internal/service/production/validation.go + 100.00% internal/service/production/chats.go + 100.00% internal/config/config.go + 100.00% cmd/server/commands.go + 100.00% internal/config/environment.go + 94.74% internal/valkey/cache.go + N/A internal/service/auth.go + 100.00% internal/valkey/admission.go + 100.00% internal/controller/http/fiber/auth.go + 94.74% cmd/server/healthcheck.go + 100.00% internal/store/memory/ordering.go + N/A internal/service/cache.go + 100.00% internal/store/memory/chats.go + 100.00% internal/controller/http/fiber/decode.go + 100.00% internal/controller/http/fiber/controller.go + 92.31% internal/controller/http/fiber/public_errors.go + 97.30% internal/controller/http/fiber/handlers.go + 100.00% internal/store/postgres/sessions.go + N/A internal/admission/distributed.go + N/A internal/store/interface.go + 97.44% internal/controller/http/fiber/middleware.go + 100.00% internal/config/logger.go + 100.00% internal/controller/http/fiber/errors.go + N/A internal/controller/http/fiber/error_codes.go + 91.80% internal/store/postgres/store.go + 95.24% internal/store/postgres/users.go + 100.00% internal/service/production/users.go + N/A internal/model/http/models.go + N/A internal/model/dto/models.go + 100.00% internal/config/persistence.go + 93.10% internal/store/postgres/messages.go + N/A internal/model/dto/session.go + N/A internal/controller/http/fiber/dependencies.go + 100.00% internal/store/memory/store.go + 100.00% internal/service/production/access.go + 100.00% internal/controller/fx.go + 95.45% internal/store/memory/users.go + 100.00% internal/controller/http/fiber/mapping.go + 100.00% internal/controller/http/fiber/error_registry.go diff --git a/evidence/failover-targets.txt b/evidence/failover-targets.txt new file mode 100644 index 00000000..3aee4c8a --- /dev/null +++ b/evidence/failover-targets.txt @@ -0,0 +1 @@ +2026-10-16T08:46:57Z target=api-647dcfd499-fwtds diff --git a/evidence/load-idempotency-20261016084724.txt b/evidence/load-idempotency-20261016084724.txt new file mode 100644 index 00000000..86726224 --- /dev/null +++ b/evidence/load-idempotency-20261016084724.txt @@ -0,0 +1,68 @@ +time="2026-10-16T08:47:26Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-6lh86, status=201" source=console +time="2026-10-16T08:47:27Z" level=info msg="instance=api-647dcfd499-vrnnv, status=201" source=console + + + █ THRESHOLDS + + checks + ✓ 'rate==1' rate=100.00% + + + █ TOTAL RESULTS + + checks_total.......: 34 19.886583/s + checks_succeeded...: 100.00% 34 out of 34 + checks_failed......: 0.00% 0 out of 34 + + ✓ concurrent retry succeeds + ✓ exactly one stored message + ✓ different body conflicts + + HTTP + http_req_duration..............: avg=49.18ms min=16.29ms med=45.78ms max=119.2ms p(90)=68.32ms p(95)=103.99ms + { expected_response:true }...: avg=52.33ms min=22.83ms med=46.25ms max=119.2ms p(90)=75.9ms p(95)=107.41ms + http_req_failed................: 12.19% 5 out of 41 + http_reqs......................: 41 23.980879/s + + EXECUTION + iteration_duration.............: avg=72.16ms min=30.32ms med=50.96ms max=220.71ms p(90)=144.08ms p(95)=171.58ms + iterations.....................: 32 18.716784/s + vus............................: 0 min=0 max=0 + vus_max........................: 8 min=8 max=8 + + NETWORK + data_received..................: 61 kB 35 kB/s + data_sent......................: 11 kB 6.2 kB/s + + + diff --git a/evidence/load-rolling-20261016.json b/evidence/load-rolling-20261016.json new file mode 100644 index 00000000..a9da72eb --- /dev/null +++ b/evidence/load-rolling-20261016.json @@ -0,0 +1,325 @@ +{ + "profile": { + "vus": 4, + "seconds": 20, + "warmup_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 493, + "fails": 9, + "name": "message confirmed" + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 53, + "fails": 0 + }, + { + "passes": 494, + "fails": 8, + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8" + } + ], + "name": "", + "path": "" + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 35896.458568 + }, + "metrics": { + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 104799, + "rate": 2919.4801989025004 + } + }, + "confirmed_messages": { + "contains": "default", + "values": { + "count": 308, + "rate": 8.580233602056985 + }, + "type": "counter" + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 107.14148209411755, + "p(50)": 45.745154, + "p(95)": 99.8943652, + "p(99)": 2032.5897884800002, + "max": 7206.858645 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0.000965, + "p(95)": 0.001395, + "p(99)": 0.0038502800000000718, + "max": 606.843456, + "avg": 0.6654776325791854 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 502, + "rate": 13.984666455300673 + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "max": 4069.037767, + "avg": 141.1973867507886, + "p(50)": 60.784952, + "p(95)": 107.54482639999999, + "p(99)": 3036.45417512 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 1105, + "rate": 30.782980942444706 + } + }, + "http_req_receiving": { + "contains": "time", + "values": { + "p(95)": 0.5982831999999998, + "p(99)": 1.129207840000003, + "max": 9.195694, + "avg": 0.26215743348416304, + "p(50)": 0.166438 + }, + "type": "trend" + }, + "vus": { + "values": { + "value": 1, + "min": 0, + "max": 4 + }, + "type": "gauge", + "contains": "default" + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 102.933588, + "p(95)": 219.91099354999994, + "p(99)": 5047.706061420009, + "max": 9095.88069, + "avg": 230.09780262549805 + } + }, + "http_req_sending": { + "contains": "time", + "values": { + "p(99)": 0.41411440000000055, + "max": 3.329727, + "avg": 0.1880026678733031, + "p(50)": 0.173364, + "p(95)": 0.30632359999999986 + }, + "type": "trend" + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 17, + "rate": 0.473584322191457 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.02591960814479638, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 3.756808 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 317, + "rate": 8.830954713805404 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "avg": 60.055339191176486, + "p(50)": 45.278537, + "p(95)": 95.53229384999999, + "p(99)": 123.21868363999846, + "max": 3151.644601 + } + }, + "http_req_tls_handshaking": { + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 17.520916, + "avg": 0.10471677647058822 + }, + "type": "trend" + }, + "http_req_failed": { + "contains": "default", + "values": { + "fails": 1088, + "rate": 0.015384615384615385, + "passes": 17 + }, + "type": "rate" + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 1392518, + "rate": 38792.629009964905 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "max": 7206.407109, + "avg": 106.69132199276018, + "p(50)": 45.315886, + "p(95)": 99.57287799999999, + "p(99)": 2031.2303810800001 + } + }, + "vus_max": { + "values": { + "max": 8, + "value": 8, + "min": 8 + }, + "type": "gauge", + "contains": "default" + }, + "checks": { + "contains": "default", + "values": { + "fails": 17, + "rate": 0.9839167455061495, + "passes": 1040 + }, + "type": "rate" + } + }, + "setup_data": [ + { + "token": "RMDAkY-Aed_W_tTOaJA5wu6TnOlN7m1UPrKAWMbtFQQ", + "chat": "715f2535-708a-4348-b154-9d85f0598fdf" + }, + { + "chat": "239e6262-5e95-4f65-8966-b389662c6101", + "token": "AmAOis6KfQyhlSistPhJOQM4XD3dFYobzU1Ct470qsY" + }, + { + "chat": "13e6a4d9-ca96-4c51-9eba-6e68b723e91c", + "token": "axqVVcp2Wlp5WLwq8t0YiGTYMye0XNRyvgMV-nzkPbQ" + }, + { + "chat": "c5c5c8b6-4602-4bb8-a659-b591715ab74b", + "token": "lo_zOOHgOq-xIgabAdaaGaFDLXASBkp8XAnr_Rwthao" + }, + { + "chat": "84f42d37-b65e-45b8-a736-dcdabb8d245e", + "token": "xkMKAehhhWMil8LSXF_DaVgQmAQCWFmCOWZvHmguIIY" + }, + { + "chat": "eaf3db13-97f1-4f96-a4db-f1197325497b", + "token": "AZDSshpwx1yn7DFeJlSyRpUaufvbLINW8bb-00Wt7ss" + }, + { + "chat": "b4ad2b36-b7ec-4605-8683-de83557f1cf5", + "token": "vs5w_-eg733XSvMyyziV6-7q47xZEQ372V5X_FsCGIA" + }, + { + "chat": "48e63e65-b90f-41c1-8bbc-6b60ebcabedc", + "token": "CQ8XeGorK0HomebCx_nUQijxGBG4MU0_eEtwwFWIW6Y" + }, + { + "token": "TZcYWe9cmOef_hrmozp1IOJSc9OSLTA04MxtGlkJ8XU", + "chat": "bbcecdd1-0cbc-4493-99a8-cbe9caba54f9" + }, + { + "token": "zCtwwuQh5gdcAnJUcRY9P-ktFEDHIV2rGSDVEQL-5bc", + "chat": "68dee914-40c9-4188-9d90-b7b9d44b8543" + }, + { + "chat": "89642210-6535-48be-a46c-8c19cdf9efac", + "token": "zqOhFtYQDONavNIIDMy6bwCFETNTd_tsWIU9X0D40G0" + }, + { + "chat": "73f0e9e1-f170-400c-9cfd-d90e473a19e2", + "token": "k8FRCbioLnN4MFvLrdyQ9dhwvYZUVV-O_ecyoq9VbOM" + }, + { + "chat": "fff6d4a8-515f-44ba-ba78-10297a58859d", + "token": "LxB3akwYgrEG0LLY9zeVRBCtTCwFCarK4SpPqANtOs4" + }, + { + "chat": "dbe76193-9952-4ebd-aad6-1cea59f0b4ce", + "token": "IykVKbHSToSG176w5aMJueQReRHXAvQAG8keTET7txc" + }, + { + "chat": "44bf5586-1443-44f3-aef4-f35f26b8ca36", + "token": "4zP8j_2J9UtJktGE6_isyb3rvHqB6LcKyMUfBuqSXJU" + }, + { + "chat": "5464947f-701d-43d3-887e-54a1df125654", + "token": "Vg-TqjU86Al7Isbs-el_AD9aB_gK15cEhLeP4jzHrpk" + } + ] + } +} diff --git a/evidence/load-rolling-20261016.txt b/evidence/load-rolling-20261016.txt new file mode 100644 index 00000000..35b6eaf5 --- /dev/null +++ b/evidence/load-rolling-20261016.txt @@ -0,0 +1 @@ +{"profile":{"vus":4,"seconds":20,"warmup_seconds":5,"users":16},"summary":{"root_group":{"id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":493,"fails":9,"name":"message confirmed"},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":53,"fails":0},{"passes":494,"fails":8,"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8"}],"name":"","path":""},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":35896.458568},"metrics":{"data_sent":{"type":"counter","contains":"data","values":{"count":104799,"rate":2919.4801989025004}},"confirmed_messages":{"contains":"default","values":{"count":308,"rate":8.580233602056985},"type":"counter"},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":107.14148209411755,"p(50)":45.745154,"p(95)":99.8943652,"p(99)":2032.5897884800002,"max":7206.858645}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(50)":0.000965,"p(95)":0.001395,"p(99)":0.0038502800000000718,"max":606.843456,"avg":0.6654776325791854}},"iterations":{"type":"counter","contains":"default","values":{"count":502,"rate":13.984666455300673}},"message_latency_ms":{"type":"trend","contains":"time","values":{"max":4069.037767,"avg":141.1973867507886,"p(50)":60.784952,"p(95)":107.54482639999999,"p(99)":3036.45417512}},"http_reqs":{"type":"counter","contains":"default","values":{"count":1105,"rate":30.782980942444706}},"http_req_receiving":{"contains":"time","values":{"p(95)":0.5982831999999998,"p(99)":1.129207840000003,"max":9.195694,"avg":0.26215743348416304,"p(50)":0.166438},"type":"trend"},"vus":{"values":{"value":1,"min":0,"max":4},"type":"gauge","contains":"default"},"iteration_duration":{"type":"trend","contains":"time","values":{"p(50)":102.933588,"p(95)":219.91099354999994,"p(99)":5047.706061420009,"max":9095.88069,"avg":230.09780262549805}},"http_req_sending":{"contains":"time","values":{"p(99)":0.41411440000000055,"max":3.329727,"avg":0.1880026678733031,"p(50)":0.173364,"p(95)":0.30632359999999986},"type":"trend"},"application_errors":{"type":"counter","contains":"default","values":{"count":17,"rate":0.473584322191457}},"http_req_connecting":{"type":"trend","contains":"time","values":{"avg":0.02591960814479638,"p(50)":0,"p(95)":0,"p(99)":0,"max":3.756808}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":317,"rate":8.830954713805404}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"avg":60.055339191176486,"p(50)":45.278537,"p(95)":95.53229384999999,"p(99)":123.21868363999846,"max":3151.644601}},"http_req_tls_handshaking":{"contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":17.520916,"avg":0.10471677647058822},"type":"trend"},"http_req_failed":{"contains":"default","values":{"fails":1088,"rate":0.015384615384615385,"passes":17},"type":"rate"},"data_received":{"type":"counter","contains":"data","values":{"count":1392518,"rate":38792.629009964905}},"http_req_waiting":{"type":"trend","contains":"time","values":{"max":7206.407109,"avg":106.69132199276018,"p(50)":45.315886,"p(95)":99.57287799999999,"p(99)":2031.2303810800001}},"vus_max":{"values":{"max":8,"value":8,"min":8},"type":"gauge","contains":"default"},"checks":{"contains":"default","values":{"fails":17,"rate":0.9839167455061495,"passes":1040},"type":"rate"}},"setup_data":[{"token":"RMDAkY-Aed_W_tTOaJA5wu6TnOlN7m1UPrKAWMbtFQQ","chat":"715f2535-708a-4348-b154-9d85f0598fdf"},{"chat":"239e6262-5e95-4f65-8966-b389662c6101","token":"AmAOis6KfQyhlSistPhJOQM4XD3dFYobzU1Ct470qsY"},{"chat":"13e6a4d9-ca96-4c51-9eba-6e68b723e91c","token":"axqVVcp2Wlp5WLwq8t0YiGTYMye0XNRyvgMV-nzkPbQ"},{"chat":"c5c5c8b6-4602-4bb8-a659-b591715ab74b","token":"lo_zOOHgOq-xIgabAdaaGaFDLXASBkp8XAnr_Rwthao"},{"chat":"84f42d37-b65e-45b8-a736-dcdabb8d245e","token":"xkMKAehhhWMil8LSXF_DaVgQmAQCWFmCOWZvHmguIIY"},{"chat":"eaf3db13-97f1-4f96-a4db-f1197325497b","token":"AZDSshpwx1yn7DFeJlSyRpUaufvbLINW8bb-00Wt7ss"},{"chat":"b4ad2b36-b7ec-4605-8683-de83557f1cf5","token":"vs5w_-eg733XSvMyyziV6-7q47xZEQ372V5X_FsCGIA"},{"chat":"48e63e65-b90f-41c1-8bbc-6b60ebcabedc","token":"CQ8XeGorK0HomebCx_nUQijxGBG4MU0_eEtwwFWIW6Y"},{"token":"TZcYWe9cmOef_hrmozp1IOJSc9OSLTA04MxtGlkJ8XU","chat":"bbcecdd1-0cbc-4493-99a8-cbe9caba54f9"},{"token":"zCtwwuQh5gdcAnJUcRY9P-ktFEDHIV2rGSDVEQL-5bc","chat":"68dee914-40c9-4188-9d90-b7b9d44b8543"},{"chat":"89642210-6535-48be-a46c-8c19cdf9efac","token":"zqOhFtYQDONavNIIDMy6bwCFETNTd_tsWIU9X0D40G0"},{"chat":"73f0e9e1-f170-400c-9cfd-d90e473a19e2","token":"k8FRCbioLnN4MFvLrdyQ9dhwvYZUVV-O_ecyoq9VbOM"},{"chat":"fff6d4a8-515f-44ba-ba78-10297a58859d","token":"LxB3akwYgrEG0LLY9zeVRBCtTCwFCarK4SpPqANtOs4"},{"chat":"dbe76193-9952-4ebd-aad6-1cea59f0b4ce","token":"IykVKbHSToSG176w5aMJueQReRHXAvQAG8keTET7txc"},{"chat":"44bf5586-1443-44f3-aef4-f35f26b8ca36","token":"4zP8j_2J9UtJktGE6_isyb3rvHqB6LcKyMUfBuqSXJU"},{"chat":"5464947f-701d-43d3-887e-54a1df125654","token":"Vg-TqjU86Al7Isbs-el_AD9aB_gK15cEhLeP4jzHrpk"}]}} diff --git a/evidence/research-20261029-budget/README.md b/evidence/research-20261029-budget/README.md new file mode 100644 index 00000000..c3a8e361 --- /dev/null +++ b/evidence/research-20261029-budget/README.md @@ -0,0 +1,7 @@ +# Контролируемый бюджет, 29.10.2026 + +Команда: `EVIDENCE_DIR=evidence/research-20261029-budget BENCHMARK_NODE=dev.asisti.tech PROFILES='growing1 saturation8 resource-low-a resource-high-a resource-low-b resource-high-b' scripts/experiment.sh`. + +HPA отключён отдельным обновлением до смены replicas. Для каждого запуска сохранены Deployment и values; run-load проверяет ожидаемое число реплик. Все шесть точек имеют корректное число API. Прогоны последовательные, один образ, pool=8. После завершения штатные values восстановлены (restore.txt, release lab2 revision 40). + +source.sha256 фиксирует исходники запуска. Результаты и ограничения приведены в ../../docs/RESEARCH.md; агрегирование в соседнем research-20261029-final/summary.csv. Рост полезного RPS в A/B повторился, снижение ошибок — нет. Инфраструктурные ошибки не удалены из измерений. diff --git a/evidence/research-20261029-budget/base-revision.txt b/evidence/research-20261029-budget/base-revision.txt new file mode 100644 index 00000000..32abb9b4 --- /dev/null +++ b/evidence/research-20261029-budget/base-revision.txt @@ -0,0 +1 @@ +7b7e23fd029beea47e6f625a96cb98d2fe04bafb diff --git a/evidence/research-20261029-budget/date.txt b/evidence/research-20261029-budget/date.txt new file mode 100644 index 00000000..e4097551 --- /dev/null +++ b/evidence/research-20261029-budget/date.txt @@ -0,0 +1 @@ +2026-10-29T11:58:04Z diff --git a/evidence/research-20261029-budget/deployment-growing1-20261029115804.json b/evidence/research-20261029-budget/deployment-growing1-20261029115804.json new file mode 100644 index 00000000..5124874b --- /dev/null +++ b/evidence/research-20261029-budget/deployment-growing1-20261029115804.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "28", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 45, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60171652", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "250m", + "memory": "128Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:57:50Z", + "lastUpdateTime": "2026-10-29T11:57:50Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:58:08Z", + "message": "ReplicaSet \"api-577bffc7b\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 45, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-budget/deployment-resource-high-a-20261029121644.json b/evidence/research-20261029-budget/deployment-resource-high-a-20261029121644.json new file mode 100644 index 00000000..8a93f5b3 --- /dev/null +++ b/evidence/research-20261029-budget/deployment-resource-high-a-20261029121644.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "31", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 48, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60175422", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "500m", + "memory": "256Mi" + }, + "requests": { + "cpu": "500m", + "memory": "256Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T12:16:30Z", + "lastUpdateTime": "2026-10-29T12:16:30Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T12:16:52Z", + "message": "ReplicaSet \"api-54d5599c7b\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 48, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/research-20261029-budget/deployment-resource-high-b-20261029122017.json b/evidence/research-20261029-budget/deployment-resource-high-b-20261029122017.json new file mode 100644 index 00000000..78535428 --- /dev/null +++ b/evidence/research-20261029-budget/deployment-resource-high-b-20261029122017.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "33", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 50, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60176430", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "500m", + "memory": "256Mi" + }, + "requests": { + "cpu": "500m", + "memory": "256Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T12:20:01Z", + "lastUpdateTime": "2026-10-29T12:20:01Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T12:20:24Z", + "message": "ReplicaSet \"api-54d5599c7b\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 50, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/research-20261029-budget/deployment-resource-low-a-20261029121455.json b/evidence/research-20261029-budget/deployment-resource-low-a-20261029121455.json new file mode 100644 index 00000000..24d9ad48 --- /dev/null +++ b/evidence/research-20261029-budget/deployment-resource-low-a-20261029121455.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "30", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 47, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60174994", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "250m", + "memory": "128Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T12:15:09Z", + "lastUpdateTime": "2026-10-29T12:15:09Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T12:15:14Z", + "message": "ReplicaSet \"api-577bffc7b\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 47, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/research-20261029-budget/deployment-resource-low-b-20261029121833.json b/evidence/research-20261029-budget/deployment-resource-low-b-20261029121833.json new file mode 100644 index 00000000..f7fe22f9 --- /dev/null +++ b/evidence/research-20261029-budget/deployment-resource-low-b-20261029121833.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "32", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 49, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60175941", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "250m", + "memory": "128Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T12:18:25Z", + "lastUpdateTime": "2026-10-29T12:18:25Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T12:18:43Z", + "message": "ReplicaSet \"api-577bffc7b\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 49, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/research-20261029-budget/deployment-saturation8-20261029121309.json b/evidence/research-20261029-budget/deployment-saturation8-20261029121309.json new file mode 100644 index 00000000..ce10c133 --- /dev/null +++ b/evidence/research-20261029-budget/deployment-saturation8-20261029121309.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "29", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 46, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60174477", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T12:12:38Z", + "lastUpdateTime": "2026-10-29T12:12:38Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T12:13:16Z", + "message": "ReplicaSet \"api-84fbf9968\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 46, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-budget/disable-hpa.txt b/evidence/research-20261029-budget/disable-hpa.txt new file mode 100644 index 00000000..850c8a7e --- /dev/null +++ b/evidence/research-20261029-budget/disable-hpa.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:57:42 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 33 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-budget/load-growing1-20261029115804.json b/evidence/research-20261029-budget/load-growing1-20261029115804.json new file mode 100644 index 00000000..5d63ce80 --- /dev/null +++ b/evidence/research-20261029-budget/load-growing1-20261029115804.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "setup_data": [ + { + "chat": "9b417389-5ffb-4b55-89d4-4b44eb3c86f1", + "token": "mj4Dmi0RqqV1RTjGdIBf2cSgOkyeqzBFhTkR7sQID9Q" + }, + { + "chat": "b6b250df-02a3-4dd8-b9c7-35772b844654", + "token": "lVuGejLCguPVHAqBEGpbnOt0uUD-18hSA77S2VpfSKo" + }, + { + "chat": "a0d10970-e9f7-4d5e-b31e-c7760fd5501d", + "token": "4txkO49FyWWFsbC09SPANQ-r7TKypeuHsQ0AHBTbWKg" + }, + { + "chat": "d2b0029e-edc7-4d7d-aba8-d00e636795a7", + "token": "Me461ExRTt76-3jzUUJU6ipGx8EBDFrp4Dexiusn-7I" + }, + { + "chat": "17b76cbd-113e-4a57-a0c6-8b37903826c0", + "token": "-lX7fbA9RWv0xZaVkovZH5o-0hESAoAC4RfEEEbUpkA" + }, + { + "token": "rAxwvLIDz7Jt6W1r52A3wHVLA5NqSMMqPMpVappfbHI", + "chat": "31d30ba6-fc91-4b6b-bac3-282c1c54b3c5" + }, + { + "chat": "ebb987b0-0316-4df0-9ea0-427bbd91c11c", + "token": "KXwp_IoEs7d-duV6EoGVxpICm9kDQOrRhd8YjQ8BXGk" + }, + { + "token": "5LtzJoNoLTqwxuGxkh6hBw3Aq1_ORF-bMgY4XgT3f-M", + "chat": "db2ac4da-05ad-45f2-ad61-1f301890bf71" + }, + { + "chat": "be9fea05-36a8-4cdd-aa1c-ff2da5881f39", + "token": "5oXVcUceeS7cIyWO22EWDFv4OjiozbUukkwh6-FdE34" + }, + { + "chat": "3ab5dc1c-ba5c-4120-b72f-9be93c8e09ba", + "token": "_kuCCV_m4F-VRA3Q7M9Puae9pe3bfOlgD6oLxbeKxKI" + }, + { + "token": "qGptaVQ54z7eHbHhB9BPXd13dugSZ6jg74sjlr2RF_E", + "chat": "46aaab09-ed0d-4238-b778-28aa4325d6c2" + }, + { + "chat": "3b744ef2-dd7a-47ba-b05a-225995674bb9", + "token": "f7NvgCC12z-_GWcwupuMlEEH5p3XmOTsoglCCL-XGz8" + }, + { + "chat": "50966e79-a203-4255-9385-66d48c5ffb50", + "token": "ef79_V8IjqME-yCTGUO5WyZVYU2n9IuksXPkgrVmyvM" + }, + { + "chat": "85bc2af3-6303-4748-ae55-eea12d9247e9", + "token": "aYK851cmC2jYDgYRAjOqU5vjjfBprlbqVhf-bBjhw_s" + }, + { + "chat": "a467bc0a-86e2-48ed-8ae6-b3bd9a7de7da", + "token": "-bx-GIqCuXA8YgVw7I5UWQ3OE12X3CatR-V6X_r8fAA" + }, + { + "chat": "19090aa7-1ab7-46de-9d9d-678178dbabd7", + "token": "gvs9LtpeJlUob9cTBxrCpfkQJKI10u7_oIeWkAekOc4" + } + ], + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "passes": 1336, + "fails": 1947, + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e" + }, + { + "passes": 149, + "fails": 4, + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa" + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 1317, + "fails": 1947 + } + ] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 50700.779292 + }, + "metrics": { + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.4182089552238806, + "passes": 2802, + "fails": 3898 + } + }, + "application_errors{status:503}": { + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default", + "values": { + "count": 3897, + "rate": 76.86272389534852 + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 144.07987260023705, + "p(50)": 16.528008999999997, + "p(95)": 389.29778824999994, + "p(99)": 497.70713441, + "max": 9159.233298 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "rate": 64.37770869756675, + "count": 3264 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "rate": 22.346796554639436, + "count": 1133 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 3898, + "rate": 76.88244745806225 + } + }, + "failed_writes": { + "type": "counter", + "contains": "default", + "values": { + "count": 1947, + "rate": 38.401776603603686 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 497.10024959, + "max": 9156.518622, + "avg": 142.64434993775882, + "p(50)": 8.1193335, + "p(95)": 388.80872635 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 585179, + "rate": 11541.814705249206 + } + }, + "message_latency_ms": { + "contains": "time", + "values": { + "avg": 156.76337151785663, + "p(50)": 9.191468, + "p(95)": 400.90426964999995, + "p(99)": 515.0820838300001, + "max": 9075.971106 + }, + "type": "trend" + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "http_req_duration{expected_response:true}": { + "contains": "time", + "values": { + "p(99)": 601.6781475499987, + "max": 8073.096102, + "avg": 314.4811274036987, + "p(50)": 279.6986455, + "p(95)": 419.368238 + }, + "type": "trend" + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 6764, + "rate": 133.4101781955703 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.37589536191602296, + "p(50)": 0.000688, + "p(95)": 0.001273, + "p(99)": 0.004134719999999994, + "max": 950.975337 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 3080, + "rate": 60.748573158243126 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 37.74685, + "avg": 0.02312838571850976 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 239.484409, + "avg": 0.22270943598462445 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.5762862211709048, + "passes": 3898, + "fails": 2866 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 4195518, + "rate": 82750.5623895214 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "max": 32, + "value": 32, + "min": 32 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "max": 216.639188, + "avg": 1.201672609107039, + "p(50)": 0.2664335, + "p(95)": 3.857153799999995, + "p(99)": 24.95663570999991 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 296.96846638419083, + "p(50)": 28.244625, + "p(95)": 808.12144195, + "p(99)": 1222.6212108099976, + "max": 9457.513679 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 6292, + "rate": 124.10065659469667 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_sending": { + "contains": "time", + "values": { + "avg": 0.23385005337078663, + "p(50)": 0.1136735, + "p(95)": 0.3216075499999999, + "p(99)": 2.026604269999999, + "max": 65.394982 + }, + "type": "trend" + }, + "application_errors{status:429}": { + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter" + } + } + } +} diff --git a/evidence/research-20261029-budget/load-growing1-20261029115804.txt b/evidence/research-20261029-budget/load-growing1-20261029115804.txt new file mode 100644 index 00000000..9e71858b --- /dev/null +++ b/evidence/research-20261029-budget/load-growing1-20261029115804.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"setup_data":[{"chat":"9b417389-5ffb-4b55-89d4-4b44eb3c86f1","token":"mj4Dmi0RqqV1RTjGdIBf2cSgOkyeqzBFhTkR7sQID9Q"},{"chat":"b6b250df-02a3-4dd8-b9c7-35772b844654","token":"lVuGejLCguPVHAqBEGpbnOt0uUD-18hSA77S2VpfSKo"},{"chat":"a0d10970-e9f7-4d5e-b31e-c7760fd5501d","token":"4txkO49FyWWFsbC09SPANQ-r7TKypeuHsQ0AHBTbWKg"},{"chat":"d2b0029e-edc7-4d7d-aba8-d00e636795a7","token":"Me461ExRTt76-3jzUUJU6ipGx8EBDFrp4Dexiusn-7I"},{"chat":"17b76cbd-113e-4a57-a0c6-8b37903826c0","token":"-lX7fbA9RWv0xZaVkovZH5o-0hESAoAC4RfEEEbUpkA"},{"token":"rAxwvLIDz7Jt6W1r52A3wHVLA5NqSMMqPMpVappfbHI","chat":"31d30ba6-fc91-4b6b-bac3-282c1c54b3c5"},{"chat":"ebb987b0-0316-4df0-9ea0-427bbd91c11c","token":"KXwp_IoEs7d-duV6EoGVxpICm9kDQOrRhd8YjQ8BXGk"},{"token":"5LtzJoNoLTqwxuGxkh6hBw3Aq1_ORF-bMgY4XgT3f-M","chat":"db2ac4da-05ad-45f2-ad61-1f301890bf71"},{"chat":"be9fea05-36a8-4cdd-aa1c-ff2da5881f39","token":"5oXVcUceeS7cIyWO22EWDFv4OjiozbUukkwh6-FdE34"},{"chat":"3ab5dc1c-ba5c-4120-b72f-9be93c8e09ba","token":"_kuCCV_m4F-VRA3Q7M9Puae9pe3bfOlgD6oLxbeKxKI"},{"token":"qGptaVQ54z7eHbHhB9BPXd13dugSZ6jg74sjlr2RF_E","chat":"46aaab09-ed0d-4238-b778-28aa4325d6c2"},{"chat":"3b744ef2-dd7a-47ba-b05a-225995674bb9","token":"f7NvgCC12z-_GWcwupuMlEEH5p3XmOTsoglCCL-XGz8"},{"chat":"50966e79-a203-4255-9385-66d48c5ffb50","token":"ef79_V8IjqME-yCTGUO5WyZVYU2n9IuksXPkgrVmyvM"},{"chat":"85bc2af3-6303-4748-ae55-eea12d9247e9","token":"aYK851cmC2jYDgYRAjOqU5vjjfBprlbqVhf-bBjhw_s"},{"chat":"a467bc0a-86e2-48ed-8ae6-b3bd9a7de7da","token":"-bx-GIqCuXA8YgVw7I5UWQ3OE12X3CatR-V6X_r8fAA"},{"chat":"19090aa7-1ab7-46de-9d9d-678178dbabd7","token":"gvs9LtpeJlUob9cTBxrCpfkQJKI10u7_oIeWkAekOc4"}],"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"passes":1336,"fails":1947,"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e"},{"passes":149,"fails":4,"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa"},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":1317,"fails":1947}]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":50700.779292},"metrics":{"checks":{"type":"rate","contains":"default","values":{"rate":0.4182089552238806,"passes":2802,"fails":3898}},"application_errors{status:503}":{"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default","values":{"count":3897,"rate":76.86272389534852}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":144.07987260023705,"p(50)":16.528008999999997,"p(95)":389.29778824999994,"p(99)":497.70713441,"max":9159.233298}},"iterations":{"type":"counter","contains":"default","values":{"rate":64.37770869756675,"count":3264}},"confirmed_messages":{"type":"counter","contains":"default","values":{"rate":22.346796554639436,"count":1133}},"application_errors":{"type":"counter","contains":"default","values":{"count":3898,"rate":76.88244745806225}},"failed_writes":{"type":"counter","contains":"default","values":{"count":1947,"rate":38.401776603603686}},"http_req_waiting":{"type":"trend","contains":"time","values":{"p(99)":497.10024959,"max":9156.518622,"avg":142.64434993775882,"p(50)":8.1193335,"p(95)":388.80872635}},"data_sent":{"type":"counter","contains":"data","values":{"count":585179,"rate":11541.814705249206}},"message_latency_ms":{"contains":"time","values":{"avg":156.76337151785663,"p(50)":9.191468,"p(95)":400.90426964999995,"p(99)":515.0820838300001,"max":9075.971106},"type":"trend"},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"http_req_duration{expected_response:true}":{"contains":"time","values":{"p(99)":601.6781475499987,"max":8073.096102,"avg":314.4811274036987,"p(50)":279.6986455,"p(95)":419.368238},"type":"trend"},"http_reqs":{"type":"counter","contains":"default","values":{"count":6764,"rate":133.4101781955703}},"http_req_blocked":{"type":"trend","contains":"time","values":{"avg":0.37589536191602296,"p(50)":0.000688,"p(95)":0.001273,"p(99)":0.004134719999999994,"max":950.975337}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":3080,"rate":60.748573158243126}},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":37.74685,"avg":0.02312838571850976}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":239.484409,"avg":0.22270943598462445}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.5762862211709048,"passes":3898,"fails":2866}},"data_received":{"type":"counter","contains":"data","values":{"count":4195518,"rate":82750.5623895214}},"vus_max":{"type":"gauge","contains":"default","values":{"max":32,"value":32,"min":32}},"http_req_receiving":{"type":"trend","contains":"time","values":{"max":216.639188,"avg":1.201672609107039,"p(50)":0.2664335,"p(95)":3.857153799999995,"p(99)":24.95663570999991}},"iteration_duration":{"type":"trend","contains":"time","values":{"avg":296.96846638419083,"p(50)":28.244625,"p(95)":808.12144195,"p(99)":1222.6212108099976,"max":9457.513679}},"measured_operations":{"type":"counter","contains":"default","values":{"count":6292,"rate":124.10065659469667}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_sending":{"contains":"time","values":{"avg":0.23385005337078663,"p(50)":0.1136735,"p(95)":0.3216075499999999,"p(99)":2.026604269999999,"max":65.394982},"type":"trend"},"application_errors{status:429}":{"contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter"}}}} diff --git a/evidence/research-20261029-budget/load-resource-high-a-20261029121644.json b/evidence/research-20261029-budget/load-resource-high-a-20261029121644.json new file mode 100644 index 00000000..b312030e --- /dev/null +++ b/evidence/research-20261029-budget/load-resource-high-a-20261029121644.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 62799.862953 + }, + "metrics": { + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 2134144, + "rate": 33983.2588742624 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 77.48847192855455, + "p(50)": 6.951556, + "p(95)": 329.7308103, + "p(99)": 479.30767200000037, + "max": 5260.066465 + } + }, + "http_req_receiving": { + "contains": "time", + "values": { + "avg": 0.6482721659767205, + "p(50)": 0.2119605, + "p(95)": 1.7822905, + "p(99)": 10.010433900000011, + "max": 188.911651 + }, + "type": "trend" + }, + "attempted_messages": { + "values": { + "count": 12508, + "rate": 199.1724091716745 + }, + "type": "counter", + "contains": "default" + }, + "iterations": { + "values": { + "count": 12583, + "rate": 200.3666792938264 + }, + "type": "counter", + "contains": "default" + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 18494, + "rate": 294.49108852102245 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.7224088104350543, + "passes": 18498, + "fails": 7108 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 25355, + "rate": 403.7429192954755 + } + }, + "failed_writes": { + "contains": "default", + "values": { + "count": 9238, + "rate": 147.102231845853 + }, + "type": "counter" + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 11327671, + "rate": 180377.3203848826 + } + }, + "message_latency_ms": { + "values": { + "p(99)": 214.25322976000027, + "max": 2105.229414, + "avg": 37.81423101127255, + "p(50)": 3.132864, + "p(95)": 165.90313379999998 + }, + "type": "trend", + "contains": "time" + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.07160572112005212, + "p(50)": 0.000252, + "p(95)": 0.00135, + "p(99)": 0.001486, + "max": 512.599107 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 25606, + "rate": 407.73974330427706 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.0036877972740763884, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 4.38229 + } + }, + "vus": { + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + }, + "type": "gauge" + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 38.61973596547674, + "p(50)": 3.2507835, + "p(95)": 162.070367, + "p(99)": 209.24074225000007, + "max": 3000.98968 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 61.066863, + "avg": 0.047064733578067626 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "max": 3000.926011, + "avg": 37.85816009825789, + "p(50)": 2.554658, + "p(95)": 161.6179185, + "p(99)": 208.48592990000006 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 271.1536319600006, + "max": 1095.280026, + "avg": 119.94345917177822, + "p(50)": 104.1612405, + "p(95)": 197.87173769999998 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "max": 23.808162, + "avg": 0.1133037012418968, + "p(50)": 0.044178, + "p(95)": 0.24903725, + "p(99)": 0.5478875500000034 + } + }, + "confirmed_messages": { + "values": { + "count": 3270, + "rate": 52.070177325821525 + }, + "type": "counter", + "contains": "default" + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 18494, + "rate": 294.49108852102245 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.2758242618842509, + "passes": 7044, + "fails": 18494 + } + } + }, + "setup_data": [ + { + "chat": "79fce74b-08ea-41a1-b659-a49d92408248", + "token": "bdPHACJnUZ67x-OhE_u0czdsxG2jZAo8w2PnzPVKqhc" + }, + { + "chat": "8084c8b5-da74-4913-ab4a-4b94ba03968d", + "token": "wGgvrzNhNei_PXAKZJTlvC6428zr_5VK92qrzlx21_s" + }, + { + "chat": "624be9d1-3696-4912-b789-01f005a573f8", + "token": "2uTqthqAJh1CG_3odQBvE2X2Ncdz_6oPPexPBuZsY6M" + }, + { + "chat": "61703b54-db6f-47ce-97c9-84fa6b41e3f4", + "token": "FG1w3BzPyIxeHMSQjh_4tzbflVJUYlZPt7bcHqRHOwA" + }, + { + "chat": "57250da8-8d3e-434a-90d3-251390ce7cc1", + "token": "89GxyIWG3aD6ONpW9--RRvb-8tSQN-9ThmU-biHvEq4" + }, + { + "chat": "fa0e6ec3-f868-466b-99c1-c1bd4103796d", + "token": "ncV60vGVnD0IKJJrU8Y9wVuzDmhGZh8ouo6U2mV9kWo" + }, + { + "token": "RorabKAImE-Lg2vCJsPPL90D4RIElqPq4FPkFquUoNY", + "chat": "27be6988-eeba-4508-8fc6-31a2d3f7839c" + }, + { + "chat": "5d4cb9a0-bbcc-4b70-9d87-489b30b8b1ca", + "token": "TW1H4KBgVysTjbZtLtIBdWJSuyh3YD3u1fm8ev9y0u8" + }, + { + "chat": "7cfbac7c-5b6d-4aa8-8b17-1dd9e9ea67e9", + "token": "14V6y1PWn-5phmYob785pPlTXR9ucKMyUPPgQ0pZvSc" + }, + { + "chat": "aecc1954-4ef4-4dd2-a6b1-d4f901d3b575", + "token": "9wMUqzYNqfpBCuP4cQvlppYnfu0aS-AHAwJtVZ73PqE" + }, + { + "chat": "7c95333d-5b62-4c16-b3bf-ab385d1f26b7", + "token": "_1zSY4PxjXfi7veKrTrHG2dHudSX9Aghad-AuvPMbEw" + }, + { + "chat": "630c5be7-3899-4f64-b34a-617eff79559e", + "token": "rT9rFph4gA_D4yTDgvO6TfFy2fO5cxY7x-mogC000sY" + }, + { + "token": "-VTRD1xP86fz_axMZWbJUMTZQcR54gZMz5OAQB9pKJ4", + "chat": "efc8dcdd-08e3-4845-9f1f-495b24625313" + }, + { + "chat": "73e1e0c9-63d7-4bce-87cf-7899f76a55b6", + "token": "_o2VVVtTF3qAzF1B-hIvrY8KYteCY1TjDx70p0Wh5W0" + }, + { + "chat": "4422251f-cceb-4a1f-836d-4f19505c4c2c", + "token": "c_OYhyxFq0S6ECEHyL_fKoLy40Pd4bWd_izfDoa6ccM" + }, + { + "chat": "026a220d-ccc6-4bea-af94-6fa9e433b09b", + "token": "cLlQKwn1yDF_veVg_m35-bIAnkCysClsuQYYZtQb_18" + } + ], + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "fails": 9238, + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 3366 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 344, + "fails": 7 + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 3334, + "fails": 9249 + } + ] + } + } +} diff --git a/evidence/research-20261029-budget/load-resource-high-a-20261029121644.txt b/evidence/research-20261029-budget/load-resource-high-a-20261029121644.txt new file mode 100644 index 00000000..6e4f58df --- /dev/null +++ b/evidence/research-20261029-budget/load-resource-high-a-20261029121644.txt @@ -0,0 +1,4 @@ +time="2026-10-29T12:17:29Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/health/ready\": request timeout" +time="2026-10-29T12:17:33Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/health/ready\": request timeout" +time="2026-10-29T12:17:37Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/health/ready\": request timeout" +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":62799.862953},"metrics":{"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"data_sent":{"type":"counter","contains":"data","values":{"count":2134144,"rate":33983.2588742624}},"iteration_duration":{"type":"trend","contains":"time","values":{"avg":77.48847192855455,"p(50)":6.951556,"p(95)":329.7308103,"p(99)":479.30767200000037,"max":5260.066465}},"http_req_receiving":{"contains":"time","values":{"avg":0.6482721659767205,"p(50)":0.2119605,"p(95)":1.7822905,"p(99)":10.010433900000011,"max":188.911651},"type":"trend"},"attempted_messages":{"values":{"count":12508,"rate":199.1724091716745},"type":"counter","contains":"default"},"iterations":{"values":{"count":12583,"rate":200.3666792938264},"type":"counter","contains":"default"},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":18494,"rate":294.49108852102245},"thresholds":{"count>=0":{"ok":true}}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.7224088104350543,"passes":18498,"fails":7108}},"measured_operations":{"type":"counter","contains":"default","values":{"count":25355,"rate":403.7429192954755}},"failed_writes":{"contains":"default","values":{"count":9238,"rate":147.102231845853},"type":"counter"},"data_received":{"type":"counter","contains":"data","values":{"count":11327671,"rate":180377.3203848826}},"message_latency_ms":{"values":{"p(99)":214.25322976000027,"max":2105.229414,"avg":37.81423101127255,"p(50)":3.132864,"p(95)":165.90313379999998},"type":"trend","contains":"time"},"http_req_blocked":{"type":"trend","contains":"time","values":{"avg":0.07160572112005212,"p(50)":0.000252,"p(95)":0.00135,"p(99)":0.001486,"max":512.599107}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_reqs":{"type":"counter","contains":"default","values":{"count":25606,"rate":407.73974330427706}},"http_req_connecting":{"type":"trend","contains":"time","values":{"avg":0.0036877972740763884,"p(50)":0,"p(95)":0,"p(99)":0,"max":4.38229}},"vus":{"contains":"default","values":{"value":32,"min":0,"max":32},"type":"gauge"},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":38.61973596547674,"p(50)":3.2507835,"p(95)":162.070367,"p(99)":209.24074225000007,"max":3000.98968}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":61.066863,"avg":0.047064733578067626}},"http_req_waiting":{"type":"trend","contains":"time","values":{"max":3000.926011,"avg":37.85816009825789,"p(50)":2.554658,"p(95)":161.6179185,"p(99)":208.48592990000006}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(99)":271.1536319600006,"max":1095.280026,"avg":119.94345917177822,"p(50)":104.1612405,"p(95)":197.87173769999998}},"http_req_sending":{"type":"trend","contains":"time","values":{"max":23.808162,"avg":0.1133037012418968,"p(50)":0.044178,"p(95)":0.24903725,"p(99)":0.5478875500000034}},"confirmed_messages":{"values":{"count":3270,"rate":52.070177325821525},"type":"counter","contains":"default"},"application_errors":{"type":"counter","contains":"default","values":{"count":18494,"rate":294.49108852102245}},"checks":{"type":"rate","contains":"default","values":{"rate":0.2758242618842509,"passes":7044,"fails":18494}}},"setup_data":[{"chat":"79fce74b-08ea-41a1-b659-a49d92408248","token":"bdPHACJnUZ67x-OhE_u0czdsxG2jZAo8w2PnzPVKqhc"},{"chat":"8084c8b5-da74-4913-ab4a-4b94ba03968d","token":"wGgvrzNhNei_PXAKZJTlvC6428zr_5VK92qrzlx21_s"},{"chat":"624be9d1-3696-4912-b789-01f005a573f8","token":"2uTqthqAJh1CG_3odQBvE2X2Ncdz_6oPPexPBuZsY6M"},{"chat":"61703b54-db6f-47ce-97c9-84fa6b41e3f4","token":"FG1w3BzPyIxeHMSQjh_4tzbflVJUYlZPt7bcHqRHOwA"},{"chat":"57250da8-8d3e-434a-90d3-251390ce7cc1","token":"89GxyIWG3aD6ONpW9--RRvb-8tSQN-9ThmU-biHvEq4"},{"chat":"fa0e6ec3-f868-466b-99c1-c1bd4103796d","token":"ncV60vGVnD0IKJJrU8Y9wVuzDmhGZh8ouo6U2mV9kWo"},{"token":"RorabKAImE-Lg2vCJsPPL90D4RIElqPq4FPkFquUoNY","chat":"27be6988-eeba-4508-8fc6-31a2d3f7839c"},{"chat":"5d4cb9a0-bbcc-4b70-9d87-489b30b8b1ca","token":"TW1H4KBgVysTjbZtLtIBdWJSuyh3YD3u1fm8ev9y0u8"},{"chat":"7cfbac7c-5b6d-4aa8-8b17-1dd9e9ea67e9","token":"14V6y1PWn-5phmYob785pPlTXR9ucKMyUPPgQ0pZvSc"},{"chat":"aecc1954-4ef4-4dd2-a6b1-d4f901d3b575","token":"9wMUqzYNqfpBCuP4cQvlppYnfu0aS-AHAwJtVZ73PqE"},{"chat":"7c95333d-5b62-4c16-b3bf-ab385d1f26b7","token":"_1zSY4PxjXfi7veKrTrHG2dHudSX9Aghad-AuvPMbEw"},{"chat":"630c5be7-3899-4f64-b34a-617eff79559e","token":"rT9rFph4gA_D4yTDgvO6TfFy2fO5cxY7x-mogC000sY"},{"token":"-VTRD1xP86fz_axMZWbJUMTZQcR54gZMz5OAQB9pKJ4","chat":"efc8dcdd-08e3-4845-9f1f-495b24625313"},{"chat":"73e1e0c9-63d7-4bce-87cf-7899f76a55b6","token":"_o2VVVtTF3qAzF1B-hIvrY8KYteCY1TjDx70p0Wh5W0"},{"chat":"4422251f-cceb-4a1f-836d-4f19505c4c2c","token":"c_OYhyxFq0S6ECEHyL_fKoLy40Pd4bWd_izfDoa6ccM"},{"chat":"026a220d-ccc6-4bea-af94-6fa9e433b09b","token":"cLlQKwn1yDF_veVg_m35-bIAnkCysClsuQYYZtQb_18"}],"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"fails":9238,"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":3366},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":344,"fails":7},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":3334,"fails":9249}]}}} diff --git a/evidence/research-20261029-budget/load-resource-high-b-20261029122017.json b/evidence/research-20261029-budget/load-resource-high-b-20261029122017.json new file mode 100644 index 00000000..e2dcaa80 --- /dev/null +++ b/evidence/research-20261029-budget/load-resource-high-b-20261029122017.json @@ -0,0 +1,373 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 5230, + "fails": 0 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 528, + "fails": 0 + }, + { + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 5216, + "fails": 0, + "name": "history readable", + "path": "::history readable" + } + ] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 45658.562455 + }, + "metrics": { + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 11038, + "rate": 241.75093140259926 + } + }, + "http_req_failed": { + "values": { + "rate": 0, + "passes": 0, + "fails": 11038 + }, + "type": "rate", + "contains": "default" + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 5109, + "rate": 111.8957699343975 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 15125395, + "rate": 331271.8181810308 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "min": 32, + "max": 32, + "value": 32 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.04566174053270521, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 25.739401 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0.6592425499999996, + "p(99)": 1.4886263799999973, + "max": 189.491048, + "avg": 0.2831693467113601, + "p(50)": 0.181108 + } + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "http_req_duration{expected_response:true}": { + "values": { + "p(95)": 148.4398172, + "p(99)": 169.97291509999982, + "max": 634.447418, + "avg": 88.6529423891107, + "p(50)": 78.5364045 + }, + "type": "trend", + "contains": "time" + }, + "http_req_connecting": { + "contains": "time", + "values": { + "avg": 0.01091145696684182, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 7.66539 + }, + "type": "trend" + }, + "checks": { + "values": { + "rate": 1, + "passes": 10974, + "fails": 0 + }, + "type": "rate", + "contains": "default" + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "rate": 111.8957699343975, + "count": 5109 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "http_req_duration": { + "contains": "time", + "values": { + "avg": 88.6529423891107, + "p(50)": 78.5364045, + "p(95)": 148.4398172, + "p(99)": 169.97291509999982, + "max": 634.447418 + }, + "type": "trend" + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 94.34357741456262, + "p(50)": 86.548129, + "p(95)": 150.95621699999998, + "p(99)": 174.36450792000005, + "max": 634.447418 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.19530083266896073, + "p(50)": 0.172547, + "p(95)": 0.35084894999999994, + "p(99)": 0.70326441, + "max": 10.432989 + } + }, + "http_req_waiting": { + "values": { + "p(95)": 147.96067564999998, + "p(99)": 169.61154033999983, + "max": 634.096686, + "avg": 88.17447220973034, + "p(50)": 78.139894 + }, + "type": "trend", + "contains": "time" + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 1007642, + "rate": 22069.069760860475 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 166.124368, + "p(95)": 305.40765375, + "p(99)": 436.3995856, + "max": 963.702448, + "avg": 187.09528789589734 + } + }, + "http_req_blocked": { + "values": { + "p(50)": 0.001214, + "p(95)": 0.0014271499999999996, + "p(99)": 0.0017360399999999936, + "max": 29.570485, + "avg": 0.0587230481971364 + }, + "type": "trend", + "contains": "time" + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 5216, + "rate": 114.23925151258904 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 10734, + "rate": 235.09281551689622 + } + }, + "application_errors{status:0}": { + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + } + }, + "setup_data": [ + { + "chat": "91c65169-e029-41e8-9a3d-3d9cdc50f533", + "token": "hdd53_NS9rXWBVHU20Jt9JMbfiv4gMd2hBddG2vfRKA" + }, + { + "token": "HRzWk5NyCEtz8951cOQem8IBiHCjqos-RQcyKU4DIcw", + "chat": "9a20bcc5-ed82-442d-9ef3-c013d9f4b90f" + }, + { + "chat": "351d6fd3-4c8a-4d70-9165-5ac60720cc53", + "token": "SpKlhn-4Te0lrzYKauV38dR4NQJV9dFW4cJC7RLkVRA" + }, + { + "chat": "b3e37643-bb89-480e-b5c0-f127a44e4c32", + "token": "BBan9FT7VI3u6m0TLUOx3gCacA6BW3ucHrT3KvKTj1M" + }, + { + "chat": "8aacf184-5d09-4e85-9f7e-7c0213def1c0", + "token": "l-uDa3tyKbZcHpzTyz1kCdwI9JsjXmom2VW_swcnJxA" + }, + { + "chat": "008c85d5-376a-4089-9f14-374db3db5ad4", + "token": "bK7Z0mpBA27GM4X1tIfw_6G0UuCR84M9km_INxq1BVY" + }, + { + "token": "vzi9034UW9R6UvZVq5yNmhjx08_xdZNlh2o4NDmdJYM", + "chat": "ef0420a2-a9e4-49d3-834e-664cb604c76f" + }, + { + "chat": "48f6bb3d-0e53-4440-ad2a-5e086c71b516", + "token": "SDIZBSpAVxdQRoSyr2WX4z9n2CiBw_9dlj55cr33zTQ" + }, + { + "token": "Umz1yWJ9_wbf4bQ6bpXkOYtsGofs-hbJno0vPRlR968", + "chat": "aee8ebc6-e03f-4865-834a-d002513444c8" + }, + { + "chat": "0f39ff84-68bc-4e77-8250-6d84448938a4", + "token": "McLP3DOUFeB7TdHaKxfVzJVU6Yiwf4hPmIloihNX6LQ" + }, + { + "token": "egIHGXPgXaDkOr5EEI-tj0lLbv6i53QSQ3p9rvPdS8Q", + "chat": "9813b57a-f83c-4a32-b855-2a73e5e94fa3" + }, + { + "chat": "1fdf4a8f-a2a6-4ff6-8e95-d7cc2dff2424", + "token": "syrQ8IGX5nqF6fm2a-K9cSLxHRBEsUVDbpfGRGJExyk" + }, + { + "chat": "0f1a041e-11d2-410b-a6f3-610138932863", + "token": "gZMY-iKeabd3X0x2hjQrel4-UKk9QixdXjWx-ZZwAQI" + }, + { + "token": "bOdeqdhjMQ3MS-vqgwc_uR55qd-FD9oxtHXu35nd1A0", + "chat": "4aae219b-0deb-4028-851c-99a61c521274" + }, + { + "chat": "9b66b89a-0993-429e-abe2-ae40103e25da", + "token": "uzibd3tAtqrzYJAJd88csGZl8PQ517P4HI67qXDZYzA" + }, + { + "chat": "1f95d050-3b75-4071-826f-4b121a63cf51", + "token": "Yb4OgdBWC9t9zXoH26STDLzOlMzddZysFz3xS00kpnA" + } + ] + } +} diff --git a/evidence/research-20261029-budget/load-resource-high-b-20261029122017.txt b/evidence/research-20261029-budget/load-resource-high-b-20261029122017.txt new file mode 100644 index 00000000..db628043 --- /dev/null +++ b/evidence/research-20261029-budget/load-resource-high-b-20261029122017.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":5230,"fails":0},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":528,"fails":0},{"id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":5216,"fails":0,"name":"history readable","path":"::history readable"}]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":45658.562455},"metrics":{"http_reqs":{"type":"counter","contains":"default","values":{"count":11038,"rate":241.75093140259926}},"http_req_failed":{"values":{"rate":0,"passes":0,"fails":11038},"type":"rate","contains":"default"},"attempted_messages":{"type":"counter","contains":"default","values":{"count":5109,"rate":111.8957699343975}},"data_received":{"type":"counter","contains":"data","values":{"count":15125395,"rate":331271.8181810308}},"vus_max":{"type":"gauge","contains":"default","values":{"min":32,"max":32,"value":32}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"avg":0.04566174053270521,"p(50)":0,"p(95)":0,"p(99)":0,"max":25.739401}},"http_req_receiving":{"type":"trend","contains":"time","values":{"p(95)":0.6592425499999996,"p(99)":1.4886263799999973,"max":189.491048,"avg":0.2831693467113601,"p(50)":0.181108}},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"http_req_duration{expected_response:true}":{"values":{"p(95)":148.4398172,"p(99)":169.97291509999982,"max":634.447418,"avg":88.6529423891107,"p(50)":78.5364045},"type":"trend","contains":"time"},"http_req_connecting":{"contains":"time","values":{"avg":0.01091145696684182,"p(50)":0,"p(95)":0,"p(99)":0,"max":7.66539},"type":"trend"},"checks":{"values":{"rate":1,"passes":10974,"fails":0},"type":"rate","contains":"default"},"confirmed_messages":{"type":"counter","contains":"default","values":{"rate":111.8957699343975,"count":5109}},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"http_req_duration":{"contains":"time","values":{"avg":88.6529423891107,"p(50)":78.5364045,"p(95)":148.4398172,"p(99)":169.97291509999982,"max":634.447418},"type":"trend"},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":94.34357741456262,"p(50)":86.548129,"p(95)":150.95621699999998,"p(99)":174.36450792000005,"max":634.447418}},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.19530083266896073,"p(50)":0.172547,"p(95)":0.35084894999999994,"p(99)":0.70326441,"max":10.432989}},"http_req_waiting":{"values":{"p(95)":147.96067564999998,"p(99)":169.61154033999983,"max":634.096686,"avg":88.17447220973034,"p(50)":78.139894},"type":"trend","contains":"time"},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"data_sent":{"type":"counter","contains":"data","values":{"count":1007642,"rate":22069.069760860475}},"iteration_duration":{"type":"trend","contains":"time","values":{"p(50)":166.124368,"p(95)":305.40765375,"p(99)":436.3995856,"max":963.702448,"avg":187.09528789589734}},"http_req_blocked":{"values":{"p(50)":0.001214,"p(95)":0.0014271499999999996,"p(99)":0.0017360399999999936,"max":29.570485,"avg":0.0587230481971364},"type":"trend","contains":"time"},"iterations":{"type":"counter","contains":"default","values":{"count":5216,"rate":114.23925151258904}},"measured_operations":{"type":"counter","contains":"default","values":{"count":10734,"rate":235.09281551689622}},"application_errors{status:0}":{"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default","values":{"count":0,"rate":0}}},"setup_data":[{"chat":"91c65169-e029-41e8-9a3d-3d9cdc50f533","token":"hdd53_NS9rXWBVHU20Jt9JMbfiv4gMd2hBddG2vfRKA"},{"token":"HRzWk5NyCEtz8951cOQem8IBiHCjqos-RQcyKU4DIcw","chat":"9a20bcc5-ed82-442d-9ef3-c013d9f4b90f"},{"chat":"351d6fd3-4c8a-4d70-9165-5ac60720cc53","token":"SpKlhn-4Te0lrzYKauV38dR4NQJV9dFW4cJC7RLkVRA"},{"chat":"b3e37643-bb89-480e-b5c0-f127a44e4c32","token":"BBan9FT7VI3u6m0TLUOx3gCacA6BW3ucHrT3KvKTj1M"},{"chat":"8aacf184-5d09-4e85-9f7e-7c0213def1c0","token":"l-uDa3tyKbZcHpzTyz1kCdwI9JsjXmom2VW_swcnJxA"},{"chat":"008c85d5-376a-4089-9f14-374db3db5ad4","token":"bK7Z0mpBA27GM4X1tIfw_6G0UuCR84M9km_INxq1BVY"},{"token":"vzi9034UW9R6UvZVq5yNmhjx08_xdZNlh2o4NDmdJYM","chat":"ef0420a2-a9e4-49d3-834e-664cb604c76f"},{"chat":"48f6bb3d-0e53-4440-ad2a-5e086c71b516","token":"SDIZBSpAVxdQRoSyr2WX4z9n2CiBw_9dlj55cr33zTQ"},{"token":"Umz1yWJ9_wbf4bQ6bpXkOYtsGofs-hbJno0vPRlR968","chat":"aee8ebc6-e03f-4865-834a-d002513444c8"},{"chat":"0f39ff84-68bc-4e77-8250-6d84448938a4","token":"McLP3DOUFeB7TdHaKxfVzJVU6Yiwf4hPmIloihNX6LQ"},{"token":"egIHGXPgXaDkOr5EEI-tj0lLbv6i53QSQ3p9rvPdS8Q","chat":"9813b57a-f83c-4a32-b855-2a73e5e94fa3"},{"chat":"1fdf4a8f-a2a6-4ff6-8e95-d7cc2dff2424","token":"syrQ8IGX5nqF6fm2a-K9cSLxHRBEsUVDbpfGRGJExyk"},{"chat":"0f1a041e-11d2-410b-a6f3-610138932863","token":"gZMY-iKeabd3X0x2hjQrel4-UKk9QixdXjWx-ZZwAQI"},{"token":"bOdeqdhjMQ3MS-vqgwc_uR55qd-FD9oxtHXu35nd1A0","chat":"4aae219b-0deb-4028-851c-99a61c521274"},{"chat":"9b66b89a-0993-429e-abe2-ae40103e25da","token":"uzibd3tAtqrzYJAJd88csGZl8PQ517P4HI67qXDZYzA"},{"chat":"1f95d050-3b75-4071-826f-4b121a63cf51","token":"Yb4OgdBWC9t9zXoH26STDLzOlMzddZysFz3xS00kpnA"}]}} diff --git a/evidence/research-20261029-budget/load-resource-low-a-20261029121455.json b/evidence/research-20261029-budget/load-resource-low-a-20261029121455.json new file mode 100644 index 00000000..93b94d85 --- /dev/null +++ b/evidence/research-20261029-budget/load-resource-low-a-20261029121455.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "metrics": { + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 1342, + "rate": 26.561472909672695 + } + }, + "application_errors{status:0}": { + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default" + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 126, + "rate": 2.493849170356751 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.4785587288240778, + "p(50)": 0.170357, + "p(95)": 1.1339236, + "p(99)": 3.4475808399999934, + "max": 214.619895 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 308580, + "rate": 6107.555372926081 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 1495, + "rate": 29.58971833082018 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "rate": 55.874096888231016, + "count": 2823 + } + }, + "application_errors{status:429}": { + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default" + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 304.09755029351567, + "p(50)": 147.824596, + "p(95)": 410.633796, + "p(99)": 4001.48060386, + "max": 15305.91387 + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 179.871273, + "p(95)": 474.7400550500002, + "p(99)": 2920.94988727998, + "max": 4001.89549, + "avg": 244.71032225335352 + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 412.31885059999956, + "p(99)": 4001.85648818, + "max": 15306.114353, + "avg": 304.80681099596694, + "p(50)": 148.372542 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.9290434660254416, + "p(50)": 0.000929, + "p(95)": 0.0014948999999999997, + "p(99)": 9.614031419997158, + "max": 1122.781083 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 1.7588446199994259, + "max": 1084.331548, + "avg": 0.4973989196400869 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.039094011790257524, + "passes": 126, + "fails": 3097 + } + }, + "http_reqs": { + "contains": "default", + "values": { + "rate": 63.79107838142705, + "count": 3223 + }, + "type": "counter" + }, + "http_req_duration{expected_response:true}": { + "values": { + "avg": 258.8675715650633, + "p(50)": 151.210045, + "p(95)": 395.1222127999998, + "p(99)": 805.1593229599996, + "max": 13484.65663 + }, + "type": "trend", + "contains": "time" + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 4186739, + "rate": 82865.83794960518 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.9601139601139601, + "passes": 3033, + "fails": 126 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 6.95150741999773, + "max": 318.387688, + "avg": 0.40447649953459514 + } + }, + "vus": { + "values": { + "value": 32, + "min": 0, + "max": 32 + }, + "type": "gauge", + "contains": "default" + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 315.29533, + "p(95)": 952.9943968, + "p(99)": 13495.279628039998, + "max": 16686.161806, + "avg": 651.9972944147166 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 1281, + "rate": 25.3541332319603 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.2307019736270553, + "p(50)": 0.139785, + "p(95)": 0.49472829999999995, + "p(99)": 2.3659373399999986, + "max": 14.509999 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + } + }, + "failed_writes": { + "type": "counter", + "contains": "default", + "values": { + "count": 61, + "rate": 1.2073396777123953 + } + }, + "application_errors{status:503}": { + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default", + "values": { + "count": 110, + "rate": 2.1771699106289093 + } + } + }, + "setup_data": [ + { + "chat": "40f3048c-dc88-46bc-993a-d50c7468fccd", + "token": "aXl5610t-lUuA05L5uAThAZvXaM6maZid2q3lzVf1ic" + }, + { + "chat": "ef3e62fe-d54d-4749-891a-5233e057b95f", + "token": "eMcEAwKjc9-IiSDNb7P_pwetWZTx1f-u1dZVz7b5YZA" + }, + { + "chat": "befb66cf-e346-4c9b-ad7b-df21a62f493d", + "token": "ubikwf5lirrYiOpuhDdqZNI6BK_hoY1LHZk0R6JYeWo" + }, + { + "chat": "f3df2a1d-5c5c-402b-b201-7645dfac22dd", + "token": "pCOPkGEq-8fPpFW0hvbm0ZhNCAyaSlIbWdVJbIMzE3g" + }, + { + "chat": "1835e164-8df2-4579-b9c6-909e4afff190", + "token": "beA-HCCfv1GdrGklVYZfGyyPCdO6aoGu6PwXckCYu78" + }, + { + "chat": "12bbdd61-859d-4def-9194-0ac72ecb97cd", + "token": "gbPAIwQqpI8TjoUFI3jIjE1Me_bHeaV9WnYflVDAkKM" + }, + { + "chat": "731e7274-e841-478d-994a-f8bd3e9e5589", + "token": "zn66NKnRanUawQ4uwQ5xbnk09PCYrHf1YHWQzsxREt4" + }, + { + "chat": "a3b4692a-af10-48d3-8f54-8e48feae4612", + "token": "edxXRcbiyVYcYmRveFaMjherFV-9SGrta-dHJZ56ECI" + }, + { + "chat": "ba8a1024-117b-49e3-b83f-337651f3fda0", + "token": "P_6O8HryOaE-k4EFDHNN2ATnEhdvqlkRjB3wvoAmnS4" + }, + { + "chat": "23d1b45e-da68-4e81-8c66-24637a77fac0", + "token": "az8g6fY5btOXxU65YbUURcy_lMF22NmbISPfcezRiQE" + }, + { + "chat": "bf7a8f6a-ec14-4aff-b7bd-254ab247e91a", + "token": "r-P4mXHViC666mF7QqoRPt3zQuthk2Y-8B7lBcJKpRw" + }, + { + "chat": "595ef50d-5e75-4c52-b396-b18954402e47", + "token": "tpO20J4OJfLOnJIncvb8obstXNtflzCNIxdll6U4LZM" + }, + { + "chat": "ca0c67f7-8dc4-45f0-a947-43b5276e6023", + "token": "XUWiuyO9BtlQQmSPp13w7k3Xp0PDLqKw27N7e6u6t8U" + }, + { + "token": "We7Y2W-VGPBSFET5WeAZWiSD4aPQoKoeHjmO-7JMFnI", + "chat": "d32d06cf-62e7-442a-8d55-23f0df08fbe7" + }, + { + "chat": "6b10db1b-d3d4-4969-aab5-d59e06578ffb", + "token": "pst6F_kphCd5WIQF3O-QqQyEGNWxDYw_fVFORby8bmM" + }, + { + "token": "eFnY_ls7ovtLZSz6C2R6INBLAKAyKEbSwhAxGsaZEr4", + "chat": "8a347874-dd9a-42b3-9618-2f99f0b53ec2" + } + ], + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "fails": 61, + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 1447 + }, + { + "passes": 153, + "fails": 3, + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa" + }, + { + "passes": 1433, + "fails": 62, + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8" + } + ] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 50524.306561 + } + } +} diff --git a/evidence/research-20261029-budget/load-resource-low-a-20261029121455.txt b/evidence/research-20261029-budget/load-resource-low-a-20261029121455.txt new file mode 100644 index 00000000..97a27861 --- /dev/null +++ b/evidence/research-20261029-budget/load-resource-low-a-20261029121455.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"metrics":{"attempted_messages":{"type":"counter","contains":"default","values":{"count":1342,"rate":26.561472909672695}},"application_errors{status:0}":{"values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default"},"application_errors":{"type":"counter","contains":"default","values":{"count":126,"rate":2.493849170356751}},"http_req_receiving":{"type":"trend","contains":"time","values":{"avg":0.4785587288240778,"p(50)":0.170357,"p(95)":1.1339236,"p(99)":3.4475808399999934,"max":214.619895}},"data_sent":{"type":"counter","contains":"data","values":{"count":308580,"rate":6107.555372926081}},"iterations":{"type":"counter","contains":"default","values":{"count":1495,"rate":29.58971833082018}},"measured_operations":{"type":"counter","contains":"default","values":{"rate":55.874096888231016,"count":2823}},"application_errors{status:429}":{"values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default"},"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":304.09755029351567,"p(50)":147.824596,"p(95)":410.633796,"p(99)":4001.48060386,"max":15305.91387}},"message_latency_ms":{"type":"trend","contains":"time","values":{"p(50)":179.871273,"p(95)":474.7400550500002,"p(99)":2920.94988727998,"max":4001.89549,"avg":244.71032225335352}},"http_req_duration":{"type":"trend","contains":"time","values":{"p(95)":412.31885059999956,"p(99)":4001.85648818,"max":15306.114353,"avg":304.80681099596694,"p(50)":148.372542}},"http_req_blocked":{"type":"trend","contains":"time","values":{"avg":0.9290434660254416,"p(50)":0.000929,"p(95)":0.0014948999999999997,"p(99)":9.614031419997158,"max":1122.781083}},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":1.7588446199994259,"max":1084.331548,"avg":0.4973989196400869}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.039094011790257524,"passes":126,"fails":3097}},"http_reqs":{"contains":"default","values":{"rate":63.79107838142705,"count":3223},"type":"counter"},"http_req_duration{expected_response:true}":{"values":{"avg":258.8675715650633,"p(50)":151.210045,"p(95)":395.1222127999998,"p(99)":805.1593229599996,"max":13484.65663},"type":"trend","contains":"time"},"data_received":{"type":"counter","contains":"data","values":{"count":4186739,"rate":82865.83794960518}},"checks":{"type":"rate","contains":"default","values":{"rate":0.9601139601139601,"passes":3033,"fails":126}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":6.95150741999773,"max":318.387688,"avg":0.40447649953459514}},"vus":{"values":{"value":32,"min":0,"max":32},"type":"gauge","contains":"default"},"iteration_duration":{"type":"trend","contains":"time","values":{"p(50)":315.29533,"p(95)":952.9943968,"p(99)":13495.279628039998,"max":16686.161806,"avg":651.9972944147166}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":1281,"rate":25.3541332319603}},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.2307019736270553,"p(50)":0.139785,"p(95)":0.49472829999999995,"p(99)":2.3659373399999986,"max":14.509999}},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"failed_writes":{"type":"counter","contains":"default","values":{"count":61,"rate":1.2073396777123953}},"application_errors{status:503}":{"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default","values":{"count":110,"rate":2.1771699106289093}}},"setup_data":[{"chat":"40f3048c-dc88-46bc-993a-d50c7468fccd","token":"aXl5610t-lUuA05L5uAThAZvXaM6maZid2q3lzVf1ic"},{"chat":"ef3e62fe-d54d-4749-891a-5233e057b95f","token":"eMcEAwKjc9-IiSDNb7P_pwetWZTx1f-u1dZVz7b5YZA"},{"chat":"befb66cf-e346-4c9b-ad7b-df21a62f493d","token":"ubikwf5lirrYiOpuhDdqZNI6BK_hoY1LHZk0R6JYeWo"},{"chat":"f3df2a1d-5c5c-402b-b201-7645dfac22dd","token":"pCOPkGEq-8fPpFW0hvbm0ZhNCAyaSlIbWdVJbIMzE3g"},{"chat":"1835e164-8df2-4579-b9c6-909e4afff190","token":"beA-HCCfv1GdrGklVYZfGyyPCdO6aoGu6PwXckCYu78"},{"chat":"12bbdd61-859d-4def-9194-0ac72ecb97cd","token":"gbPAIwQqpI8TjoUFI3jIjE1Me_bHeaV9WnYflVDAkKM"},{"chat":"731e7274-e841-478d-994a-f8bd3e9e5589","token":"zn66NKnRanUawQ4uwQ5xbnk09PCYrHf1YHWQzsxREt4"},{"chat":"a3b4692a-af10-48d3-8f54-8e48feae4612","token":"edxXRcbiyVYcYmRveFaMjherFV-9SGrta-dHJZ56ECI"},{"chat":"ba8a1024-117b-49e3-b83f-337651f3fda0","token":"P_6O8HryOaE-k4EFDHNN2ATnEhdvqlkRjB3wvoAmnS4"},{"chat":"23d1b45e-da68-4e81-8c66-24637a77fac0","token":"az8g6fY5btOXxU65YbUURcy_lMF22NmbISPfcezRiQE"},{"chat":"bf7a8f6a-ec14-4aff-b7bd-254ab247e91a","token":"r-P4mXHViC666mF7QqoRPt3zQuthk2Y-8B7lBcJKpRw"},{"chat":"595ef50d-5e75-4c52-b396-b18954402e47","token":"tpO20J4OJfLOnJIncvb8obstXNtflzCNIxdll6U4LZM"},{"chat":"ca0c67f7-8dc4-45f0-a947-43b5276e6023","token":"XUWiuyO9BtlQQmSPp13w7k3Xp0PDLqKw27N7e6u6t8U"},{"token":"We7Y2W-VGPBSFET5WeAZWiSD4aPQoKoeHjmO-7JMFnI","chat":"d32d06cf-62e7-442a-8d55-23f0df08fbe7"},{"chat":"6b10db1b-d3d4-4969-aab5-d59e06578ffb","token":"pst6F_kphCd5WIQF3O-QqQyEGNWxDYw_fVFORby8bmM"},{"token":"eFnY_ls7ovtLZSz6C2R6INBLAKAyKEbSwhAxGsaZEr4","chat":"8a347874-dd9a-42b3-9618-2f99f0b53ec2"}],"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"fails":61,"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":1447},{"passes":153,"fails":3,"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa"},{"passes":1433,"fails":62,"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8"}]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":50524.306561}}} diff --git a/evidence/research-20261029-budget/load-resource-low-b-20261029121833.json b/evidence/research-20261029-budget/load-resource-low-b-20261029121833.json new file mode 100644 index 00000000..b1f51165 --- /dev/null +++ b/evidence/research-20261029-budget/load-resource-low-b-20261029121833.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 1357, + "fails": 16 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 149, + "fails": 0 + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 1347, + "fails": 9 + } + ] + }, + "options": { + "noColor": false, + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "" + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 52348.857544 + }, + "metrics": { + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0.15752149999999998, + "p(95)": 1.0667816499999996, + "p(99)": 2.6036035500000057, + "max": 56.486935, + "avg": 0.35244900611828683 + } + }, + "confirmed_messages": { + "values": { + "count": 1164, + "rate": 22.23544227343721 + }, + "type": "counter", + "contains": "default" + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 1356, + "rate": 25.90314409173613 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.14524504452753234, + "p(50)": 0, + "p(95)": 0, + "p(99)": 3.306125890000003, + "max": 29.974407 + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 3906.8322486500006, + "max": 4021.414764, + "avg": 251.97356974999994, + "p(50)": 183.4024585, + "p(95)": 427.3455392499994 + } + }, + "http_req_tls_handshaking": { + "contains": "time", + "values": { + "avg": 0.2917874279401767, + "p(50)": 0, + "p(95)": 0, + "p(99)": 13.475143490000024, + "max": 52.169655 + }, + "type": "trend" + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 1180, + "rate": 22.541084091628786 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_duration": { + "contains": "time", + "values": { + "avg": 334.8987685271932, + "p(50)": 156.650286, + "p(95)": 391.2477612499998, + "p(99)": 11087.787277590052, + "max": 17274.305742 + }, + "type": "trend" + }, + "data_received": { + "values": { + "count": 3916167, + "rate": 74809.02513886579 + }, + "type": "counter", + "contains": "data" + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 10, + "rate": 0.19102613636973548 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_failed": { + "contains": "default", + "values": { + "rate": 0.00849762066621346, + "passes": 25, + "fails": 2917 + }, + "type": "rate" + }, + "http_reqs": { + "values": { + "count": 2942, + "rate": 56.19988931997618 + }, + "type": "counter", + "contains": "default" + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + } + }, + "iteration_duration": { + "values": { + "p(95)": 906.11886825, + "p(99)": 15413.7550611, + "max": 17502.378788, + "avg": 717.6840371460174, + "p(50)": 322.13766 + }, + "type": "trend", + "contains": "time" + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "measured_operations": { + "contains": "default", + "values": { + "count": 2489, + "rate": 47.546405342427164 + }, + "type": "counter" + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "avg": 277.3633390939327, + "p(50)": 155.341015, + "p(95)": 358.18594759999957, + "p(99)": 790.3229117200002, + "max": 15880.251665 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 25, + "rate": 0.4775653409243387 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.7281408660774972, + "p(50)": 0.000867, + "p(95)": 0.00143295, + "p(99)": 18.86882777000019, + "max": 840.913251 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 334.32122564751796, + "p(50)": 155.961825, + "p(95)": 390.94999664999983, + "p(99)": 11087.508132510053, + "max": 17274.101193 + } + }, + "data_sent": { + "values": { + "count": 285048, + "rate": 5445.161811992036 + }, + "type": "counter", + "contains": "data" + }, + "checks": { + "contains": "default", + "values": { + "rate": 0.9913134120917304, + "passes": 2853, + "fails": 25 + }, + "type": "rate" + }, + "failed_writes": { + "values": { + "count": 16, + "rate": 0.30564181819157676 + }, + "type": "counter", + "contains": "default" + }, + "http_req_sending": { + "contains": "time", + "values": { + "max": 14.874507, + "avg": 0.22509387355540372, + "p(50)": 0.134031, + "p(95)": 0.4687294499999987, + "p(99)": 2.5053839100000292 + }, + "type": "trend" + } + }, + "setup_data": [ + { + "chat": "f8ba9b15-98af-4a44-bdf5-624cd8402b38", + "token": "FxFcSoDTGgvrZpeWew6MVyckuFbwYmuYTIF_zUQVKU4" + }, + { + "token": "iRi1cRIConJL3t4fHWe5MZbSyhQe82wWVpuKOsM0ddo", + "chat": "97b17938-f0a6-4897-a2a0-67e81890cea5" + }, + { + "chat": "7ea71e1e-aaac-49d3-ab42-89b338d3a57d", + "token": "K28Wa6osCYcg2TXfmcUOmrvfL0z6RdH48YkyPTKRGi0" + }, + { + "token": "nokvkZFHXTWaZpYxKPh9FmXru2guwyPYTAy9YseVkdc", + "chat": "d0025650-b502-41c5-bb24-36fd04faad3c" + }, + { + "chat": "cac06fb0-fcbe-408b-89e6-98b707fabe5b", + "token": "XUajTicdRBXi6xKQGAzD60zGr21Bo1d5lGnfM-7TSgM" + }, + { + "chat": "0bcd1418-5038-4b51-8d03-091b8d8ff356", + "token": "Gs0LTQrub60JCwcISVLvIOJs7gSPIOPVER4AvodwEkw" + }, + { + "chat": "a3603938-6466-4b5a-9d51-f490145ed9ee", + "token": "Wgi-mBssvieIQOSLEGANd_7iD6Q5z1LgQFOZiavt6mc" + }, + { + "chat": "eeb932ec-d94b-4454-aca7-b10d998cb88f", + "token": "6teaF3P1YycmnULmqIaZPrpoNfmAgp0JdxKPRcW7T0M" + }, + { + "chat": "b29920d6-da8d-45ce-9d5d-9cda85e1cce7", + "token": "-Tx-ORNi08VBzWW2KsJQdCjB7v6MGGwkQnmTxTrzBaI" + }, + { + "token": "v7kefD4hC2SxYQooYKp0RZVJ0nJelJm9BbCcSMKI2Gg", + "chat": "eb05d4cd-d12b-4f63-b337-3b026d2a4508" + }, + { + "chat": "09b2325e-da8f-4ec5-84a2-08c1c75bc091", + "token": "atd5Frtyyy6QbsE4hMq9xC-3r8G2nF_FxP7vl69kuWg" + }, + { + "chat": "40f24b78-ffeb-4d27-ba79-38207f29f968", + "token": "HJvqaa0wD8MghYJos9SIyZcPW6Lr-DNaLr2xOBhbK9A" + }, + { + "chat": "51aec66f-8ad2-4083-b7d3-973da37ed89c", + "token": "L4GeIxSkDAZdydLwiDDNRurxbWlktqRVVXJnX4KHlM8" + }, + { + "chat": "5d473002-832f-4a93-bab6-0f63da9de9dc", + "token": "FAp4pUv4PFdCTmGe61M6ZMv0mdMD3NBn6Ac8ZPE9av4" + }, + { + "chat": "16808b44-8d8b-4fdc-bf64-44ee8aeb3a74", + "token": "y4OydC_AES-GoPDiGmFF2bsiqO57EmYG2yq2ENLz_Ek" + }, + { + "chat": "fd74965f-1d8e-44b2-9c9d-e1a988ccea92", + "token": "uod-2yoApCVejCegpfkcjAcAM55Z5EsSS42yEBk2pNk" + } + ] + } +} diff --git a/evidence/research-20261029-budget/load-resource-low-b-20261029121833.txt b/evidence/research-20261029-budget/load-resource-low-b-20261029121833.txt new file mode 100644 index 00000000..64bf3777 --- /dev/null +++ b/evidence/research-20261029-budget/load-resource-low-b-20261029121833.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":1357,"fails":16},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":149,"fails":0},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":1347,"fails":9}]},"options":{"noColor":false,"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":""},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":52348.857544},"metrics":{"http_req_receiving":{"type":"trend","contains":"time","values":{"p(50)":0.15752149999999998,"p(95)":1.0667816499999996,"p(99)":2.6036035500000057,"max":56.486935,"avg":0.35244900611828683}},"confirmed_messages":{"values":{"count":1164,"rate":22.23544227343721},"type":"counter","contains":"default"},"iterations":{"type":"counter","contains":"default","values":{"count":1356,"rate":25.90314409173613}},"http_req_connecting":{"type":"trend","contains":"time","values":{"avg":0.14524504452753234,"p(50)":0,"p(95)":0,"p(99)":3.306125890000003,"max":29.974407}},"message_latency_ms":{"type":"trend","contains":"time","values":{"p(99)":3906.8322486500006,"max":4021.414764,"avg":251.97356974999994,"p(50)":183.4024585,"p(95)":427.3455392499994}},"http_req_tls_handshaking":{"contains":"time","values":{"avg":0.2917874279401767,"p(50)":0,"p(95)":0,"p(99)":13.475143490000024,"max":52.169655},"type":"trend"},"attempted_messages":{"type":"counter","contains":"default","values":{"count":1180,"rate":22.541084091628786}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_duration":{"contains":"time","values":{"avg":334.8987685271932,"p(50)":156.650286,"p(95)":391.2477612499998,"p(99)":11087.787277590052,"max":17274.305742},"type":"trend"},"data_received":{"values":{"count":3916167,"rate":74809.02513886579},"type":"counter","contains":"data"},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":10,"rate":0.19102613636973548},"thresholds":{"count>=0":{"ok":true}}},"http_req_failed":{"contains":"default","values":{"rate":0.00849762066621346,"passes":25,"fails":2917},"type":"rate"},"http_reqs":{"values":{"count":2942,"rate":56.19988931997618},"type":"counter","contains":"default"},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"iteration_duration":{"values":{"p(95)":906.11886825,"p(99)":15413.7550611,"max":17502.378788,"avg":717.6840371460174,"p(50)":322.13766},"type":"trend","contains":"time"},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"measured_operations":{"contains":"default","values":{"count":2489,"rate":47.546405342427164},"type":"counter"},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"avg":277.3633390939327,"p(50)":155.341015,"p(95)":358.18594759999957,"p(99)":790.3229117200002,"max":15880.251665}},"application_errors":{"type":"counter","contains":"default","values":{"count":25,"rate":0.4775653409243387}},"http_req_blocked":{"type":"trend","contains":"time","values":{"avg":0.7281408660774972,"p(50)":0.000867,"p(95)":0.00143295,"p(99)":18.86882777000019,"max":840.913251}},"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":334.32122564751796,"p(50)":155.961825,"p(95)":390.94999664999983,"p(99)":11087.508132510053,"max":17274.101193}},"data_sent":{"values":{"count":285048,"rate":5445.161811992036},"type":"counter","contains":"data"},"checks":{"contains":"default","values":{"rate":0.9913134120917304,"passes":2853,"fails":25},"type":"rate"},"failed_writes":{"values":{"count":16,"rate":0.30564181819157676},"type":"counter","contains":"default"},"http_req_sending":{"contains":"time","values":{"max":14.874507,"avg":0.22509387355540372,"p(50)":0.134031,"p(95)":0.4687294499999987,"p(99)":2.5053839100000292},"type":"trend"}},"setup_data":[{"chat":"f8ba9b15-98af-4a44-bdf5-624cd8402b38","token":"FxFcSoDTGgvrZpeWew6MVyckuFbwYmuYTIF_zUQVKU4"},{"token":"iRi1cRIConJL3t4fHWe5MZbSyhQe82wWVpuKOsM0ddo","chat":"97b17938-f0a6-4897-a2a0-67e81890cea5"},{"chat":"7ea71e1e-aaac-49d3-ab42-89b338d3a57d","token":"K28Wa6osCYcg2TXfmcUOmrvfL0z6RdH48YkyPTKRGi0"},{"token":"nokvkZFHXTWaZpYxKPh9FmXru2guwyPYTAy9YseVkdc","chat":"d0025650-b502-41c5-bb24-36fd04faad3c"},{"chat":"cac06fb0-fcbe-408b-89e6-98b707fabe5b","token":"XUajTicdRBXi6xKQGAzD60zGr21Bo1d5lGnfM-7TSgM"},{"chat":"0bcd1418-5038-4b51-8d03-091b8d8ff356","token":"Gs0LTQrub60JCwcISVLvIOJs7gSPIOPVER4AvodwEkw"},{"chat":"a3603938-6466-4b5a-9d51-f490145ed9ee","token":"Wgi-mBssvieIQOSLEGANd_7iD6Q5z1LgQFOZiavt6mc"},{"chat":"eeb932ec-d94b-4454-aca7-b10d998cb88f","token":"6teaF3P1YycmnULmqIaZPrpoNfmAgp0JdxKPRcW7T0M"},{"chat":"b29920d6-da8d-45ce-9d5d-9cda85e1cce7","token":"-Tx-ORNi08VBzWW2KsJQdCjB7v6MGGwkQnmTxTrzBaI"},{"token":"v7kefD4hC2SxYQooYKp0RZVJ0nJelJm9BbCcSMKI2Gg","chat":"eb05d4cd-d12b-4f63-b337-3b026d2a4508"},{"chat":"09b2325e-da8f-4ec5-84a2-08c1c75bc091","token":"atd5Frtyyy6QbsE4hMq9xC-3r8G2nF_FxP7vl69kuWg"},{"chat":"40f24b78-ffeb-4d27-ba79-38207f29f968","token":"HJvqaa0wD8MghYJos9SIyZcPW6Lr-DNaLr2xOBhbK9A"},{"chat":"51aec66f-8ad2-4083-b7d3-973da37ed89c","token":"L4GeIxSkDAZdydLwiDDNRurxbWlktqRVVXJnX4KHlM8"},{"chat":"5d473002-832f-4a93-bab6-0f63da9de9dc","token":"FAp4pUv4PFdCTmGe61M6ZMv0mdMD3NBn6Ac8ZPE9av4"},{"chat":"16808b44-8d8b-4fdc-bf64-44ee8aeb3a74","token":"y4OydC_AES-GoPDiGmFF2bsiqO57EmYG2yq2ENLz_Ek"},{"chat":"fd74965f-1d8e-44b2-9c9d-e1a988ccea92","token":"uod-2yoApCVejCegpfkcjAcAM55Z5EsSS42yEBk2pNk"}]}} diff --git a/evidence/research-20261029-budget/load-saturation8-20261029121309.json b/evidence/research-20261029-budget/load-saturation8-20261029121309.json new file mode 100644 index 00000000..bc56a002 --- /dev/null +++ b/evidence/research-20261029-budget/load-saturation8-20261029121309.json @@ -0,0 +1,373 @@ +{ + "profile": { + "vus": 8, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 58533.224654 + }, + "metrics": { + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 124.812207, + "p(99)": 156.87072295, + "max": 2008.148619, + "avg": 59.06277293209852, + "p(50)": 49.5675375 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 105.085101, + "p(95)": 249.0688166, + "p(99)": 318.28196140000006, + "max": 518.972685, + "avg": 121.67717165125049 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 0.7203928499999984, + "max": 3.02267, + "avg": 0.2122016633597882, + "p(50)": 0.17847449999999998, + "p(95)": 0.450818 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 4536, + "rate": 77.49444912377679 + } + }, + "http_req_failed": { + "contains": "default", + "values": { + "passes": 7, + "fails": 4529, + "rate": 0.0015432098765432098 + }, + "type": "rate" + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "data_sent": { + "values": { + "count": 409935, + "rate": 7003.458333676243 + }, + "type": "counter", + "contains": "data" + }, + "message_latency_ms": { + "values": { + "avg": 60.06522328685268, + "p(50)": 51.4747885, + "p(95)": 119.66888329999979, + "p(99)": 161.99635167000022, + "max": 383.839615 + }, + "type": "trend", + "contains": "time" + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 58.65014784303353, + "p(50)": 49.104319000000004, + "p(95)": 124.4806335, + "p(99)": 156.5714554, + "max": 2007.92283 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "avg": 58.2964705361004, + "p(50)": 49.600483, + "p(95)": 124.24023219999997, + "p(99)": 156.77442796000005, + "max": 383.839615 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 2008, + "rate": 34.305302874899425 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 2008, + "rate": 34.305302874899425 + } + }, + "application_errors{status:503}": { + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0.001467, + "p(99)": 0.001548, + "max": 1149.0839, + "avg": 0.28507101477072533, + "p(50)": 0.001266 + } + }, + "checks": { + "values": { + "passes": 4463, + "fails": 0, + "rate": 1 + }, + "type": "rate", + "contains": "default" + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 2119, + "rate": 36.2016617489601 + } + }, + "application_errors{status:0}": { + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default" + }, + "measured_operations": { + "contains": "default", + "values": { + "count": 4219, + "rate": 72.07872152848638 + }, + "type": "counter" + }, + "data_received": { + "values": { + "count": 6094354, + "rate": 104117.85846456912 + }, + "type": "counter", + "contains": "data" + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.03034404232804233, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 18.706683 + } + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 8, + "min": 0, + "max": 8 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 8, + "min": 8, + "max": 8 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.0027153842592592594, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 2.019461 + } + }, + "http_req_sending": { + "values": { + "avg": 0.20042342570546717, + "p(50)": 0.1861285, + "p(95)": 0.33068575, + "p(99)": 0.4858578999999986, + "max": 1.372177 + }, + "type": "trend", + "contains": "time" + } + }, + "setup_data": [ + { + "chat": "aad19813-b918-49ee-a675-ea64de92eb82", + "token": "McFHyQOOmJrQiY0Krd6QuKzx1GQIpQNT-7WVApDz6VQ" + }, + { + "chat": "d5ad0897-8ea4-4a0a-ab1d-ef166cc95420", + "token": "nxyFMZ7Qfz_f83H0oJUker3rugDW3tib4899RiZrw3M" + }, + { + "chat": "8c008e9a-2036-4e1e-a86a-3e2c67892cc9", + "token": "hn_QtclR09h1_f7pdtrF9BKb2dX9YE5pxbBNHqQvfkU" + }, + { + "token": "uokeKLlS__JqpvQF_nnLRiVci1hH0veRFUrpUK_QzdA", + "chat": "cc75aee9-f2b4-4b0f-9e39-48fbfe0a319b" + }, + { + "chat": "0eb6995b-3936-4371-b405-2fe8be652518", + "token": "2C_eomghSuI8cCj8ixXEzraheNmKvSSQjcRrKDkTjYg" + }, + { + "chat": "c25cb19b-67e2-44f7-8236-c25c0627cf61", + "token": "gflPZGijrBU4aI3a_lFP5DAs12kz0qPn6MjZGtP8jnA" + }, + { + "token": "nG2W3lf6c65WOeqXo3VBaIfXCB18YRnxrOUKt3H7TVk", + "chat": "e2dab8da-f10a-4ecd-87ad-5be618910f5d" + }, + { + "token": "2d8wnOfRcTXQ1-H8kSZsQ8Lz68eAiK5p4Q4_qO_0j98", + "chat": "c1caeab7-ebc8-4237-a38b-7f922a083274" + }, + { + "token": "BB1HYKS52PJw-H21L4oFQRt3RobrQAcz7eDNtTHx2wI", + "chat": "e1f4f31f-fcbe-4682-894e-b79fa1f3e840" + }, + { + "chat": "dcf4fa44-5bf7-44bd-adb5-ae3f2b14ad4b", + "token": "-C3EPu5toLqoNXWSWe1oAGYPMNFuKYvPbM_qMZjRJjY" + }, + { + "token": "PES781v5lAqrFxLzgJ66LD5-tUbibpdVT_U1IwYHIxM", + "chat": "7b6cbd4c-b305-4e0b-ac30-71c288d55d50" + }, + { + "chat": "f8868c3e-1d6f-47e3-9212-51ee2ea679d9", + "token": "KggRLbhURDDM3yBVqoxCuh-LIBzMyo60U9OirvvU3Qc" + }, + { + "chat": "a85af962-a595-42b8-bc08-4cada9aa1cfd", + "token": "khFWZr9CUKi46mjpxjYsYHSOUhBe8UtvBBbUx4JCuI8" + }, + { + "chat": "4528529c-c005-4301-9fc9-b42638f2168d", + "token": "Gy0PTXoTT5dwLGtLRZK-wdgPPlAobPOATZiLdWMu8yI" + }, + { + "chat": "95275f21-ae0c-4697-bb49-2535fed94f4d", + "token": "74785SvBvtY7aHVHumO9LnNRQ3C5m6AFgq2LECQ51UA" + }, + { + "chat": "5402e1d5-2d95-4e8f-8b13-563a70fc60f9", + "token": "ofgSsCiaphnhGYa-UgzLOJj-zGPJ1aE02KdsAeaL9t0" + } + ], + "root_group": { + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 2127, + "fails": 0 + }, + { + "passes": 217, + "fails": 0, + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa" + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 2119, + "fails": 0 + } + ], + "name": "" + }, + "options": { + "noColor": false, + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "" + } + } +} diff --git a/evidence/research-20261029-budget/load-saturation8-20261029121309.txt b/evidence/research-20261029-budget/load-saturation8-20261029121309.txt new file mode 100644 index 00000000..9247f28c --- /dev/null +++ b/evidence/research-20261029-budget/load-saturation8-20261029121309.txt @@ -0,0 +1,3 @@ +time="2026-10-29T12:13:53Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/health/ready\": request timeout" +time="2026-10-29T12:14:01Z" level=warning msg="setup login: 503; abandoning synthetic actor" source=console +{"profile":{"vus":8,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":58533.224654},"metrics":{"http_req_duration":{"type":"trend","contains":"time","values":{"p(95)":124.812207,"p(99)":156.87072295,"max":2008.148619,"avg":59.06277293209852,"p(50)":49.5675375}},"iteration_duration":{"type":"trend","contains":"time","values":{"p(50)":105.085101,"p(95)":249.0688166,"p(99)":318.28196140000006,"max":518.972685,"avg":121.67717165125049}},"http_req_receiving":{"type":"trend","contains":"time","values":{"p(99)":0.7203928499999984,"max":3.02267,"avg":0.2122016633597882,"p(50)":0.17847449999999998,"p(95)":0.450818}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_reqs":{"type":"counter","contains":"default","values":{"count":4536,"rate":77.49444912377679}},"http_req_failed":{"contains":"default","values":{"passes":7,"fails":4529,"rate":0.0015432098765432098},"type":"rate"},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"data_sent":{"values":{"count":409935,"rate":7003.458333676243},"type":"counter","contains":"data"},"message_latency_ms":{"values":{"avg":60.06522328685268,"p(50)":51.4747885,"p(95)":119.66888329999979,"p(99)":161.99635167000022,"max":383.839615},"type":"trend","contains":"time"},"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":58.65014784303353,"p(50)":49.104319000000004,"p(95)":124.4806335,"p(99)":156.5714554,"max":2007.92283}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"avg":58.2964705361004,"p(50)":49.600483,"p(95)":124.24023219999997,"p(99)":156.77442796000005,"max":383.839615}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":2008,"rate":34.305302874899425}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":2008,"rate":34.305302874899425}},"application_errors{status:503}":{"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default","values":{"count":0,"rate":0}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(95)":0.001467,"p(99)":0.001548,"max":1149.0839,"avg":0.28507101477072533,"p(50)":0.001266}},"checks":{"values":{"passes":4463,"fails":0,"rate":1},"type":"rate","contains":"default"},"iterations":{"type":"counter","contains":"default","values":{"count":2119,"rate":36.2016617489601}},"application_errors{status:0}":{"values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default"},"measured_operations":{"contains":"default","values":{"count":4219,"rate":72.07872152848638},"type":"counter"},"data_received":{"values":{"count":6094354,"rate":104117.85846456912},"type":"counter","contains":"data"},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"avg":0.03034404232804233,"p(50)":0,"p(95)":0,"p(99)":0,"max":18.706683}},"vus":{"type":"gauge","contains":"default","values":{"value":8,"min":0,"max":8}},"vus_max":{"type":"gauge","contains":"default","values":{"value":8,"min":8,"max":8}},"http_req_connecting":{"type":"trend","contains":"time","values":{"avg":0.0027153842592592594,"p(50)":0,"p(95)":0,"p(99)":0,"max":2.019461}},"http_req_sending":{"values":{"avg":0.20042342570546717,"p(50)":0.1861285,"p(95)":0.33068575,"p(99)":0.4858578999999986,"max":1.372177},"type":"trend","contains":"time"}},"setup_data":[{"chat":"aad19813-b918-49ee-a675-ea64de92eb82","token":"McFHyQOOmJrQiY0Krd6QuKzx1GQIpQNT-7WVApDz6VQ"},{"chat":"d5ad0897-8ea4-4a0a-ab1d-ef166cc95420","token":"nxyFMZ7Qfz_f83H0oJUker3rugDW3tib4899RiZrw3M"},{"chat":"8c008e9a-2036-4e1e-a86a-3e2c67892cc9","token":"hn_QtclR09h1_f7pdtrF9BKb2dX9YE5pxbBNHqQvfkU"},{"token":"uokeKLlS__JqpvQF_nnLRiVci1hH0veRFUrpUK_QzdA","chat":"cc75aee9-f2b4-4b0f-9e39-48fbfe0a319b"},{"chat":"0eb6995b-3936-4371-b405-2fe8be652518","token":"2C_eomghSuI8cCj8ixXEzraheNmKvSSQjcRrKDkTjYg"},{"chat":"c25cb19b-67e2-44f7-8236-c25c0627cf61","token":"gflPZGijrBU4aI3a_lFP5DAs12kz0qPn6MjZGtP8jnA"},{"token":"nG2W3lf6c65WOeqXo3VBaIfXCB18YRnxrOUKt3H7TVk","chat":"e2dab8da-f10a-4ecd-87ad-5be618910f5d"},{"token":"2d8wnOfRcTXQ1-H8kSZsQ8Lz68eAiK5p4Q4_qO_0j98","chat":"c1caeab7-ebc8-4237-a38b-7f922a083274"},{"token":"BB1HYKS52PJw-H21L4oFQRt3RobrQAcz7eDNtTHx2wI","chat":"e1f4f31f-fcbe-4682-894e-b79fa1f3e840"},{"chat":"dcf4fa44-5bf7-44bd-adb5-ae3f2b14ad4b","token":"-C3EPu5toLqoNXWSWe1oAGYPMNFuKYvPbM_qMZjRJjY"},{"token":"PES781v5lAqrFxLzgJ66LD5-tUbibpdVT_U1IwYHIxM","chat":"7b6cbd4c-b305-4e0b-ac30-71c288d55d50"},{"chat":"f8868c3e-1d6f-47e3-9212-51ee2ea679d9","token":"KggRLbhURDDM3yBVqoxCuh-LIBzMyo60U9OirvvU3Qc"},{"chat":"a85af962-a595-42b8-bc08-4cada9aa1cfd","token":"khFWZr9CUKi46mjpxjYsYHSOUhBe8UtvBBbUx4JCuI8"},{"chat":"4528529c-c005-4301-9fc9-b42638f2168d","token":"Gy0PTXoTT5dwLGtLRZK-wdgPPlAobPOATZiLdWMu8yI"},{"chat":"95275f21-ae0c-4697-bb49-2535fed94f4d","token":"74785SvBvtY7aHVHumO9LnNRQ3C5m6AFgq2LECQ51UA"},{"chat":"5402e1d5-2d95-4e8f-8b13-563a70fc60f9","token":"ofgSsCiaphnhGYa-UgzLOJj-zGPJ1aE02KdsAeaL9t0"}],"root_group":{"path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":2127,"fails":0},{"passes":217,"fails":0,"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa"},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":2119,"fails":0}],"name":""},"options":{"noColor":false,"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":""}}} diff --git a/evidence/research-20261029-budget/nodes.txt b/evidence/research-20261029-budget/nodes.txt new file mode 100644 index 00000000..e6b77ed4 --- /dev/null +++ b/evidence/research-20261029-budget/nodes.txt @@ -0,0 +1,4 @@ +NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME +dev.asisti.tech Ready 252d v1.33.13 100.99.166.40 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 +marlosrv0 Ready 254d v1.33.13 192.168.1.37 Ubuntu 24.04.5 LTS 6.8.0-147-generic containerd://1.7.29 +srv0.agapov.space Ready 247d v1.33.13 100.108.186.94 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 diff --git a/evidence/research-20261029-budget/pods-growing1-20261029115804.txt b/evidence/research-20261029-budget/pods-growing1-20261029115804.txt new file mode 100644 index 00000000..1371b882 --- /dev/null +++ b/evidence/research-20261029-budget/pods-growing1-20261029115804.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-577bffc7b-dvvjk 1/1 Running 0 36s 10.1.25.84 dev.asisti.tech diff --git a/evidence/research-20261029-budget/pods-resource-high-a-20261029121644.txt b/evidence/research-20261029-budget/pods-resource-high-a-20261029121644.txt new file mode 100644 index 00000000..44c89361 --- /dev/null +++ b/evidence/research-20261029-budget/pods-resource-high-a-20261029121644.txt @@ -0,0 +1,3 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-54d5599c7b-686bv 1/1 Running 0 39s 10.1.25.96 dev.asisti.tech +api-54d5599c7b-mltrn 1/1 Running 0 35s 10.1.25.125 dev.asisti.tech diff --git a/evidence/research-20261029-budget/pods-resource-high-b-20261029122017.txt b/evidence/research-20261029-budget/pods-resource-high-b-20261029122017.txt new file mode 100644 index 00000000..187b8ade --- /dev/null +++ b/evidence/research-20261029-budget/pods-resource-high-b-20261029122017.txt @@ -0,0 +1,3 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-54d5599c7b-d2w8w 1/1 Running 0 34s 10.1.25.87 dev.asisti.tech +api-54d5599c7b-kbkkc 1/1 Running 0 38s 10.1.25.86 dev.asisti.tech diff --git a/evidence/research-20261029-budget/pods-resource-low-a-20261029121455.txt b/evidence/research-20261029-budget/pods-resource-low-a-20261029121455.txt new file mode 100644 index 00000000..b8889d79 --- /dev/null +++ b/evidence/research-20261029-budget/pods-resource-low-a-20261029121455.txt @@ -0,0 +1,3 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-577bffc7b-mb5qr 1/1 Running 0 50s 10.1.25.74 dev.asisti.tech +api-577bffc7b-xqltd 1/1 Running 0 36s 10.1.25.90 dev.asisti.tech diff --git a/evidence/research-20261029-budget/pods-resource-low-b-20261029121833.txt b/evidence/research-20261029-budget/pods-resource-low-b-20261029121833.txt new file mode 100644 index 00000000..8e759c97 --- /dev/null +++ b/evidence/research-20261029-budget/pods-resource-low-b-20261029121833.txt @@ -0,0 +1,3 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-577bffc7b-7nl2h 1/1 Running 0 42s 10.1.25.80 dev.asisti.tech +api-577bffc7b-scz2v 1/1 Running 0 37s 10.1.25.78 dev.asisti.tech diff --git a/evidence/research-20261029-budget/pods-saturation8-20261029121309.txt b/evidence/research-20261029-budget/pods-saturation8-20261029121309.txt new file mode 100644 index 00000000..cbf9e364 --- /dev/null +++ b/evidence/research-20261029-budget/pods-saturation8-20261029121309.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-84fbf9968-lbwjl 1/1 Running 0 35s 10.1.25.108 dev.asisti.tech diff --git a/evidence/research-20261029-budget/profiles.csv b/evidence/research-20261029-budget/profiles.csv new file mode 100644 index 00000000..909711b9 --- /dev/null +++ b/evidence/research-20261029-budget/profiles.csv @@ -0,0 +1,7 @@ +profile,run,replicas,cpu_millicores_per_replica,memory_mib_per_replica,pool,vus,duration +growing1,growing1-20261029115804,1,250,128,8,32,30 +saturation8,saturation8-20261029121309,1,1000,512,8,8,30 +resource-low-a,resource-low-a-20261029121455,2,250,128,8,32,30 +resource-high-a,resource-high-a-20261029121644,2,500,256,8,32,30 +resource-low-b,resource-low-b-20261029121833,2,250,128,8,32,30 +resource-high-b,resource-high-b-20261029122017,2,500,256,8,32,30 diff --git a/evidence/research-20261029-budget/resources-growing1-20261029115804.txt b/evidence/research-20261029-budget/resources-growing1-20261029115804.txt new file mode 100644 index 00000000..2c1dee53 --- /dev/null +++ b/evidence/research-20261029-budget/resources-growing1-20261029115804.txt @@ -0,0 +1,107 @@ +UTC 2026-10-29T11:58:42Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-dvvjk 2m 23Mi +postgres-0 5m 63Mi +valkey-0 6m 10Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:58:48Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-dvvjk 3m 23Mi +postgres-0 2m 63Mi +valkey-0 9m 10Mi +valkey-1 5m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:58:53Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-dvvjk 3m 23Mi +postgres-0 2m 63Mi +valkey-0 9m 10Mi +valkey-1 5m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:58:59Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-dvvjk 3m 23Mi +postgres-0 2m 63Mi +valkey-0 9m 10Mi +valkey-1 5m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:59:04Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-dvvjk 100m 59Mi +load-growing1-20261029115804-54pjv 51m 18Mi +postgres-0 7m 64Mi +valkey-0 9m 10Mi +valkey-1 15m 15Mi +valkey-2 7m 4Mi +active|Lock|transactionid|1 +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|7 +UTC 2026-10-29T11:59:10Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-dvvjk 100m 59Mi +load-growing1-20261029115804-54pjv 51m 18Mi +postgres-0 7m 64Mi +valkey-0 9m 10Mi +valkey-1 15m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:59:16Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-dvvjk 188m 14Mi +load-growing1-20261029115804-54pjv 80m 26Mi +postgres-0 94m 81Mi +valkey-0 35m 10Mi +valkey-1 29m 15Mi +valkey-2 12m 4Mi +active|IO|WalSync|1 +active|Lock|transactionid|1 +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|3 +UTC 2026-10-29T11:59:22Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-dvvjk 188m 14Mi +load-growing1-20261029115804-54pjv 80m 26Mi +postgres-0 94m 81Mi +valkey-0 35m 10Mi +valkey-1 29m 15Mi +valkey-2 12m 4Mi +active|||1 +idle|Client|ClientRead|6 +idle in transaction|Client|ClientRead|3 +UTC 2026-10-29T11:59:27Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-dvvjk 188m 14Mi +load-growing1-20261029115804-54pjv 80m 26Mi +postgres-0 94m 81Mi +valkey-0 35m 10Mi +valkey-1 29m 15Mi +valkey-2 12m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:13:08Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-dvvjk 3m 12Mi +postgres-0 4m 83Mi +valkey-0 9m 8Mi +valkey-1 5m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-budget/resources-resource-high-a-20261029121644.txt b/evidence/research-20261029-budget/resources-resource-high-a-20261029121644.txt new file mode 100644 index 00000000..1a6b9766 --- /dev/null +++ b/evidence/research-20261029-budget/resources-resource-high-a-20261029121644.txt @@ -0,0 +1,112 @@ +UTC 2026-10-29T12:17:26Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-686bv 10m 22Mi +api-54d5599c7b-mltrn 20m 22Mi +postgres-0 6m 68Mi +valkey-0 10m 9Mi +valkey-1 4m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:17:46Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-686bv 3m 23Mi +api-54d5599c7b-mltrn 3m 23Mi +load-resource-high-a-20261029121644-nrbcx 10m 16Mi +postgres-0 4m 68Mi +valkey-0 8m 9Mi +valkey-1 5m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:17:52Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-686bv 3m 23Mi +api-54d5599c7b-mltrn 3m 23Mi +load-resource-high-a-20261029121644-nrbcx 10m 16Mi +postgres-0 4m 68Mi +valkey-0 8m 9Mi +valkey-1 5m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:17:58Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-686bv 3m 23Mi +api-54d5599c7b-mltrn 3m 23Mi +load-resource-high-a-20261029121644-nrbcx 10m 16Mi +postgres-0 4m 68Mi +valkey-0 8m 9Mi +valkey-1 5m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:18:04Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-686bv 88m 60Mi +api-54d5599c7b-mltrn 172m 59Mi +load-resource-high-a-20261029121644-nrbcx 33m 19Mi +postgres-0 46m 75Mi +valkey-0 33m 9Mi +valkey-1 5m 15Mi +valkey-2 6m 4Mi +active|IO|WalSync|1 +active|Lock|transactionid|1 +active|||2 +idle|Client|ClientRead|13 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:18:10Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-686bv 88m 60Mi +api-54d5599c7b-mltrn 172m 59Mi +load-resource-high-a-20261029121644-nrbcx 33m 19Mi +postgres-0 46m 75Mi +valkey-0 33m 9Mi +valkey-1 5m 15Mi +valkey-2 6m 4Mi +active|||4 +idle|Client|ClientRead|11 +idle|||1 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T12:18:16Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-686bv 200m 14Mi +api-54d5599c7b-mltrn 298m 15Mi +load-resource-high-a-20261029121644-nrbcx 295m 29Mi +postgres-0 377m 106Mi +valkey-0 114m 9Mi +valkey-1 18m 15Mi +valkey-2 92m 5Mi +active|IO|WalSync|1 +active|LWLock|WALWrite|2 +active|||3 +idle|Client|ClientRead|11 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:18:22Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-686bv 200m 14Mi +api-54d5599c7b-mltrn 298m 15Mi +load-resource-high-a-20261029121644-nrbcx 295m 29Mi +postgres-0 377m 106Mi +valkey-0 114m 9Mi +valkey-1 18m 15Mi +valkey-2 92m 5Mi +active|||3 +idle|Client|ClientRead|14 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:18:27Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-686bv 200m 14Mi +api-54d5599c7b-mltrn 298m 15Mi +load-resource-high-a-20261029121644-nrbcx 295m 29Mi +postgres-0 377m 106Mi +valkey-0 114m 9Mi +valkey-1 18m 15Mi +valkey-2 92m 5Mi +active|||2 +idle|Client|ClientRead|14 +idle in transaction|Client|ClientRead|2 diff --git a/evidence/research-20261029-budget/resources-resource-high-b-20261029122017.txt b/evidence/research-20261029-budget/resources-resource-high-b-20261029122017.txt new file mode 100644 index 00000000..9b3bd39a --- /dev/null +++ b/evidence/research-20261029-budget/resources-resource-high-b-20261029122017.txt @@ -0,0 +1,97 @@ +UTC 2026-10-29T12:20:57Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-d2w8w 2m 22Mi +api-54d5599c7b-kbkkc 2m 22Mi +postgres-0 9m 71Mi +valkey-0 8m 9Mi +valkey-1 4m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:21:03Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-d2w8w 2m 22Mi +api-54d5599c7b-kbkkc 2m 22Mi +postgres-0 4m 71Mi +valkey-0 7m 9Mi +valkey-1 6m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:21:09Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-d2w8w 109m 9Mi +api-54d5599c7b-kbkkc 83m 58Mi +load-resource-high-b-20261029122017-7ssbm 50m 22Mi +postgres-0 42m 78Mi +valkey-0 31m 9Mi +valkey-1 6m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|15 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T12:21:21Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-d2w8w 109m 9Mi +api-54d5599c7b-kbkkc 83m 58Mi +load-resource-high-b-20261029122017-7ssbm 50m 22Mi +postgres-0 42m 78Mi +valkey-0 31m 9Mi +valkey-1 6m 15Mi +valkey-2 6m 4Mi +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|9 +idle in transaction|Client|ClientRead|5 +idle in transaction|||2 +UTC 2026-10-29T12:21:27Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-d2w8w 109m 9Mi +api-54d5599c7b-kbkkc 83m 58Mi +load-resource-high-b-20261029122017-7ssbm 50m 22Mi +postgres-0 42m 78Mi +valkey-0 31m 9Mi +valkey-1 6m 15Mi +valkey-2 6m 4Mi +active|IO|WalSync|1 +active|||2 +idle|Client|ClientRead|11 +idle in transaction|Client|ClientRead|4 +UTC 2026-10-29T12:21:33Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-d2w8w 307m 13Mi +api-54d5599c7b-kbkkc 203m 12Mi +load-resource-high-b-20261029122017-7ssbm 50m 22Mi +postgres-0 287m 108Mi +valkey-0 120m 9Mi +valkey-1 45m 15Mi +valkey-2 34m 5Mi +active|Client|ClientRead|1 +active|||2 +idle|Client|ClientRead|14 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:21:42Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-d2w8w 307m 13Mi +api-54d5599c7b-kbkkc 203m 12Mi +load-resource-high-b-20261029122017-7ssbm 50m 22Mi +postgres-0 287m 108Mi +valkey-0 120m 9Mi +valkey-1 45m 15Mi +valkey-2 34m 5Mi +active|||1 +idle|Client|ClientRead|16 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:21:48Z +NAME CPU(cores) MEMORY(bytes) +api-54d5599c7b-d2w8w 386m 14Mi +api-54d5599c7b-kbkkc 391m 12Mi +postgres-0 851m 111Mi +valkey-0 155m 9Mi +valkey-1 138m 15Mi +valkey-2 84m 5Mi +active|||1 +idle|Client|ClientRead|16 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-budget/resources-resource-low-a-20261029121455.txt b/evidence/research-20261029-budget/resources-resource-low-a-20261029121455.txt new file mode 100644 index 00000000..54a7b3bc --- /dev/null +++ b/evidence/research-20261029-budget/resources-resource-low-a-20261029121455.txt @@ -0,0 +1,92 @@ +UTC 2026-10-29T12:15:47Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-mb5qr 2m 22Mi +api-577bffc7b-xqltd 3m 22Mi +postgres-0 11m 67Mi +valkey-0 9m 8Mi +valkey-1 5m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:15:53Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-mb5qr 2m 22Mi +api-577bffc7b-xqltd 3m 22Mi +postgres-0 11m 67Mi +valkey-0 9m 8Mi +valkey-1 5m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:15:58Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-mb5qr 2m 22Mi +api-577bffc7b-xqltd 3m 22Mi +postgres-0 11m 67Mi +valkey-0 9m 8Mi +valkey-1 5m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:16:04Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-mb5qr 42m 59Mi +api-577bffc7b-xqltd 68m 61Mi +load-resource-low-a-20261029121455-tn8rc 49m 17Mi +postgres-0 11m 67Mi +valkey-0 9m 8Mi +valkey-1 6m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|6 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:16:10Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-mb5qr 42m 59Mi +api-577bffc7b-xqltd 68m 61Mi +load-resource-low-a-20261029121455-tn8rc 49m 17Mi +postgres-0 11m 67Mi +valkey-0 9m 8Mi +valkey-1 6m 15Mi +valkey-2 7m 4Mi +active|||2 +idle|Client|ClientRead|13 +idle|||1 +idle in transaction|Client|ClientRead|1 +idle in transaction|IO|WalSync|1 +UTC 2026-10-29T12:16:31Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-mb5qr 31m 8Mi +api-577bffc7b-xqltd 33m 9Mi +load-resource-low-a-20261029121455-tn8rc 50m 22Mi +postgres-0 111m 103Mi +valkey-0 19m 9Mi +valkey-2 18m 4Mi +active|||2 +idle|Client|ClientRead|11 +idle in transaction|Client|ClientRead|4 +idle in transaction|||1 +UTC 2026-10-29T12:16:37Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-mb5qr 31m 8Mi +api-577bffc7b-xqltd 33m 9Mi +load-resource-low-a-20261029121455-tn8rc 50m 22Mi +postgres-0 111m 103Mi +valkey-0 19m 9Mi +valkey-2 18m 4Mi +active|||1 +idle|Client|ClientRead|12 +idle in transaction|Client|ClientRead|5 +UTC 2026-10-29T12:16:43Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-mb5qr 31m 8Mi +api-577bffc7b-xqltd 33m 9Mi +postgres-0 111m 103Mi +valkey-0 19m 9Mi +valkey-2 18m 4Mi +active|||1 +idle|Client|ClientRead|16 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-budget/resources-resource-low-b-20261029121833.txt b/evidence/research-20261029-budget/resources-resource-low-b-20261029121833.txt new file mode 100644 index 00000000..3832581d --- /dev/null +++ b/evidence/research-20261029-budget/resources-resource-low-b-20261029121833.txt @@ -0,0 +1,82 @@ +UTC 2026-10-29T12:19:17Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7nl2h 3m 22Mi +api-577bffc7b-scz2v 3m 22Mi +postgres-0 4m 70Mi +valkey-0 8m 9Mi +valkey-1 6m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:19:23Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7nl2h 3m 22Mi +api-577bffc7b-scz2v 3m 22Mi +postgres-0 4m 70Mi +valkey-0 8m 9Mi +valkey-1 6m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:19:29Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7nl2h 3m 22Mi +api-577bffc7b-scz2v 3m 22Mi +postgres-0 4m 70Mi +valkey-0 8m 9Mi +valkey-1 6m 15Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|3 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:19:34Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7nl2h 2m 22Mi +api-577bffc7b-scz2v 23m 61Mi +load-resource-low-b-20261029121833-2hx7m 34m 16Mi +postgres-0 19m 73Mi +valkey-0 8m 9Mi +valkey-1 6m 15Mi +valkey-2 5m 5Mi +active|IO|WalSync|1 +active|||3 +idle|Client|ClientRead|9 +idle|||1 +idle in transaction|Client|ClientRead|4 +UTC 2026-10-29T12:19:47Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7nl2h 2m 22Mi +api-577bffc7b-scz2v 23m 61Mi +load-resource-low-b-20261029121833-2hx7m 34m 16Mi +postgres-0 19m 73Mi +valkey-0 8m 9Mi +valkey-1 6m 15Mi +valkey-2 5m 5Mi +active|||3 +idle|Client|ClientRead|13 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T12:20:05Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7nl2h 44m 12Mi +api-577bffc7b-scz2v 104m 10Mi +load-resource-low-b-20261029121833-2hx7m 58m 24Mi +postgres-0 5m 107Mi +valkey-0 26m 9Mi +valkey-2 18m 4Mi +active|Lock|transactionid|1 +active|||1 +idle|Client|ClientRead|13 +idle in transaction|Client|ClientRead|3 +UTC 2026-10-29T12:20:11Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7nl2h 44m 12Mi +api-577bffc7b-scz2v 104m 10Mi +load-resource-low-b-20261029121833-2hx7m 58m 24Mi +postgres-0 5m 107Mi +valkey-0 26m 9Mi +valkey-2 18m 4Mi +active|||1 +idle|Client|ClientRead|16 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-budget/resources-saturation8-20261029121309.txt b/evidence/research-20261029-budget/resources-saturation8-20261029121309.txt new file mode 100644 index 00000000..9343c74d --- /dev/null +++ b/evidence/research-20261029-budget/resources-saturation8-20261029121309.txt @@ -0,0 +1,115 @@ +UTC 2026-10-29T12:13:50Z +Error from server (ServiceUnavailable): the server is currently unable to handle the request (get pods.metrics.k8s.io) +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:13:59Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lbwjl 21m 22Mi +postgres-0 8m 64Mi +valkey-0 10m 8Mi +valkey-1 5m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:14:04Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lbwjl 3m 22Mi +postgres-0 3m 64Mi +valkey-0 8m 8Mi +valkey-1 3m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:14:10Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lbwjl 3m 22Mi +postgres-0 3m 64Mi +valkey-0 8m 8Mi +valkey-1 3m 15Mi +valkey-2 6m 4Mi +active|||2 +idle|Client|ClientRead|2 +idle|||1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:14:16Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lbwjl 54m 59Mi +load-saturation8-20261029121309-rt8h2 22m 13Mi +postgres-0 19m 65Mi +valkey-0 12m 8Mi +valkey-1 6m 15Mi +valkey-2 8m 4Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:14:22Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lbwjl 54m 59Mi +load-saturation8-20261029121309-rt8h2 22m 13Mi +postgres-0 19m 65Mi +valkey-0 12m 8Mi +valkey-1 6m 15Mi +valkey-2 8m 4Mi +active|||2 +idle|Client|ClientRead|7 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:14:27Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lbwjl 54m 59Mi +load-saturation8-20261029121309-rt8h2 22m 13Mi +postgres-0 19m 65Mi +valkey-0 12m 8Mi +valkey-1 6m 15Mi +valkey-2 8m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:14:33Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lbwjl 260m 62Mi +load-saturation8-20261029121309-rt8h2 45m 15Mi +postgres-0 210m 83Mi +valkey-0 51m 8Mi +valkey-1 15m 15Mi +valkey-2 8m 4Mi +active|IO|WalSync|1 +active|LWLock|WALWrite|1 +active|||2 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:14:39Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lbwjl 260m 62Mi +load-saturation8-20261029121309-rt8h2 45m 15Mi +postgres-0 210m 83Mi +valkey-0 51m 8Mi +valkey-1 15m 15Mi +valkey-2 8m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:14:45Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lbwjl 488m 11Mi +load-saturation8-20261029121309-rt8h2 211m 18Mi +postgres-0 499m 84Mi +valkey-0 130m 8Mi +valkey-1 53m 15Mi +valkey-2 47m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T12:14:51Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lbwjl 488m 11Mi +load-saturation8-20261029121309-rt8h2 211m 18Mi +postgres-0 499m 84Mi +valkey-0 130m 8Mi +valkey-1 53m 15Mi +valkey-2 47m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-budget/restore-values.yaml b/evidence/research-20261029-budget/restore-values.yaml new file mode 100644 index 00000000..4e915dac --- /dev/null +++ b/evidence/research-20261029-budget/restore-values.yaml @@ -0,0 +1,61 @@ +api: + env: + DEPENDENCY_POOL_SIZE: "8" + DEPENDENCY_TIMEOUT_MS: "2000" + GOMEMLIMIT: 160MiB + REQUEST_TIMEOUT_SECONDS: "4" + SESSION_TTL_SECONDS: "3600" + SHUTDOWN_TIMEOUT_SECONDS: "5" + replicas: 2 + resources: + limits: + cpu: "1" + memory: 256Mi + requests: + cpu: 250m + memory: 128Mi +autoscaling: + cpuPercent: 60 + enabled: true + maxReplicas: 4 + minReplicas: 2 +databaseSecret: messenger-secrets +image: + digest: sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 + repository: asisti.registry.twcstorage.ru/mtusi2026lab3 +imagePullSecret: registry-pull +ingress: + className: traefik + clusterIssuer: letsencrypt-prod + host: hl.agapov.space +load: + duration: 30 + enabled: false + run: manual + script: scaling.js + vus: 32 +monitoring: + serviceMonitor: false +postgres: + image: postgres:17.6-alpine + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + storage: 2Gi +storageClass: "" +valkey: + image: valkey/valkey:8.1.3-alpine + maxmemory: 64mb + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 100m + memory: 96Mi + shards: 3 + storage: 1Gi diff --git a/evidence/research-20261029-budget/restore.txt b/evidence/research-20261029-budget/restore.txt new file mode 100644 index 00000000..32a33fd9 --- /dev/null +++ b/evidence/research-20261029-budget/restore.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 15:21:51 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 40 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-budget/rollout-growing1.txt b/evidence/research-20261029-budget/rollout-growing1.txt new file mode 100644 index 00000000..f2c4a73c --- /dev/null +++ b/evidence/research-20261029-budget/rollout-growing1.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:58:04 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 34 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-budget/rollout-resource-high-a.txt b/evidence/research-20261029-budget/rollout-resource-high-a.txt new file mode 100644 index 00000000..7facbbdc --- /dev/null +++ b/evidence/research-20261029-budget/rollout-resource-high-a.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 15:16:45 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 37 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-budget/rollout-resource-high-b.txt b/evidence/research-20261029-budget/rollout-resource-high-b.txt new file mode 100644 index 00000000..15eb4160 --- /dev/null +++ b/evidence/research-20261029-budget/rollout-resource-high-b.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 15:20:18 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 39 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-budget/rollout-resource-low-a.txt b/evidence/research-20261029-budget/rollout-resource-low-a.txt new file mode 100644 index 00000000..f858ba09 --- /dev/null +++ b/evidence/research-20261029-budget/rollout-resource-low-a.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 15:14:56 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 36 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-budget/rollout-resource-low-b.txt b/evidence/research-20261029-budget/rollout-resource-low-b.txt new file mode 100644 index 00000000..8e0d9723 --- /dev/null +++ b/evidence/research-20261029-budget/rollout-resource-low-b.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 15:18:34 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 38 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-budget/rollout-saturation8.txt b/evidence/research-20261029-budget/rollout-saturation8.txt new file mode 100644 index 00000000..511e2bfe --- /dev/null +++ b/evidence/research-20261029-budget/rollout-saturation8.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 15:13:10 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 35 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-budget/source.sha256 b/evidence/research-20261029-budget/source.sha256 new file mode 100644 index 00000000..b6c26a83 --- /dev/null +++ b/evidence/research-20261029-budget/source.sha256 @@ -0,0 +1,3 @@ +0a58dff9ad7acf8f228e0fd1c2a670bbe7e18a11360715b47659104832e34892 student-tests/load/scaling.js +c0506f65b976d54273f3e2fb3404b732929a276263ff8974c2a6ab6e27820b8b charts/messenger/values.yaml +60e09dd38fd1d413b744f21b57f64ba83e49a5ae1b4251aa5bf20be033f90cfb internal/controller/http/fiber/errors.go diff --git a/evidence/research-20261029-budget/values-growing1-20261029115804.json b/evidence/research-20261029-budget/values-growing1-20261029115804.json new file mode 100644 index 00000000..5688ec73 --- /dev/null +++ b/evidence/research-20261029-budget/values-growing1-20261029115804.json @@ -0,0 +1 @@ +{"api":{"env":{"DEPENDENCY_POOL_SIZE":"8","DEPENDENCY_TIMEOUT_MS":"2000","GOMEMLIMIT":"80MiB","REQUEST_TIMEOUT_SECONDS":"4","SESSION_TTL_SECONDS":"3600","SHUTDOWN_TIMEOUT_SECONDS":"5"},"nodeSelector":{"kubernetes.io/hostname":"dev.asisti.tech"},"readiness":{"failureThreshold":2,"timeoutSeconds":2},"replicas":1,"resources":{"limits":{"cpu":"250m","memory":"128Mi"},"requests":{"cpu":"250m","memory":"128Mi"}}},"autoscaling":{"cpuPercent":60,"enabled":false,"maxReplicas":4,"minReplicas":2},"databaseSecret":"messenger-secrets","image":{"digest":"sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3","repository":"asisti.registry.twcstorage.ru/mtusi2026lab3"},"imagePullSecret":"registry-pull","ingress":{"className":"traefik","clusterIssuer":"letsencrypt-prod","host":"hl.agapov.space"},"load":{"duration":30,"enabled":false,"run":"manual","script":"scaling.js","vus":32},"monitoring":{"serviceMonitor":false},"postgres":{"image":"postgres:17.6-alpine","resources":{"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"250m","memory":"256Mi"}},"storage":"2Gi"},"storageClass":"","valkey":{"image":"valkey/valkey:8.1.3-alpine","maxmemory":"64mb","resources":{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"100m","memory":"96Mi"}},"shards":3,"storage":"1Gi"}} diff --git a/evidence/research-20261029-budget/values-resource-high-a-20261029121644.json b/evidence/research-20261029-budget/values-resource-high-a-20261029121644.json new file mode 100644 index 00000000..12fa1397 --- /dev/null +++ b/evidence/research-20261029-budget/values-resource-high-a-20261029121644.json @@ -0,0 +1 @@ +{"api":{"env":{"DEPENDENCY_POOL_SIZE":"8","DEPENDENCY_TIMEOUT_MS":"2000","GOMEMLIMIT":"80MiB","REQUEST_TIMEOUT_SECONDS":"4","SESSION_TTL_SECONDS":"3600","SHUTDOWN_TIMEOUT_SECONDS":"5"},"nodeSelector":{"kubernetes.io/hostname":"dev.asisti.tech"},"readiness":{"failureThreshold":2,"timeoutSeconds":2},"replicas":2,"resources":{"limits":{"cpu":"500m","memory":"256Mi"},"requests":{"cpu":"500m","memory":"256Mi"}}},"autoscaling":{"cpuPercent":60,"enabled":false,"maxReplicas":4,"minReplicas":2},"databaseSecret":"messenger-secrets","image":{"digest":"sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3","repository":"asisti.registry.twcstorage.ru/mtusi2026lab3"},"imagePullSecret":"registry-pull","ingress":{"className":"traefik","clusterIssuer":"letsencrypt-prod","host":"hl.agapov.space"},"load":{"duration":30,"enabled":false,"run":"manual","script":"scaling.js","vus":32},"monitoring":{"serviceMonitor":false},"postgres":{"image":"postgres:17.6-alpine","resources":{"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"250m","memory":"256Mi"}},"storage":"2Gi"},"storageClass":"","valkey":{"image":"valkey/valkey:8.1.3-alpine","maxmemory":"64mb","resources":{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"100m","memory":"96Mi"}},"shards":3,"storage":"1Gi"}} diff --git a/evidence/research-20261029-budget/values-resource-high-b-20261029122017.json b/evidence/research-20261029-budget/values-resource-high-b-20261029122017.json new file mode 100644 index 00000000..12fa1397 --- /dev/null +++ b/evidence/research-20261029-budget/values-resource-high-b-20261029122017.json @@ -0,0 +1 @@ +{"api":{"env":{"DEPENDENCY_POOL_SIZE":"8","DEPENDENCY_TIMEOUT_MS":"2000","GOMEMLIMIT":"80MiB","REQUEST_TIMEOUT_SECONDS":"4","SESSION_TTL_SECONDS":"3600","SHUTDOWN_TIMEOUT_SECONDS":"5"},"nodeSelector":{"kubernetes.io/hostname":"dev.asisti.tech"},"readiness":{"failureThreshold":2,"timeoutSeconds":2},"replicas":2,"resources":{"limits":{"cpu":"500m","memory":"256Mi"},"requests":{"cpu":"500m","memory":"256Mi"}}},"autoscaling":{"cpuPercent":60,"enabled":false,"maxReplicas":4,"minReplicas":2},"databaseSecret":"messenger-secrets","image":{"digest":"sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3","repository":"asisti.registry.twcstorage.ru/mtusi2026lab3"},"imagePullSecret":"registry-pull","ingress":{"className":"traefik","clusterIssuer":"letsencrypt-prod","host":"hl.agapov.space"},"load":{"duration":30,"enabled":false,"run":"manual","script":"scaling.js","vus":32},"monitoring":{"serviceMonitor":false},"postgres":{"image":"postgres:17.6-alpine","resources":{"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"250m","memory":"256Mi"}},"storage":"2Gi"},"storageClass":"","valkey":{"image":"valkey/valkey:8.1.3-alpine","maxmemory":"64mb","resources":{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"100m","memory":"96Mi"}},"shards":3,"storage":"1Gi"}} diff --git a/evidence/research-20261029-budget/values-resource-low-a-20261029121455.json b/evidence/research-20261029-budget/values-resource-low-a-20261029121455.json new file mode 100644 index 00000000..9711a783 --- /dev/null +++ b/evidence/research-20261029-budget/values-resource-low-a-20261029121455.json @@ -0,0 +1 @@ +{"api":{"env":{"DEPENDENCY_POOL_SIZE":"8","DEPENDENCY_TIMEOUT_MS":"2000","GOMEMLIMIT":"80MiB","REQUEST_TIMEOUT_SECONDS":"4","SESSION_TTL_SECONDS":"3600","SHUTDOWN_TIMEOUT_SECONDS":"5"},"nodeSelector":{"kubernetes.io/hostname":"dev.asisti.tech"},"readiness":{"failureThreshold":2,"timeoutSeconds":2},"replicas":2,"resources":{"limits":{"cpu":"250m","memory":"128Mi"},"requests":{"cpu":"250m","memory":"128Mi"}}},"autoscaling":{"cpuPercent":60,"enabled":false,"maxReplicas":4,"minReplicas":2},"databaseSecret":"messenger-secrets","image":{"digest":"sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3","repository":"asisti.registry.twcstorage.ru/mtusi2026lab3"},"imagePullSecret":"registry-pull","ingress":{"className":"traefik","clusterIssuer":"letsencrypt-prod","host":"hl.agapov.space"},"load":{"duration":30,"enabled":false,"run":"manual","script":"scaling.js","vus":32},"monitoring":{"serviceMonitor":false},"postgres":{"image":"postgres:17.6-alpine","resources":{"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"250m","memory":"256Mi"}},"storage":"2Gi"},"storageClass":"","valkey":{"image":"valkey/valkey:8.1.3-alpine","maxmemory":"64mb","resources":{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"100m","memory":"96Mi"}},"shards":3,"storage":"1Gi"}} diff --git a/evidence/research-20261029-budget/values-resource-low-b-20261029121833.json b/evidence/research-20261029-budget/values-resource-low-b-20261029121833.json new file mode 100644 index 00000000..9711a783 --- /dev/null +++ b/evidence/research-20261029-budget/values-resource-low-b-20261029121833.json @@ -0,0 +1 @@ +{"api":{"env":{"DEPENDENCY_POOL_SIZE":"8","DEPENDENCY_TIMEOUT_MS":"2000","GOMEMLIMIT":"80MiB","REQUEST_TIMEOUT_SECONDS":"4","SESSION_TTL_SECONDS":"3600","SHUTDOWN_TIMEOUT_SECONDS":"5"},"nodeSelector":{"kubernetes.io/hostname":"dev.asisti.tech"},"readiness":{"failureThreshold":2,"timeoutSeconds":2},"replicas":2,"resources":{"limits":{"cpu":"250m","memory":"128Mi"},"requests":{"cpu":"250m","memory":"128Mi"}}},"autoscaling":{"cpuPercent":60,"enabled":false,"maxReplicas":4,"minReplicas":2},"databaseSecret":"messenger-secrets","image":{"digest":"sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3","repository":"asisti.registry.twcstorage.ru/mtusi2026lab3"},"imagePullSecret":"registry-pull","ingress":{"className":"traefik","clusterIssuer":"letsencrypt-prod","host":"hl.agapov.space"},"load":{"duration":30,"enabled":false,"run":"manual","script":"scaling.js","vus":32},"monitoring":{"serviceMonitor":false},"postgres":{"image":"postgres:17.6-alpine","resources":{"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"250m","memory":"256Mi"}},"storage":"2Gi"},"storageClass":"","valkey":{"image":"valkey/valkey:8.1.3-alpine","maxmemory":"64mb","resources":{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"100m","memory":"96Mi"}},"shards":3,"storage":"1Gi"}} diff --git a/evidence/research-20261029-budget/values-saturation8-20261029121309.json b/evidence/research-20261029-budget/values-saturation8-20261029121309.json new file mode 100644 index 00000000..d7a5aa78 --- /dev/null +++ b/evidence/research-20261029-budget/values-saturation8-20261029121309.json @@ -0,0 +1 @@ +{"api":{"env":{"DEPENDENCY_POOL_SIZE":"8","DEPENDENCY_TIMEOUT_MS":"2000","GOMEMLIMIT":"80MiB","REQUEST_TIMEOUT_SECONDS":"4","SESSION_TTL_SECONDS":"3600","SHUTDOWN_TIMEOUT_SECONDS":"5"},"nodeSelector":{"kubernetes.io/hostname":"dev.asisti.tech"},"readiness":{"failureThreshold":2,"timeoutSeconds":2},"replicas":1,"resources":{"limits":{"cpu":"1000m","memory":"512Mi"},"requests":{"cpu":"1000m","memory":"512Mi"}}},"autoscaling":{"cpuPercent":60,"enabled":false,"maxReplicas":4,"minReplicas":2},"databaseSecret":"messenger-secrets","image":{"digest":"sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3","repository":"asisti.registry.twcstorage.ru/mtusi2026lab3"},"imagePullSecret":"registry-pull","ingress":{"className":"traefik","clusterIssuer":"letsencrypt-prod","host":"hl.agapov.space"},"load":{"duration":30,"enabled":false,"run":"manual","script":"scaling.js","vus":32},"monitoring":{"serviceMonitor":false},"postgres":{"image":"postgres:17.6-alpine","resources":{"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"250m","memory":"256Mi"}},"storage":"2Gi"},"storageClass":"","valkey":{"image":"valkey/valkey:8.1.3-alpine","maxmemory":"64mb","resources":{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"100m","memory":"96Mi"}},"shards":3,"storage":"1Gi"}} diff --git a/evidence/research-20261029-controlled-final/README.md b/evidence/research-20261029-controlled-final/README.md new file mode 100644 index 00000000..045d5935 --- /dev/null +++ b/evidence/research-20261029-controlled-final/README.md @@ -0,0 +1,5 @@ +# Исключение из матрицы + +В growing1-20261029112219 фактически работали две API вместо запрошенной одной: это видно в deployment-growing1-*.json и pods-growing1-*.txt. HPA успел изменить scale при отключении. Поэтому результат 83.57 записей/с не используется как точка «1 реплика». + +Следующее обновление Helm 4 остановилось на конфликте владения spec.replicas с HPA. restore.txt подтверждает восстановление нормальной конфигурации. В итоговом сценарии HPA отключается отдельным обновлением до изменения replicas; перед Job проверяется фактическое число API. Анализатор автоматически исключает этот прогон. diff --git a/evidence/research-20261029-controlled-final/base-revision.txt b/evidence/research-20261029-controlled-final/base-revision.txt new file mode 100644 index 00000000..32abb9b4 --- /dev/null +++ b/evidence/research-20261029-controlled-final/base-revision.txt @@ -0,0 +1 @@ +7b7e23fd029beea47e6f625a96cb98d2fe04bafb diff --git a/evidence/research-20261029-controlled-final/date.txt b/evidence/research-20261029-controlled-final/date.txt new file mode 100644 index 00000000..289118fb --- /dev/null +++ b/evidence/research-20261029-controlled-final/date.txt @@ -0,0 +1 @@ +2026-10-29T11:22:18Z diff --git a/evidence/research-20261029-controlled-final/deployment-growing1-20261029112219.json b/evidence/research-20261029-controlled-final/deployment-growing1-20261029112219.json new file mode 100644 index 00000000..3b8aed69 --- /dev/null +++ b/evidence/research-20261029-controlled-final/deployment-growing1-20261029112219.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "16", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 28, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60163228", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "250m", + "memory": "128Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:22:33Z", + "message": "ReplicaSet \"api-577bffc7b\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + }, + { + "lastTransitionTime": "2026-10-29T11:23:06Z", + "lastUpdateTime": "2026-10-29T11:23:06Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + } + ], + "observedGeneration": 28, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/research-20261029-controlled-final/load-growing1-20261029112219.json b/evidence/research-20261029-controlled-final/load-growing1-20261029112219.json new file mode 100644 index 00000000..25877373 --- /dev/null +++ b/evidence/research-20261029-controlled-final/load-growing1-20261029112219.json @@ -0,0 +1,373 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 2690, + "fails": 0 + }, + { + "fails": 0, + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 281 + }, + { + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 2671, + "fails": 0, + "name": "history readable", + "path": "::history readable" + } + ], + "name": "", + "path": "" + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 51938.508152 + }, + "metrics": { + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 149.9495135, + "p(95)": 295.03911825, + "p(99)": 459.6104094499996, + "max": 1753.715572, + "avg": 162.60486951664882 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 2671, + "rate": 51.426197922035385 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 5706, + "rate": 109.86068339316132 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.30998464423413946, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 277.02813 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 1, + "passes": 5642, + "fails": 0 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 314.756489, + "p(95)": 599.818975, + "p(99)": 862.0272017000001, + "max": 2045.675542, + "avg": 343.6956271527526 + } + }, + "attempted_messages": { + "values": { + "count": 2507, + "rate": 48.26861781750008 + }, + "type": "counter", + "contains": "default" + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "rate": 0, + "count": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 163.21581296582568, + "p(50)": 150.47742399999998, + "p(95)": 295.70493350000004, + "p(99)": 460.4602330499995, + "max": 1753.931379 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 5274, + "rate": 101.54315531292198 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.24427641062039882, + "p(50)": 0.135235, + "p(95)": 0.662551, + "p(99)": 2.6266256999999906, + "max": 11.443155 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.3666670385559065, + "p(50)": 0.163557, + "p(95)": 1.3028165, + "p(99)": 3.2255626499999983, + "max": 15.694926 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "rate": 0, + "count": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 192.16667320781806, + "p(50)": 177.132425, + "p(95)": 337.5963050999997, + "p(99)": 519.0942395600002, + "max": 1548.601143 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "confirmed_messages": { + "contains": "default", + "values": { + "rate": 48.26861781750008, + "count": 2507 + }, + "type": "counter" + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0, + "passes": 0, + "fails": 5706 + } + }, + "http_req_duration{expected_response:true}": { + "contains": "time", + "values": { + "avg": 163.21581296582568, + "p(50)": 150.47742399999998, + "p(95)": 295.70493350000004, + "p(99)": 460.4602330499995, + "max": 1753.931379 + }, + "type": "trend" + }, + "vus": { + "values": { + "min": 0, + "max": 32, + "value": 32 + }, + "type": "gauge", + "contains": "default" + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "max": 32, + "value": 32, + "min": 32 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 7757131, + "rate": 149352.21045045162 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 0, + "max": 20.379458, + "avg": 0.037312242902208206, + "p(50)": 0, + "p(95)": 0 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0.00145775, + "p(99)": 0.013477249999999849, + "max": 690.712483, + "avg": 0.47036642166140996, + "p(50)": 0.000861 + } + }, + "data_sent": { + "contains": "data", + "values": { + "rate": 10235.873514967878, + "count": 531636 + }, + "type": "counter" + } + }, + "setup_data": [ + { + "chat": "5bdcfe1f-c2c7-45cc-9648-79f35cd17279", + "token": "GvkF6GIVBOq0RPxv1ZDMshM_CCjLnd0tZDkb2ThnLks" + }, + { + "chat": "85883086-729a-4849-aeed-2ba4f9fb5f7f", + "token": "ULOB-U0MMfln9PsDd7At9ALo1Y5QoBhbNxN0nIXIgAY" + }, + { + "chat": "068ace76-5971-4039-8b01-fd4d7f182424", + "token": "UFu4FYvXpL0VsYBMAgkCm-_Rv7aUY3BDCpKjN2MDnCI" + }, + { + "chat": "f5628414-bc8a-488a-b2e8-d42b9fb8bedc", + "token": "-lmwut2zmkfkLbQATkHhUwTGqRlriHlLXpHJQvpl49o" + }, + { + "chat": "314bc8ae-3b89-4667-bf72-aec4d2f4ccbd", + "token": "9vZXVw2jZUc-kwFoqZ0MPFkO1vvf91ILdjtQZT4pDho" + }, + { + "chat": "91a10a38-887e-468e-8bd3-bc595205cb49", + "token": "rq6hB6KvDtysZ6ZWd-mr6imxhu5l1HgYQgxvSySxPl8" + }, + { + "chat": "50986276-3200-4991-a748-aa79e87d7deb", + "token": "aqubOAS19q1RD2SKANlGwtPONx5uUbP-otwN_E4Shxs" + }, + { + "token": "ftDzWLT9Tk6s89xOlQ1DPh94k4V9dydLgYrAb9lR2iQ", + "chat": "6ffb3f83-6dc8-425e-9c81-d998adc12727" + }, + { + "chat": "3f949c78-c4ae-4716-8923-64a608f446cc", + "token": "NjXb0NhTkIxVMi1ama3Tzz3VdNc_UFlMauhxhMbP-lo" + }, + { + "chat": "30d0da08-7f28-4ae8-8b75-f198c5c13c7c", + "token": "AlFbpbRlscnfL6tMePku09q3S1YwQoARzHNQwsJThNM" + }, + { + "chat": "4e031048-8d6a-4161-8957-b5d8625da8e9", + "token": "jrs-CIGZqSWGIYn2eEGg4IK1XSGBU7BUef9EoIe6kQ4" + }, + { + "chat": "94aa326c-f0b2-4f67-899c-bb6444de3102", + "token": "DsRJx5Uo4hRTHBMADva_0H2hE351yw2DDCHdpAYEqhE" + }, + { + "chat": "4a3ad7d0-a3ff-4fe9-b7af-a9bb61493a0d", + "token": "_UpCZL__EOIVhkT0iMiQI2xF_1qDPzvDlkCBq1HTSaI" + }, + { + "token": "pei20WJFCkkTAJs9CSYKRHi2bzf1tNZohgFWmBnrZAM", + "chat": "1533dc2b-b92f-4edb-906a-835aa87405de" + }, + { + "chat": "4e0f42a9-42b2-4323-bf26-18acc6cbb3f7", + "token": "MhFov5bltyLc8gLwDubkNxB6FR_xiJNv5LdAViSMEXQ" + }, + { + "token": "foh0BkOgQyAWgzdTpMwhfEJ94YXQb2kQhZIhWsbYxxM", + "chat": "4cf118d4-e7a3-446c-9613-41633a629642" + } + ] + } +} diff --git a/evidence/research-20261029-controlled-final/load-growing1-20261029112219.txt b/evidence/research-20261029-controlled-final/load-growing1-20261029112219.txt new file mode 100644 index 00000000..905521e4 --- /dev/null +++ b/evidence/research-20261029-controlled-final/load-growing1-20261029112219.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":2690,"fails":0},{"fails":0,"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":281},{"id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":2671,"fails":0,"name":"history readable","path":"::history readable"}],"name":"","path":""},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":51938.508152},"metrics":{"http_req_waiting":{"type":"trend","contains":"time","values":{"p(50)":149.9495135,"p(95)":295.03911825,"p(99)":459.6104094499996,"max":1753.715572,"avg":162.60486951664882}},"iterations":{"type":"counter","contains":"default","values":{"count":2671,"rate":51.426197922035385}},"http_reqs":{"type":"counter","contains":"default","values":{"count":5706,"rate":109.86068339316132}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"avg":0.30998464423413946,"p(50)":0,"p(95)":0,"p(99)":0,"max":277.02813}},"checks":{"type":"rate","contains":"default","values":{"rate":1,"passes":5642,"fails":0}},"iteration_duration":{"type":"trend","contains":"time","values":{"p(50)":314.756489,"p(95)":599.818975,"p(99)":862.0272017000001,"max":2045.675542,"avg":343.6956271527526}},"attempted_messages":{"values":{"count":2507,"rate":48.26861781750008},"type":"counter","contains":"default"},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"rate":0,"count":0},"thresholds":{"count>=0":{"ok":true}}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":163.21581296582568,"p(50)":150.47742399999998,"p(95)":295.70493350000004,"p(99)":460.4602330499995,"max":1753.931379}},"measured_operations":{"type":"counter","contains":"default","values":{"count":5274,"rate":101.54315531292198}},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.24427641062039882,"p(50)":0.135235,"p(95)":0.662551,"p(99)":2.6266256999999906,"max":11.443155}},"http_req_receiving":{"type":"trend","contains":"time","values":{"avg":0.3666670385559065,"p(50)":0.163557,"p(95)":1.3028165,"p(99)":3.2255626499999983,"max":15.694926}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"rate":0,"count":0},"thresholds":{"count>=0":{"ok":true}}},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":192.16667320781806,"p(50)":177.132425,"p(95)":337.5963050999997,"p(99)":519.0942395600002,"max":1548.601143}},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"confirmed_messages":{"contains":"default","values":{"rate":48.26861781750008,"count":2507},"type":"counter"},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0,"passes":0,"fails":5706}},"http_req_duration{expected_response:true}":{"contains":"time","values":{"avg":163.21581296582568,"p(50)":150.47742399999998,"p(95)":295.70493350000004,"p(99)":460.4602330499995,"max":1753.931379},"type":"trend"},"vus":{"values":{"min":0,"max":32,"value":32},"type":"gauge","contains":"default"},"vus_max":{"type":"gauge","contains":"default","values":{"max":32,"value":32,"min":32}},"data_received":{"type":"counter","contains":"data","values":{"count":7757131,"rate":149352.21045045162}},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(99)":0,"max":20.379458,"avg":0.037312242902208206,"p(50)":0,"p(95)":0}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(95)":0.00145775,"p(99)":0.013477249999999849,"max":690.712483,"avg":0.47036642166140996,"p(50)":0.000861}},"data_sent":{"contains":"data","values":{"rate":10235.873514967878,"count":531636},"type":"counter"}},"setup_data":[{"chat":"5bdcfe1f-c2c7-45cc-9648-79f35cd17279","token":"GvkF6GIVBOq0RPxv1ZDMshM_CCjLnd0tZDkb2ThnLks"},{"chat":"85883086-729a-4849-aeed-2ba4f9fb5f7f","token":"ULOB-U0MMfln9PsDd7At9ALo1Y5QoBhbNxN0nIXIgAY"},{"chat":"068ace76-5971-4039-8b01-fd4d7f182424","token":"UFu4FYvXpL0VsYBMAgkCm-_Rv7aUY3BDCpKjN2MDnCI"},{"chat":"f5628414-bc8a-488a-b2e8-d42b9fb8bedc","token":"-lmwut2zmkfkLbQATkHhUwTGqRlriHlLXpHJQvpl49o"},{"chat":"314bc8ae-3b89-4667-bf72-aec4d2f4ccbd","token":"9vZXVw2jZUc-kwFoqZ0MPFkO1vvf91ILdjtQZT4pDho"},{"chat":"91a10a38-887e-468e-8bd3-bc595205cb49","token":"rq6hB6KvDtysZ6ZWd-mr6imxhu5l1HgYQgxvSySxPl8"},{"chat":"50986276-3200-4991-a748-aa79e87d7deb","token":"aqubOAS19q1RD2SKANlGwtPONx5uUbP-otwN_E4Shxs"},{"token":"ftDzWLT9Tk6s89xOlQ1DPh94k4V9dydLgYrAb9lR2iQ","chat":"6ffb3f83-6dc8-425e-9c81-d998adc12727"},{"chat":"3f949c78-c4ae-4716-8923-64a608f446cc","token":"NjXb0NhTkIxVMi1ama3Tzz3VdNc_UFlMauhxhMbP-lo"},{"chat":"30d0da08-7f28-4ae8-8b75-f198c5c13c7c","token":"AlFbpbRlscnfL6tMePku09q3S1YwQoARzHNQwsJThNM"},{"chat":"4e031048-8d6a-4161-8957-b5d8625da8e9","token":"jrs-CIGZqSWGIYn2eEGg4IK1XSGBU7BUef9EoIe6kQ4"},{"chat":"94aa326c-f0b2-4f67-899c-bb6444de3102","token":"DsRJx5Uo4hRTHBMADva_0H2hE351yw2DDCHdpAYEqhE"},{"chat":"4a3ad7d0-a3ff-4fe9-b7af-a9bb61493a0d","token":"_UpCZL__EOIVhkT0iMiQI2xF_1qDPzvDlkCBq1HTSaI"},{"token":"pei20WJFCkkTAJs9CSYKRHi2bzf1tNZohgFWmBnrZAM","chat":"1533dc2b-b92f-4edb-906a-835aa87405de"},{"chat":"4e0f42a9-42b2-4323-bf26-18acc6cbb3f7","token":"MhFov5bltyLc8gLwDubkNxB6FR_xiJNv5LdAViSMEXQ"},{"token":"foh0BkOgQyAWgzdTpMwhfEJ94YXQb2kQhZIhWsbYxxM","chat":"4cf118d4-e7a3-446c-9613-41633a629642"}]}} diff --git a/evidence/research-20261029-controlled-final/nodes.txt b/evidence/research-20261029-controlled-final/nodes.txt new file mode 100644 index 00000000..461dea77 --- /dev/null +++ b/evidence/research-20261029-controlled-final/nodes.txt @@ -0,0 +1,4 @@ +NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME +dev.asisti.tech Ready 252d v1.33.13 100.99.166.40 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 +marlosrv0 Ready 254d v1.33.13 192.168.1.37 Ubuntu 24.04.5 LTS 6.8.0-147-generic containerd://1.7.29 +srv0.agapov.space Ready 246d v1.33.13 100.108.186.94 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 diff --git a/evidence/research-20261029-controlled-final/pods-growing1-20261029112219.txt b/evidence/research-20261029-controlled-final/pods-growing1-20261029112219.txt new file mode 100644 index 00000000..724365d4 --- /dev/null +++ b/evidence/research-20261029-controlled-final/pods-growing1-20261029112219.txt @@ -0,0 +1,3 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-577bffc7b-7pfjv 1/1 Running 0 44s 10.1.25.123 dev.asisti.tech +api-577bffc7b-9dl4t 1/1 Running 0 44s 10.1.25.88 dev.asisti.tech diff --git a/evidence/research-20261029-controlled-final/profiles.csv b/evidence/research-20261029-controlled-final/profiles.csv new file mode 100644 index 00000000..2a0ddae6 --- /dev/null +++ b/evidence/research-20261029-controlled-final/profiles.csv @@ -0,0 +1,2 @@ +profile,run,replicas,cpu_millicores_per_replica,memory_mib_per_replica,pool,vus,duration +growing1,growing1-20261029112219,1,250,128,8,32,30 diff --git a/evidence/research-20261029-controlled-final/resources-growing1-20261029112219.txt b/evidence/research-20261029-controlled-final/resources-growing1-20261029112219.txt new file mode 100644 index 00000000..95472516 --- /dev/null +++ b/evidence/research-20261029-controlled-final/resources-growing1-20261029112219.txt @@ -0,0 +1,85 @@ +UTC 2026-10-29T11:23:15Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7pfjv 4m 22Mi +api-577bffc7b-9dl4t 4m 23Mi +postgres-0 6m 43Mi +valkey-0 8m 9Mi +valkey-1 3m 14Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:23:23Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7pfjv 4m 22Mi +api-577bffc7b-9dl4t 4m 23Mi +postgres-0 6m 43Mi +valkey-0 8m 9Mi +valkey-1 3m 14Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:23:31Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7pfjv 94m 60Mi +api-577bffc7b-9dl4t 98m 56Mi +load-growing1-20261029112219-kb6g4 47m 17Mi +postgres-0 17m 44Mi +valkey-0 8m 9Mi +valkey-1 6m 14Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:23:39Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7pfjv 94m 60Mi +api-577bffc7b-9dl4t 98m 56Mi +load-growing1-20261029112219-kb6g4 47m 17Mi +postgres-0 17m 44Mi +valkey-0 8m 9Mi +valkey-1 6m 14Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|12 +idle in transaction|Client|ClientRead|5 +UTC 2026-10-29T11:23:48Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7pfjv 139m 11Mi +api-577bffc7b-9dl4t 98m 56Mi +load-growing1-20261029112219-kb6g4 91m 18Mi +postgres-0 224m 80Mi +valkey-0 39m 10Mi +valkey-1 6m 14Mi +valkey-2 25m 4Mi +active|||1 +idle|Client|ClientRead|16 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:23:57Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7pfjv 139m 11Mi +api-577bffc7b-9dl4t 98m 56Mi +load-growing1-20261029112219-kb6g4 91m 18Mi +postgres-0 224m 80Mi +valkey-0 39m 10Mi +valkey-1 6m 14Mi +valkey-2 25m 4Mi +active|IO|WalSync|1 +active|Lock|transactionid|1 +active|||1 +idle|Client|ClientRead|7 +idle in transaction|Client|ClientRead|7 +idle in transaction|||1 +UTC 2026-10-29T11:24:05Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-7pfjv 247m 12Mi +api-577bffc7b-9dl4t 186m 14Mi +load-growing1-20261029112219-kb6g4 193m 28Mi +postgres-0 550m 81Mi +valkey-0 103m 10Mi +valkey-1 40m 15Mi +valkey-2 25m 4Mi +active|||1 +idle|Client|ClientRead|16 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-controlled-final/restore-values.yaml b/evidence/research-20261029-controlled-final/restore-values.yaml new file mode 100644 index 00000000..4e915dac --- /dev/null +++ b/evidence/research-20261029-controlled-final/restore-values.yaml @@ -0,0 +1,61 @@ +api: + env: + DEPENDENCY_POOL_SIZE: "8" + DEPENDENCY_TIMEOUT_MS: "2000" + GOMEMLIMIT: 160MiB + REQUEST_TIMEOUT_SECONDS: "4" + SESSION_TTL_SECONDS: "3600" + SHUTDOWN_TIMEOUT_SECONDS: "5" + replicas: 2 + resources: + limits: + cpu: "1" + memory: 256Mi + requests: + cpu: 250m + memory: 128Mi +autoscaling: + cpuPercent: 60 + enabled: true + maxReplicas: 4 + minReplicas: 2 +databaseSecret: messenger-secrets +image: + digest: sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 + repository: asisti.registry.twcstorage.ru/mtusi2026lab3 +imagePullSecret: registry-pull +ingress: + className: traefik + clusterIssuer: letsencrypt-prod + host: hl.agapov.space +load: + duration: 30 + enabled: false + run: manual + script: scaling.js + vus: 32 +monitoring: + serviceMonitor: false +postgres: + image: postgres:17.6-alpine + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + storage: 2Gi +storageClass: "" +valkey: + image: valkey/valkey:8.1.3-alpine + maxmemory: 64mb + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 100m + memory: 96Mi + shards: 3 + storage: 1Gi diff --git a/evidence/research-20261029-controlled-final/restore.txt b/evidence/research-20261029-controlled-final/restore.txt new file mode 100644 index 00000000..051d04d7 --- /dev/null +++ b/evidence/research-20261029-controlled-final/restore.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:24:33 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 20 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-controlled-final/rollout-growing1.txt b/evidence/research-20261029-controlled-final/rollout-growing1.txt new file mode 100644 index 00000000..89b3cab2 --- /dev/null +++ b/evidence/research-20261029-controlled-final/rollout-growing1.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:22:22 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 18 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-controlled-final/rollout-saturation8.txt b/evidence/research-20261029-controlled-final/rollout-saturation8.txt new file mode 100644 index 00000000..e69de29b diff --git a/evidence/research-20261029-controlled-final/source.sha256 b/evidence/research-20261029-controlled-final/source.sha256 new file mode 100644 index 00000000..862a7ac7 --- /dev/null +++ b/evidence/research-20261029-controlled-final/source.sha256 @@ -0,0 +1,3 @@ +0a58dff9ad7acf8f228e0fd1c2a670bbe7e18a11360715b47659104832e34892 student-tests/load/scaling.js +dcc8dc1217792aca3385c8e3195b236058ee9b2df912e60f9af46dc51b9a6c86 charts/messenger/values.yaml +60e09dd38fd1d413b744f21b57f64ba83e49a5ae1b4251aa5bf20be033f90cfb internal/controller/http/fiber/errors.go diff --git a/evidence/research-20261029-controlled/README.md b/evidence/research-20261029-controlled/README.md new file mode 100644 index 00000000..31751f4e --- /dev/null +++ b/evidence/research-20261029-controlled/README.md @@ -0,0 +1,3 @@ +# Исключённый прогон + +Чтение состояния Job через Kubernetes API завершилось TLS handshake timeout. Восстановление обычной конфигурации могло пересечься с нагрузкой, поэтому этот growing1 не включается в матрицу. Следующий запуск ограниченно повторяет только чтение статуса Job; при неуспехе останавливает свой Job перед восстановлением Helm-конфигурации. diff --git a/evidence/research-20261029-controlled/base-revision.txt b/evidence/research-20261029-controlled/base-revision.txt new file mode 100644 index 00000000..32abb9b4 --- /dev/null +++ b/evidence/research-20261029-controlled/base-revision.txt @@ -0,0 +1 @@ +7b7e23fd029beea47e6f625a96cb98d2fe04bafb diff --git a/evidence/research-20261029-controlled/date.txt b/evidence/research-20261029-controlled/date.txt new file mode 100644 index 00000000..a050f4fd --- /dev/null +++ b/evidence/research-20261029-controlled/date.txt @@ -0,0 +1 @@ +2026-10-29T11:19:19Z diff --git a/evidence/research-20261029-controlled/deployment-growing1-20261029111920.json b/evidence/research-20261029-controlled/deployment-growing1-20261029111920.json new file mode 100644 index 00000000..e104f027 --- /dev/null +++ b/evidence/research-20261029-controlled/deployment-growing1-20261029111920.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "14", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 24, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60162236", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "250m", + "memory": "128Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:19:28Z", + "lastUpdateTime": "2026-10-29T11:19:28Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:19:31Z", + "message": "ReplicaSet \"api-577bffc7b\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 24, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-controlled/nodes.txt b/evidence/research-20261029-controlled/nodes.txt new file mode 100644 index 00000000..461dea77 --- /dev/null +++ b/evidence/research-20261029-controlled/nodes.txt @@ -0,0 +1,4 @@ +NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME +dev.asisti.tech Ready 252d v1.33.13 100.99.166.40 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 +marlosrv0 Ready 254d v1.33.13 192.168.1.37 Ubuntu 24.04.5 LTS 6.8.0-147-generic containerd://1.7.29 +srv0.agapov.space Ready 246d v1.33.13 100.108.186.94 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 diff --git a/evidence/research-20261029-controlled/pods-growing1-20261029111920.txt b/evidence/research-20261029-controlled/pods-growing1-20261029111920.txt new file mode 100644 index 00000000..d1dc18d7 --- /dev/null +++ b/evidence/research-20261029-controlled/pods-growing1-20261029111920.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-577bffc7b-c9wsv 1/1 Running 0 43s 10.1.25.118 dev.asisti.tech diff --git a/evidence/research-20261029-controlled/profiles.csv b/evidence/research-20261029-controlled/profiles.csv new file mode 100644 index 00000000..e678c936 --- /dev/null +++ b/evidence/research-20261029-controlled/profiles.csv @@ -0,0 +1,2 @@ +profile,run,replicas,cpu_millicores_per_replica,memory_mib_per_replica,pool,vus,duration +growing1,growing1-20261029111920,1,250,128,8,32,30 diff --git a/evidence/research-20261029-controlled/resources-growing1-20261029111920.txt b/evidence/research-20261029-controlled/resources-growing1-20261029111920.txt new file mode 100644 index 00000000..738e981e --- /dev/null +++ b/evidence/research-20261029-controlled/resources-growing1-20261029111920.txt @@ -0,0 +1,51 @@ +UTC 2026-10-29T11:20:07Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-c9wsv 22m 22Mi +postgres-0 5m 41Mi +valkey-0 7m 10Mi +valkey-1 6m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:20:13Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-c9wsv 22m 22Mi +postgres-0 5m 41Mi +valkey-0 7m 10Mi +valkey-1 6m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:20:20Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-c9wsv 3m 22Mi +postgres-0 10m 41Mi +valkey-0 8m 10Mi +valkey-1 6m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:20:28Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-c9wsv 3m 22Mi +postgres-0 10m 41Mi +valkey-0 8m 10Mi +valkey-1 6m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:20:35Z +NAME CPU(cores) MEMORY(bytes) +api-577bffc7b-c9wsv 113m 11Mi +load-growing1-20261029111920-qrwb8 34m 17Mi +postgres-0 34m 44Mi +valkey-0 14m 9Mi +valkey-1 5m 14Mi +valkey-2 8m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-controlled/restore-values.yaml b/evidence/research-20261029-controlled/restore-values.yaml new file mode 100644 index 00000000..4e915dac --- /dev/null +++ b/evidence/research-20261029-controlled/restore-values.yaml @@ -0,0 +1,61 @@ +api: + env: + DEPENDENCY_POOL_SIZE: "8" + DEPENDENCY_TIMEOUT_MS: "2000" + GOMEMLIMIT: 160MiB + REQUEST_TIMEOUT_SECONDS: "4" + SESSION_TTL_SECONDS: "3600" + SHUTDOWN_TIMEOUT_SECONDS: "5" + replicas: 2 + resources: + limits: + cpu: "1" + memory: 256Mi + requests: + cpu: 250m + memory: 128Mi +autoscaling: + cpuPercent: 60 + enabled: true + maxReplicas: 4 + minReplicas: 2 +databaseSecret: messenger-secrets +image: + digest: sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 + repository: asisti.registry.twcstorage.ru/mtusi2026lab3 +imagePullSecret: registry-pull +ingress: + className: traefik + clusterIssuer: letsencrypt-prod + host: hl.agapov.space +load: + duration: 30 + enabled: false + run: manual + script: scaling.js + vus: 32 +monitoring: + serviceMonitor: false +postgres: + image: postgres:17.6-alpine + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + storage: 2Gi +storageClass: "" +valkey: + image: valkey/valkey:8.1.3-alpine + maxmemory: 64mb + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 100m + memory: 96Mi + shards: 3 + storage: 1Gi diff --git a/evidence/research-20261029-controlled/restore.txt b/evidence/research-20261029-controlled/restore.txt new file mode 100644 index 00000000..410949cb --- /dev/null +++ b/evidence/research-20261029-controlled/restore.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:20:49 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 17 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-controlled/rollout-growing1.txt b/evidence/research-20261029-controlled/rollout-growing1.txt new file mode 100644 index 00000000..e92f5464 --- /dev/null +++ b/evidence/research-20261029-controlled/rollout-growing1.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:19:21 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 16 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-controlled/source.sha256 b/evidence/research-20261029-controlled/source.sha256 new file mode 100644 index 00000000..93d2dce5 --- /dev/null +++ b/evidence/research-20261029-controlled/source.sha256 @@ -0,0 +1,3 @@ +614623b626103627eea3d8946b9b22474be13a49115ffbb9e68e2d883ff1e4d4 student-tests/load/scaling.js +dcc8dc1217792aca3385c8e3195b236058ee9b2df912e60f9af46dc51b9a6c86 charts/messenger/values.yaml +60e09dd38fd1d413b744f21b57f64ba83e49a5ae1b4251aa5bf20be033f90cfb internal/controller/http/fiber/errors.go diff --git a/evidence/research-20261029-final/base-revision.txt b/evidence/research-20261029-final/base-revision.txt new file mode 100644 index 00000000..32abb9b4 --- /dev/null +++ b/evidence/research-20261029-final/base-revision.txt @@ -0,0 +1 @@ +7b7e23fd029beea47e6f625a96cb98d2fe04bafb diff --git a/evidence/research-20261029-final/cpu-quota-config.json b/evidence/research-20261029-final/cpu-quota-config.json new file mode 100644 index 00000000..7c6ba7b6 --- /dev/null +++ b/evidence/research-20261029-final/cpu-quota-config.json @@ -0,0 +1,4 @@ +{ + "cpuCFSQuota": true, + "cpuCFSQuotaPeriod": "100ms" +} diff --git a/evidence/research-20261029-final/date.txt b/evidence/research-20261029-final/date.txt new file mode 100644 index 00000000..a629bf8e --- /dev/null +++ b/evidence/research-20261029-final/date.txt @@ -0,0 +1 @@ +2026-10-29T11:04:37Z diff --git a/evidence/research-20261029-final/deployment-fixed1-20261029110437.json b/evidence/research-20261029-final/deployment-fixed1-20261029110437.json new file mode 100644 index 00000000..f7d74cc3 --- /dev/null +++ b/evidence/research-20261029-final/deployment-fixed1-20261029110437.json @@ -0,0 +1,214 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "9", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 15, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60158295", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:04:57Z", + "lastUpdateTime": "2026-10-29T11:04:57Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:05:04Z", + "message": "ReplicaSet \"api-6fc45595fc\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 15, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-final/deployment-fixed2-20261029110639.json b/evidence/research-20261029-final/deployment-fixed2-20261029110639.json new file mode 100644 index 00000000..ef0f6ed9 --- /dev/null +++ b/evidence/research-20261029-final/deployment-fixed2-20261029110639.json @@ -0,0 +1,214 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "10", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 16, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60158796", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "500m", + "memory": "256Mi" + }, + "requests": { + "cpu": "500m", + "memory": "256Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:06:45Z", + "lastUpdateTime": "2026-10-29T11:06:45Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:06:48Z", + "message": "ReplicaSet \"api-7f5b6b9d85\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 16, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/research-20261029-final/deployment-fixed4-20261029110815.json b/evidence/research-20261029-final/deployment-fixed4-20261029110815.json new file mode 100644 index 00000000..0674bac4 --- /dev/null +++ b/evidence/research-20261029-final/deployment-fixed4-20261029110815.json @@ -0,0 +1,214 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "11", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 17, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60159468", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 4, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "250m", + "memory": "128Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 4, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:08:33Z", + "lastUpdateTime": "2026-10-29T11:08:33Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:08:39Z", + "message": "ReplicaSet \"api-855b9f4fb5\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 17, + "readyReplicas": 4, + "replicas": 4, + "updatedReplicas": 4 + } +} diff --git a/evidence/research-20261029-final/deployment-growing1-20261029111013.json b/evidence/research-20261029-final/deployment-growing1-20261029111013.json new file mode 100644 index 00000000..8df154ae --- /dev/null +++ b/evidence/research-20261029-final/deployment-growing1-20261029111013.json @@ -0,0 +1,214 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "11", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 18, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60159975", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "250m", + "memory": "128Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:08:39Z", + "message": "ReplicaSet \"api-855b9f4fb5\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + }, + { + "lastTransitionTime": "2026-10-29T11:10:42Z", + "lastUpdateTime": "2026-10-29T11:10:42Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + } + ], + "observedGeneration": 18, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-final/deployment-growing2-20261029111200.json b/evidence/research-20261029-final/deployment-growing2-20261029111200.json new file mode 100644 index 00000000..33ba3f49 --- /dev/null +++ b/evidence/research-20261029-final/deployment-growing2-20261029111200.json @@ -0,0 +1,214 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "11", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 19, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60160315", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "250m", + "memory": "128Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:08:39Z", + "message": "ReplicaSet \"api-855b9f4fb5\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + }, + { + "lastTransitionTime": "2026-10-29T11:12:07Z", + "lastUpdateTime": "2026-10-29T11:12:07Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + } + ], + "observedGeneration": 19, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/research-20261029-final/deployment-growing4-20261029111342.json b/evidence/research-20261029-final/deployment-growing4-20261029111342.json new file mode 100644 index 00000000..96a78cec --- /dev/null +++ b/evidence/research-20261029-final/deployment-growing4-20261029111342.json @@ -0,0 +1,214 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "11", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 20, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60160765", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 4, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "250m", + "memory": "128Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 4, + "conditions": [ + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:08:39Z", + "message": "ReplicaSet \"api-855b9f4fb5\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + }, + { + "lastTransitionTime": "2026-10-29T11:13:48Z", + "lastUpdateTime": "2026-10-29T11:13:48Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + } + ], + "observedGeneration": 20, + "readyReplicas": 4, + "replicas": 4, + "updatedReplicas": 4 + } +} diff --git a/evidence/research-20261029-final/deployment-saturation8-20261029111530.json b/evidence/research-20261029-final/deployment-saturation8-20261029111530.json new file mode 100644 index 00000000..2bbaad40 --- /dev/null +++ b/evidence/research-20261029-final/deployment-saturation8-20261029111530.json @@ -0,0 +1,214 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "12", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 21, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60161224", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:14:31Z", + "lastUpdateTime": "2026-10-29T11:14:31Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:15:36Z", + "message": "ReplicaSet \"api-6fc45595fc\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 21, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-final/events.json b/evidence/research-20261029-final/events.json new file mode 100644 index 00000000..8795511b --- /dev/null +++ b/evidence/research-20261029-final/events.json @@ -0,0 +1,2590 @@ +{ + "apiVersion": "v1", + "items": [ + { + "action": "Binding", + "apiVersion": "v1", + "eventTime": "2026-10-29T11:21:06.541999Z", + "firstTimestamp": null, + "involvedObject": { + "apiVersion": "v1", + "kind": "Pod", + "name": "api-54f7cc6f98-2277p", + "namespace": "highload-applications", + "resourceVersion": "60162672", + "uid": "e48e0d5f-6011-4e30-9f8e-10364509f9bd" + }, + "kind": "Event", + "lastTimestamp": null, + "message": "Successfully assigned highload-applications/api-54f7cc6f98-2277p to dev.asisti.tech", + "metadata": { + "creationTimestamp": "2026-10-29T11:21:06Z", + "name": "api-54f7cc6f98-2277p.18e2fc2bc3953bc2", + "namespace": "highload-applications", + "resourceVersion": "60162677", + "uid": "4d8ec82a-a731-48ff-a5fc-b8f20b830843" + }, + "reason": "Scheduled", + "reportingComponent": "default-scheduler", + "reportingInstance": "default-scheduler-marlosrv0", + "source": {}, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:21:07Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-2277p", + "namespace": "highload-applications", + "resourceVersion": "60162675", + "uid": "e48e0d5f-6011-4e30-9f8e-10364509f9bd" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:21:07Z", + "message": "Container image \"asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3\" already present on machine", + "metadata": { + "creationTimestamp": "2026-10-29T11:21:07Z", + "name": "api-54f7cc6f98-2277p.18e2fc2c090abf57", + "namespace": "highload-applications", + "resourceVersion": "60162689", + "uid": "7f4ae7bd-2b04-405b-9e7d-2dd42ef52b65" + }, + "reason": "Pulled", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:21:07Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-2277p", + "namespace": "highload-applications", + "resourceVersion": "60162675", + "uid": "e48e0d5f-6011-4e30-9f8e-10364509f9bd" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:21:07Z", + "message": "Created container: api", + "metadata": { + "creationTimestamp": "2026-10-29T11:21:07Z", + "name": "api-54f7cc6f98-2277p.18e2fc2c0bb3213a", + "namespace": "highload-applications", + "resourceVersion": "60162690", + "uid": "ee5e3342-744c-48e1-a480-a1ff1cb4b263" + }, + "reason": "Created", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:21:07Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-2277p", + "namespace": "highload-applications", + "resourceVersion": "60162675", + "uid": "e48e0d5f-6011-4e30-9f8e-10364509f9bd" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:21:07Z", + "message": "Started container api", + "metadata": { + "creationTimestamp": "2026-10-29T11:21:07Z", + "name": "api-54f7cc6f98-2277p.18e2fc2c1386cc99", + "namespace": "highload-applications", + "resourceVersion": "60162691", + "uid": "bec855be-ebe0-4259-b657-4e16df5367f5" + }, + "reason": "Started", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 8, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:21:45Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-2277p", + "namespace": "highload-applications", + "resourceVersion": "60162675", + "uid": "e48e0d5f-6011-4e30-9f8e-10364509f9bd" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:21:59Z", + "message": "Readiness probe failed: Get \"http://10.1.25.120:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:03Z", + "name": "api-54f7cc6f98-2277p.18e2fc34cae4ec99", + "namespace": "highload-applications", + "resourceVersion": "60162911", + "uid": "b757545f-ec60-48df-bd78-2d6d4064cdf0" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:28Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-2277p", + "namespace": "highload-applications", + "resourceVersion": "60162675", + "uid": "e48e0d5f-6011-4e30-9f8e-10364509f9bd" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:28Z", + "message": "Stopping container api", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:28Z", + "name": "api-54f7cc6f98-2277p.18e2fc3ecc95738e", + "namespace": "highload-applications", + "resourceVersion": "60163001", + "uid": "31e508d9-3998-433a-8bb1-bdc95f9f4ed2" + }, + "reason": "Killing", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:31Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-2277p", + "namespace": "highload-applications", + "resourceVersion": "60162675", + "uid": "e48e0d5f-6011-4e30-9f8e-10364509f9bd" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:31Z", + "message": "Readiness probe failed: Get \"http://10.1.25.120:8080/health/ready\": dial tcp 10.1.25.120:8080: connect: connection refused", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:31Z", + "name": "api-54f7cc6f98-2277p.18e2fc3f81844d97", + "namespace": "highload-applications", + "resourceVersion": "60163058", + "uid": "36c71db5-caac-43da-97f3-9f0d0bbd7da0" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 5, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:17:44Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-jzbb7", + "namespace": "highload-applications", + "resourceVersion": "60161624", + "uid": "d6485622-2406-455d-98f1-dc78ece3341f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:27Z", + "message": "Readiness probe failed: Get \"http://10.1.112.66:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:17:44Z", + "name": "api-54f7cc6f98-jzbb7.18e2fbfcb49e72a6", + "namespace": "highload-applications", + "resourceVersion": "60162174", + "uid": "918615fd-e731-444a-858f-7802ba16ac28" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:31Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-jzbb7", + "namespace": "highload-applications", + "resourceVersion": "60161624", + "uid": "d6485622-2406-455d-98f1-dc78ece3341f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:31Z", + "message": "Stopping container api", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:31Z", + "name": "api-54f7cc6f98-jzbb7.18e2fc15b7ff73eb", + "namespace": "highload-applications", + "resourceVersion": "60162234", + "uid": "8fd32006-3f66-4450-b8f5-bc52729b34fd" + }, + "reason": "Killing", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Normal" + }, + { + "action": "Binding", + "apiVersion": "v1", + "eventTime": "2026-10-29T11:20:51.314767Z", + "firstTimestamp": null, + "involvedObject": { + "apiVersion": "v1", + "kind": "Pod", + "name": "api-54f7cc6f98-p5pzh", + "namespace": "highload-applications", + "resourceVersion": "60162543", + "uid": "e6de6505-03c7-4b68-bb14-d776dfc60ff6" + }, + "kind": "Event", + "lastTimestamp": null, + "message": "Successfully assigned highload-applications/api-54f7cc6f98-p5pzh to marlosrv0", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:51Z", + "name": "api-54f7cc6f98-p5pzh.18e2fc2837f81d3c", + "namespace": "highload-applications", + "resourceVersion": "60162548", + "uid": "cc613143-489a-4bc4-893c-5d76ac3eb379" + }, + "reason": "Scheduled", + "reportingComponent": "default-scheduler", + "reportingInstance": "default-scheduler-marlosrv0", + "source": {}, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:51Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-p5pzh", + "namespace": "highload-applications", + "resourceVersion": "60162546", + "uid": "e6de6505-03c7-4b68-bb14-d776dfc60ff6" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:51Z", + "message": "Container image \"asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3\" already present on machine", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:51Z", + "name": "api-54f7cc6f98-p5pzh.18e2fc285654b589", + "namespace": "highload-applications", + "resourceVersion": "60162559", + "uid": "1d24d5da-ebcf-4a40-a8bb-337307f167f7" + }, + "reason": "Pulled", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:51Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-p5pzh", + "namespace": "highload-applications", + "resourceVersion": "60162546", + "uid": "e6de6505-03c7-4b68-bb14-d776dfc60ff6" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:51Z", + "message": "Created container: api", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:51Z", + "name": "api-54f7cc6f98-p5pzh.18e2fc2857905410", + "namespace": "highload-applications", + "resourceVersion": "60162560", + "uid": "c886016c-1956-45a2-ad9e-a860484fbf03" + }, + "reason": "Created", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:51Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-p5pzh", + "namespace": "highload-applications", + "resourceVersion": "60162546", + "uid": "e6de6505-03c7-4b68-bb14-d776dfc60ff6" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:51Z", + "message": "Started container api", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:51Z", + "name": "api-54f7cc6f98-p5pzh.18e2fc285ace5f78", + "namespace": "highload-applications", + "resourceVersion": "60162561", + "uid": "6a4a0c39-46ec-4a45-82eb-2621a1729978" + }, + "reason": "Started", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 5, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:21:44Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-p5pzh", + "namespace": "highload-applications", + "resourceVersion": "60162546", + "uid": "e6de6505-03c7-4b68-bb14-d776dfc60ff6" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:21:54Z", + "message": "Readiness probe failed: Get \"http://10.1.112.109:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:21:44Z", + "name": "api-54f7cc6f98-p5pzh.18e2fc34a54480fb", + "namespace": "highload-applications", + "resourceVersion": "60162844", + "uid": "88dcad08-0f91-4d26-8a76-ef7bf57b3720" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:21:48Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-p5pzh", + "namespace": "highload-applications", + "resourceVersion": "60162546", + "uid": "e6de6505-03c7-4b68-bb14-d776dfc60ff6" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:21:48Z", + "message": "Readiness probe failed: HTTP probe failed with statuscode: 503", + "metadata": { + "creationTimestamp": "2026-10-29T11:21:48Z", + "name": "api-54f7cc6f98-p5pzh.18e2fc3593c4a1aa", + "namespace": "highload-applications", + "resourceVersion": "60162821", + "uid": "ed456697-9a8f-4381-bf44-86aa2a21c9e2" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:33Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-p5pzh", + "namespace": "highload-applications", + "resourceVersion": "60162546", + "uid": "e6de6505-03c7-4b68-bb14-d776dfc60ff6" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:33Z", + "message": "Stopping container api", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:33Z", + "name": "api-54f7cc6f98-p5pzh.18e2fc40192b0b76", + "namespace": "highload-applications", + "resourceVersion": "60163102", + "uid": "983b52e1-77cf-49dc-ae0e-cddf1f2a7b9e" + }, + "reason": "Killing", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 6, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:17:44Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-w78wt", + "namespace": "highload-applications", + "resourceVersion": "60161485", + "uid": "6a16a4ff-c8e7-4d26-a5fa-fee874a3f7f2" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:28Z", + "message": "Readiness probe failed: Get \"http://10.1.25.81:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:17:49Z", + "name": "api-54f7cc6f98-w78wt.18e2fbfccfde780b", + "namespace": "highload-applications", + "resourceVersion": "60162189", + "uid": "8ba3ff9f-dd6f-47e8-a663-73e96ca5827d" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:28Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-w78wt", + "namespace": "highload-applications", + "resourceVersion": "60161485", + "uid": "6a16a4ff-c8e7-4d26-a5fa-fee874a3f7f2" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:28Z", + "message": "Stopping container api", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:28Z", + "name": "api-54f7cc6f98-w78wt.18e2fc1503ce1ac1", + "namespace": "highload-applications", + "resourceVersion": "60162187", + "uid": "a7d5e841-50ea-467d-8749-07fcbb25ab93" + }, + "reason": "Killing", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:22Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "ReplicaSet", + "name": "api-54f7cc6f98", + "namespace": "highload-applications", + "resourceVersion": "60162123", + "uid": "9a9710e1-f5e8-456c-a8d9-6a6a06fe4839" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:22Z", + "message": "Deleted pod: api-54f7cc6f98-w78wt", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:22Z", + "name": "api-54f7cc6f98.18e2fc138bd3a8de", + "namespace": "highload-applications", + "resourceVersion": "60162128", + "uid": "0c701733-5988-40b7-8fa5-b5c0836e974c" + }, + "reason": "SuccessfulDelete", + "reportingComponent": "replicaset-controller", + "reportingInstance": "", + "source": { + "component": "replicaset-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:31Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "ReplicaSet", + "name": "api-54f7cc6f98", + "namespace": "highload-applications", + "resourceVersion": "60162227", + "uid": "9a9710e1-f5e8-456c-a8d9-6a6a06fe4839" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:31Z", + "message": "Deleted pod: api-54f7cc6f98-jzbb7", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:31Z", + "name": "api-54f7cc6f98.18e2fc15b7d28ce1", + "namespace": "highload-applications", + "resourceVersion": "60162230", + "uid": "b45a1e56-d302-46e3-8cfb-08a34b4bed29" + }, + "reason": "SuccessfulDelete", + "reportingComponent": "replicaset-controller", + "reportingInstance": "", + "source": { + "component": "replicaset-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:51Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "ReplicaSet", + "name": "api-54f7cc6f98", + "namespace": "highload-applications", + "resourceVersion": "60162542", + "uid": "9a9710e1-f5e8-456c-a8d9-6a6a06fe4839" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:51Z", + "message": "Created pod: api-54f7cc6f98-p5pzh", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:51Z", + "name": "api-54f7cc6f98.18e2fc2836e53169", + "namespace": "highload-applications", + "resourceVersion": "60162544", + "uid": "01b4a797-de46-4eef-a70a-5a7a2d8aa530" + }, + "reason": "SuccessfulCreate", + "reportingComponent": "replicaset-controller", + "reportingInstance": "", + "source": { + "component": "replicaset-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:21:06Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "ReplicaSet", + "name": "api-54f7cc6f98", + "namespace": "highload-applications", + "resourceVersion": "60162671", + "uid": "9a9710e1-f5e8-456c-a8d9-6a6a06fe4839" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:21:06Z", + "message": "Created pod: api-54f7cc6f98-2277p", + "metadata": { + "creationTimestamp": "2026-10-29T11:21:06Z", + "name": "api-54f7cc6f98.18e2fc2bc2606e26", + "namespace": "highload-applications", + "resourceVersion": "60162674", + "uid": "8b11ffd9-9c45-4614-8d3c-d1c868f1a76a" + }, + "reason": "SuccessfulCreate", + "reportingComponent": "replicaset-controller", + "reportingInstance": "", + "source": { + "component": "replicaset-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:28Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "ReplicaSet", + "name": "api-54f7cc6f98", + "namespace": "highload-applications", + "resourceVersion": "60162991", + "uid": "9a9710e1-f5e8-456c-a8d9-6a6a06fe4839" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:28Z", + "message": "Deleted pod: api-54f7cc6f98-2277p", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:28Z", + "name": "api-54f7cc6f98.18e2fc3ecb8eec04", + "namespace": "highload-applications", + "resourceVersion": "60162994", + "uid": "b5ee2f2c-0f7d-4aa0-bb8e-81cd90ff232d" + }, + "reason": "SuccessfulDelete", + "reportingComponent": "replicaset-controller", + "reportingInstance": "", + "source": { + "component": "replicaset-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:33Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "ReplicaSet", + "name": "api-54f7cc6f98", + "namespace": "highload-applications", + "resourceVersion": "60163094", + "uid": "9a9710e1-f5e8-456c-a8d9-6a6a06fe4839" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:33Z", + "message": "Deleted pod: api-54f7cc6f98-p5pzh", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:33Z", + "name": "api-54f7cc6f98.18e2fc4018c82774", + "namespace": "highload-applications", + "resourceVersion": "60163098", + "uid": "f4595847-98f0-405a-a4bd-e1980ae12380" + }, + "reason": "SuccessfulDelete", + "reportingComponent": "replicaset-controller", + "reportingInstance": "", + "source": { + "component": "replicaset-controller" + }, + "type": "Normal" + }, + { + "action": "Binding", + "apiVersion": "v1", + "eventTime": "2026-10-29T11:22:28.318800Z", + "firstTimestamp": null, + "involvedObject": { + "apiVersion": "v1", + "kind": "Pod", + "name": "api-577bffc7b-7pfjv", + "namespace": "highload-applications", + "resourceVersion": "60162999", + "uid": "56b44bd1-0f98-4169-ba8e-b70b6262b818" + }, + "kind": "Event", + "lastTimestamp": null, + "message": "Successfully assigned highload-applications/api-577bffc7b-7pfjv to dev.asisti.tech", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:28Z", + "name": "api-577bffc7b-7pfjv.18e2fc3ecddc17c4", + "namespace": "highload-applications", + "resourceVersion": "60163006", + "uid": "e5ff08be-47ea-40e6-b19a-d15d488a1008" + }, + "reason": "Scheduled", + "reportingComponent": "default-scheduler", + "reportingInstance": "default-scheduler-marlosrv0", + "source": {}, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:29Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-7pfjv", + "namespace": "highload-applications", + "resourceVersion": "60163002", + "uid": "56b44bd1-0f98-4169-ba8e-b70b6262b818" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:29Z", + "message": "Container image \"asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3\" already present on machine", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:29Z", + "name": "api-577bffc7b-7pfjv.18e2fc3f160ea88c", + "namespace": "highload-applications", + "resourceVersion": "60163029", + "uid": "3071b88b-743d-46ee-939f-32e0bf21e9d5" + }, + "reason": "Pulled", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:29Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-7pfjv", + "namespace": "highload-applications", + "resourceVersion": "60163002", + "uid": "56b44bd1-0f98-4169-ba8e-b70b6262b818" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:29Z", + "message": "Created container: api", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:29Z", + "name": "api-577bffc7b-7pfjv.18e2fc3f1a07e76b", + "namespace": "highload-applications", + "resourceVersion": "60163032", + "uid": "dac34e80-865b-4c00-a0fd-3061e0537124" + }, + "reason": "Created", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:29Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-7pfjv", + "namespace": "highload-applications", + "resourceVersion": "60163002", + "uid": "56b44bd1-0f98-4169-ba8e-b70b6262b818" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:29Z", + "message": "Started container api", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:29Z", + "name": "api-577bffc7b-7pfjv.18e2fc3f281a0a9e", + "namespace": "highload-applications", + "resourceVersion": "60163033", + "uid": "2f249c7e-4958-458a-aa92-e1dfd3b38c88" + }, + "reason": "Started", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 3, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:23:00Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-7pfjv", + "namespace": "highload-applications", + "resourceVersion": "60163002", + "uid": "56b44bd1-0f98-4169-ba8e-b70b6262b818" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:23:04Z", + "message": "Readiness probe failed: Get \"http://10.1.25.123:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:23:06Z", + "name": "api-577bffc7b-7pfjv.18e2fc465cdc337d", + "namespace": "highload-applications", + "resourceVersion": "60163223", + "uid": "bdefbc90-9498-475a-9571-55e334b030b1" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "action": "Binding", + "apiVersion": "v1", + "eventTime": "2026-10-29T11:22:28.997450Z", + "firstTimestamp": null, + "involvedObject": { + "apiVersion": "v1", + "kind": "Pod", + "name": "api-577bffc7b-9dl4t", + "namespace": "highload-applications", + "resourceVersion": "60163014", + "uid": "2d8c4451-3413-48e8-8b56-7f05de06738f" + }, + "kind": "Event", + "lastTimestamp": null, + "message": "Successfully assigned highload-applications/api-577bffc7b-9dl4t to dev.asisti.tech", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:28Z", + "name": "api-577bffc7b-9dl4t.18e2fc3ef64f873c", + "namespace": "highload-applications", + "resourceVersion": "60163020", + "uid": "7f18a31a-874e-4f7e-be36-b4da90750880" + }, + "reason": "Scheduled", + "reportingComponent": "default-scheduler", + "reportingInstance": "default-scheduler-marlosrv0", + "source": {}, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:30Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-9dl4t", + "namespace": "highload-applications", + "resourceVersion": "60163017", + "uid": "2d8c4451-3413-48e8-8b56-7f05de06738f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:30Z", + "message": "Container image \"asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3\" already present on machine", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:30Z", + "name": "api-577bffc7b-9dl4t.18e2fc3f53783a49", + "namespace": "highload-applications", + "resourceVersion": "60163047", + "uid": "e4324dae-5510-426d-9c0a-3893b496f121" + }, + "reason": "Pulled", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:30Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-9dl4t", + "namespace": "highload-applications", + "resourceVersion": "60163017", + "uid": "2d8c4451-3413-48e8-8b56-7f05de06738f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:30Z", + "message": "Created container: api", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:30Z", + "name": "api-577bffc7b-9dl4t.18e2fc3f5aaf746c", + "namespace": "highload-applications", + "resourceVersion": "60163048", + "uid": "02adf172-93ed-4375-8c0f-31fc42b28261" + }, + "reason": "Created", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:30Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-9dl4t", + "namespace": "highload-applications", + "resourceVersion": "60163017", + "uid": "2d8c4451-3413-48e8-8b56-7f05de06738f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:30Z", + "message": "Started container api", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:30Z", + "name": "api-577bffc7b-9dl4t.18e2fc3f691a4ecf", + "namespace": "highload-applications", + "resourceVersion": "60163052", + "uid": "145a67a2-fe47-4e5e-891f-189c5fb624ad" + }, + "reason": "Started", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 3, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:59Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-9dl4t", + "namespace": "highload-applications", + "resourceVersion": "60163017", + "uid": "2d8c4451-3413-48e8-8b56-7f05de06738f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:23:03Z", + "message": "Readiness probe failed: Get \"http://10.1.25.88:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:59Z", + "name": "api-577bffc7b-9dl4t.18e2fc462186f252", + "namespace": "highload-applications", + "resourceVersion": "60163220", + "uid": "9c07ae42-255b-40c6-bb26-b28466c18f1c" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "action": "Binding", + "apiVersion": "v1", + "eventTime": "2026-10-29T11:19:22.570826Z", + "firstTimestamp": null, + "involvedObject": { + "apiVersion": "v1", + "kind": "Pod", + "name": "api-577bffc7b-c9wsv", + "namespace": "highload-applications", + "resourceVersion": "60162133", + "uid": "eda3f3ef-ee8b-453b-89fd-6a2b778d380c" + }, + "kind": "Event", + "lastTimestamp": null, + "message": "Successfully assigned highload-applications/api-577bffc7b-c9wsv to dev.asisti.tech", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:22Z", + "name": "api-577bffc7b-c9wsv.18e2fc138e6af003", + "namespace": "highload-applications", + "resourceVersion": "60162139", + "uid": "ebe407ac-5846-473e-9cd1-6eb8510ffd92" + }, + "reason": "Scheduled", + "reportingComponent": "default-scheduler", + "reportingInstance": "default-scheduler-marlosrv0", + "source": {}, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:29Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-c9wsv", + "namespace": "highload-applications", + "resourceVersion": "60162136", + "uid": "eda3f3ef-ee8b-453b-89fd-6a2b778d380c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:29Z", + "message": "Container image \"asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3\" already present on machine", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:29Z", + "name": "api-577bffc7b-c9wsv.18e2fc153c95f33e", + "namespace": "highload-applications", + "resourceVersion": "60162205", + "uid": "afdfd685-c2e9-4634-9b3d-b40b17a664f1" + }, + "reason": "Pulled", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:29Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-c9wsv", + "namespace": "highload-applications", + "resourceVersion": "60162136", + "uid": "eda3f3ef-ee8b-453b-89fd-6a2b778d380c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:29Z", + "message": "Created container: api", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:29Z", + "name": "api-577bffc7b-c9wsv.18e2fc15408bc10a", + "namespace": "highload-applications", + "resourceVersion": "60162208", + "uid": "891327fe-f1da-4dc6-81b0-230aa86e1f3f" + }, + "reason": "Created", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:30Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-c9wsv", + "namespace": "highload-applications", + "resourceVersion": "60162136", + "uid": "eda3f3ef-ee8b-453b-89fd-6a2b778d380c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:30Z", + "message": "Started container api", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:30Z", + "name": "api-577bffc7b-c9wsv.18e2fc154fdb5f34", + "namespace": "highload-applications", + "resourceVersion": "60162211", + "uid": "677aabfa-2295-4a06-94d0-ad85bac4912c" + }, + "reason": "Started", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 5, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:23Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-c9wsv", + "namespace": "highload-applications", + "resourceVersion": "60162136", + "uid": "eda3f3ef-ee8b-453b-89fd-6a2b778d380c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:39Z", + "message": "Readiness probe failed: Get \"http://10.1.25.118:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:23Z", + "name": "api-577bffc7b-c9wsv.18e2fc21ce851361", + "namespace": "highload-applications", + "resourceVersion": "60162487", + "uid": "7a60d2f3-4ad2-4400-aa03-6fb8b6478b2b" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:54Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-c9wsv", + "namespace": "highload-applications", + "resourceVersion": "60162136", + "uid": "eda3f3ef-ee8b-453b-89fd-6a2b778d380c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:54Z", + "message": "Stopping container api", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:54Z", + "name": "api-577bffc7b-c9wsv.18e2fc2907ca7bcf", + "namespace": "highload-applications", + "resourceVersion": "60162604", + "uid": "9ed1c53a-75f1-4709-88d9-6d4b0ddbb080" + }, + "reason": "Killing", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:57Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-577bffc7b-c9wsv", + "namespace": "highload-applications", + "resourceVersion": "60162136", + "uid": "eda3f3ef-ee8b-453b-89fd-6a2b778d380c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:57Z", + "message": "Readiness probe failed: Get \"http://10.1.25.118:8080/health/ready\": dial tcp 10.1.25.118:8080: connect: connection refused", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:57Z", + "name": "api-577bffc7b-c9wsv.18e2fc29bfbdd4a3", + "namespace": "highload-applications", + "resourceVersion": "60162625", + "uid": "38b47972-2662-4214-9a07-06e1ba37366c" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:22Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "ReplicaSet", + "name": "api-577bffc7b", + "namespace": "highload-applications", + "resourceVersion": "60162127", + "uid": "3b15ef13-9497-4746-b092-f16be09d480c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:22Z", + "message": "Created pod: api-577bffc7b-c9wsv", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:22Z", + "name": "api-577bffc7b.18e2fc138dbe45d8", + "namespace": "highload-applications", + "resourceVersion": "60162135", + "uid": "eb2c537f-95e6-4777-9301-9c28070c3641" + }, + "reason": "SuccessfulCreate", + "reportingComponent": "replicaset-controller", + "reportingInstance": "", + "source": { + "component": "replicaset-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:54Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "ReplicaSet", + "name": "api-577bffc7b", + "namespace": "highload-applications", + "resourceVersion": "60162597", + "uid": "3b15ef13-9497-4746-b092-f16be09d480c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:54Z", + "message": "Deleted pod: api-577bffc7b-c9wsv", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:54Z", + "name": "api-577bffc7b.18e2fc290660857f", + "namespace": "highload-applications", + "resourceVersion": "60162600", + "uid": "4705e1fb-4132-4cc6-92f0-692459770281" + }, + "reason": "SuccessfulDelete", + "reportingComponent": "replicaset-controller", + "reportingInstance": "", + "source": { + "component": "replicaset-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:28Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "ReplicaSet", + "name": "api-577bffc7b", + "namespace": "highload-applications", + "resourceVersion": "60162993", + "uid": "3b15ef13-9497-4746-b092-f16be09d480c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:28Z", + "message": "Created pod: api-577bffc7b-7pfjv", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:28Z", + "name": "api-577bffc7b.18e2fc3ecd29e1ba", + "namespace": "highload-applications", + "resourceVersion": "60163003", + "uid": "e7b962b0-1833-47a7-a7e5-149fcab15766" + }, + "reason": "SuccessfulCreate", + "reportingComponent": "replicaset-controller", + "reportingInstance": "", + "source": { + "component": "replicaset-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:28Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "ReplicaSet", + "name": "api-577bffc7b", + "namespace": "highload-applications", + "resourceVersion": "60163013", + "uid": "3b15ef13-9497-4746-b092-f16be09d480c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:28Z", + "message": "Created pod: api-577bffc7b-9dl4t", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:28Z", + "name": "api-577bffc7b.18e2fc3ef59b6dcf", + "namespace": "highload-applications", + "resourceVersion": "60163016", + "uid": "3c8783a1-f5df-40dc-93ea-54677c3aa6fa" + }, + "reason": "SuccessfulCreate", + "reportingComponent": "replicaset-controller", + "reportingInstance": "", + "source": { + "component": "replicaset-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 38, + "eventTime": null, + "firstTimestamp": "2026-10-29T10:58:42Z", + "involvedObject": { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60162122", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:22Z", + "message": "(combined from similar events): Scaled down replica set api-54f7cc6f98 from 2 to 1", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:22Z", + "name": "api.18e2faf2c643f5fd", + "namespace": "highload-applications", + "resourceVersion": "60162125", + "uid": "b7b420d6-e7f4-4ce3-8e11-00a1d69c724d" + }, + "reason": "ScalingReplicaSet", + "reportingComponent": "", + "reportingInstance": "", + "source": { + "component": "deployment-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 4, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:17:06Z", + "involvedObject": { + "apiVersion": "autoscaling/v2", + "kind": "HorizontalPodAutoscaler", + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60161619", + "uid": "f4ff85e3-7a2e-4a63-af15-7227d6125fa5" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:29Z", + "message": "failed to get cpu utilization: did not receive metrics for targeted pods (pods might be unready)", + "metadata": { + "creationTimestamp": "2026-10-29T11:17:06Z", + "name": "api.18e2fbf3e0e732ee", + "namespace": "highload-applications", + "resourceVersion": "60162196", + "uid": "cb64f8f6-45bc-481b-8a74-0ae1f9277a88" + }, + "reason": "FailedGetResourceMetric", + "reportingComponent": "horizontal-pod-autoscaler", + "reportingInstance": "", + "source": { + "component": "horizontal-pod-autoscaler" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 4, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:17:06Z", + "involvedObject": { + "apiVersion": "autoscaling/v2", + "kind": "HorizontalPodAutoscaler", + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60161619", + "uid": "f4ff85e3-7a2e-4a63-af15-7227d6125fa5" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:29Z", + "message": "invalid metrics (1 invalid out of 1), first error is: failed to get cpu resource metric value: failed to get cpu utilization: did not receive metrics for targeted pods (pods might be unready)", + "metadata": { + "creationTimestamp": "2026-10-29T11:17:06Z", + "name": "api.18e2fbf3e1d04cf2", + "namespace": "highload-applications", + "resourceVersion": "60162198", + "uid": "4e6e628b-c8f4-4dc3-b405-abdffb0650e4" + }, + "reason": "FailedComputeMetricsReplicas", + "reportingComponent": "horizontal-pod-autoscaler", + "reportingInstance": "", + "source": { + "component": "horizontal-pod-autoscaler" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:29Z", + "involvedObject": { + "apiVersion": "autoscaling/v2", + "kind": "HorizontalPodAutoscaler", + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60162076", + "uid": "f4ff85e3-7a2e-4a63-af15-7227d6125fa5" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:29Z", + "message": "Operation cannot be fulfilled on horizontalpodautoscalers.autoscaling \"api\": StorageError: invalid object, Code: 4, Key: /registry/horizontalpodautoscalers/highload-applications/api, ResourceVersion: 0, AdditionalErrorMsg: Precondition failed: UID in precondition: f4ff85e3-7a2e-4a63-af15-7227d6125fa5, UID in object meta: ", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:29Z", + "name": "api.18e2fc1527c4ebba", + "namespace": "highload-applications", + "resourceVersion": "60162197", + "uid": "c6d1900c-5bcf-43d8-9df2-b8c2a7a07b7f" + }, + "reason": "FailedUpdateStatus", + "reportingComponent": "horizontal-pod-autoscaler", + "reportingInstance": "", + "source": { + "component": "horizontal-pod-autoscaler" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 2, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:21:06Z", + "involvedObject": { + "apiVersion": "autoscaling/v2", + "kind": "HorizontalPodAutoscaler", + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60162552", + "uid": "72625cc0-d163-4075-9335-816cfb2102de" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:28Z", + "message": "New size: 2; reason: Current number of replicas below Spec.MinReplicas", + "metadata": { + "creationTimestamp": "2026-10-29T11:21:06Z", + "name": "api.18e2fc2bc0281d3b", + "namespace": "highload-applications", + "resourceVersion": "60163012", + "uid": "5f5f73c0-9a13-4a1d-a18a-a8155c857ba2" + }, + "reason": "SuccessfulRescale", + "reportingComponent": "horizontal-pod-autoscaler", + "reportingInstance": "", + "source": { + "component": "horizontal-pod-autoscaler" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:13Z", + "involvedObject": { + "apiVersion": "autoscaling/v2", + "kind": "HorizontalPodAutoscaler", + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60162865", + "uid": "72625cc0-d163-4075-9335-816cfb2102de" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:13Z", + "message": "failed to get cpu utilization: did not receive metrics for targeted pods (pods might be unready)", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:13Z", + "name": "api.18e2fc3b74533e5b", + "namespace": "highload-applications", + "resourceVersion": "60162945", + "uid": "d2382884-b07f-4f62-97bb-4799c9dca7ba" + }, + "reason": "FailedGetResourceMetric", + "reportingComponent": "horizontal-pod-autoscaler", + "reportingInstance": "", + "source": { + "component": "horizontal-pod-autoscaler" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:13Z", + "involvedObject": { + "apiVersion": "autoscaling/v2", + "kind": "HorizontalPodAutoscaler", + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60162865", + "uid": "72625cc0-d163-4075-9335-816cfb2102de" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:13Z", + "message": "invalid metrics (1 invalid out of 1), first error is: failed to get cpu resource metric value: failed to get cpu utilization: did not receive metrics for targeted pods (pods might be unready)", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:13Z", + "name": "api.18e2fc3b75378ced", + "namespace": "highload-applications", + "resourceVersion": "60162947", + "uid": "45596b12-4bb5-4e5b-8676-cf0bb514a246" + }, + "reason": "FailedComputeMetricsReplicas", + "reportingComponent": "horizontal-pod-autoscaler", + "reportingInstance": "", + "source": { + "component": "horizontal-pod-autoscaler" + }, + "type": "Warning" + }, + { + "action": "Binding", + "apiVersion": "v1", + "eventTime": "2026-10-29T11:20:06.178578Z", + "firstTimestamp": null, + "involvedObject": { + "apiVersion": "v1", + "kind": "Pod", + "name": "load-growing1-20261029111920-qrwb8", + "namespace": "highload-applications", + "resourceVersion": "60162362", + "uid": "23f73e0e-d7ca-41bb-9747-5a520690afcc" + }, + "kind": "Event", + "lastTimestamp": null, + "message": "Successfully assigned highload-applications/load-growing1-20261029111920-qrwb8 to dev.asisti.tech", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:06Z", + "name": "load-growing1-20261029111920-qrwb8.18e2fc1db5a489bc", + "namespace": "highload-applications", + "resourceVersion": "60162366", + "uid": "5e59068d-bb67-438c-aabf-2ae629f1d26a" + }, + "reason": "Scheduled", + "reportingComponent": "default-scheduler", + "reportingInstance": "default-scheduler-marlosrv0", + "source": {}, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:07Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{k6}", + "kind": "Pod", + "name": "load-growing1-20261029111920-qrwb8", + "namespace": "highload-applications", + "resourceVersion": "60162364", + "uid": "23f73e0e-d7ca-41bb-9747-5a520690afcc" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:07Z", + "message": "Container image \"grafana/k6:1.3.0\" already present on machine", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:07Z", + "name": "load-growing1-20261029111920-qrwb8.18e2fc1e1dbbd6ae", + "namespace": "highload-applications", + "resourceVersion": "60162373", + "uid": "f7e9c2dd-1e7a-4dbb-b644-148366724b7b" + }, + "reason": "Pulled", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:07Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{k6}", + "kind": "Pod", + "name": "load-growing1-20261029111920-qrwb8", + "namespace": "highload-applications", + "resourceVersion": "60162364", + "uid": "23f73e0e-d7ca-41bb-9747-5a520690afcc" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:07Z", + "message": "Created container: k6", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:08Z", + "name": "load-growing1-20261029111920-qrwb8.18e2fc1e20bc70b1", + "namespace": "highload-applications", + "resourceVersion": "60162374", + "uid": "7b447aae-177c-41c2-95f8-64c2d2cb5a4c" + }, + "reason": "Created", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:08Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{k6}", + "kind": "Pod", + "name": "load-growing1-20261029111920-qrwb8", + "namespace": "highload-applications", + "resourceVersion": "60162364", + "uid": "23f73e0e-d7ca-41bb-9747-5a520690afcc" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:08Z", + "message": "Started container k6", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:08Z", + "name": "load-growing1-20261029111920-qrwb8.18e2fc1e276602d7", + "namespace": "highload-applications", + "resourceVersion": "60162377", + "uid": "44dfef0e-d45b-472d-9971-de49c8e29701" + }, + "reason": "Started", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:06Z", + "involvedObject": { + "apiVersion": "batch/v1", + "kind": "Job", + "name": "load-growing1-20261029111920", + "namespace": "highload-applications", + "resourceVersion": "60162361", + "uid": "f9646401-1671-46d3-b2d4-aee29e410257" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:06Z", + "message": "Created pod: load-growing1-20261029111920-qrwb8", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:06Z", + "name": "load-growing1-20261029111920.18e2fc1db4b37df7", + "namespace": "highload-applications", + "resourceVersion": "60162363", + "uid": "13558755-4499-4e00-9fd9-f886e31cfeaa" + }, + "reason": "SuccessfulCreate", + "reportingComponent": "job-controller", + "reportingInstance": "", + "source": { + "component": "job-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:21:05Z", + "involvedObject": { + "apiVersion": "batch/v1", + "kind": "Job", + "name": "load-growing1-20261029111920", + "namespace": "highload-applications", + "resourceVersion": "60162663", + "uid": "f9646401-1671-46d3-b2d4-aee29e410257" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:21:05Z", + "message": "Job completed", + "metadata": { + "creationTimestamp": "2026-10-29T11:21:05Z", + "name": "load-growing1-20261029111920.18e2fc2b7e0fdbb1", + "namespace": "highload-applications", + "resourceVersion": "60162666", + "uid": "788b9ebd-7f57-4cc7-a177-8467db135fc3" + }, + "reason": "Completed", + "reportingComponent": "job-controller", + "reportingInstance": "", + "source": { + "component": "job-controller" + }, + "type": "Normal" + }, + { + "action": "Binding", + "apiVersion": "v1", + "eventTime": "2026-10-29T11:23:14.626066Z", + "firstTimestamp": null, + "involvedObject": { + "apiVersion": "v1", + "kind": "Pod", + "name": "load-growing1-20261029112219-kb6g4", + "namespace": "highload-applications", + "resourceVersion": "60163252", + "uid": "d57e423b-69e7-4f21-bfd3-b39be3580e8b" + }, + "kind": "Event", + "lastTimestamp": null, + "message": "Successfully assigned highload-applications/load-growing1-20261029112219-kb6g4 to dev.asisti.tech", + "metadata": { + "creationTimestamp": "2026-10-29T11:23:14Z", + "name": "load-growing1-20261029112219-kb6g4.18e2fc4995fd1146", + "namespace": "highload-applications", + "resourceVersion": "60163256", + "uid": "66ce5470-9471-4425-9cf1-e7d56f926ade" + }, + "reason": "Scheduled", + "reportingComponent": "default-scheduler", + "reportingInstance": "default-scheduler-marlosrv0", + "source": {}, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:23:16Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{k6}", + "kind": "Pod", + "name": "load-growing1-20261029112219-kb6g4", + "namespace": "highload-applications", + "resourceVersion": "60163254", + "uid": "d57e423b-69e7-4f21-bfd3-b39be3580e8b" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:23:16Z", + "message": "Container image \"grafana/k6:1.3.0\" already present on machine", + "metadata": { + "creationTimestamp": "2026-10-29T11:23:16Z", + "name": "load-growing1-20261029112219-kb6g4.18e2fc49e935101b", + "namespace": "highload-applications", + "resourceVersion": "60163265", + "uid": "917ffe13-8c73-48a6-a753-a8aacf92ea89" + }, + "reason": "Pulled", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:23:16Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{k6}", + "kind": "Pod", + "name": "load-growing1-20261029112219-kb6g4", + "namespace": "highload-applications", + "resourceVersion": "60163254", + "uid": "d57e423b-69e7-4f21-bfd3-b39be3580e8b" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:23:16Z", + "message": "Created container: k6", + "metadata": { + "creationTimestamp": "2026-10-29T11:23:16Z", + "name": "load-growing1-20261029112219-kb6g4.18e2fc49eb96ed3f", + "namespace": "highload-applications", + "resourceVersion": "60163266", + "uid": "e8f1c283-5a87-4097-81f1-540923c54354" + }, + "reason": "Created", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:23:16Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{k6}", + "kind": "Pod", + "name": "load-growing1-20261029112219-kb6g4", + "namespace": "highload-applications", + "resourceVersion": "60163254", + "uid": "d57e423b-69e7-4f21-bfd3-b39be3580e8b" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:23:16Z", + "message": "Started container k6", + "metadata": { + "creationTimestamp": "2026-10-29T11:23:16Z", + "name": "load-growing1-20261029112219-kb6g4.18e2fc49f18cd249", + "namespace": "highload-applications", + "resourceVersion": "60163267", + "uid": "0ca6f304-e4be-4bd6-be86-1352180c04ee" + }, + "reason": "Started", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:23:14Z", + "involvedObject": { + "apiVersion": "batch/v1", + "kind": "Job", + "name": "load-growing1-20261029112219", + "namespace": "highload-applications", + "resourceVersion": "60163251", + "uid": "7d536025-a5f2-4290-9ea0-54643341b97c" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:23:14Z", + "message": "Created pod: load-growing1-20261029112219-kb6g4", + "metadata": { + "creationTimestamp": "2026-10-29T11:23:14Z", + "name": "load-growing1-20261029112219.18e2fc499511e3c2", + "namespace": "highload-applications", + "resourceVersion": "60163253", + "uid": "20f5e6c5-0ec5-4744-9bc7-31d5544077c1" + }, + "reason": "SuccessfulCreate", + "reportingComponent": "job-controller", + "reportingInstance": "", + "source": { + "component": "job-controller" + }, + "type": "Normal" + }, + { + "action": "Binding", + "apiVersion": "v1", + "eventTime": "2026-10-29T11:19:23.237540Z", + "firstTimestamp": null, + "involvedObject": { + "apiVersion": "v1", + "kind": "Pod", + "name": "migrate-16-r5cdz", + "namespace": "highload-applications", + "resourceVersion": "60162146", + "uid": "3e94c137-2626-43c3-b771-cd4145574bc1" + }, + "kind": "Event", + "lastTimestamp": null, + "message": "Successfully assigned highload-applications/migrate-16-r5cdz to dev.asisti.tech", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:23Z", + "name": "migrate-16-r5cdz.18e2fc13b6282eae", + "namespace": "highload-applications", + "resourceVersion": "60162150", + "uid": "d0b65008-3cef-40c2-a4d0-db44e4e50601" + }, + "reason": "Scheduled", + "reportingComponent": "default-scheduler", + "reportingInstance": "default-scheduler-marlosrv0", + "source": {}, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:29Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{migrate}", + "kind": "Pod", + "name": "migrate-16-r5cdz", + "namespace": "highload-applications", + "resourceVersion": "60162149", + "uid": "3e94c137-2626-43c3-b771-cd4145574bc1" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:29Z", + "message": "Container image \"asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3\" already present on machine", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:29Z", + "name": "migrate-16-r5cdz.18e2fc153e8b96c2", + "namespace": "highload-applications", + "resourceVersion": "60162207", + "uid": "98e2eb55-3a75-49ec-92e1-9b79c54311a3" + }, + "reason": "Pulled", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:29Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{migrate}", + "kind": "Pod", + "name": "migrate-16-r5cdz", + "namespace": "highload-applications", + "resourceVersion": "60162149", + "uid": "3e94c137-2626-43c3-b771-cd4145574bc1" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:29Z", + "message": "Created container: migrate", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:29Z", + "name": "migrate-16-r5cdz.18e2fc15423dfe61", + "namespace": "highload-applications", + "resourceVersion": "60162209", + "uid": "bf30a313-588a-4c18-861b-e9d53b38f0d7" + }, + "reason": "Created", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:30Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{migrate}", + "kind": "Pod", + "name": "migrate-16-r5cdz", + "namespace": "highload-applications", + "resourceVersion": "60162149", + "uid": "3e94c137-2626-43c3-b771-cd4145574bc1" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:30Z", + "message": "Started container migrate", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:30Z", + "name": "migrate-16-r5cdz.18e2fc154a1c7ade", + "namespace": "highload-applications", + "resourceVersion": "60162210", + "uid": "91b80b55-8abb-4e5a-9190-6781fda37a59" + }, + "reason": "Started", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:23Z", + "involvedObject": { + "apiVersion": "batch/v1", + "kind": "Job", + "name": "migrate-16", + "namespace": "highload-applications", + "resourceVersion": "60162145", + "uid": "2a9108e2-2fc1-4391-b75e-b907f87355b8" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:23Z", + "message": "Created pod: migrate-16-r5cdz", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:23Z", + "name": "migrate-16.18e2fc13b59d4539", + "namespace": "highload-applications", + "resourceVersion": "60162147", + "uid": "f68cdc25-8b0e-4404-aa2d-bf8ae6033489" + }, + "reason": "SuccessfulCreate", + "reportingComponent": "job-controller", + "reportingInstance": "", + "source": { + "component": "job-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:19:33Z", + "involvedObject": { + "apiVersion": "batch/v1", + "kind": "Job", + "name": "migrate-16", + "namespace": "highload-applications", + "resourceVersion": "60162252", + "uid": "2a9108e2-2fc1-4391-b75e-b907f87355b8" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:19:33Z", + "message": "Job completed", + "metadata": { + "creationTimestamp": "2026-10-29T11:19:33Z", + "name": "migrate-16.18e2fc15fd2da6f8", + "namespace": "highload-applications", + "resourceVersion": "60162255", + "uid": "92407f93-1dbd-4b18-8de9-a6f2ca465da8" + }, + "reason": "Completed", + "reportingComponent": "job-controller", + "reportingInstance": "", + "source": { + "component": "job-controller" + }, + "type": "Normal" + }, + { + "action": "Binding", + "apiVersion": "v1", + "eventTime": "2026-10-29T11:20:52.185631Z", + "firstTimestamp": null, + "involvedObject": { + "apiVersion": "v1", + "kind": "Pod", + "name": "migrate-17-qnn49", + "namespace": "highload-applications", + "resourceVersion": "60162563", + "uid": "aad7e921-0be5-4ff8-b32c-cfb0ddaf1a7b" + }, + "kind": "Event", + "lastTimestamp": null, + "message": "Successfully assigned highload-applications/migrate-17-qnn49 to dev.asisti.tech", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:52Z", + "name": "migrate-17-qnn49.18e2fc286be05c10", + "namespace": "highload-applications", + "resourceVersion": "60162567", + "uid": "52d37526-c80b-42ff-9e7d-847ae65bd892" + }, + "reason": "Scheduled", + "reportingComponent": "default-scheduler", + "reportingInstance": "default-scheduler-marlosrv0", + "source": {}, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:53Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{migrate}", + "kind": "Pod", + "name": "migrate-17-qnn49", + "namespace": "highload-applications", + "resourceVersion": "60162564", + "uid": "aad7e921-0be5-4ff8-b32c-cfb0ddaf1a7b" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:53Z", + "message": "Container image \"asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3\" already present on machine", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:53Z", + "name": "migrate-17-qnn49.18e2fc28a6bb5e20", + "namespace": "highload-applications", + "resourceVersion": "60162585", + "uid": "869b8d64-4475-496a-866c-d5d09626480f" + }, + "reason": "Pulled", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:53Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{migrate}", + "kind": "Pod", + "name": "migrate-17-qnn49", + "namespace": "highload-applications", + "resourceVersion": "60162564", + "uid": "aad7e921-0be5-4ff8-b32c-cfb0ddaf1a7b" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:53Z", + "message": "Created container: migrate", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:53Z", + "name": "migrate-17-qnn49.18e2fc28ab14d093", + "namespace": "highload-applications", + "resourceVersion": "60162586", + "uid": "2d9c11fc-a162-48a9-bdc8-f20be36a4de9" + }, + "reason": "Created", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:53Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{migrate}", + "kind": "Pod", + "name": "migrate-17-qnn49", + "namespace": "highload-applications", + "resourceVersion": "60162564", + "uid": "aad7e921-0be5-4ff8-b32c-cfb0ddaf1a7b" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:53Z", + "message": "Started container migrate", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:53Z", + "name": "migrate-17-qnn49.18e2fc28b2ad3bff", + "namespace": "highload-applications", + "resourceVersion": "60162587", + "uid": "d73e5547-fbe1-4a26-976c-2ee427aa5049" + }, + "reason": "Started", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:52Z", + "involvedObject": { + "apiVersion": "batch/v1", + "kind": "Job", + "name": "migrate-17", + "namespace": "highload-applications", + "resourceVersion": "60162562", + "uid": "7afb4cf6-b6fe-497c-a312-bfb3ca8a599f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:52Z", + "message": "Created pod: migrate-17-qnn49", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:52Z", + "name": "migrate-17.18e2fc286b7a4c43", + "namespace": "highload-applications", + "resourceVersion": "60162566", + "uid": "a856567b-cf66-4ea2-8925-87c6c17e4ff6" + }, + "reason": "SuccessfulCreate", + "reportingComponent": "job-controller", + "reportingInstance": "", + "source": { + "component": "job-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:20:56Z", + "involvedObject": { + "apiVersion": "batch/v1", + "kind": "Job", + "name": "migrate-17", + "namespace": "highload-applications", + "resourceVersion": "60162615", + "uid": "7afb4cf6-b6fe-497c-a312-bfb3ca8a599f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:20:56Z", + "message": "Job completed", + "metadata": { + "creationTimestamp": "2026-10-29T11:20:56Z", + "name": "migrate-17.18e2fc297012e67c", + "namespace": "highload-applications", + "resourceVersion": "60162618", + "uid": "64997301-d100-466b-8551-39fd27535277" + }, + "reason": "Completed", + "reportingComponent": "job-controller", + "reportingInstance": "", + "source": { + "component": "job-controller" + }, + "type": "Normal" + }, + { + "action": "Binding", + "apiVersion": "v1", + "eventTime": "2026-10-29T11:22:30.033193Z", + "firstTimestamp": null, + "involvedObject": { + "apiVersion": "v1", + "kind": "Pod", + "name": "migrate-18-lg8kn", + "namespace": "highload-applications", + "resourceVersion": "60163035", + "uid": "8ede605b-8720-4f85-98f2-cb214511251d" + }, + "kind": "Event", + "lastTimestamp": null, + "message": "Successfully assigned highload-applications/migrate-18-lg8kn to dev.asisti.tech", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:30Z", + "name": "migrate-18-lg8kn.18e2fc3f340badd2", + "namespace": "highload-applications", + "resourceVersion": "60163039", + "uid": "9911d781-2fe6-492c-aeca-235c5359be7f" + }, + "reason": "Scheduled", + "reportingComponent": "default-scheduler", + "reportingInstance": "default-scheduler-marlosrv0", + "source": {}, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:31Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{migrate}", + "kind": "Pod", + "name": "migrate-18-lg8kn", + "namespace": "highload-applications", + "resourceVersion": "60163038", + "uid": "8ede605b-8720-4f85-98f2-cb214511251d" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:31Z", + "message": "Container image \"asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3\" already present on machine", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:31Z", + "name": "migrate-18-lg8kn.18e2fc3f96c7a16d", + "namespace": "highload-applications", + "resourceVersion": "60163061", + "uid": "b46c03db-8711-4e10-bec0-ed1c9333dc99" + }, + "reason": "Pulled", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:31Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{migrate}", + "kind": "Pod", + "name": "migrate-18-lg8kn", + "namespace": "highload-applications", + "resourceVersion": "60163038", + "uid": "8ede605b-8720-4f85-98f2-cb214511251d" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:31Z", + "message": "Created container: migrate", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:31Z", + "name": "migrate-18-lg8kn.18e2fc3f9a19d199", + "namespace": "highload-applications", + "resourceVersion": "60163062", + "uid": "6caa3f49-2756-4c94-8636-c31d12783fec" + }, + "reason": "Created", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:31Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{migrate}", + "kind": "Pod", + "name": "migrate-18-lg8kn", + "namespace": "highload-applications", + "resourceVersion": "60163038", + "uid": "8ede605b-8720-4f85-98f2-cb214511251d" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:31Z", + "message": "Started container migrate", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:31Z", + "name": "migrate-18-lg8kn.18e2fc3fa15acbb8", + "namespace": "highload-applications", + "resourceVersion": "60163066", + "uid": "a46d577a-0a78-4112-a2a8-1d452c334003" + }, + "reason": "Started", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:30Z", + "involvedObject": { + "apiVersion": "batch/v1", + "kind": "Job", + "name": "migrate-18", + "namespace": "highload-applications", + "resourceVersion": "60163034", + "uid": "bb8776d0-fdc1-40f9-82a1-99456bb1b64b" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:30Z", + "message": "Created pod: migrate-18-lg8kn", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:30Z", + "name": "migrate-18.18e2fc3f332bd7b6", + "namespace": "highload-applications", + "resourceVersion": "60163036", + "uid": "d6519df8-2603-4f4b-8cb6-6f4d8ca40668" + }, + "reason": "SuccessfulCreate", + "reportingComponent": "job-controller", + "reportingInstance": "", + "source": { + "component": "job-controller" + }, + "type": "Normal" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:22:35Z", + "involvedObject": { + "apiVersion": "batch/v1", + "kind": "Job", + "name": "migrate-18", + "namespace": "highload-applications", + "resourceVersion": "60163113", + "uid": "bb8776d0-fdc1-40f9-82a1-99456bb1b64b" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:22:35Z", + "message": "Job completed", + "metadata": { + "creationTimestamp": "2026-10-29T11:22:35Z", + "name": "migrate-18.18e2fc405d3ad326", + "namespace": "highload-applications", + "resourceVersion": "60163116", + "uid": "9a23fd61-6832-4c14-9bf9-692c7576c823" + }, + "reason": "Completed", + "reportingComponent": "job-controller", + "reportingInstance": "", + "source": { + "component": "job-controller" + }, + "type": "Normal" + } + ], + "kind": "List", + "metadata": { + "resourceVersion": "" + } +} diff --git a/evidence/research-20261029-final/excluded.json b/evidence/research-20261029-final/excluded.json new file mode 100644 index 00000000..5f3a95ec --- /dev/null +++ b/evidence/research-20261029-final/excluded.json @@ -0,0 +1,6 @@ +[ + "evidence/research-20261029-final/load-growing1-20261029111013.json", + "evidence/research-20261029-final/load-saturation8-20261029111530.json", + "evidence/research-20261029-pool/deployment-saturation8-20261029112615.json (replica mismatch)", + "evidence/research-20261029-readiness/deployment-probe2a-20261029113757.json (replica mismatch)" +] diff --git a/evidence/research-20261029-final/invalid-growing1-log.txt b/evidence/research-20261029-final/invalid-growing1-log.txt new file mode 100644 index 00000000..6130ed66 --- /dev/null +++ b/evidence/research-20261029-final/invalid-growing1-log.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":1198,"fails":19},{"id":"f737ff9008ff036f7a4b775b05a953fa","passes":134,"fails":1,"name":"retry returns original","path":"::retry returns original"},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":1179,"fails":3}],"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[]},"options":{"summaryTimeUnit":"","noColor":false,"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"]},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":55367.980277},"metrics":{"failed_writes":{"values":{"count":19,"rate":0.3431586253452819},"type":"counter","contains":"default"},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_waiting":{"values":{"max":4013.911145,"avg":297.81720610999224,"p(50)":263.95369000000005,"p(95)":413.17917339999985,"p(99)":604.7509460200013},"type":"trend","contains":"time"},"iterations":{"type":"counter","contains":"default","values":{"rate":21.3480786925328,"count":1182}},"measured_operations":{"type":"counter","contains":"default","values":{"count":2400,"rate":43.3463526751935}},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":355.6252164868189,"p(50)":291.28524749999997,"p(95)":462.9099535499996,"p(99)":4005.9950556599997,"max":4014.418809}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(95)":406.2463302,"p(99)":504.5710182400003,"max":1187.822861,"avg":267.1168591070733,"p(50)":262.760403}},"http_req_receiving":{"type":"trend","contains":"time","values":{"p(99)":1.5840202100000005,"max":44.779815,"avg":0.2732304372579401,"p(50)":0.1597055,"p(95)":0.6923887000000001}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":298.2575188466307,"p(50)":264.407159,"p(95)":413.67931565,"p(99)":605.5805445600013,"max":4014.418809}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":3,"rate":0.054182940843991875},"thresholds":{"count>=0":{"ok":true}}},"vus":{"values":{"value":32,"min":0,"max":32},"type":"gauge","contains":"default"},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":1119,"rate":20.21023693480897}},"http_req_blocked":{"type":"trend","contains":"time","values":{"max":1255.149739,"avg":1.6344206080557782,"p(50)":0.000826,"p(95)":0.00135795,"p(99)":27.324818060000318}},"http_req_connecting":{"type":"trend","contains":"time","values":{"avg":0.6570658907823393,"p(50)":0,"p(95)":0,"p(99)":4.042904520000011,"max":1020.04565}},"http_req_sending":{"type":"trend","contains":"time","values":{"p(95)":0.2917665999999996,"p(99)":0.6606140900000003,"max":11.115504,"avg":0.16708229938032532,"p(50)":0.13094450000000002}},"data_sent":{"type":"counter","contains":"data","values":{"count":253256,"rate":4574.051622128669}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.008907823392718823,"passes":23,"fails":2559}},"application_errors":{"type":"counter","contains":"default","values":{"count":23,"rate":0.4154025464706044}},"application_errors{status:429}":{"contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter"},"checks":{"contains":"default","values":{"rate":0.9909234411996843,"passes":2511,"fails":23},"type":"rate"},"attempted_messages":{"type":"counter","contains":"default","values":{"count":1138,"rate":20.55339556015425}},"data_received":{"contains":"data","values":{"count":3434918,"rate":62037.98626598763},"type":"counter"},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"p(99)":19.32826936000025,"max":283.028296,"avg":0.5257641402013942,"p(50)":0,"p(95)":0}},"iteration_duration":{"contains":"time","values":{"avg":570.8932141150593,"p(50)":553.444838,"p(95)":905.7134026,"p(99)":1115.6861048000019,"max":2503.263238},"type":"trend"},"http_reqs":{"type":"counter","contains":"default","values":{"count":2582,"rate":46.633451086395674}}},"setup_data":[{"chat":"d9d8f2d4-8f6e-49ae-a80a-ece546cf42c6","token":"G4qF2Ute7G8F_APmqJLFEux0hdA53ri61ronobiOyg4"},{"chat":"d4b356a0-df3a-4633-9ecf-ca1493390bda","token":"C5wyqIQ7B09bphk-R3u6fKVZbfdeTtro0uhAcSFA8C8"},{"token":"zz30LRUG3SrBPuDWQ1sEg52NXOvZ-Bw0KMm23JFRyVY","chat":"b222aad4-8391-4d6a-8045-530887924ba4"},{"chat":"a1761fff-1dd3-4127-b774-8a847720ef1c","token":"FloVwhfqIgo19UsPuHALuktUw-qDI5VwVgIisS9lH98"},{"chat":"60fa4c46-4523-4488-bca1-dafaf427af7a","token":"YktaKb3-XVbBpQ6_X3wEdNa53JwzVBCeELNMSJSOv78"},{"token":"yjy9YRAekbRhfzgAWXoGt71qs1kzHMyYEX33AFuL8bI","chat":"c78f15a3-0c98-4d2e-a243-9822329a62d6"},{"chat":"b8b9fcd5-eca8-4911-98e9-0e07130eaa7f","token":"_flkDKIhbYwSMlwssqC8ypQ_XD8ENN0cEHYfuutM3TM"},{"chat":"e5577f27-a69e-4186-8e94-571f56c768d0","token":"VTFm9UnAQJHO4IDgVco3gyqwJt06ogVK4RTX3At0sk4"},{"token":"do2I5wtXXagD1hhNAysx90tjpeErNn0ZalsIfzpFAkQ","chat":"5a463815-2e22-479a-a868-bb70699ba1eb"},{"chat":"d64034a9-f2fd-4f9f-832f-111188ec5ec5","token":"x0aVzgFR-76AWhZI4TQ44o15g8SqxqVsGRusDwJlgRs"},{"chat":"a1dcb79a-1eaf-478a-ad20-1ce5a3868960","token":"WBYbR4I9S9TLLwjA6XWjly_RjmHcOfqboSNGlz7eheE"},{"token":"EE6btE1zMMWDMfffrW54wlyutRw-UrTHwDTVtNrgLvU","chat":"7b84d4bb-8857-4596-98f1-af304812fa5a"},{"token":"YiaJiD9gueKl4zRScUd4pvIchRWlHMhZ3v9SbUTsPxs","chat":"de3bfa66-6503-4951-94ab-50a84753a362"},{"chat":"25e66a5c-c3a2-42a1-ae8b-ca09b5c85d34","token":"DXVgvk4A1FrQx4tvgMD6WJkQbvPy8XCqo6cAKOc4JNs"},{"chat":"86c5e47f-5275-48fd-956b-f2c4596f63a1","token":"U3OZpqLbaEvWu1dwAX-MpwFHk38MM6YLYPuiEl60ACI"},{"chat":"154b072e-bc71-4acd-8d4f-b59b2245419c","token":"Nvfi1NkMce3_R2AXRaj3i0eoqAHzLQGiYwsm0kIQcSk"}]}} diff --git a/evidence/research-20261029-final/invalid-growing1.md b/evidence/research-20261029-final/invalid-growing1.md new file mode 100644 index 00000000..b9918aa6 --- /dev/null +++ b/evidence/research-20261029-final/invalid-growing1.md @@ -0,0 +1,3 @@ +# Исключённый профиль growing1 + +Сборщик shell завершился с ошибкой разбора до сохранения JSON; следующая смена конфигурации могла начаться до завершения k6. Профиль growing1-20261029111013 исключён из сравнительной матрицы, даже несмотря на Completed у Job. Raw сохранён как invalid-growing1-log.txt. Требуется отдельный повтор без одновременного изменения сценариев. diff --git a/evidence/research-20261029-final/load-fixed1-20261029110437.json b/evidence/research-20261029-final/load-fixed1-20261029110437.json new file mode 100644 index 00000000..93df38c3 --- /dev/null +++ b/evidence/research-20261029-final/load-fixed1-20261029110437.json @@ -0,0 +1,373 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "fails": 0, + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 4410 + }, + { + "fails": 0, + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 450 + }, + { + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 4386, + "fails": 0, + "name": "history readable" + } + ], + "name": "", + "path": "" + }, + "options": { + "noColor": false, + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "" + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 53455.947116 + }, + "metrics": { + "application_errors{status:503}": { + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default" + }, + "iteration_duration": { + "values": { + "p(99)": 994.0872749499946, + "max": 2097.024005, + "avg": 222.51865749338796, + "p(50)": 181.8969165, + "p(95)": 448.8924635 + }, + "type": "trend", + "contains": "time" + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "min": 0, + "max": 32, + "value": 32 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 9296, + "rate": 173.9002019705605 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 0, + "max": 5.401903, + "avg": 0.010837729238382096, + "p(50)": 0, + "p(95)": 0 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.18664502474182468, + "p(50)": 0.168196, + "p(95)": 0.35287175, + "p(99)": 0.6798374499999994, + "max": 2.701782 + } + }, + "checks": { + "values": { + "rate": 1, + "passes": 9246, + "fails": 0 + }, + "type": "rate", + "contains": "default" + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 4242, + "rate": 79.35506204379492 + } + }, + "application_errors{status:0}": { + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 851313, + "rate": 15925.505877814518 + } + }, + "vus_max": { + "values": { + "max": 32, + "value": 32, + "min": 32 + }, + "type": "gauge", + "contains": "default" + }, + "http_req_failed": { + "values": { + "rate": 0.0002151462994836489, + "passes": 2, + "fails": 9294 + }, + "type": "rate", + "contains": "default" + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 12713523, + "rate": 237831.77898637758 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 85.33531500000001, + "p(95)": 200.28237675, + "p(99)": 518.9361790499993, + "max": 7289.852967, + "avg": 105.50648479292175 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 4242, + "rate": 79.35506204379492 + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 114.11333843800108, + "p(50)": 91.8974085, + "p(95)": 221.84451689999997, + "p(99)": 570.8439318800006, + "max": 2008.877224 + } + }, + "measured_operations": { + "values": { + "count": 8916, + "rate": 166.79154483320968 + }, + "type": "counter", + "contains": "default" + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 4386, + "rate": 82.04886895900154 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 55.030213, + "avg": 0.12879976473752153 + } + }, + "http_req_duration{expected_response:true}": { + "contains": "time", + "values": { + "p(95)": 200.60701310000002, + "p(99)": 519.1186737799997, + "max": 7290.221682, + "avg": 105.96144836711845, + "p(50)": 85.7954265 + }, + "type": "trend" + }, + "http_req_receiving": { + "contains": "time", + "values": { + "max": 10.663606, + "avg": 0.24584906777108384, + "p(50)": 0.17332350000000002, + "p(95)": 0.6394920000000001, + "p(99)": 1.2738066999999884 + }, + "type": "trend" + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 0.0015902999999999957, + "max": 513.246557, + "avg": 0.19672042340792084, + "p(50)": 0.0012205, + "p(95)": 0.001436 + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 200.6005985, + "p(99)": 519.0985366999993, + "max": 7290.221682, + "avg": 105.9389788854345, + "p(50)": 85.7931045 + } + } + }, + "setup_data": [ + { + "token": "H8U4mmxMOeylShMDdiLrr72zztAMv0tQOcSpwi9hrPU", + "chat": "58fad9fc-0cd2-4def-bf4f-d3620a5e3e5e" + }, + { + "chat": "2940388e-bd6b-4778-9262-7343cab570d2", + "token": "PB3oFGkJqjqxyIWK7HX6iWolj855xuVelLm6qLjq33U" + }, + { + "chat": "2661bde6-5999-40df-baf3-a2f8780512eb", + "token": "YN7yfBsma4LZYQhGBeBTwhx1RmtBktHsBagLE0OjG7Q" + }, + { + "token": "SgVP99a72A3Er3UbeSDQnb3NBg3mqDFhykUeDiS1OP8", + "chat": "d0353044-8ed1-4542-beaa-9ae09d88d368" + }, + { + "chat": "e59639ee-af0e-4c9b-b7f5-b110585de2f1", + "token": "VUV735UMNw83g39npVOjk0inHkWdK_v6ly445iic3WM" + }, + { + "chat": "8082db8a-a626-4982-9206-16a6f23f940d", + "token": "Ys3PGxAYi60O6jiITGZzs79EqDI_j-nz_Ai3cmMmvNY" + }, + { + "chat": "c3d7bc6d-a3b7-4e52-8291-e06b4dcb98b6", + "token": "njG8Z5TqNpxvfONk95PqWmhVNL8K9QlCDqcJ9cKpnA4" + }, + { + "chat": "ee800f84-62e2-4ef5-b9c3-fe84204d6a0b", + "token": "M7EwIgJ2t25tj7w82K5P1fMI9vkhVCYculeIjcIRiFE" + }, + { + "chat": "f9d45edf-7c49-410e-8d6c-f49f84e00141", + "token": "dIHwBjYIzUBQ4vN2WGzQYIPS-FDnt4YTP7jSsGMvz04" + }, + { + "chat": "6c65c749-c699-4b05-bb7c-37d4f54ec17c", + "token": "QlS_zXWOF8JpA_eTFTViFzFSWR6p7JyDoaBvdSAK56A" + }, + { + "chat": "8c4c1c95-701e-4a41-865e-a24b61176191", + "token": "7KgeMNgLrJr84EpFXMWiCgwEAnexwVnpbu7pCvlrBFk" + }, + { + "chat": "0d782d99-5416-479b-b3c3-4853efd0cee5", + "token": "3DVrz1eH8UJwga_LlmdGWqchaFLtGmo7834qeb66HYw" + }, + { + "token": "VYz7O7dq8bvIb3xvnXyIUKM72wF1pWaOEINVUHly92A", + "chat": "7785e1b5-daba-4949-8e7f-664dc45dcf70" + }, + { + "chat": "842f3193-2521-4417-bca9-9dbb48da7c26", + "token": "1hHpv9HJy7QoecF3gYnjpvDIHaQamo2oC_Vhfx99ogI" + }, + { + "chat": "277e221c-7e6f-48ef-854f-0998fdfde031", + "token": "QbgZb2Kkg3TevlCJgrHGajkOCdDJ0cdwWHDb27fj5Sw" + }, + { + "chat": "96511043-5ba3-4cd8-a17a-7feae0fa48f5", + "token": "VPwy8KTykHPZUKZ7H4WvpXwDs5cqm_7BG0xT66HSplg" + } + ] + } +} diff --git a/evidence/research-20261029-final/load-fixed1-20261029110437.txt b/evidence/research-20261029-final/load-fixed1-20261029110437.txt new file mode 100644 index 00000000..92c58b8e --- /dev/null +++ b/evidence/research-20261029-final/load-fixed1-20261029110437.txt @@ -0,0 +1,3 @@ +time="2026-10-29T11:05:47Z" level=warning msg="setup registration: 503; abandoning synthetic actor" source=console +time="2026-10-29T11:05:48Z" level=warning msg="setup registration: 503; abandoning synthetic actor" source=console +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"fails":0,"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":4410},{"fails":0,"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":450},{"path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":4386,"fails":0,"name":"history readable"}],"name":"","path":""},"options":{"noColor":false,"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":""},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":53455.947116},"metrics":{"application_errors{status:503}":{"values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default"},"iteration_duration":{"values":{"p(99)":994.0872749499946,"max":2097.024005,"avg":222.51865749338796,"p(50)":181.8969165,"p(95)":448.8924635},"type":"trend","contains":"time"},"vus":{"type":"gauge","contains":"default","values":{"min":0,"max":32,"value":32}},"http_reqs":{"type":"counter","contains":"default","values":{"count":9296,"rate":173.9002019705605}},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(99)":0,"max":5.401903,"avg":0.010837729238382096,"p(50)":0,"p(95)":0}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.18664502474182468,"p(50)":0.168196,"p(95)":0.35287175,"p(99)":0.6798374499999994,"max":2.701782}},"checks":{"values":{"rate":1,"passes":9246,"fails":0},"type":"rate","contains":"default"},"attempted_messages":{"type":"counter","contains":"default","values":{"count":4242,"rate":79.35506204379492}},"application_errors{status:0}":{"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default","values":{"count":0,"rate":0}},"data_sent":{"type":"counter","contains":"data","values":{"count":851313,"rate":15925.505877814518}},"vus_max":{"values":{"max":32,"value":32,"min":32},"type":"gauge","contains":"default"},"http_req_failed":{"values":{"rate":0.0002151462994836489,"passes":2,"fails":9294},"type":"rate","contains":"default"},"data_received":{"type":"counter","contains":"data","values":{"count":12713523,"rate":237831.77898637758}},"http_req_waiting":{"type":"trend","contains":"time","values":{"p(50)":85.33531500000001,"p(95)":200.28237675,"p(99)":518.9361790499993,"max":7289.852967,"avg":105.50648479292175}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":4242,"rate":79.35506204379492}},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":114.11333843800108,"p(50)":91.8974085,"p(95)":221.84451689999997,"p(99)":570.8439318800006,"max":2008.877224}},"measured_operations":{"values":{"count":8916,"rate":166.79154483320968},"type":"counter","contains":"default"},"iterations":{"type":"counter","contains":"default","values":{"count":4386,"rate":82.04886895900154}},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":55.030213,"avg":0.12879976473752153}},"http_req_duration{expected_response:true}":{"contains":"time","values":{"p(95)":200.60701310000002,"p(99)":519.1186737799997,"max":7290.221682,"avg":105.96144836711845,"p(50)":85.7954265},"type":"trend"},"http_req_receiving":{"contains":"time","values":{"max":10.663606,"avg":0.24584906777108384,"p(50)":0.17332350000000002,"p(95)":0.6394920000000001,"p(99)":1.2738066999999884},"type":"trend"},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(99)":0.0015902999999999957,"max":513.246557,"avg":0.19672042340792084,"p(50)":0.0012205,"p(95)":0.001436}},"http_req_duration":{"type":"trend","contains":"time","values":{"p(95)":200.6005985,"p(99)":519.0985366999993,"max":7290.221682,"avg":105.9389788854345,"p(50)":85.7931045}}},"setup_data":[{"token":"H8U4mmxMOeylShMDdiLrr72zztAMv0tQOcSpwi9hrPU","chat":"58fad9fc-0cd2-4def-bf4f-d3620a5e3e5e"},{"chat":"2940388e-bd6b-4778-9262-7343cab570d2","token":"PB3oFGkJqjqxyIWK7HX6iWolj855xuVelLm6qLjq33U"},{"chat":"2661bde6-5999-40df-baf3-a2f8780512eb","token":"YN7yfBsma4LZYQhGBeBTwhx1RmtBktHsBagLE0OjG7Q"},{"token":"SgVP99a72A3Er3UbeSDQnb3NBg3mqDFhykUeDiS1OP8","chat":"d0353044-8ed1-4542-beaa-9ae09d88d368"},{"chat":"e59639ee-af0e-4c9b-b7f5-b110585de2f1","token":"VUV735UMNw83g39npVOjk0inHkWdK_v6ly445iic3WM"},{"chat":"8082db8a-a626-4982-9206-16a6f23f940d","token":"Ys3PGxAYi60O6jiITGZzs79EqDI_j-nz_Ai3cmMmvNY"},{"chat":"c3d7bc6d-a3b7-4e52-8291-e06b4dcb98b6","token":"njG8Z5TqNpxvfONk95PqWmhVNL8K9QlCDqcJ9cKpnA4"},{"chat":"ee800f84-62e2-4ef5-b9c3-fe84204d6a0b","token":"M7EwIgJ2t25tj7w82K5P1fMI9vkhVCYculeIjcIRiFE"},{"chat":"f9d45edf-7c49-410e-8d6c-f49f84e00141","token":"dIHwBjYIzUBQ4vN2WGzQYIPS-FDnt4YTP7jSsGMvz04"},{"chat":"6c65c749-c699-4b05-bb7c-37d4f54ec17c","token":"QlS_zXWOF8JpA_eTFTViFzFSWR6p7JyDoaBvdSAK56A"},{"chat":"8c4c1c95-701e-4a41-865e-a24b61176191","token":"7KgeMNgLrJr84EpFXMWiCgwEAnexwVnpbu7pCvlrBFk"},{"chat":"0d782d99-5416-479b-b3c3-4853efd0cee5","token":"3DVrz1eH8UJwga_LlmdGWqchaFLtGmo7834qeb66HYw"},{"token":"VYz7O7dq8bvIb3xvnXyIUKM72wF1pWaOEINVUHly92A","chat":"7785e1b5-daba-4949-8e7f-664dc45dcf70"},{"chat":"842f3193-2521-4417-bca9-9dbb48da7c26","token":"1hHpv9HJy7QoecF3gYnjpvDIHaQamo2oC_Vhfx99ogI"},{"chat":"277e221c-7e6f-48ef-854f-0998fdfde031","token":"QbgZb2Kkg3TevlCJgrHGajkOCdDJ0cdwWHDb27fj5Sw"},{"chat":"96511043-5ba3-4cd8-a17a-7feae0fa48f5","token":"VPwy8KTykHPZUKZ7H4WvpXwDs5cqm_7BG0xT66HSplg"}]}} diff --git a/evidence/research-20261029-final/load-fixed2-20261029110639.json b/evidence/research-20261029-final/load-fixed2-20261029110639.json new file mode 100644 index 00000000..544157c2 --- /dev/null +++ b/evidence/research-20261029-final/load-fixed2-20261029110639.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "state": { + "isStdErrTTY": false, + "testRunDurationMs": 45089.877687, + "isStdOutTTY": false + }, + "metrics": { + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.004363107502120955, + "passes": 36, + "fails": 8215 + } + }, + "data_sent": { + "values": { + "count": 756454, + "rate": 16776.581326103165 + }, + "type": "counter", + "contains": "data" + }, + "message_latency_ms": { + "values": { + "p(99)": 350.0392311900002, + "max": 7476.430483, + "avg": 118.41393109545463, + "p(50)": 95.44093000000001, + "p(95)": 172.7375654 + }, + "type": "trend", + "contains": "time" + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "rate": 82.94544567102011, + "count": 3740 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.2448521322263965, + "p(50)": 0.124512, + "p(95)": 0.7444295000000001, + "p(99)": 2.853361, + "max": 11.145533 + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 118.13134720821714, + "p(50)": 79.858031, + "p(95)": 162.8672555, + "p(99)": 304.042258, + "max": 8878.405299 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 3725, + "rate": 82.61277677127002 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0, + "p(99)": 0, + "max": 47.58753, + "avg": 0.11403234735183615, + "p(50)": 0 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.9956113616969401, + "passes": 8167, + "fails": 36 + } + }, + "http_req_receiving": { + "values": { + "p(99)": 3.6444775, + "max": 12.034562, + "avg": 0.4018474326748282, + "p(50)": 0.162811, + "p(95)": 1.5399995 + }, + "type": "trend", + "contains": "time" + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 79.686114, + "p(95)": 160.01444709999998, + "p(99)": 250.48234031999905, + "max": 7045.594857, + "avg": 96.09753803262318 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 3891, + "rate": 86.29431259517092 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 7863, + "rate": 174.38503724899226 + } + }, + "http_req_waiting": { + "contains": "time", + "values": { + "max": 8878.23761, + "avg": 117.48464764331604, + "p(50)": 79.133728, + "p(95)": 162.3500035, + "p(99)": 303.5276025 + }, + "type": "trend" + }, + "application_errors{status:503}": { + "contains": "default", + "values": { + "count": 24, + "rate": 0.532270239600129 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter" + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0.000776, + "p(95)": 0.001311, + "p(99)": 0.004868, + "max": 1031.861751, + "avg": 0.44426853799539207 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "max": 32, + "value": 32, + "min": 32 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 11238060, + "rate": 249236.8703683594 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 8251, + "rate": 182.99007278919436 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 1006.938944, + "avg": 0.2605599047388195 + } + }, + "iteration_duration": { + "values": { + "max": 9008.140023, + "avg": 250.82069100796707, + "p(50)": 170.736861, + "p(95)": 335.9246815, + "p(99)": 1694.5916108999495 + }, + "type": "trend", + "contains": "time" + }, + "application_errors{status:429}": { + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default" + }, + "failed_writes": { + "contains": "default", + "values": { + "count": 15, + "rate": 0.3326688997500806 + }, + "type": "counter" + }, + "application_errors": { + "values": { + "count": 36, + "rate": 0.7984053594001935 + }, + "type": "counter", + "contains": "default" + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "max": 32, + "value": 32, + "min": 0 + } + } + }, + "setup_data": [ + { + "chat": "c66108b5-5753-4a29-a047-0feb050dd9ab", + "token": "FcDsP4lRE-mLd2BAJIdKtiGWpUSAlWQrukJpiV9eYnI" + }, + { + "chat": "318f1b8e-9509-4d3d-bbce-d2977cedaf46", + "token": "mHs7XPex06v8AK3pLYXUvcEWz9A7fRJux7OPcOLOLVg" + }, + { + "chat": "36259faa-accc-4233-90fb-d2e42fdb31bd", + "token": "Lfp_B9VGErvjdKXQ6YEBAHENc8FHZlBqwSI30KOwG1Q" + }, + { + "chat": "a02a3b81-8c98-43aa-8a70-b8634f59b543", + "token": "Nk3H9TkrJFlTg9S1dsmZZBJRQNoCd23Y_jIEn4s4gjc" + }, + { + "chat": "29d68106-aec5-4e86-89c9-2e896facbf84", + "token": "BPKUhicgsLvk2WhFuKvOt5wkxeujm0lT8WTD3M5TdmA" + }, + { + "chat": "e645c69f-06f9-46d6-a713-f6f09e00e9ac", + "token": "NTguC82hZev-jYJ6b2lTLHBsjF2Nk9MNiMdwxFwzBJY" + }, + { + "chat": "bc413188-fd7b-4ffd-b02e-69d4bf7cd396", + "token": "lVyq3lsOrULGkfQV5UcHBP2nB6p5CXb1miyfwauVF1A" + }, + { + "chat": "1da88109-0510-4b23-9a16-6e125f11c1cb", + "token": "6OGJ5uAENszz8IpoZWem4gDzSRLyWISYuBEJ2YJC4aU" + }, + { + "chat": "e269124a-72dd-4321-81e6-cacb559f1daa", + "token": "nwaTJBaJMtYr7FMF97dzsKFlcFrnoQofK722Tyw3w1U" + }, + { + "chat": "b85d0ba2-cb3f-44e6-a50c-494bfb3f41de", + "token": "GPCxZmS6y_FRwGlj4HUDthKCYskPae8xgmf-fWvR794" + }, + { + "chat": "f6f1299c-8194-4769-9776-c9098007f855", + "token": "8yTBe7GKLrqL97U5Yruoy2quiXV_ae-xci4cmAqMal0" + }, + { + "chat": "ad6ed954-0246-4ac0-8614-0231a0785ca5", + "token": "PUnNe5Cavyb8UlfuOZ1Y0W_ar70yzUsJIiVRTX9ly28" + }, + { + "chat": "ab55adb9-1a5f-4774-9989-26b84b0c00e9", + "token": "zPMXRF_E3Trp3RgZXApa5cPH5ZbR8HPMDuS_dFL8whI" + }, + { + "chat": "230c0fc7-0dc6-4800-b89c-a0e83b3049d2", + "token": "hjqzpxMeP4zj5_2VtqC3Waq9K9F0gwkMKp9WxV_GH3I" + }, + { + "token": "eaFjeetUIDepBH04yI00i4an3wq9TyEedV-FYoB7hqY", + "chat": "6483a57e-5e03-45f0-ae1f-314a456c7f16" + }, + { + "chat": "77280141-7873-43ed-a2f2-c952824ee44e", + "token": "BJDsxzPF2KYe3jBlboUlUoTb0nm-9kULeSX84jU4GxA" + } + ], + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 3896, + "fails": 15, + "name": "message confirmed" + }, + { + "passes": 399, + "fails": 2, + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa" + }, + { + "passes": 3872, + "fails": 19, + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8" + } + ] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + } + } +} diff --git a/evidence/research-20261029-final/load-fixed2-20261029110639.txt b/evidence/research-20261029-final/load-fixed2-20261029110639.txt new file mode 100644 index 00000000..e407c75d --- /dev/null +++ b/evidence/research-20261029-final/load-fixed2-20261029110639.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"state":{"isStdErrTTY":false,"testRunDurationMs":45089.877687,"isStdOutTTY":false},"metrics":{"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.004363107502120955,"passes":36,"fails":8215}},"data_sent":{"values":{"count":756454,"rate":16776.581326103165},"type":"counter","contains":"data"},"message_latency_ms":{"values":{"p(99)":350.0392311900002,"max":7476.430483,"avg":118.41393109545463,"p(50)":95.44093000000001,"p(95)":172.7375654},"type":"trend","contains":"time"},"attempted_messages":{"type":"counter","contains":"default","values":{"rate":82.94544567102011,"count":3740}},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.2448521322263965,"p(50)":0.124512,"p(95)":0.7444295000000001,"p(99)":2.853361,"max":11.145533}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":118.13134720821714,"p(50)":79.858031,"p(95)":162.8672555,"p(99)":304.042258,"max":8878.405299}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":3725,"rate":82.61277677127002}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"p(95)":0,"p(99)":0,"max":47.58753,"avg":0.11403234735183615,"p(50)":0}},"checks":{"type":"rate","contains":"default","values":{"rate":0.9956113616969401,"passes":8167,"fails":36}},"http_req_receiving":{"values":{"p(99)":3.6444775,"max":12.034562,"avg":0.4018474326748282,"p(50)":0.162811,"p(95)":1.5399995},"type":"trend","contains":"time"},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(50)":79.686114,"p(95)":160.01444709999998,"p(99)":250.48234031999905,"max":7045.594857,"avg":96.09753803262318}},"iterations":{"type":"counter","contains":"default","values":{"count":3891,"rate":86.29431259517092}},"measured_operations":{"type":"counter","contains":"default","values":{"count":7863,"rate":174.38503724899226}},"http_req_waiting":{"contains":"time","values":{"max":8878.23761,"avg":117.48464764331604,"p(50)":79.133728,"p(95)":162.3500035,"p(99)":303.5276025},"type":"trend"},"application_errors{status:503}":{"contains":"default","values":{"count":24,"rate":0.532270239600129},"thresholds":{"count>=0":{"ok":true}},"type":"counter"},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(50)":0.000776,"p(95)":0.001311,"p(99)":0.004868,"max":1031.861751,"avg":0.44426853799539207}},"vus_max":{"type":"gauge","contains":"default","values":{"max":32,"value":32,"min":32}},"data_received":{"type":"counter","contains":"data","values":{"count":11238060,"rate":249236.8703683594}},"http_reqs":{"type":"counter","contains":"default","values":{"count":8251,"rate":182.99007278919436}},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":1006.938944,"avg":0.2605599047388195}},"iteration_duration":{"values":{"max":9008.140023,"avg":250.82069100796707,"p(50)":170.736861,"p(95)":335.9246815,"p(99)":1694.5916108999495},"type":"trend","contains":"time"},"application_errors{status:429}":{"values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default"},"failed_writes":{"contains":"default","values":{"count":15,"rate":0.3326688997500806},"type":"counter"},"application_errors":{"values":{"count":36,"rate":0.7984053594001935},"type":"counter","contains":"default"},"vus":{"type":"gauge","contains":"default","values":{"max":32,"value":32,"min":0}}},"setup_data":[{"chat":"c66108b5-5753-4a29-a047-0feb050dd9ab","token":"FcDsP4lRE-mLd2BAJIdKtiGWpUSAlWQrukJpiV9eYnI"},{"chat":"318f1b8e-9509-4d3d-bbce-d2977cedaf46","token":"mHs7XPex06v8AK3pLYXUvcEWz9A7fRJux7OPcOLOLVg"},{"chat":"36259faa-accc-4233-90fb-d2e42fdb31bd","token":"Lfp_B9VGErvjdKXQ6YEBAHENc8FHZlBqwSI30KOwG1Q"},{"chat":"a02a3b81-8c98-43aa-8a70-b8634f59b543","token":"Nk3H9TkrJFlTg9S1dsmZZBJRQNoCd23Y_jIEn4s4gjc"},{"chat":"29d68106-aec5-4e86-89c9-2e896facbf84","token":"BPKUhicgsLvk2WhFuKvOt5wkxeujm0lT8WTD3M5TdmA"},{"chat":"e645c69f-06f9-46d6-a713-f6f09e00e9ac","token":"NTguC82hZev-jYJ6b2lTLHBsjF2Nk9MNiMdwxFwzBJY"},{"chat":"bc413188-fd7b-4ffd-b02e-69d4bf7cd396","token":"lVyq3lsOrULGkfQV5UcHBP2nB6p5CXb1miyfwauVF1A"},{"chat":"1da88109-0510-4b23-9a16-6e125f11c1cb","token":"6OGJ5uAENszz8IpoZWem4gDzSRLyWISYuBEJ2YJC4aU"},{"chat":"e269124a-72dd-4321-81e6-cacb559f1daa","token":"nwaTJBaJMtYr7FMF97dzsKFlcFrnoQofK722Tyw3w1U"},{"chat":"b85d0ba2-cb3f-44e6-a50c-494bfb3f41de","token":"GPCxZmS6y_FRwGlj4HUDthKCYskPae8xgmf-fWvR794"},{"chat":"f6f1299c-8194-4769-9776-c9098007f855","token":"8yTBe7GKLrqL97U5Yruoy2quiXV_ae-xci4cmAqMal0"},{"chat":"ad6ed954-0246-4ac0-8614-0231a0785ca5","token":"PUnNe5Cavyb8UlfuOZ1Y0W_ar70yzUsJIiVRTX9ly28"},{"chat":"ab55adb9-1a5f-4774-9989-26b84b0c00e9","token":"zPMXRF_E3Trp3RgZXApa5cPH5ZbR8HPMDuS_dFL8whI"},{"chat":"230c0fc7-0dc6-4800-b89c-a0e83b3049d2","token":"hjqzpxMeP4zj5_2VtqC3Waq9K9F0gwkMKp9WxV_GH3I"},{"token":"eaFjeetUIDepBH04yI00i4an3wq9TyEedV-FYoB7hqY","chat":"6483a57e-5e03-45f0-ae1f-314a456c7f16"},{"chat":"77280141-7873-43ed-a2f2-c952824ee44e","token":"BJDsxzPF2KYe3jBlboUlUoTb0nm-9kULeSX84jU4GxA"}],"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":3896,"fails":15,"name":"message confirmed"},{"passes":399,"fails":2,"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa"},{"passes":3872,"fails":19,"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8"}]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false}}} diff --git a/evidence/research-20261029-final/load-fixed4-20261029110815.json b/evidence/research-20261029-final/load-fixed4-20261029110815.json new file mode 100644 index 00000000..33939d04 --- /dev/null +++ b/evidence/research-20261029-final/load-fixed4-20261029110815.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "metrics": { + "attempted_messages": { + "values": { + "count": 2790, + "rate": 51.763747376829826 + }, + "type": "counter", + "contains": "default" + }, + "data_sent": { + "values": { + "count": 567733, + "rate": 10533.328885121766 + }, + "type": "counter", + "contains": "data" + }, + "iterations": { + "contains": "default", + "values": { + "count": 2875, + "rate": 53.3407791069483 + }, + "type": "counter" + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.37676321653027833, + "p(50)": 0.000881, + "p(95)": 0.0014035500000000002, + "p(99)": 0.01542993999999998, + "max": 1074.405946 + } + }, + "http_req_connecting": { + "contains": "time", + "values": { + "max": 16.206067, + "avg": 0.02185257872340426, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0 + }, + "type": "trend" + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 677.489221160001, + "max": 1574.730015, + "avg": 157.03332343508137, + "p(50)": 112.71044, + "p(95)": 441.5516142 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0.1301345, + "p(95)": 0.4516536500000001, + "p(99)": 1.8935093399999887, + "max": 26.838941, + "avg": 0.2181190584288052 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 333.28199130747777, + "p(50)": 264.544507, + "p(95)": 821.051293599999, + "p(99)": 1135.339405979999, + "max": 3755.833063 + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 198.3693728301075, + "p(50)": 138.39813800000002, + "p(95)": 579.4783116, + "p(99)": 748.0037995700006, + "max": 2216.161919 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 5868, + "rate": 108.87084932159047 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "rate": 113.36075142381011, + "count": 6110 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 112.06156849999999, + "p(95)": 447.6265996500002, + "p(99)": 691.4704105999998, + "max": 2215.852134, + "avg": 159.3341722936168 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.9983503794127351, + "passes": 6052, + "fails": 10 + } + }, + "vus_max": { + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + }, + "type": "gauge" + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 692.0658116299999, + "max": 2216.161919, + "avg": 159.9462934507359, + "p(50)": 112.81320550000001, + "p(95)": 449.4352676500003 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "rate": 0, + "count": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.0016366612111292963, + "passes": 10, + "fails": 6100 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 8339967, + "rate": 154734.03043695245 + } + }, + "failed_writes": { + "type": "counter", + "contains": "default", + "values": { + "rate": 0.12987320130387411, + "count": 7 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 10, + "rate": 0.18553314471982016 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.18011543404255315, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 57.900152 + } + }, + "confirmed_messages": { + "values": { + "count": 2783, + "rate": 51.63387417552595 + }, + "type": "counter", + "contains": "default" + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 2.801295119999995, + "max": 182.062348, + "avg": 0.39400209869067115, + "p(50)": 0.16825299999999999, + "p(95)": 1.12102205 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "rate": 0, + "count": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "rate": 0.16697983024783813, + "count": 9 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + } + }, + "setup_data": [ + { + "token": "qg15snR55dLe08IM6yLlsvRnZ_bveLUL8SBZHyy-5LM", + "chat": "1cbe40f2-3e3b-459c-b8ec-bf4043fe5ebd" + }, + { + "chat": "b73d0191-1347-4d15-842c-2a1099817fe7", + "token": "c6yuW-GBbG7ShfVY6LQwdDf92-BEuFGQ2YQKg-PFXjE" + }, + { + "chat": "ed7b8f53-4240-4624-85e8-aec3cf86808e", + "token": "mXWVPeHhbRlM_8xfWtav5rNj9noEP76rSfwRXIcMgJo" + }, + { + "chat": "00ddd329-bf41-4e08-b2ec-a36bdb5a2626", + "token": "rWciKWmJ3pkitGL3JLUm4IgmsPNnkLCW46Tua0Zr8iI" + }, + { + "chat": "34346afe-1d2d-4896-aca2-adc1c3da1ffa", + "token": "zJT9aTtQwBs0KG-Cf6uVvit5Mq8s9YpPn-FSEkLJxQ8" + }, + { + "chat": "082f5414-924a-458f-bf9a-50e664de36bb", + "token": "xbU5qTMqMdQlMUpxqJebtqf1q08HHVxH3o-iAo6guYA" + }, + { + "chat": "8458b0f8-3d65-4d8f-8a8e-0c4dd71657e3", + "token": "xj-2Bjrvi6QIt1agqcVgDUPqAWUT_eQt78Go28lgKqw" + }, + { + "chat": "8f094ab1-b144-4f7f-aa0d-2fae7d5a429e", + "token": "_ygQviOREt1DFyFMR_7QakcGuuDdjImMtfvnG0OWrQI" + }, + { + "chat": "e9754d40-c8bc-43d8-9b0d-90a680c95d94", + "token": "11x3YBEAgl4pVBb_EBmNOfoPDUcy7P06onxltDIdQ1s" + }, + { + "chat": "741e3291-a847-462a-88eb-bd338cd36be1", + "token": "upO-FdZoHTiMczLRGpZFBd7X2gd8i8ZT4THkqXMg7Yw" + }, + { + "chat": "d83a9171-d3d2-4cdb-903c-30b8873741b0", + "token": "WCxrgkqaW6xmcLvrgvqvJePKT3koKINNV_OEPH0hOlY" + }, + { + "chat": "7548aae3-6ab0-4241-8c2e-9e27719ce2d6", + "token": "sSYiF3-FgYvznpa62bpJi9YF-hL5106E8CpGQyIkW30" + }, + { + "chat": "275276ee-2b06-4dc0-8598-5b1a6bf0fdd9", + "token": "B0grJ61_RoM3fQypZAThVSEDZjX-nripdrEIOOkgWQ0" + }, + { + "chat": "6ecc0bab-29f3-4081-b0e7-b14767c679e9", + "token": "IIW2GCNhRONt-b8rk8XPlNfv7oYw_jbuikb907fZtgs" + }, + { + "chat": "d18d951c-064e-441f-9a46-58cf273c84f6", + "token": "vMDMMfy3GsS5qh3PBTQqZne9Pd1aVWnM0Mw3-RT7oAQ" + }, + { + "token": "nV7FhntWMWjl6Z71QvAgVxNWXUxIUl8GGi088xYJghg", + "chat": "3f0ca8f4-98f5-41cb-8816-c1d489fad463" + } + ], + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 2881, + "fails": 7, + "name": "message confirmed" + }, + { + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 299, + "fails": 0, + "name": "retry returns original", + "path": "::retry returns original" + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 2872, + "fails": 3 + } + ] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 53898.725293 + } + } +} diff --git a/evidence/research-20261029-final/load-fixed4-20261029110815.txt b/evidence/research-20261029-final/load-fixed4-20261029110815.txt new file mode 100644 index 00000000..698db292 --- /dev/null +++ b/evidence/research-20261029-final/load-fixed4-20261029110815.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"metrics":{"attempted_messages":{"values":{"count":2790,"rate":51.763747376829826},"type":"counter","contains":"default"},"data_sent":{"values":{"count":567733,"rate":10533.328885121766},"type":"counter","contains":"data"},"iterations":{"contains":"default","values":{"count":2875,"rate":53.3407791069483},"type":"counter"},"http_req_blocked":{"type":"trend","contains":"time","values":{"avg":0.37676321653027833,"p(50)":0.000881,"p(95)":0.0014035500000000002,"p(99)":0.01542993999999998,"max":1074.405946}},"http_req_connecting":{"contains":"time","values":{"max":16.206067,"avg":0.02185257872340426,"p(50)":0,"p(95)":0,"p(99)":0},"type":"trend"},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(99)":677.489221160001,"max":1574.730015,"avg":157.03332343508137,"p(50)":112.71044,"p(95)":441.5516142}},"http_req_sending":{"type":"trend","contains":"time","values":{"p(50)":0.1301345,"p(95)":0.4516536500000001,"p(99)":1.8935093399999887,"max":26.838941,"avg":0.2181190584288052}},"iteration_duration":{"type":"trend","contains":"time","values":{"avg":333.28199130747777,"p(50)":264.544507,"p(95)":821.051293599999,"p(99)":1135.339405979999,"max":3755.833063}},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":198.3693728301075,"p(50)":138.39813800000002,"p(95)":579.4783116,"p(99)":748.0037995700006,"max":2216.161919}},"measured_operations":{"type":"counter","contains":"default","values":{"count":5868,"rate":108.87084932159047}},"http_reqs":{"type":"counter","contains":"default","values":{"rate":113.36075142381011,"count":6110}},"http_req_waiting":{"type":"trend","contains":"time","values":{"p(50)":112.06156849999999,"p(95)":447.6265996500002,"p(99)":691.4704105999998,"max":2215.852134,"avg":159.3341722936168}},"checks":{"type":"rate","contains":"default","values":{"rate":0.9983503794127351,"passes":6052,"fails":10}},"vus_max":{"contains":"default","values":{"value":32,"min":32,"max":32},"type":"gauge"},"http_req_duration":{"type":"trend","contains":"time","values":{"p(99)":692.0658116299999,"max":2216.161919,"avg":159.9462934507359,"p(50)":112.81320550000001,"p(95)":449.4352676500003}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"rate":0,"count":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.0016366612111292963,"passes":10,"fails":6100}},"data_received":{"type":"counter","contains":"data","values":{"count":8339967,"rate":154734.03043695245}},"failed_writes":{"type":"counter","contains":"default","values":{"rate":0.12987320130387411,"count":7}},"application_errors":{"type":"counter","contains":"default","values":{"count":10,"rate":0.18553314471982016}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"avg":0.18011543404255315,"p(50)":0,"p(95)":0,"p(99)":0,"max":57.900152}},"confirmed_messages":{"values":{"count":2783,"rate":51.63387417552595},"type":"counter","contains":"default"},"http_req_receiving":{"type":"trend","contains":"time","values":{"p(99)":2.801295119999995,"max":182.062348,"avg":0.39400209869067115,"p(50)":0.16825299999999999,"p(95)":1.12102205}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"rate":0,"count":0},"thresholds":{"count>=0":{"ok":true}}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"rate":0.16697983024783813,"count":9},"thresholds":{"count>=0":{"ok":true}}},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}}},"setup_data":[{"token":"qg15snR55dLe08IM6yLlsvRnZ_bveLUL8SBZHyy-5LM","chat":"1cbe40f2-3e3b-459c-b8ec-bf4043fe5ebd"},{"chat":"b73d0191-1347-4d15-842c-2a1099817fe7","token":"c6yuW-GBbG7ShfVY6LQwdDf92-BEuFGQ2YQKg-PFXjE"},{"chat":"ed7b8f53-4240-4624-85e8-aec3cf86808e","token":"mXWVPeHhbRlM_8xfWtav5rNj9noEP76rSfwRXIcMgJo"},{"chat":"00ddd329-bf41-4e08-b2ec-a36bdb5a2626","token":"rWciKWmJ3pkitGL3JLUm4IgmsPNnkLCW46Tua0Zr8iI"},{"chat":"34346afe-1d2d-4896-aca2-adc1c3da1ffa","token":"zJT9aTtQwBs0KG-Cf6uVvit5Mq8s9YpPn-FSEkLJxQ8"},{"chat":"082f5414-924a-458f-bf9a-50e664de36bb","token":"xbU5qTMqMdQlMUpxqJebtqf1q08HHVxH3o-iAo6guYA"},{"chat":"8458b0f8-3d65-4d8f-8a8e-0c4dd71657e3","token":"xj-2Bjrvi6QIt1agqcVgDUPqAWUT_eQt78Go28lgKqw"},{"chat":"8f094ab1-b144-4f7f-aa0d-2fae7d5a429e","token":"_ygQviOREt1DFyFMR_7QakcGuuDdjImMtfvnG0OWrQI"},{"chat":"e9754d40-c8bc-43d8-9b0d-90a680c95d94","token":"11x3YBEAgl4pVBb_EBmNOfoPDUcy7P06onxltDIdQ1s"},{"chat":"741e3291-a847-462a-88eb-bd338cd36be1","token":"upO-FdZoHTiMczLRGpZFBd7X2gd8i8ZT4THkqXMg7Yw"},{"chat":"d83a9171-d3d2-4cdb-903c-30b8873741b0","token":"WCxrgkqaW6xmcLvrgvqvJePKT3koKINNV_OEPH0hOlY"},{"chat":"7548aae3-6ab0-4241-8c2e-9e27719ce2d6","token":"sSYiF3-FgYvznpa62bpJi9YF-hL5106E8CpGQyIkW30"},{"chat":"275276ee-2b06-4dc0-8598-5b1a6bf0fdd9","token":"B0grJ61_RoM3fQypZAThVSEDZjX-nripdrEIOOkgWQ0"},{"chat":"6ecc0bab-29f3-4081-b0e7-b14767c679e9","token":"IIW2GCNhRONt-b8rk8XPlNfv7oYw_jbuikb907fZtgs"},{"chat":"d18d951c-064e-441f-9a46-58cf273c84f6","token":"vMDMMfy3GsS5qh3PBTQqZne9Pd1aVWnM0Mw3-RT7oAQ"},{"token":"nV7FhntWMWjl6Z71QvAgVxNWXUxIUl8GGi088xYJghg","chat":"3f0ca8f4-98f5-41cb-8816-c1d489fad463"}],"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":2881,"fails":7,"name":"message confirmed"},{"id":"f737ff9008ff036f7a4b775b05a953fa","passes":299,"fails":0,"name":"retry returns original","path":"::retry returns original"},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":2872,"fails":3}]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":53898.725293}}} diff --git a/evidence/research-20261029-final/load-growing2-20261029111200.json b/evidence/research-20261029-final/load-growing2-20261029111200.json new file mode 100644 index 00000000..27ce7e4f --- /dev/null +++ b/evidence/research-20261029-final/load-growing2-20261029111200.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "metrics": { + "confirmed_messages": { + "values": { + "count": 1198, + "rate": 23.529679326482384 + }, + "type": "counter", + "contains": "default" + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 108.69036763592449, + "p(50)": 46.2625695, + "p(95)": 347.8488570999995, + "p(99)": 559.5331142800044, + "max": 5685.060447 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 32.998023, + "avg": 0.031332127966013895 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 528.727421, + "max": 6909.018767, + "avg": 101.19088046036686, + "p(50)": 44.942618, + "p(95)": 299.96549000000005 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.2959491825471207, + "passes": 2842, + "fails": 6761 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 4554, + "rate": 89.44420672187043 + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 300.3332265, + "p(99)": 532.1885824999999, + "max": 6909.282275, + "avg": 101.79095922432899, + "p(50)": 45.646539 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "max": 8850.488329, + "avg": 206.99840641309893, + "p(50)": 101.834915, + "p(95)": 513.8149045999997, + "p(99)": 2185.7408070499964 + } + }, + "measured_operations": { + "values": { + "count": 9238, + "rate": 181.44171754427734 + }, + "type": "counter", + "contains": "default" + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 9651, + "rate": 189.55336826367403 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0.000764, + "p(95)": 0.001335, + "p(99)": 0.0027064999999999997, + "max": 255.45403, + "avg": 0.17973057144337523 + } + }, + "http_req_sending": { + "values": { + "avg": 0.1988478163920834, + "p(50)": 0.124926, + "p(95)": 0.420881, + "p(99)": 2.006459, + "max": 16.513069 + }, + "type": "trend", + "contains": "time" + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0, + "p(99)": 0, + "max": 250.443313, + "avg": 0.13779117407522537, + "p(50)": 0 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.7005491658895451, + "passes": 6761, + "fails": 2890 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 6761, + "rate": 132.7914540286706 + } + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 6754, + "rate": 132.6539684232571 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_duration{expected_response:true}": { + "contains": "time", + "values": { + "p(99)": 491.57760301000013, + "max": 6909.282275, + "avg": 173.62529970069215, + "p(50)": 137.42771249999998, + "p(95)": 393.88058744999995 + }, + "type": "trend" + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "rate": 92.66529804870108, + "count": 4718 + } + }, + "data_sent": { + "contains": "data", + "values": { + "count": 824854, + "rate": 16200.793081107095 + }, + "type": "counter" + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 5369158, + "rate": 105454.56259867904 + } + }, + "application_errors{status:429}": { + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "failed_writes": { + "type": "counter", + "contains": "default", + "values": { + "rate": 65.91452739538805, + "count": 3356 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0.144285, + "p(95)": 1.4200315, + "p(99)": 3.5102095, + "max": 258.830876, + "avg": 0.401230947570202 + } + } + }, + "setup_data": [ + { + "chat": "60b6c42c-bb2b-47f0-8440-f78ce6b0f5a3", + "token": "KBg__tDt9tv80-UWsIb2xZOa3VRpJKQqLsSNytC1UyU" + }, + { + "chat": "d18dbfd6-372b-443f-8f86-c6cc393146a0", + "token": "8ZE10fYr29wNL87Gsa4Cja1l3wITHrJ7bu3pIJ5rO7g" + }, + { + "chat": "bd00a62a-e05e-430a-8b22-e031aa91c2f0", + "token": "WPou0EVIhqgxSvans3Snm27twDrQBEPJ2IR_qhLPhvM" + }, + { + "token": "YFvO2vu0_9z7F1ETpwJzDFuc33aBvrrBRg91PKnSGrs", + "chat": "20265296-072f-4e4e-9774-b0359e871ab4" + }, + { + "chat": "6e647ef2-9b39-4f8e-bd5f-ebf84b7378c1", + "token": "cws4KnQHlgqvpS_Y9yRiGP_u7ao5Oz-GMfx7WnWnI3w" + }, + { + "chat": "5dbc3f79-6559-40c4-9af3-4f53ace94d94", + "token": "aCWxmrYIE8lfb-8QZRdjFY_hwdfT-fnBnXEwBCiCIX8" + }, + { + "chat": "35fe28ed-e3f3-40f3-962b-95ea8294d3e4", + "token": "HO6bWtmUTTJOSacdXY6wZg8lADiOA9dMf7Mj2XS6WN0" + }, + { + "chat": "b6be36fa-a0cd-47b0-951b-3a286bd228cd", + "token": "vgeSW2_KQde5MMGMYhKhuSB8z0VvyNbzEdnxZE9F-7w" + }, + { + "token": "M_HXY61_jDGVyuO8GlbpuAQqH0GTFVb8qvQtljKTZes", + "chat": "4d80528f-8f90-4a56-9b4a-dd519e94804c" + }, + { + "chat": "1d75172e-ceef-4d2b-a88d-120f4ac81ae2", + "token": "rgBPMQiVcl1BMHlapF-ag4BfR8sUYfTLpbLwlW9ZZ_E" + }, + { + "chat": "71d0b00a-0ed6-4eea-a5bf-3b94df4be281", + "token": "JwQ9RFQxDsB2ECNUr29jel2Br90idTb3na8d0jMgpiY" + }, + { + "chat": "4c99bd9f-951a-4d5c-a1dd-ca2fc0d53151", + "token": "RzhQkd_g_o1vUGFMecJQANVji2PWTqPJy9l5o1dhkps" + }, + { + "chat": "f7c6e5d8-dc55-477e-bc6c-98ebf4d2a0b5", + "token": "Rzy-mgHjltDgSRJlxvL_S4FQQnPk5dPlkcxX3CWBvOQ" + }, + { + "chat": "428e1aed-b1e4-4757-b676-9526cadcfa02", + "token": "QMDJrzFT4uRQs3FF-Rh91bKwminIPfs4yD0WZDCfTko" + }, + { + "chat": "26d61bb6-d0ac-4394-a60b-240c5ac4ec21", + "token": "CNQ78KUZrADoK1-PkDIH2GFdX_tUHNQtqa3E1lWPd8o" + }, + { + "chat": "a2099fa1-4296-445b-9589-4841ff12a150", + "token": "2fc7jn0fu8v3kXCtOU5Ras4aq1cZD28ZCh3poX3iY48" + } + ], + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "fails": 3356, + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 1379 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 98, + "fails": 52 + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 1365, + "fails": 3353 + } + ] + }, + "options": { + "noColor": false, + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "" + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 50914.421033 + } + } +} diff --git a/evidence/research-20261029-final/load-growing2-20261029111200.txt b/evidence/research-20261029-final/load-growing2-20261029111200.txt new file mode 100644 index 00000000..007a95ef --- /dev/null +++ b/evidence/research-20261029-final/load-growing2-20261029111200.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"metrics":{"confirmed_messages":{"values":{"count":1198,"rate":23.529679326482384},"type":"counter","contains":"default"},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":108.69036763592449,"p(50)":46.2625695,"p(95)":347.8488570999995,"p(99)":559.5331142800044,"max":5685.060447}},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":32.998023,"avg":0.031332127966013895}},"http_req_waiting":{"type":"trend","contains":"time","values":{"p(99)":528.727421,"max":6909.018767,"avg":101.19088046036686,"p(50)":44.942618,"p(95)":299.96549000000005}},"checks":{"type":"rate","contains":"default","values":{"rate":0.2959491825471207,"passes":2842,"fails":6761}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":4554,"rate":89.44420672187043}},"http_req_duration":{"type":"trend","contains":"time","values":{"p(95)":300.3332265,"p(99)":532.1885824999999,"max":6909.282275,"avg":101.79095922432899,"p(50)":45.646539}},"iteration_duration":{"type":"trend","contains":"time","values":{"max":8850.488329,"avg":206.99840641309893,"p(50)":101.834915,"p(95)":513.8149045999997,"p(99)":2185.7408070499964}},"measured_operations":{"values":{"count":9238,"rate":181.44171754427734},"type":"counter","contains":"default"},"http_reqs":{"type":"counter","contains":"default","values":{"count":9651,"rate":189.55336826367403}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(50)":0.000764,"p(95)":0.001335,"p(99)":0.0027064999999999997,"max":255.45403,"avg":0.17973057144337523}},"http_req_sending":{"values":{"avg":0.1988478163920834,"p(50)":0.124926,"p(95)":0.420881,"p(99)":2.006459,"max":16.513069},"type":"trend","contains":"time"},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"p(95)":0,"p(99)":0,"max":250.443313,"avg":0.13779117407522537,"p(50)":0}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.7005491658895451,"passes":6761,"fails":2890}},"application_errors":{"type":"counter","contains":"default","values":{"count":6761,"rate":132.7914540286706}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":6754,"rate":132.6539684232571},"thresholds":{"count>=0":{"ok":true}}},"http_req_duration{expected_response:true}":{"contains":"time","values":{"p(99)":491.57760301000013,"max":6909.282275,"avg":173.62529970069215,"p(50)":137.42771249999998,"p(95)":393.88058744999995},"type":"trend"},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"iterations":{"type":"counter","contains":"default","values":{"rate":92.66529804870108,"count":4718}},"data_sent":{"contains":"data","values":{"count":824854,"rate":16200.793081107095},"type":"counter"},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"data_received":{"type":"counter","contains":"data","values":{"count":5369158,"rate":105454.56259867904}},"application_errors{status:429}":{"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default","values":{"count":0,"rate":0}},"failed_writes":{"type":"counter","contains":"default","values":{"rate":65.91452739538805,"count":3356}},"http_req_receiving":{"type":"trend","contains":"time","values":{"p(50)":0.144285,"p(95)":1.4200315,"p(99)":3.5102095,"max":258.830876,"avg":0.401230947570202}}},"setup_data":[{"chat":"60b6c42c-bb2b-47f0-8440-f78ce6b0f5a3","token":"KBg__tDt9tv80-UWsIb2xZOa3VRpJKQqLsSNytC1UyU"},{"chat":"d18dbfd6-372b-443f-8f86-c6cc393146a0","token":"8ZE10fYr29wNL87Gsa4Cja1l3wITHrJ7bu3pIJ5rO7g"},{"chat":"bd00a62a-e05e-430a-8b22-e031aa91c2f0","token":"WPou0EVIhqgxSvans3Snm27twDrQBEPJ2IR_qhLPhvM"},{"token":"YFvO2vu0_9z7F1ETpwJzDFuc33aBvrrBRg91PKnSGrs","chat":"20265296-072f-4e4e-9774-b0359e871ab4"},{"chat":"6e647ef2-9b39-4f8e-bd5f-ebf84b7378c1","token":"cws4KnQHlgqvpS_Y9yRiGP_u7ao5Oz-GMfx7WnWnI3w"},{"chat":"5dbc3f79-6559-40c4-9af3-4f53ace94d94","token":"aCWxmrYIE8lfb-8QZRdjFY_hwdfT-fnBnXEwBCiCIX8"},{"chat":"35fe28ed-e3f3-40f3-962b-95ea8294d3e4","token":"HO6bWtmUTTJOSacdXY6wZg8lADiOA9dMf7Mj2XS6WN0"},{"chat":"b6be36fa-a0cd-47b0-951b-3a286bd228cd","token":"vgeSW2_KQde5MMGMYhKhuSB8z0VvyNbzEdnxZE9F-7w"},{"token":"M_HXY61_jDGVyuO8GlbpuAQqH0GTFVb8qvQtljKTZes","chat":"4d80528f-8f90-4a56-9b4a-dd519e94804c"},{"chat":"1d75172e-ceef-4d2b-a88d-120f4ac81ae2","token":"rgBPMQiVcl1BMHlapF-ag4BfR8sUYfTLpbLwlW9ZZ_E"},{"chat":"71d0b00a-0ed6-4eea-a5bf-3b94df4be281","token":"JwQ9RFQxDsB2ECNUr29jel2Br90idTb3na8d0jMgpiY"},{"chat":"4c99bd9f-951a-4d5c-a1dd-ca2fc0d53151","token":"RzhQkd_g_o1vUGFMecJQANVji2PWTqPJy9l5o1dhkps"},{"chat":"f7c6e5d8-dc55-477e-bc6c-98ebf4d2a0b5","token":"Rzy-mgHjltDgSRJlxvL_S4FQQnPk5dPlkcxX3CWBvOQ"},{"chat":"428e1aed-b1e4-4757-b676-9526cadcfa02","token":"QMDJrzFT4uRQs3FF-Rh91bKwminIPfs4yD0WZDCfTko"},{"chat":"26d61bb6-d0ac-4394-a60b-240c5ac4ec21","token":"CNQ78KUZrADoK1-PkDIH2GFdX_tUHNQtqa3E1lWPd8o"},{"chat":"a2099fa1-4296-445b-9589-4841ff12a150","token":"2fc7jn0fu8v3kXCtOU5Ras4aq1cZD28ZCh3poX3iY48"}],"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"fails":3356,"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":1379},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":98,"fails":52},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":1365,"fails":3353}]},"options":{"noColor":false,"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":""},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":50914.421033}}} diff --git a/evidence/research-20261029-final/load-growing4-20261029111342.json b/evidence/research-20261029-final/load-growing4-20261029111342.json new file mode 100644 index 00000000..b1119767 --- /dev/null +++ b/evidence/research-20261029-final/load-growing4-20261029111342.json @@ -0,0 +1,373 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "passes": 2435, + "fails": 0, + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e" + }, + { + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 257, + "fails": 0, + "name": "retry returns original", + "path": "::retry returns original" + }, + { + "fails": 0, + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 2425 + } + ] + }, + "options": { + "noColor": false, + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "" + }, + "state": { + "isStdErrTTY": false, + "testRunDurationMs": 51404.879007, + "isStdOutTTY": false + }, + "metrics": { + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "max": 1146.897122, + "avg": 190.30279135237166, + "p(50)": 114.618387, + "p(95)": 667.2456056000004, + "p(99)": 933.54675704 + } + }, + "confirmed_messages": { + "contains": "default", + "values": { + "count": 2319, + "rate": 45.11244933937522 + }, + "type": "counter" + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "vus": { + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + }, + "type": "gauge" + }, + "iteration_duration": { + "contains": "time", + "values": { + "p(99)": 1443.3416365199994, + "max": 1863.623413, + "avg": 402.7049130078351, + "p(50)": 296.913235, + "p(95)": 1010.3944568 + }, + "type": "trend" + }, + "http_req_waiting": { + "contains": "time", + "values": { + "p(95)": 666.1086130000003, + "p(99)": 933.1889214, + "max": 1143.40204, + "avg": 189.51302138025207, + "p(50)": 113.692636 + }, + "type": "trend" + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 4.379571959999983, + "max": 214.94892, + "avg": 0.4611384611810247, + "p(50)": 0.178007, + "p(95)": 1.4489760000000012 + } + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.32863151093901344, + "p(50)": 0.15359, + "p(95)": 0.9729462000000001, + "p(99)": 3.6155539599999913, + "max": 42.797223 + } + }, + "http_req_tls_handshaking": { + "contains": "time", + "values": { + "avg": 0.26630205479186836, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 220.841301 + }, + "type": "trend" + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 16.054407, + "avg": 0.05068375062923525 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 1, + "passes": 5117, + "fails": 0 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 2425, + "rate": 47.17451041310259 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 484808, + "rate": 9431.16702860018 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0, + "passes": 0, + "fails": 5165 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 7050343, + "rate": 137153.18732760617 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 5165, + "rate": 100.47684382831953 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 667.2456056000004, + "p(99)": 933.54675704, + "max": 1146.897122, + "avg": 190.30279135237166, + "p(50)": 114.618387 + } + }, + "http_req_blocked": { + "values": { + "max": 1046.463791, + "avg": 0.5203352913843139, + "p(50)": 0.000982, + "p(95)": 0.0016316000000000004, + "p(99)": 0.023012799999999917 + }, + "type": "trend", + "contains": "time" + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 2319, + "rate": 45.11244933937522 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 4882, + "rate": 94.97152982959457 + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 1002.1604266600006, + "max": 1146.897122, + "avg": 227.4769499275549, + "p(50)": 136.678739, + "p(95)": 800.6695819 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + } + }, + "setup_data": [ + { + "token": "lpZ0VpymuFDLCT3e760KOu_43GCenXd50r0ODc6ke54", + "chat": "4db8c4c4-06a6-4880-bcf4-8c5cc7d513bc" + }, + { + "chat": "539f8a9c-dec4-45cd-8941-cc75d54f9986", + "token": "vNJuePDsneXwlvqeKFToIKkfj48lfb0RyRhpatAs2j4" + }, + { + "chat": "e19d89eb-be90-4359-81f0-6d5cf73b4619", + "token": "EloM5f0iM0OIP2wjcryeizKtzRmkJk46iVhYx3WwnDw" + }, + { + "chat": "710e5064-15f7-44df-b819-a0a404551a94", + "token": "Hx26gzSmf_EiCldr-WzMqUVRi_33rtoCa8K8PnXAIEg" + }, + { + "chat": "638f0fdf-2909-4b0f-a69a-f608192d77fa", + "token": "PhMxEPkvvP6-L0qUus3OWDU0TmO3BVskDroOH4efo04" + }, + { + "token": "u7XcpOYIlVn8c29vF1VEto-uzc1SSmUBFjmtoL9sIBc", + "chat": "cc21bcb6-ca85-49c8-82ba-30b3e9da46a0" + }, + { + "chat": "04d17b6a-ab3f-4dbc-a62e-ab635e909382", + "token": "ov_WvOJCgSHKESmCsYx6aMQYkvTt9VudL-zuTjjXy6Q" + }, + { + "token": "i6c-KVbdhw8xH19kn2_Bkg5Kp38FquQH260Fw-iTd-8", + "chat": "0e816a28-b0f3-46ee-be25-a40124f8c3f3" + }, + { + "chat": "4d54402e-8975-4889-8fa2-b44eaf87e2c3", + "token": "QHSLNvqtELJRkiGHCVmGOD1ejHnnzxcGQAuVPj-eziE" + }, + { + "chat": "632a6c93-18df-4974-bdf2-5110a522e2ae", + "token": "Geq7bTpG20zBeX_s23U9X8xN317XATH2eweGy-RieXg" + }, + { + "chat": "0e36bcac-e990-4156-89da-8a3c492d8526", + "token": "xlmKVl2sNpDN3Kum5iWG4dEMmJ9LFqJiGilDm2Tu88k" + }, + { + "chat": "9a7b7de4-91e0-4e03-937f-a3fa72949b07", + "token": "VSkcBGRfrwf2fxYtV_oSBuGUcvORHVzN95aIYOn8POM" + }, + { + "chat": "7d6db047-612d-4285-af7b-427f03870fe9", + "token": "wP80c5-mOKlckO-sYPt_5gKpMdl4XK6w6PfLLLQdLBM" + }, + { + "chat": "6b80359e-4a85-42e8-95af-8eae5815f785", + "token": "ZtmOXFduW3drJEFi5Ri1IMe9zfqgYkNW2kjc5Vwsl8Q" + }, + { + "chat": "5f588e80-3f9e-4fbf-8d0e-8556ec93babf", + "token": "8jGgpeZ4g7g2ZtdEbW1nQYXDiDvQPJ2aq5jQ1M46eps" + }, + { + "chat": "51ffcb94-a4c8-4c56-834a-5dc599361c19", + "token": "HJhusJ2jIywrswbUA2dSKjGwY1ZMRrRzT-MwHfE7liI" + } + ] + } +} diff --git a/evidence/research-20261029-final/load-growing4-20261029111342.txt b/evidence/research-20261029-final/load-growing4-20261029111342.txt new file mode 100644 index 00000000..f863721c --- /dev/null +++ b/evidence/research-20261029-final/load-growing4-20261029111342.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"passes":2435,"fails":0,"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e"},{"id":"f737ff9008ff036f7a4b775b05a953fa","passes":257,"fails":0,"name":"retry returns original","path":"::retry returns original"},{"fails":0,"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":2425}]},"options":{"noColor":false,"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":""},"state":{"isStdErrTTY":false,"testRunDurationMs":51404.879007,"isStdOutTTY":false},"metrics":{"http_req_duration":{"type":"trend","contains":"time","values":{"max":1146.897122,"avg":190.30279135237166,"p(50)":114.618387,"p(95)":667.2456056000004,"p(99)":933.54675704}},"confirmed_messages":{"contains":"default","values":{"count":2319,"rate":45.11244933937522},"type":"counter"},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"vus":{"contains":"default","values":{"value":32,"min":0,"max":32},"type":"gauge"},"iteration_duration":{"contains":"time","values":{"p(99)":1443.3416365199994,"max":1863.623413,"avg":402.7049130078351,"p(50)":296.913235,"p(95)":1010.3944568},"type":"trend"},"http_req_waiting":{"contains":"time","values":{"p(95)":666.1086130000003,"p(99)":933.1889214,"max":1143.40204,"avg":189.51302138025207,"p(50)":113.692636},"type":"trend"},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"http_req_receiving":{"type":"trend","contains":"time","values":{"p(99)":4.379571959999983,"max":214.94892,"avg":0.4611384611810247,"p(50)":0.178007,"p(95)":1.4489760000000012}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.32863151093901344,"p(50)":0.15359,"p(95)":0.9729462000000001,"p(99)":3.6155539599999913,"max":42.797223}},"http_req_tls_handshaking":{"contains":"time","values":{"avg":0.26630205479186836,"p(50)":0,"p(95)":0,"p(99)":0,"max":220.841301},"type":"trend"},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":16.054407,"avg":0.05068375062923525}},"checks":{"type":"rate","contains":"default","values":{"rate":1,"passes":5117,"fails":0}},"iterations":{"type":"counter","contains":"default","values":{"count":2425,"rate":47.17451041310259}},"data_sent":{"type":"counter","contains":"data","values":{"count":484808,"rate":9431.16702860018}},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0,"passes":0,"fails":5165}},"data_received":{"type":"counter","contains":"data","values":{"count":7050343,"rate":137153.18732760617}},"http_reqs":{"type":"counter","contains":"default","values":{"count":5165,"rate":100.47684382831953}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(95)":667.2456056000004,"p(99)":933.54675704,"max":1146.897122,"avg":190.30279135237166,"p(50)":114.618387}},"http_req_blocked":{"values":{"max":1046.463791,"avg":0.5203352913843139,"p(50)":0.000982,"p(95)":0.0016316000000000004,"p(99)":0.023012799999999917},"type":"trend","contains":"time"},"attempted_messages":{"type":"counter","contains":"default","values":{"count":2319,"rate":45.11244933937522}},"measured_operations":{"type":"counter","contains":"default","values":{"count":4882,"rate":94.97152982959457}},"message_latency_ms":{"type":"trend","contains":"time","values":{"p(99)":1002.1604266600006,"max":1146.897122,"avg":227.4769499275549,"p(50)":136.678739,"p(95)":800.6695819}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}}},"setup_data":[{"token":"lpZ0VpymuFDLCT3e760KOu_43GCenXd50r0ODc6ke54","chat":"4db8c4c4-06a6-4880-bcf4-8c5cc7d513bc"},{"chat":"539f8a9c-dec4-45cd-8941-cc75d54f9986","token":"vNJuePDsneXwlvqeKFToIKkfj48lfb0RyRhpatAs2j4"},{"chat":"e19d89eb-be90-4359-81f0-6d5cf73b4619","token":"EloM5f0iM0OIP2wjcryeizKtzRmkJk46iVhYx3WwnDw"},{"chat":"710e5064-15f7-44df-b819-a0a404551a94","token":"Hx26gzSmf_EiCldr-WzMqUVRi_33rtoCa8K8PnXAIEg"},{"chat":"638f0fdf-2909-4b0f-a69a-f608192d77fa","token":"PhMxEPkvvP6-L0qUus3OWDU0TmO3BVskDroOH4efo04"},{"token":"u7XcpOYIlVn8c29vF1VEto-uzc1SSmUBFjmtoL9sIBc","chat":"cc21bcb6-ca85-49c8-82ba-30b3e9da46a0"},{"chat":"04d17b6a-ab3f-4dbc-a62e-ab635e909382","token":"ov_WvOJCgSHKESmCsYx6aMQYkvTt9VudL-zuTjjXy6Q"},{"token":"i6c-KVbdhw8xH19kn2_Bkg5Kp38FquQH260Fw-iTd-8","chat":"0e816a28-b0f3-46ee-be25-a40124f8c3f3"},{"chat":"4d54402e-8975-4889-8fa2-b44eaf87e2c3","token":"QHSLNvqtELJRkiGHCVmGOD1ejHnnzxcGQAuVPj-eziE"},{"chat":"632a6c93-18df-4974-bdf2-5110a522e2ae","token":"Geq7bTpG20zBeX_s23U9X8xN317XATH2eweGy-RieXg"},{"chat":"0e36bcac-e990-4156-89da-8a3c492d8526","token":"xlmKVl2sNpDN3Kum5iWG4dEMmJ9LFqJiGilDm2Tu88k"},{"chat":"9a7b7de4-91e0-4e03-937f-a3fa72949b07","token":"VSkcBGRfrwf2fxYtV_oSBuGUcvORHVzN95aIYOn8POM"},{"chat":"7d6db047-612d-4285-af7b-427f03870fe9","token":"wP80c5-mOKlckO-sYPt_5gKpMdl4XK6w6PfLLLQdLBM"},{"chat":"6b80359e-4a85-42e8-95af-8eae5815f785","token":"ZtmOXFduW3drJEFi5Ri1IMe9zfqgYkNW2kjc5Vwsl8Q"},{"chat":"5f588e80-3f9e-4fbf-8d0e-8556ec93babf","token":"8jGgpeZ4g7g2ZtdEbW1nQYXDiDvQPJ2aq5jQ1M46eps"},{"chat":"51ffcb94-a4c8-4c56-834a-5dc599361c19","token":"HJhusJ2jIywrswbUA2dSKjGwY1ZMRrRzT-MwHfE7liI"}]}} diff --git a/evidence/research-20261029-final/load-saturation8-20261029111530.txt b/evidence/research-20261029-final/load-saturation8-20261029111530.txt new file mode 100644 index 00000000..0482bd68 --- /dev/null +++ b/evidence/research-20261029-final/load-saturation8-20261029111530.txt @@ -0,0 +1,7 @@ +time="2026-10-29T11:16:18Z" level=warning msg="setup chat: 503; abandoning synthetic actor" source=console +time="2026-10-29T11:16:21Z" level=warning msg="setup chat: 503; abandoning synthetic actor" source=console +time="2026-10-29T11:16:22Z" level=warning msg="setup registration: 503; abandoning synthetic actor" source=console +time="2026-10-29T11:16:23Z" level=warning msg="setup registration: 503; abandoning synthetic actor" source=console +time="2026-10-29T11:16:24Z" level=warning msg="setup registration: 503; abandoning synthetic actor" source=console +{"profile":{"vus":8,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"checks":[],"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[]},"options":{"summaryTimeUnit":"","noColor":false,"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"]},"state":{"testRunDurationMs":12302.057988,"isStdOutTTY":false,"isStdErrTTY":false},"metrics":{"http_req_connecting":{"type":"trend","contains":"time","values":{"p(95)":12.116370299999957,"p(99)":34.733594859999975,"max":40.387901,"avg":2.692526733333333,"p(50)":0}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"avg":210.89978449999998,"p(50)":197.485976,"p(95)":334.97417769999987,"p(99)":386.62928674,"max":399.543064}},"http_req_tls_handshaking":{"contains":"time","values":{"p(99)":41.55609525999997,"max":48.321041,"avg":3.2214027333333335,"p(50)":0,"p(95)":14.496312299999948},"type":"trend"},"http_req_failed":{"values":{"rate":0.3333333333333333,"passes":5,"fails":10},"type":"rate","contains":"default"},"http_req_duration":{"contains":"time","values":{"avg":427.1935672000001,"p(50)":195.27623,"p(95)":2106.8020447,"p(99)":2112.8369009400003,"max":2114.345615},"type":"trend"},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.4652859999999999,"p(50)":0.476251,"p(95)":0.7287704999999995,"p(99)":0.9538652999999997,"max":1.010139}},"http_req_receiving":{"type":"trend","contains":"time","values":{"avg":0.3033577333333333,"p(50)":0.165485,"p(95)":0.7939931999999986,"p(99)":1.5388234399999994,"max":1.725031}},"data_sent":{"type":"counter","contains":"data","values":{"count":2996,"rate":243.5364881975388}},"vus_max":{"type":"gauge","contains":"default","values":{"min":8,"max":8,"value":8}},"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":426.42492346666666,"p(50)":194.527747,"p(95)":2106.0141127999996,"p(99)":2111.6633233599996,"max":2113.075626}},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_reqs":{"type":"counter","contains":"default","values":{"count":15,"rate":1.2193081852346737}},"application_errors{status:0}":{"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default","values":{"count":0,"rate":0}},"vus":{"type":"gauge","contains":"default","values":{"value":0,"min":0,"max":0}},"data_received":{"type":"counter","contains":"data","values":{"count":8858,"rate":720.0421269872493}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(95)":264.7855810999991,"p(99)":759.0491506199995,"max":882.615043,"avg":58.84199013333333,"p(50)":0.000989}}}}} +time="2026-10-29T11:16:28Z" level=error msg="Error: synthetic actor setup exhausted retries\n\tat setup (file:///scripts/scaling.js:46:26(235))\n" hint="script exception" diff --git a/evidence/research-20261029-final/matrix.png b/evidence/research-20261029-final/matrix.png new file mode 100644 index 00000000..cf642b94 Binary files /dev/null and b/evidence/research-20261029-final/matrix.png differ diff --git a/evidence/research-20261029-final/matrix.svg b/evidence/research-20261029-final/matrix.svg new file mode 100644 index 00000000..c6c277d3 --- /dev/null +++ b/evidence/research-20261029-final/matrix.svg @@ -0,0 +1,1667 @@ + + + + + + + + 2026-10-29T15:23:04.427382 + image/svg+xml + + + Matplotlib v3.10.8, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/evidence/research-20261029-final/node-capacity.json b/evidence/research-20261029-final/node-capacity.json new file mode 100644 index 00000000..16a112b0 --- /dev/null +++ b/evidence/research-20261029-final/node-capacity.json @@ -0,0 +1,95 @@ +[ + { + "name": "dev.asisti.tech", + "capacity": { + "cpu": "4", + "ephemeral-storage": "82447384Ki", + "hugepages-1Gi": "0", + "hugepages-2Mi": "0", + "memory": "8026472Ki", + "pods": "110" + }, + "allocatable": { + "cpu": "4", + "ephemeral-storage": "81398808Ki", + "hugepages-1Gi": "0", + "hugepages-2Mi": "0", + "memory": "7924072Ki", + "pods": "110" + }, + "nodeInfo": { + "architecture": "amd64", + "containerRuntimeVersion": "containerd://1.7.29", + "kernelVersion": "6.8.0-139-generic", + "kubeProxyVersion": "", + "kubeletVersion": "v1.33.13", + "operatingSystem": "linux", + "osImage": "Ubuntu 24.04.4 LTS", + "swap": { + "capacity": 4109365248 + } + } + }, + { + "name": "marlosrv0", + "capacity": { + "cpu": "6", + "ephemeral-storage": "980227752Ki", + "hugepages-1Gi": "0", + "hugepages-2Mi": "0", + "memory": "32703800Ki", + "pods": "110" + }, + "allocatable": { + "cpu": "6", + "ephemeral-storage": "979179176Ki", + "hugepages-1Gi": "0", + "hugepages-2Mi": "0", + "memory": "32601400Ki", + "pods": "110" + }, + "nodeInfo": { + "architecture": "amd64", + "containerRuntimeVersion": "containerd://1.7.29", + "kernelVersion": "6.8.0-147-generic", + "kubeProxyVersion": "", + "kubeletVersion": "v1.33.13", + "operatingSystem": "linux", + "osImage": "Ubuntu 24.04.5 LTS", + "swap": { + "capacity": 8589930496 + } + } + }, + { + "name": "srv0.agapov.space", + "capacity": { + "cpu": "4", + "ephemeral-storage": "82447384Ki", + "hugepages-1Gi": "0", + "hugepages-2Mi": "0", + "memory": "8026556Ki", + "pods": "110" + }, + "allocatable": { + "cpu": "4", + "ephemeral-storage": "81398808Ki", + "hugepages-1Gi": "0", + "hugepages-2Mi": "0", + "memory": "7924156Ki", + "pods": "110" + }, + "nodeInfo": { + "architecture": "amd64", + "containerRuntimeVersion": "containerd://1.7.29", + "kernelVersion": "6.8.0-139-generic", + "kubeProxyVersion": "", + "kubeletVersion": "v1.33.13", + "operatingSystem": "linux", + "osImage": "Ubuntu 24.04.4 LTS", + "swap": { + "capacity": 4109365248 + } + } + } +] diff --git a/evidence/research-20261029-final/nodes.txt b/evidence/research-20261029-final/nodes.txt new file mode 100644 index 00000000..461dea77 --- /dev/null +++ b/evidence/research-20261029-final/nodes.txt @@ -0,0 +1,4 @@ +NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME +dev.asisti.tech Ready 252d v1.33.13 100.99.166.40 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 +marlosrv0 Ready 254d v1.33.13 192.168.1.37 Ubuntu 24.04.5 LTS 6.8.0-147-generic containerd://1.7.29 +srv0.agapov.space Ready 246d v1.33.13 100.108.186.94 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 diff --git a/evidence/research-20261029-final/pods-growing2-20261029111200.txt b/evidence/research-20261029-final/pods-growing2-20261029111200.txt new file mode 100644 index 00000000..6321425e --- /dev/null +++ b/evidence/research-20261029-final/pods-growing2-20261029111200.txt @@ -0,0 +1,3 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-855b9f4fb5-jmv88 1/1 Running 0 4m6s 10.1.25.91 dev.asisti.tech +api-855b9f4fb5-l4wp7 1/1 Running 0 39s 10.1.112.76 marlosrv0 diff --git a/evidence/research-20261029-final/pods-growing4-20261029111342.txt b/evidence/research-20261029-final/pods-growing4-20261029111342.txt new file mode 100644 index 00000000..fa1a526c --- /dev/null +++ b/evidence/research-20261029-final/pods-growing4-20261029111342.txt @@ -0,0 +1,5 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-855b9f4fb5-jmv88 1/1 Running 0 5m46s 10.1.25.91 dev.asisti.tech +api-855b9f4fb5-k58mh 1/1 Running 0 37s 10.1.25.113 dev.asisti.tech +api-855b9f4fb5-l4wp7 1/1 Running 0 2m19s 10.1.112.76 marlosrv0 +api-855b9f4fb5-sw875 1/1 Running 0 37s 10.1.131.11 srv0.agapov.space diff --git a/evidence/research-20261029-final/pods-saturation8-20261029111530.txt b/evidence/research-20261029-final/pods-saturation8-20261029111530.txt new file mode 100644 index 00000000..06b7e451 --- /dev/null +++ b/evidence/research-20261029-final/pods-saturation8-20261029111530.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-6fc45595fc-bc4qf 1/1 Running 0 36s 10.1.112.98 marlosrv0 diff --git a/evidence/research-20261029-final/profiles.csv b/evidence/research-20261029-final/profiles.csv new file mode 100644 index 00000000..35916c17 --- /dev/null +++ b/evidence/research-20261029-final/profiles.csv @@ -0,0 +1,8 @@ +profile,run,replicas,cpu_millicores_per_replica,memory_mib_per_replica,pool,vus,duration +fixed1,fixed1-20261029110437,1,1000,512,8,32,30 +fixed2,fixed2-20261029110639,2,500,256,8,32,30 +fixed4,fixed4-20261029110815,4,250,128,8,32,30 +growing1,growing1-20261029111013,1,250,128,8,32,30 +growing2,growing2-20261029111200,2,250,128,8,32,30 +growing4,growing4-20261029111342,4,250,128,8,32,30 +saturation8,saturation8-20261029111530,1,1000,512,8,8,30 diff --git a/evidence/research-20261029-final/resources-fixed1-20261029110437.txt b/evidence/research-20261029-final/resources-fixed1-20261029110437.txt new file mode 100644 index 00000000..273f08d8 --- /dev/null +++ b/evidence/research-20261029-final/resources-fixed1-20261029110437.txt @@ -0,0 +1,97 @@ +UTC 2026-10-29T11:05:39Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-5df5c 3m 22Mi +postgres-0 5m 30Mi +valkey-0 7m 9Mi +valkey-1 5m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:05:52Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-5df5c 2m 22Mi +postgres-0 5m 30Mi +valkey-0 7m 9Mi +valkey-1 5m 13Mi +valkey-2 5m 3Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:05:58Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-5df5c 2m 22Mi +postgres-0 5m 30Mi +valkey-0 7m 9Mi +valkey-1 5m 13Mi +valkey-2 5m 3Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:06:05Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-5df5c 233m 10Mi +load-fixed1-20261029110437-h46fd 56m 19Mi +postgres-0 10m 31Mi +valkey-0 21m 8Mi +valkey-1 5m 13Mi +valkey-2 6m 3Mi +active|Client|ClientRead|1 +active|IO|WalSync|1 +active|Lock|transactionid|1 +active|||2 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|3 +UTC 2026-10-29T11:06:12Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-5df5c 233m 10Mi +load-fixed1-20261029110437-h46fd 56m 19Mi +postgres-0 10m 31Mi +valkey-0 21m 8Mi +valkey-1 5m 13Mi +valkey-2 6m 3Mi +active|||3 +idle|Client|ClientRead|6 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:06:19Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-5df5c 233m 10Mi +load-fixed1-20261029110437-h46fd 227m 28Mi +postgres-0 328m 49Mi +valkey-0 21m 8Mi +valkey-1 13m 14Mi +valkey-2 48m 3Mi +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|7 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:06:26Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-5df5c 233m 10Mi +load-fixed1-20261029110437-h46fd 227m 28Mi +postgres-0 328m 49Mi +valkey-0 21m 8Mi +valkey-1 13m 14Mi +valkey-2 48m 3Mi +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|3 +idle in transaction|Client|ClientRead|5 +UTC 2026-10-29T11:06:32Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-5df5c 562m 15Mi +load-fixed1-20261029110437-h46fd 277m 30Mi +postgres-0 654m 50Mi +valkey-0 115m 8Mi +valkey-1 107m 14Mi +valkey-2 85m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:06:38Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-5df5c 562m 15Mi +postgres-0 654m 50Mi +valkey-0 115m 8Mi +valkey-1 107m 14Mi +valkey-2 85m 3Mi diff --git a/evidence/research-20261029-final/resources-fixed2-20261029110639.txt b/evidence/research-20261029-final/resources-fixed2-20261029110639.txt new file mode 100644 index 00000000..db6fd787 --- /dev/null +++ b/evidence/research-20261029-final/resources-fixed2-20261029110639.txt @@ -0,0 +1,99 @@ +UTC 2026-10-29T11:07:23Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-6prkx 17m 22Mi +api-7f5b6b9d85-kc6g9 3m 22Mi +postgres-0 10m 35Mi +valkey-0 8m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:07:30Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-6prkx 2m 22Mi +api-7f5b6b9d85-kc6g9 35m 58Mi +postgres-0 14m 36Mi +valkey-0 7m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|3 +idle|||1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:07:36Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-6prkx 2m 22Mi +api-7f5b6b9d85-kc6g9 35m 58Mi +postgres-0 14m 36Mi +valkey-0 7m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:07:42Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-6prkx 2m 22Mi +api-7f5b6b9d85-kc6g9 35m 58Mi +postgres-0 14m 36Mi +valkey-0 7m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|IO|WalSync|1 +active|Lock|transactionid|2 +active|||2 +idle|Client|ClientRead|7 +idle|||1 +idle in transaction|Client|ClientRead|4 +idle in transaction|||1 +UTC 2026-10-29T11:07:49Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-6prkx 143m 14Mi +api-7f5b6b9d85-kc6g9 35m 58Mi +load-fixed2-20261029110639-p24fl 151m 26Mi +postgres-0 14m 36Mi +valkey-0 52m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||4 +idle|Client|ClientRead|8 +idle|||1 +idle in transaction|Client|ClientRead|5 +UTC 2026-10-29T11:07:56Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-6prkx 143m 14Mi +api-7f5b6b9d85-kc6g9 35m 58Mi +load-fixed2-20261029110639-p24fl 151m 26Mi +postgres-0 14m 36Mi +valkey-0 52m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||2 +idle|Client|ClientRead|12 +idle in transaction|Client|ClientRead|3 +idle in transaction|||1 +UTC 2026-10-29T11:08:03Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-6prkx 394m 14Mi +api-7f5b6b9d85-kc6g9 319m 13Mi +load-fixed2-20261029110639-p24fl 361m 30Mi +postgres-0 454m 71Mi +valkey-0 52m 9Mi +valkey-1 68m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|12 +idle in transaction|Client|ClientRead|5 +UTC 2026-10-29T11:08:10Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-6prkx 394m 14Mi +api-7f5b6b9d85-kc6g9 319m 13Mi +load-fixed2-20261029110639-p24fl 361m 30Mi +postgres-0 454m 71Mi +valkey-0 52m 9Mi +valkey-1 68m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|16 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-final/resources-fixed4-20261029110815.txt b/evidence/research-20261029-final/resources-fixed4-20261029110815.txt new file mode 100644 index 00000000..4072fe8c --- /dev/null +++ b/evidence/research-20261029-final/resources-fixed4-20261029110815.txt @@ -0,0 +1,131 @@ +UTC 2026-10-29T11:09:13Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-gsprd 2m 23Mi +api-855b9f4fb5-jmv88 2m 22Mi +api-855b9f4fb5-sts4n 3m 22Mi +api-855b9f4fb5-wk5f7 2m 22Mi +postgres-0 11m 40Mi +valkey-0 8m 9Mi +valkey-1 6m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:09:20Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-gsprd 2m 23Mi +api-855b9f4fb5-jmv88 3m 22Mi +api-855b9f4fb5-sts4n 2m 22Mi +api-855b9f4fb5-wk5f7 2m 22Mi +postgres-0 7m 40Mi +valkey-0 9m 9Mi +valkey-1 6m 14Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:09:26Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-gsprd 2m 23Mi +api-855b9f4fb5-jmv88 3m 22Mi +api-855b9f4fb5-sts4n 2m 22Mi +api-855b9f4fb5-wk5f7 2m 22Mi +postgres-0 7m 40Mi +valkey-0 9m 9Mi +valkey-1 6m 14Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:09:32Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-gsprd 2m 23Mi +api-855b9f4fb5-jmv88 28m 58Mi +api-855b9f4fb5-sts4n 38m 61Mi +api-855b9f4fb5-wk5f7 31m 61Mi +load-fixed4-20261029110815-p6tfm 23m 17Mi +postgres-0 25m 44Mi +valkey-0 10m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|9 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:09:39Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-gsprd 2m 23Mi +api-855b9f4fb5-jmv88 28m 58Mi +api-855b9f4fb5-sts4n 38m 61Mi +api-855b9f4fb5-wk5f7 31m 61Mi +load-fixed4-20261029110815-p6tfm 23m 17Mi +postgres-0 25m 44Mi +valkey-0 10m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|26 +idle|||1 +idle in transaction|Client|ClientRead|5 +UTC 2026-10-29T11:09:46Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-gsprd 54m 40Mi +api-855b9f4fb5-jmv88 41m 40Mi +api-855b9f4fb5-sts4n 75m 11Mi +api-855b9f4fb5-wk5f7 92m 9Mi +load-fixed4-20261029110815-p6tfm 136m 25Mi +postgres-0 213m 110Mi +valkey-0 47m 9Mi +valkey-1 21m 14Mi +valkey-2 20m 3Mi +active|IO|WalSync|1 +active|Lock|transactionid|1 +active|||1 +idle|Client|ClientRead|26 +idle|||1 +idle in transaction|Client|ClientRead|4 +UTC 2026-10-29T11:09:52Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-gsprd 54m 40Mi +api-855b9f4fb5-jmv88 41m 40Mi +api-855b9f4fb5-sts4n 75m 11Mi +api-855b9f4fb5-wk5f7 92m 9Mi +load-fixed4-20261029110815-p6tfm 136m 25Mi +postgres-0 213m 110Mi +valkey-0 47m 9Mi +valkey-1 21m 14Mi +valkey-2 20m 3Mi +active|||1 +idle|Client|ClientRead|25 +idle in transaction|Client|ClientRead|8 +UTC 2026-10-29T11:10:00Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-gsprd 170m 11Mi +api-855b9f4fb5-jmv88 197m 12Mi +api-855b9f4fb5-sts4n 229m 12Mi +api-855b9f4fb5-wk5f7 191m 10Mi +load-fixed4-20261029110815-p6tfm 264m 29Mi +postgres-0 765m 113Mi +valkey-0 138m 9Mi +valkey-1 92m 14Mi +valkey-2 49m 3Mi +active|Client|ClientRead|1 +active|||1 +idle|Client|ClientRead|24 +idle in transaction|Client|ClientRead|6 +idle in transaction|IO|WalSync|1 +idle in transaction|LWLock|WALWrite|1 +UTC 2026-10-29T11:10:08Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-gsprd 170m 11Mi +api-855b9f4fb5-jmv88 197m 12Mi +api-855b9f4fb5-sts4n 229m 12Mi +api-855b9f4fb5-wk5f7 191m 10Mi +load-fixed4-20261029110815-p6tfm 264m 29Mi +postgres-0 765m 113Mi +valkey-0 138m 9Mi +valkey-1 92m 14Mi +valkey-2 49m 3Mi +active|||1 +idle|Client|ClientRead|32 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-final/resources-growing1-20261029111013.txt b/evidence/research-20261029-final/resources-growing1-20261029111013.txt new file mode 100644 index 00000000..c5df5753 --- /dev/null +++ b/evidence/research-20261029-final/resources-growing1-20261029111013.txt @@ -0,0 +1,96 @@ +UTC 2026-10-29T11:10:55Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 2m 12Mi +postgres-0 28m 55Mi +valkey-0 7m 9Mi +valkey-1 6m 14Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:11:02Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 2m 12Mi +postgres-0 5m 55Mi +valkey-0 7m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:11:08Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 2m 12Mi +postgres-0 5m 55Mi +valkey-0 7m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:11:15Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 82m 65Mi +load-growing1-20261029111013-4pptm 31m 18Mi +postgres-0 16m 55Mi +valkey-0 10m 9Mi +valkey-1 5m 14Mi +valkey-2 8m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:11:21Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 82m 65Mi +load-growing1-20261029111013-4pptm 31m 18Mi +postgres-0 16m 55Mi +valkey-0 10m 9Mi +valkey-1 5m 14Mi +valkey-2 8m 3Mi +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|4 +UTC 2026-10-29T11:11:28Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 82m 65Mi +load-growing1-20261029111013-4pptm 31m 18Mi +postgres-0 16m 55Mi +valkey-0 10m 9Mi +valkey-1 5m 14Mi +valkey-2 8m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:11:34Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 144m 12Mi +load-growing1-20261029111013-4pptm 55m 18Mi +postgres-0 54m 55Mi +valkey-0 28m 9Mi +valkey-1 7m 14Mi +valkey-2 26m 3Mi +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|4 +UTC 2026-10-29T11:11:41Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 144m 12Mi +load-growing1-20261029111013-4pptm 55m 18Mi +postgres-0 54m 55Mi +valkey-0 28m 9Mi +valkey-1 7m 14Mi +valkey-2 26m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:11:47Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 144m 12Mi +load-growing1-20261029111013-4pptm 55m 18Mi +postgres-0 54m 55Mi +valkey-0 28m 9Mi +valkey-1 7m 14Mi +valkey-2 26m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-final/resources-growing2-20261029111200.txt b/evidence/research-20261029-final/resources-growing2-20261029111200.txt new file mode 100644 index 00000000..e38784c4 --- /dev/null +++ b/evidence/research-20261029-final/resources-growing2-20261029111200.txt @@ -0,0 +1,105 @@ +UTC 2026-10-29T11:12:44Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 3m 15Mi +api-855b9f4fb5-l4wp7 19m 22Mi +postgres-0 6m 57Mi +valkey-0 7m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|9 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:12:51Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 3m 15Mi +api-855b9f4fb5-l4wp7 3m 23Mi +postgres-0 5m 57Mi +valkey-0 7m 9Mi +valkey-1 6m 14Mi +valkey-2 8m 3Mi +active|||1 +idle|Client|ClientRead|9 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:12:57Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 3m 15Mi +api-855b9f4fb5-l4wp7 3m 23Mi +postgres-0 5m 57Mi +valkey-0 7m 9Mi +valkey-1 6m 14Mi +valkey-2 8m 3Mi +active|||1 +idle|Client|ClientRead|12 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:13:03Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 72m 66Mi +api-855b9f4fb5-l4wp7 75m 9Mi +load-growing2-20261029111200-vdwmn 59m 18Mi +postgres-0 12m 58Mi +valkey-0 11m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|12 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:13:10Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 72m 66Mi +api-855b9f4fb5-l4wp7 75m 9Mi +load-growing2-20261029111200-vdwmn 59m 18Mi +postgres-0 12m 58Mi +valkey-0 11m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||3 +idle|Client|ClientRead|10 +idle in transaction|Client|ClientRead|5 +UTC 2026-10-29T11:13:17Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 148m 14Mi +api-855b9f4fb5-l4wp7 75m 9Mi +load-growing2-20261029111200-vdwmn 54m 18Mi +postgres-0 221m 76Mi +valkey-0 60m 9Mi +valkey-1 12m 14Mi +valkey-2 27m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:13:27Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 148m 14Mi +api-855b9f4fb5-l4wp7 75m 9Mi +load-growing2-20261029111200-vdwmn 54m 18Mi +postgres-0 221m 76Mi +valkey-0 60m 9Mi +valkey-1 12m 14Mi +valkey-2 27m 3Mi +active|||1 +idle|Client|ClientRead|13 +idle|||1 +idle in transaction|Client|ClientRead|3 +UTC 2026-10-29T11:13:33Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 133m 16Mi +api-855b9f4fb5-l4wp7 122m 12Mi +load-growing2-20261029111200-vdwmn 163m 31Mi +postgres-0 170m 76Mi +valkey-0 76m 9Mi +valkey-1 30m 14Mi +valkey-2 40m 3Mi +active|||2 +idle|Client|ClientRead|12 +idle in transaction|Client|ClientRead|4 +UTC 2026-10-29T11:13:40Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 133m 16Mi +api-855b9f4fb5-l4wp7 122m 12Mi +postgres-0 170m 76Mi +valkey-0 76m 9Mi +valkey-1 30m 14Mi +valkey-2 40m 3Mi +active|||1 +idle|Client|ClientRead|16 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-final/resources-growing4-20261029111342.txt b/evidence/research-20261029-final/resources-growing4-20261029111342.txt new file mode 100644 index 00000000..a9a220a5 --- /dev/null +++ b/evidence/research-20261029-final/resources-growing4-20261029111342.txt @@ -0,0 +1,128 @@ +UTC 2026-10-29T11:14:25Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 3m 15Mi +api-855b9f4fb5-k58mh 18m 22Mi +api-855b9f4fb5-l4wp7 2m 13Mi +api-855b9f4fb5-sw875 3m 22Mi +postgres-0 9m 80Mi +valkey-0 10m 9Mi +valkey-1 5m 14Mi +valkey-2 7m 4Mi +active|||1 +idle|Client|ClientRead|16 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:14:38Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 3m 15Mi +api-855b9f4fb5-k58mh 3m 22Mi +api-855b9f4fb5-l4wp7 3m 13Mi +api-855b9f4fb5-sw875 3m 22Mi +postgres-0 7m 80Mi +valkey-0 7m 9Mi +valkey-1 5m 14Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|17 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:14:44Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 3m 15Mi +api-855b9f4fb5-k58mh 3m 22Mi +api-855b9f4fb5-l4wp7 3m 13Mi +api-855b9f4fb5-sw875 3m 22Mi +postgres-0 7m 80Mi +valkey-0 7m 9Mi +valkey-1 5m 14Mi +valkey-2 7m 3Mi +active|||2 +idle|Client|ClientRead|17 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:14:50Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 4m 15Mi +api-855b9f4fb5-k58mh 3m 23Mi +api-855b9f4fb5-l4wp7 20m 49Mi +api-855b9f4fb5-sw875 32m 61Mi +load-growing4-20261029111342-g6kw6 39m 17Mi +postgres-0 13m 75Mi +valkey-0 9m 9Mi +valkey-1 6m 14Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|18 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:14:57Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 4m 15Mi +api-855b9f4fb5-k58mh 3m 23Mi +api-855b9f4fb5-l4wp7 20m 49Mi +api-855b9f4fb5-sw875 32m 61Mi +load-growing4-20261029111342-g6kw6 39m 17Mi +postgres-0 13m 75Mi +valkey-0 9m 9Mi +valkey-1 6m 14Mi +valkey-2 7m 3Mi +active|Lock|transactionid|1 +active|||1 +idle|Client|ClientRead|24 +idle|||1 +idle in transaction|Client|ClientRead|7 +UTC 2026-10-29T11:15:03Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 57m 66Mi +api-855b9f4fb5-k58mh 73m 39Mi +api-855b9f4fb5-l4wp7 65m 44Mi +api-855b9f4fb5-sw875 59m 61Mi +load-growing4-20261029111342-g6kw6 103m 25Mi +postgres-0 72m 82Mi +valkey-0 52m 9Mi +valkey-1 13m 14Mi +valkey-2 16m 3Mi +active|||1 +idle|Client|ClientRead|28 +idle in transaction|Client|ClientRead|4 +idle in transaction|IO|WalSync|1 +UTC 2026-10-29T11:15:11Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 57m 66Mi +api-855b9f4fb5-k58mh 73m 39Mi +api-855b9f4fb5-l4wp7 65m 44Mi +api-855b9f4fb5-sw875 59m 61Mi +load-growing4-20261029111342-g6kw6 103m 25Mi +postgres-0 72m 82Mi +valkey-0 52m 9Mi +valkey-1 13m 14Mi +valkey-2 16m 3Mi +active|Lock|transactionid|1 +active|||1 +idle|Client|ClientRead|26 +idle in transaction|Client|ClientRead|6 +UTC 2026-10-29T11:15:18Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 170m 54Mi +api-855b9f4fb5-k58mh 145m 10Mi +api-855b9f4fb5-l4wp7 153m 13Mi +api-855b9f4fb5-sw875 216m 13Mi +load-growing4-20261029111342-g6kw6 273m 29Mi +postgres-0 617m 117Mi +valkey-0 76m 10Mi +valkey-1 66m 14Mi +valkey-2 16m 3Mi +active|Lock|transactionid|1 +active|||1 +idle|Client|ClientRead|28 +idle in transaction|Client|ClientRead|4 +UTC 2026-10-29T11:15:25Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-jmv88 170m 54Mi +api-855b9f4fb5-k58mh 145m 10Mi +api-855b9f4fb5-l4wp7 153m 13Mi +api-855b9f4fb5-sw875 216m 13Mi +load-growing4-20261029111342-g6kw6 273m 29Mi +postgres-0 617m 117Mi +valkey-0 76m 10Mi +valkey-1 66m 14Mi +valkey-2 16m 3Mi +active|||1 +idle|Client|ClientRead|32 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-final/resources-saturation8-20261029111530.txt b/evidence/research-20261029-final/resources-saturation8-20261029111530.txt new file mode 100644 index 00000000..0ff4aac8 --- /dev/null +++ b/evidence/research-20261029-final/resources-saturation8-20261029111530.txt @@ -0,0 +1,40 @@ +UTC 2026-10-29T11:16:12Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-bc4qf 10m 22Mi +postgres-0 9m 41Mi +valkey-0 8m 10Mi +valkey-1 6m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:16:18Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-bc4qf 2m 22Mi +postgres-0 9m 41Mi +valkey-0 10m 10Mi +valkey-1 5m 14Mi +valkey-2 8m 3Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:16:25Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-bc4qf 2m 22Mi +postgres-0 9m 41Mi +valkey-0 10m 10Mi +valkey-1 5m 14Mi +valkey-2 8m 3Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:16:33Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-bc4qf 37m 58Mi +postgres-0 9m 42Mi +valkey-0 8m 9Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-final/restore-values.yaml b/evidence/research-20261029-final/restore-values.yaml new file mode 100644 index 00000000..4e915dac --- /dev/null +++ b/evidence/research-20261029-final/restore-values.yaml @@ -0,0 +1,61 @@ +api: + env: + DEPENDENCY_POOL_SIZE: "8" + DEPENDENCY_TIMEOUT_MS: "2000" + GOMEMLIMIT: 160MiB + REQUEST_TIMEOUT_SECONDS: "4" + SESSION_TTL_SECONDS: "3600" + SHUTDOWN_TIMEOUT_SECONDS: "5" + replicas: 2 + resources: + limits: + cpu: "1" + memory: 256Mi + requests: + cpu: 250m + memory: 128Mi +autoscaling: + cpuPercent: 60 + enabled: true + maxReplicas: 4 + minReplicas: 2 +databaseSecret: messenger-secrets +image: + digest: sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 + repository: asisti.registry.twcstorage.ru/mtusi2026lab3 +imagePullSecret: registry-pull +ingress: + className: traefik + clusterIssuer: letsencrypt-prod + host: hl.agapov.space +load: + duration: 30 + enabled: false + run: manual + script: scaling.js + vus: 32 +monitoring: + serviceMonitor: false +postgres: + image: postgres:17.6-alpine + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + storage: 2Gi +storageClass: "" +valkey: + image: valkey/valkey:8.1.3-alpine + maxmemory: 64mb + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 100m + memory: 96Mi + shards: 3 + storage: 1Gi diff --git a/evidence/research-20261029-final/restore.txt b/evidence/research-20261029-final/restore.txt new file mode 100644 index 00000000..41755a8d --- /dev/null +++ b/evidence/research-20261029-final/restore.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:16:34 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 15 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-final/results.png b/evidence/research-20261029-final/results.png new file mode 100644 index 00000000..f58739ce Binary files /dev/null and b/evidence/research-20261029-final/results.png differ diff --git a/evidence/research-20261029-final/results.svg b/evidence/research-20261029-final/results.svg new file mode 100644 index 00000000..5e445a41 --- /dev/null +++ b/evidence/research-20261029-final/results.svg @@ -0,0 +1,3372 @@ + + + + + + + + 2026-10-29T15:23:04.316010 + image/svg+xml + + + Matplotlib v3.10.8, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/evidence/research-20261029-final/rollout-fixed1.txt b/evidence/research-20261029-final/rollout-fixed1.txt new file mode 100644 index 00000000..478b770e --- /dev/null +++ b/evidence/research-20261029-final/rollout-fixed1.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:04:38 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 8 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-final/rollout-fixed2.txt b/evidence/research-20261029-final/rollout-fixed2.txt new file mode 100644 index 00000000..238f56ef --- /dev/null +++ b/evidence/research-20261029-final/rollout-fixed2.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:06:40 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 9 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-final/rollout-fixed4.txt b/evidence/research-20261029-final/rollout-fixed4.txt new file mode 100644 index 00000000..8c9fe3f7 --- /dev/null +++ b/evidence/research-20261029-final/rollout-fixed4.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:08:16 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 10 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-final/rollout-growing1.txt b/evidence/research-20261029-final/rollout-growing1.txt new file mode 100644 index 00000000..4b624d12 --- /dev/null +++ b/evidence/research-20261029-final/rollout-growing1.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:10:14 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 11 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-final/rollout-growing2.txt b/evidence/research-20261029-final/rollout-growing2.txt new file mode 100644 index 00000000..5dc09761 --- /dev/null +++ b/evidence/research-20261029-final/rollout-growing2.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:12:01 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 12 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-final/rollout-growing4.txt b/evidence/research-20261029-final/rollout-growing4.txt new file mode 100644 index 00000000..d898e60b --- /dev/null +++ b/evidence/research-20261029-final/rollout-growing4.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:13:44 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 13 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-final/rollout-saturation8.txt b/evidence/research-20261029-final/rollout-saturation8.txt new file mode 100644 index 00000000..5a540a27 --- /dev/null +++ b/evidence/research-20261029-final/rollout-saturation8.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:15:31 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 14 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-final/source.sha256 b/evidence/research-20261029-final/source.sha256 new file mode 100644 index 00000000..93d2dce5 --- /dev/null +++ b/evidence/research-20261029-final/source.sha256 @@ -0,0 +1,3 @@ +614623b626103627eea3d8946b9b22474be13a49115ffbb9e68e2d883ff1e4d4 student-tests/load/scaling.js +dcc8dc1217792aca3385c8e3195b236058ee9b2df912e60f9af46dc51b9a6c86 charts/messenger/values.yaml +60e09dd38fd1d413b744f21b57f64ba83e49a5ae1b4251aa5bf20be033f90cfb internal/controller/http/fiber/errors.go diff --git a/evidence/research-20261029-final/summary.csv b/evidence/research-20261029-final/summary.csv new file mode 100644 index 00000000..2e4c8b99 --- /dev/null +++ b/evidence/research-20261029-final/summary.csv @@ -0,0 +1,20 @@ +profile,run,replicas,cpu_millicores_per_replica,memory_mib_per_replica,pool,vus,duration,source,confirmed,rps,errors,error_percent,p50_ms,p95_ms,p99_ms,rejected_429,unavailable_503,network_errors,api_cpu_m,postgres_cpu_m,valkey_cpu_m,load_cpu_m,api_memory_mib,postgres_memory_mib,pg_active,pg_idle_transaction,pg_lock_waiters +fixed1,fixed1-20261029110437,1,1000,512,8,32,30,evidence/research-20261029-final,4242,141.4,0,0.0,91.8974085,221.84451689999997,570.8439318800006,0,0,0,562.0,654.0,307.0,277.0,22.0,50.0,5,5,1 +fixed2,fixed2-20261029110639,2,500,256,8,32,30,evidence/research-20261029-final,3725,124.16666666666667,36,0.4578405188859214,95.44093000000001,172.7375654,350.0392311900002,0,24,0,713.0,454.0,126.0,361.0,80.0,71.0,5,5,2 +fixed4,fixed4-20261029110815,4,250,128,8,32,30,evidence/research-20261029-final,2783,92.76666666666667,10,0.17041581458759372,138.39813800000002,579.4783116,748.0037995700006,0,9,0,787.0,765.0,279.0,264.0,203.0,113.0,3,8,1 +growing2,growing2-20261029111200,2,250,128,8,32,30,evidence/research-20261029-final,1198,39.93333333333333,6761,73.1868369777008,46.2625695,347.8488570999995,559.5331142800044,0,6754,0,255.0,221.0,146.0,163.0,75.0,76.0,3,5,0 +growing4,growing4-20261029111342,4,250,128,8,32,30,evidence/research-20261029-final,2319,77.3,0,0.0,136.678739,800.6695819,1002.1604266600006,0,0,0,684.0,617.0,158.0,273.0,210.0,117.0,2,7,1 +saturation64,saturation64-20261029112756,1,1000,512,8,64,30,evidence/research-20261029-pool,3246,108.2,4704,41.26677778752522,152.308315,371.86722199999997,533.1040489200009,0,4704,0,644.0,596.0,313.0,511.0,69.0,64.0,3,2,0 +single8a,single8a-20261029112953,1,1000,512,8,32,30,evidence/research-20261029-pool,2674,89.13333333333334,23,0.4056437389770723,131.492881,237.366661,553.4051984999999,0,8,0,423.0,340.0,192.0,430.0,15.0,65.0,7,1,1 +single32a,single32a-20261029113131,1,1000,512,32,32,30,evidence/research-20261029-pool,3603,120.1,16143,68.08806782234595,3.862274,112.4937897,285.82339131999726,0,16127,0,145.0,243.0,85.0,464.0,40.0,125.0,1,1,0 +single8b,single8b-20261029113315,1,1000,512,8,32,30,evidence/research-20261029-pool,2647,88.23333333333333,19983,78.22972126526777,2.858447,134.85857299999975,171.70400019000002,0,19983,0,290.0,187.0,127.0,0,22.0,69.0,5,3,0 +single32b,single32b-20261029113452,1,1000,512,32,32,30,evidence/research-20261029-pool,4952,165.06666666666666,0,0.0,98.00462,169.04933884999997,243.31071381999948,0,0,0,728.0,984.0,327.0,309.0,24.0,133.0,7,5,0 +probe5a,probe5a-20261029113950,1,1000,512,8,32,30,evidence/research-20261029-readiness,4352,145.06666666666666,0,0.0,98.04979,183.89047805,227.91660417999984,0,0,0,695.0,370.0,229.0,168.0,61.0,75.0,3,2,0 +probe2b,probe2b-20261029114146,1,1000,512,8,32,30,evidence/research-20261029-readiness,4810,160.33333333333334,0,0.0,92.3184985,159.7035873,211.03447146,0,0,0,3.0,3.0,21.0,0,22.0,59.0,4,2,0 +probe5b,probe5b-20261029114403,1,1000,512,8,32,30,evidence/research-20261029-readiness,2642,88.06666666666666,17950,76.34399455597142,3.865505,140.496066,199.81785927999985,0,17950,0,503.0,347.0,224.0,330.0,23.0,81.0,4,4,0 +growing1,growing1-20261029115804,1,250,128,8,32,30,evidence/research-20261029-budget,1133,37.766666666666666,3898,61.951684678957406,9.191468,400.90426964999995,515.0820838300001,0,3897,0,188.0,94.0,76.0,80.0,59.0,83.0,3,7,1 +saturation8,saturation8-20261029121309,1,1000,512,8,8,30,evidence/research-20261029-budget,2008,66.93333333333334,0,0.0,51.4747885,119.66888329999979,161.99635167000022,0,0,0,488.0,499.0,230.0,211.0,62.0,84.0,4,1,0 +resource-low-a,resource-low-a-20261029121455,2,250,128,8,32,30,evidence/research-20261029-budget,1281,42.7,126,4.463336875664187,179.871273,474.7400550500002,2920.94988727998,0,110,0,110.0,111.0,37.0,50.0,120.0,103.0,2,5,0 +resource-high-a,resource-high-a-20261029121644,2,500,256,8,32,30,evidence/research-20261029-budget,3270,109.0,18494,72.94024847170184,3.132864,165.90313379999998,214.25322976000027,0,18494,0,498.0,377.0,224.0,295.0,119.0,106.0,6,2,1 +resource-low-b,resource-low-b-20261029121833,2,250,128,8,32,30,evidence/research-20261029-budget,1164,38.8,25,1.004419445560466,183.4024585,427.3455392499994,3906.8322486500006,0,10,0,148.0,19.0,44.0,58.0,83.0,107.0,4,4,1 +resource-high-b,resource-high-b-20261029122017,2,500,256,8,32,30,evidence/research-20261029-budget,5109,170.3,0,0.0,86.548129,150.95621699999998,174.36450792000005,0,0,0,777.0,851.0,377.0,50.0,67.0,111.0,3,7,0 diff --git a/evidence/research-20261029-pool/README.md b/evidence/research-20261029-pool/README.md new file mode 100644 index 00000000..25b70a72 --- /dev/null +++ b/evidence/research-20261029-pool/README.md @@ -0,0 +1,7 @@ +# Насыщение и размер пула + +saturation8-20261029112615 исключён: в Deployment две реплики при ожидаемой одной (переход от HPA). Остальные профили имеют одну API на dev.asisti.tech, 1000m/512Mi. Исходные значения остаются в profiles.csv; анализатор сверяет фактические Deployment и исключает несовпадения. + +saturation64: 108.2 успешных записей/с и 4704 ошибки операций. admission-samples.txt содержит UTC-время, число неистекших глобальных слотов и значение rate-счётчика. Наблюдалось заполнение всех 32 слотов. Команда наблюдения — scripts/sample-admission.sh. + +A/B пула: single8a/single32a/single8b/single32b. Увеличение до 32 не подтвердило устойчивого улучшения: в первом B выросли ошибки, результаты повторов неоднородны. Такой вариант не выбран штатным. Параметр одновременно задаёт pgxpool и клиентские пулы Valkey; отдельно вклад каждого не выделен. diff --git a/evidence/research-20261029-pool/admission-samples.txt b/evidence/research-20261029-pool/admission-samples.txt new file mode 100644 index 00000000..1f4835ab --- /dev/null +++ b/evidence/research-20261029-pool/admission-samples.txt @@ -0,0 +1,540 @@ +UTC 2026-10-29T11:27:55Z +0 +0 +UTC 2026-10-29T11:28:01Z +0 +0 +UTC 2026-10-29T11:28:08Z +0 +0 +UTC 2026-10-29T11:28:14Z +0 +0 +UTC 2026-10-29T11:28:20Z +0 +0 +UTC 2026-10-29T11:28:26Z +0 +0 +UTC 2026-10-29T11:28:32Z +0 +0 +UTC 2026-10-29T11:28:39Z +0 +0 +UTC 2026-10-29T11:28:46Z +0 +0 +UTC 2026-10-29T11:28:53Z +0 +4 +UTC 2026-10-29T11:29:00Z +0 +0 +UTC 2026-10-29T11:29:07Z +2 +39 +UTC 2026-10-29T11:29:13Z +0 +0 +UTC 2026-10-29T11:29:19Z +32 +149 +UTC 2026-10-29T11:29:28Z +32 +191 +UTC 2026-10-29T11:29:34Z +32 +74 +UTC 2026-10-29T11:29:41Z +32 +32 +UTC 2026-10-29T11:29:48Z +0 +0 +UTC 2026-10-29T11:29:54Z +0 +0 +UTC 2026-10-29T11:30:00Z +0 +0 +UTC 2026-10-29T11:30:06Z +0 +0 +UTC 2026-10-29T11:30:24Z +0 +0 +UTC 2026-10-29T11:30:30Z +0 +0 +UTC 2026-10-29T11:30:36Z +0 +0 +UTC 2026-10-29T11:30:43Z +1 +4 +UTC 2026-10-29T11:30:49Z +0 +25 +UTC 2026-10-29T11:30:56Z +16 +200 +UTC 2026-10-29T11:31:02Z +23 +58 +UTC 2026-10-29T11:31:09Z +19 +142 +UTC 2026-10-29T11:31:15Z +20 +251 +UTC 2026-10-29T11:31:21Z +0 +0 +UTC 2026-10-29T11:31:38Z +0 +0 +UTC 2026-10-29T11:31:44Z +0 +0 +UTC 2026-10-29T11:31:51Z +0 +0 +UTC 2026-10-29T11:31:57Z +0 +0 +UTC 2026-10-29T11:32:04Z +0 +0 +UTC 2026-10-29T11:32:10Z +0 +0 +UTC 2026-10-29T11:32:16Z +0 +0 +UTC 2026-10-29T11:32:22Z +0 +0 +UTC 2026-10-29T11:32:29Z +3 +92 +UTC 2026-10-29T11:32:38Z +0 +0 +UTC 2026-10-29T11:32:44Z +1 +1 +UTC 2026-10-29T11:32:52Z +26 +117 +UTC 2026-10-29T11:32:59Z +28 +198 +UTC 2026-10-29T11:33:05Z +6 +100 +UTC 2026-10-29T11:33:12Z +0 +0 +UTC 2026-10-29T11:33:19Z +0 +0 +UTC 2026-10-29T11:33:24Z +0 +0 +UTC 2026-10-29T11:33:31Z +0 +0 +UTC 2026-10-29T11:33:37Z +0 +0 +UTC 2026-10-29T11:33:43Z +0 +0 +UTC 2026-10-29T11:33:49Z +0 +0 +UTC 2026-10-29T11:33:56Z +0 +0 +UTC 2026-10-29T11:34:02Z +1 +5 +UTC 2026-10-29T11:34:09Z +0 +0 +UTC 2026-10-29T11:34:16Z +14 +8 +UTC 2026-10-29T11:34:33Z +19 +254 +UTC 2026-10-29T11:34:40Z +16 +39 +UTC 2026-10-29T11:34:47Z +0 +0 +UTC 2026-10-29T11:34:54Z +0 +0 +UTC 2026-10-29T11:35:00Z +0 +0 +UTC 2026-10-29T11:35:06Z +0 +0 +UTC 2026-10-29T11:35:12Z +0 +0 +UTC 2026-10-29T11:35:19Z +0 +0 +UTC 2026-10-29T11:35:24Z +0 +0 +UTC 2026-10-29T11:35:30Z +1 +10 +UTC 2026-10-29T11:36:09Z +3 +107 +UTC 2026-10-29T11:36:16Z +25 +193 +UTC 2026-10-29T11:36:22Z +20 +79 +UTC 2026-10-29T11:36:28Z +30 +18 +UTC 2026-10-29T11:36:34Z +30 +302 +UTC 2026-10-29T11:36:41Z +26 +33 +UTC 2026-10-29T11:36:47Z +0 +0 +UTC 2026-10-29T11:36:54Z +0 +0 +UTC 2026-10-29T11:37:01Z +0 +0 +UTC 2026-10-29T11:37:07Z +0 +0 +UTC 2026-10-29T11:37:13Z +0 +0 +UTC 2026-10-29T11:37:19Z +0 +0 +UTC 2026-10-29T11:37:27Z +0 +0 +UTC 2026-10-29T11:37:32Z +0 +0 +UTC 2026-10-29T11:37:38Z +0 +0 +UTC 2026-10-29T11:37:44Z +0 +0 +UTC 2026-10-29T11:37:50Z +0 +0 +UTC 2026-10-29T11:37:55Z +0 +0 +UTC 2026-10-29T11:38:17Z +0 +0 +UTC 2026-10-29T11:38:22Z +0 +0 +UTC 2026-10-29T11:38:28Z +0 +0 +UTC 2026-10-29T11:38:34Z +0 +0 +UTC 2026-10-29T11:38:40Z +0 +0 +UTC 2026-10-29T11:38:46Z +0 +0 +UTC 2026-10-29T11:38:52Z +0 +0 +UTC 2026-10-29T11:38:57Z +0 +0 +UTC 2026-10-29T11:39:03Z +1 +7 +UTC 2026-10-29T11:39:11Z +0 +1 +UTC 2026-10-29T11:39:17Z +21 +173 +UTC 2026-10-29T11:39:38Z +24 +83 +UTC 2026-10-29T11:39:44Z +21 +324 +UTC 2026-10-29T11:39:49Z +0 +0 +UTC 2026-10-29T11:39:55Z +0 +0 +UTC 2026-10-29T11:40:01Z +0 +0 +UTC 2026-10-29T11:40:07Z +0 +0 +UTC 2026-10-29T11:40:12Z +0 +0 +UTC 2026-10-29T11:40:18Z +0 +0 +UTC 2026-10-29T11:40:24Z +0 +0 +UTC 2026-10-29T11:40:30Z +0 +0 +UTC 2026-10-29T11:40:35Z +0 +0 +UTC 2026-10-29T11:40:53Z +1 +2 +UTC 2026-10-29T11:40:59Z +1 +5 +UTC 2026-10-29T11:41:04Z +0 +0 +UTC 2026-10-29T11:41:10Z +17 +222 +UTC 2026-10-29T11:41:16Z +8 +162 +UTC 2026-10-29T11:41:22Z +17 +153 +UTC 2026-10-29T11:41:28Z +15 +178 +UTC 2026-10-29T11:41:34Z +17 +175 +UTC 2026-10-29T11:41:40Z +0 +0 +UTC 2026-10-29T11:41:46Z +0 +0 +UTC 2026-10-29T11:41:52Z +0 +0 +UTC 2026-10-29T11:42:08Z +0 +0 +UTC 2026-10-29T11:42:13Z +0 +0 +UTC 2026-10-29T11:42:19Z +0 +0 +UTC 2026-10-29T11:42:25Z +0 +0 +UTC 2026-10-29T11:42:31Z +0 +0 +UTC 2026-10-29T11:42:36Z +0 +0 +UTC 2026-10-29T11:42:42Z +0 +0 +UTC 2026-10-29T11:42:48Z +0 +0 +UTC 2026-10-29T11:42:54Z +0 +0 +UTC 2026-10-29T11:42:59Z +0 +0 +UTC 2026-10-29T11:43:05Z +0 +0 +UTC 2026-10-29T11:43:16Z +0 +2 +UTC 2026-10-29T11:43:22Z +2 +60 +UTC 2026-10-29T11:43:28Z +7 +7 +UTC 2026-10-29T11:43:34Z +19 +312 +UTC 2026-10-29T11:43:39Z +16 +285 +UTC 2026-10-29T11:43:46Z +22 +180 +UTC 2026-10-29T11:43:51Z +22 +154 +UTC 2026-10-29T11:43:57Z +21 +134 +UTC 2026-10-29T11:44:03Z +0 +0 +UTC 2026-10-29T11:44:09Z +0 +0 +UTC 2026-10-29T11:44:15Z +0 +0 +UTC 2026-10-29T11:44:32Z +0 +0 +UTC 2026-10-29T11:44:37Z +0 +0 +UTC 2026-10-29T11:44:43Z +0 +0 +UTC 2026-10-29T11:44:49Z +0 +1 +UTC 2026-10-29T11:44:55Z +2 +26 +UTC 2026-10-29T11:45:01Z +0 +0 +UTC 2026-10-29T11:45:07Z +12 +170 +UTC 2026-10-29T11:45:13Z +17 +192 +UTC 2026-10-29T11:45:19Z +18 +154 +UTC 2026-10-29T11:45:25Z +0 +0 +UTC 2026-10-29T11:45:34Z +0 +0 +UTC 2026-10-29T11:45:40Z +0 +0 +UTC 2026-10-29T11:45:45Z +0 +0 +UTC 2026-10-29T11:45:51Z +0 +0 +UTC 2026-10-29T11:45:57Z +0 +0 +UTC 2026-10-29T11:46:02Z +0 +0 +UTC 2026-10-29T11:46:08Z +0 +0 +UTC 2026-10-29T11:46:14Z +0 +0 +UTC 2026-10-29T11:46:20Z +0 +0 +UTC 2026-10-29T11:46:25Z +0 +0 +UTC 2026-10-29T11:46:31Z +0 +0 +UTC 2026-10-29T11:46:37Z +E1029 14:56:42.086748 4642 v2.go:168] "Copying stderr failed" err="next reader: websocket: close 1006 (abnormal closure): unexpected EOF" +E1029 14:56:42.087119 4642 v2.go:151] "Copying stdout failed" err="next reader: websocket: close 1006 (abnormal closure): unexpected EOF" +error: error reading from error stream: next reader: websocket: close 1006 (abnormal closure): unexpected EOF +UTC 2026-10-29T11:56:47Z +0 +0 +UTC 2026-10-29T11:56:53Z +error: EOF +UTC 2026-10-29T11:57:03Z +0 +0 +UTC 2026-10-29T11:57:19Z +0 +0 +UTC 2026-10-29T11:57:26Z +0 +0 +UTC 2026-10-29T11:57:32Z +0 +0 +UTC 2026-10-29T11:57:39Z +0 +0 +UTC 2026-10-29T11:57:45Z +0 +0 +UTC 2026-10-29T11:57:50Z +0 +0 +UTC 2026-10-29T11:57:55Z +0 +0 +UTC 2026-10-29T11:58:01Z +0 +0 +UTC 2026-10-29T11:58:06Z +0 +0 +UTC 2026-10-29T11:58:12Z +0 +0 +UTC 2026-10-29T11:58:32Z +0 +0 +UTC 2026-10-29T11:58:38Z +0 +0 +UTC 2026-10-29T11:58:43Z +0 +0 +UTC 2026-10-29T11:58:49Z +1 +4 +UTC 2026-10-29T11:58:54Z +4 +6 +UTC 2026-10-29T11:59:00Z +0 +25 diff --git a/evidence/research-20261029-pool/base-revision.txt b/evidence/research-20261029-pool/base-revision.txt new file mode 100644 index 00000000..32abb9b4 --- /dev/null +++ b/evidence/research-20261029-pool/base-revision.txt @@ -0,0 +1 @@ +7b7e23fd029beea47e6f625a96cb98d2fe04bafb diff --git a/evidence/research-20261029-pool/date.txt b/evidence/research-20261029-pool/date.txt new file mode 100644 index 00000000..3f7a1069 --- /dev/null +++ b/evidence/research-20261029-pool/date.txt @@ -0,0 +1 @@ +2026-10-29T11:26:15Z diff --git a/evidence/research-20261029-pool/deployment-saturation64-20261029112756.json b/evidence/research-20261029-pool/deployment-saturation64-20261029112756.json new file mode 100644 index 00000000..14fd8bad --- /dev/null +++ b/evidence/research-20261029-pool/deployment-saturation64-20261029112756.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "18", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 32, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60164526", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:26:25Z", + "message": "ReplicaSet \"api-84fbf9968\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + }, + { + "lastTransitionTime": "2026-10-29T11:27:56Z", + "lastUpdateTime": "2026-10-29T11:27:56Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + } + ], + "observedGeneration": 32, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-pool/deployment-saturation8-20261029112615.json b/evidence/research-20261029-pool/deployment-saturation8-20261029112615.json new file mode 100644 index 00000000..0ca9dc99 --- /dev/null +++ b/evidence/research-20261029-pool/deployment-saturation8-20261029112615.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "18", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 31, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60164234", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:26:25Z", + "message": "ReplicaSet \"api-84fbf9968\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + }, + { + "lastTransitionTime": "2026-10-29T11:26:46Z", + "lastUpdateTime": "2026-10-29T11:26:46Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + } + ], + "observedGeneration": 31, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/research-20261029-pool/deployment-single32a-20261029113131.json b/evidence/research-20261029-pool/deployment-single32a-20261029113131.json new file mode 100644 index 00000000..ef8caff2 --- /dev/null +++ b/evidence/research-20261029-pool/deployment-single32a-20261029113131.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "19", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 33, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60165408", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "7037faeb0676fe1a4b4de3f5bbd8f2e4f15c57479484ae610cfb30c24add1e04", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:31:36Z", + "lastUpdateTime": "2026-10-29T11:31:36Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:31:43Z", + "message": "ReplicaSet \"api-757dbc95b7\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 33, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-pool/deployment-single32b-20261029113452.json b/evidence/research-20261029-pool/deployment-single32b-20261029113452.json new file mode 100644 index 00000000..ea09bf8b --- /dev/null +++ b/evidence/research-20261029-pool/deployment-single32b-20261029113452.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "21", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 35, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60166203", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "7037faeb0676fe1a4b4de3f5bbd8f2e4f15c57479484ae610cfb30c24add1e04", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:34:30Z", + "lastUpdateTime": "2026-10-29T11:34:30Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:35:03Z", + "message": "ReplicaSet \"api-757dbc95b7\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 35, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-pool/deployment-single8a-20261029112953.json b/evidence/research-20261029-pool/deployment-single8a-20261029112953.json new file mode 100644 index 00000000..9bbf8ca2 --- /dev/null +++ b/evidence/research-20261029-pool/deployment-single8a-20261029112953.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "18", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 32, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60165044", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:26:25Z", + "message": "ReplicaSet \"api-84fbf9968\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + }, + { + "lastTransitionTime": "2026-10-29T11:30:19Z", + "lastUpdateTime": "2026-10-29T11:30:19Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + } + ], + "observedGeneration": 32, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-pool/deployment-single8b-20261029113315.json b/evidence/research-20261029-pool/deployment-single8b-20261029113315.json new file mode 100644 index 00000000..dd8965b5 --- /dev/null +++ b/evidence/research-20261029-pool/deployment-single8b-20261029113315.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "20", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 34, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60165807", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:32:49Z", + "lastUpdateTime": "2026-10-29T11:32:49Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:33:22Z", + "message": "ReplicaSet \"api-84fbf9968\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 34, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-pool/load-saturation64-20261029112756.json b/evidence/research-20261029-pool/load-saturation64-20261029112756.json new file mode 100644 index 00000000..0763c196 --- /dev/null +++ b/evidence/research-20261029-pool/load-saturation64-20261029112756.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 64, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 55995.2814 + }, + "metrics": { + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 401.99767529999997, + "p(99)": 576.616830559999, + "max": 7017.57684, + "avg": 213.6142088077467, + "p(50)": 191.3700135 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "rate": 211.78570235741327, + "count": 11859 + } + }, + "data_received": { + "contains": "data", + "values": { + "count": 11090315, + "rate": 198058.02779660645 + }, + "type": "counter" + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 1.3795551400000003, + "max": 14.244521, + "avg": 0.2349340860949491, + "p(50)": 0.155843, + "p(95)": 0.6693625000000003 + } + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 4704, + "rate": 84.00707849643916 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 11399, + "rate": 203.57072444322066 + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 163.46032220946165, + "p(50)": 143.75494, + "p(95)": 360.878234, + "p(99)": 512.61079596, + "max": 7017.57684 + } + }, + "confirmed_messages": { + "contains": "default", + "values": { + "count": 3246, + "rate": 57.96917023797651 + }, + "type": "counter" + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.1934017953453075, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 74.471482 + } + }, + "iteration_duration": { + "values": { + "avg": 337.6012475935087, + "p(50)": 301.04942500000004, + "p(95)": 697.9470468000001, + "p(99)": 936.3719748500005, + "max": 1497.258214 + }, + "type": "trend", + "contains": "time" + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "rate": 0, + "count": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 64, + "min": 64, + "max": 64 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 1058512, + "rate": 18903.59283023444 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.06324757492200016, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 34.458354 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "max": 23.806737, + "avg": 0.20671237498946082, + "p(50)": 0.181281, + "p(95)": 0.42426280000000005, + "p(99)": 0.8308295200000007 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 4704, + "rate": 84.00707849643916 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "max": 7017.064104, + "avg": 163.0186757483773, + "p(50)": 143.295731, + "p(95)": 360.3821336000001, + "p(99)": 512.27814752 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.6010178117048346, + "passes": 7086, + "fails": 4704 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.3969137364027321, + "passes": 4707, + "fails": 7152 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.3041592049076592, + "p(50)": 0.001234, + "p(95)": 0.001434, + "p(99)": 0.012724420000000014, + "max": 525.672971 + } + }, + "failed_writes": { + "type": "counter", + "contains": "default", + "values": { + "count": 2291, + "rate": 40.914161742207085 + } + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 64, + "min": 0, + "max": 64 + } + }, + "iterations": { + "values": { + "count": 5700, + "rate": 101.79429154543011 + }, + "type": "counter", + "contains": "default" + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "max": 874.341712, + "avg": 170.9695874179156, + "p(50)": 152.308315, + "p(95)": 371.86722199999997, + "p(99)": 533.1040489200009 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 5537, + "rate": 98.8833319801836 + } + } + }, + "setup_data": [ + { + "chat": "7bb14e47-ca2b-4d22-9ece-778c293e3ebf", + "token": "6IjGS4Mg7gZlo5qheTmZYxe27z-SJS-AvtbeCn7Jxjo" + }, + { + "chat": "220000bd-7884-4925-a5f1-43acc73a2c3e", + "token": "0Vuc8T2ZoLzCSAgK1SnTcliwrXvhbeA5MOi4S5gf4Q8" + }, + { + "chat": "e0cf378b-18c9-4711-b912-8bb67c2cd9ed", + "token": "i99DldVRBG_Xqms_UCRTtlcx423G_3uFKIqyhiERgPI" + }, + { + "chat": "36b04788-63b5-4d39-9bd1-0975c865576b", + "token": "TycvRZFlzzr7htbn96yUknJ9VI_yvpf1NAUN3reK9X8" + }, + { + "chat": "bf8611af-f87d-4dd3-be51-bd7d77a7bbc0", + "token": "pdJI3Cm5bFpUCBfpQmkr8DNksubnocbg3P6AHwvXzrM" + }, + { + "chat": "1bec14b9-4d35-4156-9b3a-07d867f10cd1", + "token": "wRHZ12UcdCOWU_VfNrebEz0um-o5MH3qUxtNrAhU-nk" + }, + { + "chat": "d3f32855-d6e0-4f71-9a41-f5049882e43a", + "token": "Fun7aiDNCS_aFmzH3vMrHty8pIdhO4d2suXNsxzKrhA" + }, + { + "chat": "acd9cdbb-fb68-4231-837c-445d5a9b3cfc", + "token": "iy1zm6U5UFGwJA6QrS0Hsrfuul-J_N7rsdCZIVvSHf8" + }, + { + "chat": "ce1620a2-d040-4fe7-8595-0991c591e7eb", + "token": "G95LyLE__0mN7-Tp48tq6mYOR_x12Z-En8gTqStnaKw" + }, + { + "chat": "cf9bb5ba-b517-47f8-b38a-6708f2400780", + "token": "7Mr1WuKxu7f_jROtvvWSrqJv7iNKeIgnRGvgFJPUiB8" + }, + { + "chat": "efe12f4c-4b0e-4557-88b0-623cdd9e2429", + "token": "Odjd1ietkAXcA2KDYBKv8u7rsx28YqAAqn9ld9n5rL0" + }, + { + "chat": "7324e6a5-6c52-4c8a-b47a-9682a3b98c65", + "token": "xPlmQZ3HY-XMbBUEW954T2sScYADlDj6xT7bA2bu7Ts" + }, + { + "chat": "b4f5cd58-1e5d-4d73-b19d-42ab840df946", + "token": "ofzILf_2vnVQh841wl33gQCVkSvFSp6OVj5mXdf91Iw" + }, + { + "chat": "2fd103e7-7c46-46b8-9205-42c6d3a1f906", + "token": "cNDVy1CsyX1uzUWcOKcBP607FoAUF7iQqLS4rkRBdJQ" + }, + { + "chat": "29f39173-1074-4f3b-8063-d237c0543a7e", + "token": "2vyAJ429jl1dkc0VNhxPus5BcSKstD9iNgGOzWuaHyg" + }, + { + "chat": "d6f8dd35-4944-411a-8988-8e86aacbbc39", + "token": "mJn28Ak1IU6INeLrASNuYLRrEwarQf-XBMjUVAZWmpY" + } + ], + "root_group": { + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 3451, + "fails": 2291 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 197, + "fails": 151 + }, + { + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 3438, + "fails": 2262, + "name": "history readable", + "path": "::history readable" + } + ], + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + } + } +} diff --git a/evidence/research-20261029-pool/load-saturation64-20261029112756.txt b/evidence/research-20261029-pool/load-saturation64-20261029112756.txt new file mode 100644 index 00000000..b6f772d1 --- /dev/null +++ b/evidence/research-20261029-pool/load-saturation64-20261029112756.txt @@ -0,0 +1,2 @@ +time="2026-10-29T11:29:01Z" level=warning msg="setup login: 503; abandoning synthetic actor" source=console +{"profile":{"vus":64,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":55995.2814},"metrics":{"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(95)":401.99767529999997,"p(99)":576.616830559999,"max":7017.57684,"avg":213.6142088077467,"p(50)":191.3700135}},"http_reqs":{"type":"counter","contains":"default","values":{"rate":211.78570235741327,"count":11859}},"data_received":{"contains":"data","values":{"count":11090315,"rate":198058.02779660645},"type":"counter"},"http_req_receiving":{"type":"trend","contains":"time","values":{"p(99)":1.3795551400000003,"max":14.244521,"avg":0.2349340860949491,"p(50)":0.155843,"p(95)":0.6693625000000003}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":4704,"rate":84.00707849643916},"thresholds":{"count>=0":{"ok":true}}},"measured_operations":{"type":"counter","contains":"default","values":{"count":11399,"rate":203.57072444322066}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":163.46032220946165,"p(50)":143.75494,"p(95)":360.878234,"p(99)":512.61079596,"max":7017.57684}},"confirmed_messages":{"contains":"default","values":{"count":3246,"rate":57.96917023797651},"type":"counter"},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"avg":0.1934017953453075,"p(50)":0,"p(95)":0,"p(99)":0,"max":74.471482}},"iteration_duration":{"values":{"avg":337.6012475935087,"p(50)":301.04942500000004,"p(95)":697.9470468000001,"p(99)":936.3719748500005,"max":1497.258214},"type":"trend","contains":"time"},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"rate":0,"count":0},"thresholds":{"count>=0":{"ok":true}}},"vus_max":{"type":"gauge","contains":"default","values":{"value":64,"min":64,"max":64}},"data_sent":{"type":"counter","contains":"data","values":{"count":1058512,"rate":18903.59283023444}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_connecting":{"type":"trend","contains":"time","values":{"avg":0.06324757492200016,"p(50)":0,"p(95)":0,"p(99)":0,"max":34.458354}},"http_req_sending":{"type":"trend","contains":"time","values":{"max":23.806737,"avg":0.20671237498946082,"p(50)":0.181281,"p(95)":0.42426280000000005,"p(99)":0.8308295200000007}},"application_errors":{"type":"counter","contains":"default","values":{"count":4704,"rate":84.00707849643916}},"http_req_waiting":{"type":"trend","contains":"time","values":{"max":7017.064104,"avg":163.0186757483773,"p(50)":143.295731,"p(95)":360.3821336000001,"p(99)":512.27814752}},"checks":{"type":"rate","contains":"default","values":{"rate":0.6010178117048346,"passes":7086,"fails":4704}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.3969137364027321,"passes":4707,"fails":7152}},"http_req_blocked":{"type":"trend","contains":"time","values":{"avg":0.3041592049076592,"p(50)":0.001234,"p(95)":0.001434,"p(99)":0.012724420000000014,"max":525.672971}},"failed_writes":{"type":"counter","contains":"default","values":{"count":2291,"rate":40.914161742207085}},"vus":{"type":"gauge","contains":"default","values":{"value":64,"min":0,"max":64}},"iterations":{"values":{"count":5700,"rate":101.79429154543011},"type":"counter","contains":"default"},"message_latency_ms":{"type":"trend","contains":"time","values":{"max":874.341712,"avg":170.9695874179156,"p(50)":152.308315,"p(95)":371.86722199999997,"p(99)":533.1040489200009}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":5537,"rate":98.8833319801836}}},"setup_data":[{"chat":"7bb14e47-ca2b-4d22-9ece-778c293e3ebf","token":"6IjGS4Mg7gZlo5qheTmZYxe27z-SJS-AvtbeCn7Jxjo"},{"chat":"220000bd-7884-4925-a5f1-43acc73a2c3e","token":"0Vuc8T2ZoLzCSAgK1SnTcliwrXvhbeA5MOi4S5gf4Q8"},{"chat":"e0cf378b-18c9-4711-b912-8bb67c2cd9ed","token":"i99DldVRBG_Xqms_UCRTtlcx423G_3uFKIqyhiERgPI"},{"chat":"36b04788-63b5-4d39-9bd1-0975c865576b","token":"TycvRZFlzzr7htbn96yUknJ9VI_yvpf1NAUN3reK9X8"},{"chat":"bf8611af-f87d-4dd3-be51-bd7d77a7bbc0","token":"pdJI3Cm5bFpUCBfpQmkr8DNksubnocbg3P6AHwvXzrM"},{"chat":"1bec14b9-4d35-4156-9b3a-07d867f10cd1","token":"wRHZ12UcdCOWU_VfNrebEz0um-o5MH3qUxtNrAhU-nk"},{"chat":"d3f32855-d6e0-4f71-9a41-f5049882e43a","token":"Fun7aiDNCS_aFmzH3vMrHty8pIdhO4d2suXNsxzKrhA"},{"chat":"acd9cdbb-fb68-4231-837c-445d5a9b3cfc","token":"iy1zm6U5UFGwJA6QrS0Hsrfuul-J_N7rsdCZIVvSHf8"},{"chat":"ce1620a2-d040-4fe7-8595-0991c591e7eb","token":"G95LyLE__0mN7-Tp48tq6mYOR_x12Z-En8gTqStnaKw"},{"chat":"cf9bb5ba-b517-47f8-b38a-6708f2400780","token":"7Mr1WuKxu7f_jROtvvWSrqJv7iNKeIgnRGvgFJPUiB8"},{"chat":"efe12f4c-4b0e-4557-88b0-623cdd9e2429","token":"Odjd1ietkAXcA2KDYBKv8u7rsx28YqAAqn9ld9n5rL0"},{"chat":"7324e6a5-6c52-4c8a-b47a-9682a3b98c65","token":"xPlmQZ3HY-XMbBUEW954T2sScYADlDj6xT7bA2bu7Ts"},{"chat":"b4f5cd58-1e5d-4d73-b19d-42ab840df946","token":"ofzILf_2vnVQh841wl33gQCVkSvFSp6OVj5mXdf91Iw"},{"chat":"2fd103e7-7c46-46b8-9205-42c6d3a1f906","token":"cNDVy1CsyX1uzUWcOKcBP607FoAUF7iQqLS4rkRBdJQ"},{"chat":"29f39173-1074-4f3b-8063-d237c0543a7e","token":"2vyAJ429jl1dkc0VNhxPus5BcSKstD9iNgGOzWuaHyg"},{"chat":"d6f8dd35-4944-411a-8988-8e86aacbbc39","token":"mJn28Ak1IU6INeLrASNuYLRrEwarQf-XBMjUVAZWmpY"}],"root_group":{"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":3451,"fails":2291},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":197,"fails":151},{"id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":3438,"fails":2262,"name":"history readable","path":"::history readable"}],"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false}}} diff --git a/evidence/research-20261029-pool/load-saturation8-20261029112615.json b/evidence/research-20261029-pool/load-saturation8-20261029112615.json new file mode 100644 index 00000000..eefcf762 --- /dev/null +++ b/evidence/research-20261029-pool/load-saturation8-20261029112615.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 8, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 2548, + "fails": 1 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 258, + "fails": 0 + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 2542, + "fails": 0 + } + ] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 44496.155406 + }, + "metrics": { + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 81.307029, + "p(95)": 166.36112324999993, + "p(99)": 237.15225758000037, + "max": 1275.031493, + "avg": 93.26953639929187 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 5413, + "rate": 121.65095951795634 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 2542, + "rate": 57.12853114624885 + } + }, + "measured_operations": { + "values": { + "count": 4838, + "rate": 108.72849476221555 + }, + "type": "counter", + "contains": "default" + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "rate": 0, + "count": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 44.84286413947879, + "p(50)": 38.886697, + "p(95)": 82.91048659999998, + "p(99)": 115.32284432000009, + "max": 2052.970693 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "rate": 10971.015260661687, + "count": 488168 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.009686436726399407, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 13.339376 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 44.415045599852135, + "p(50)": 38.450137, + "p(95)": 82.30610899999996, + "p(99)": 114.75960772000006, + "max": 2052.638627 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 0.001549, + "max": 524.787416, + "avg": 0.10720693811195224, + "p(50)": 0.001253, + "p(95)": 0.0014533999999999997 + } + }, + "http_req_sending": { + "values": { + "p(99)": 0.5234946400000007, + "max": 3.323115, + "avg": 0.2039293212636244, + "p(50)": 0.188413, + "p(95)": 0.3335779999999999 + }, + "type": "trend", + "contains": "time" + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 8, + "min": 0, + "max": 8 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 2302, + "rate": 51.734806726461386 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 8, + "min": 8, + "max": 8 + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 49.36489804385589, + "p(50)": 42.664478, + "p(95)": 86.18819210000001, + "p(99)": 124.96324370000004, + "max": 2052.970693 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.00018474043968224645, + "passes": 1, + "fails": 5412 + } + }, + "failed_writes": { + "type": "counter", + "contains": "default", + "values": { + "count": 1, + "rate": 0.022473851749114416 + } + }, + "application_errors{status:429}": { + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 1, + "rate": 0.022473851749114416 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_duration{expected_response:true}": { + "values": { + "avg": 44.47181317331831, + "p(50)": 38.88601, + "p(95)": 82.83867274999997, + "p(99)": 114.66379769000001, + "max": 1092.417083 + }, + "type": "trend", + "contains": "time" + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 0, + "max": 1.238689, + "avg": 0.0018240181045630888, + "p(50)": 0, + "p(95)": 0 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 2303, + "rate": 51.757280578210505 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.22388921836319944, + "p(50)": 0.180869, + "p(95)": 0.4766992, + "p(99)": 0.9231913200000004, + "max": 4.496023 + } + }, + "application_errors": { + "values": { + "count": 1, + "rate": 0.022473851749114416 + }, + "type": "counter", + "contains": "default" + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "rate": 164352.96338015492, + "count": 7313075 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.9998130491680688, + "passes": 5348, + "fails": 1 + } + } + }, + "setup_data": [ + { + "chat": "2096181b-7347-4f52-9877-38dcf7626fbd", + "token": "MkhHopatCzVIJJP55A4bVYa1J56tsMqYnR7HIDgp3xs" + }, + { + "chat": "6863a6a2-f16e-4410-b7f5-535923ea8ce7", + "token": "P3zw1mitDKQOBsAW8Z8vJFnJx_fLL2VkOocjxH3-HRw" + }, + { + "chat": "78c6fc5b-ee3f-4d80-8dd1-da4f67202900", + "token": "JdIAq6-ZbLRhPSe_5bbO0pc3lXly9_2099gFsUXO8a8" + }, + { + "chat": "b8cc94f1-7497-4f0f-838f-d61bec6bebab", + "token": "5gsJ5RlplTFccst4QPH3ReHomkZuWfe6MJABdXYJkJ0" + }, + { + "chat": "e598e172-972a-467c-9a55-11521b83ddf5", + "token": "znnTklaiBohaoyUlYYOZEHG8IGaT4F-i1aCk3cUrwaA" + }, + { + "chat": "cc0dffc5-927f-4350-bfe9-d932c3178782", + "token": "yRn1xXfKbWqWVFgbjAJbrXLB908-KjUED8mj9guZyDo" + }, + { + "token": "DfndjzqRJFxMRe8qkfhAAEdnWvearBmYk2XiXxt9toQ", + "chat": "5d0b989d-e8ab-433d-a00a-10a0a8881e72" + }, + { + "chat": "07a1712f-31ea-4a26-8739-b44e0be27f5a", + "token": "bqye58zLxKHwUelwQ2VDxzLCs4zlFA8KRiaZTjqSh2E" + }, + { + "chat": "6cac5a46-bfe7-417b-af3e-e1f5f9f7ffcc", + "token": "8_7Wj77-YpqrnBP3toyHbQfiQKNc8skgRtW23SysUNU" + }, + { + "chat": "1ada04d6-199f-4196-b972-1747f57d1943", + "token": "RbacBD2emJ_ug55jToknU7a_zCbkudODJ2Nc-vXvT7Y" + }, + { + "chat": "76788cd0-1caa-43e6-a94b-4f5ebd856f7b", + "token": "4JJPt-7lj6ldRaNtvURtDUNwpnR-Wkzb-BeyvvdnpOU" + }, + { + "chat": "71a08aff-e027-4214-be5a-b5e528f2ba81", + "token": "hYVOOG42pOdiAJNW3lQ0XGN7-vaE84NrH4peAZQHtiw" + }, + { + "chat": "247db151-7bb7-40b8-a0e0-989039068586", + "token": "7gLYI4o0Ch-lkugU93Lb-GmsJ_yTT2GELfcaoCWMa3M" + }, + { + "token": "naMlsXVyxi506YuEbrlB1KlxKhzmFcIK6I-8GVbeQg4", + "chat": "de6a3ff1-40cb-4775-94bf-0b8f7e38fc17" + }, + { + "chat": "8380aebb-ab7d-408b-a90e-899c74d0ee18", + "token": "dIS4cp9tMvPpzub6Utb-HfDcSNXEX3DP6N2CvTESR-s" + }, + { + "chat": "1c839183-b363-4036-be78-f1b6d2f52058", + "token": "PJvefc03aZWcEVDwXGTYKbgd6zxXvJv_hEsLJP6ENb4" + } + ] + } +} diff --git a/evidence/research-20261029-pool/load-saturation8-20261029112615.txt b/evidence/research-20261029-pool/load-saturation8-20261029112615.txt new file mode 100644 index 00000000..3006556d --- /dev/null +++ b/evidence/research-20261029-pool/load-saturation8-20261029112615.txt @@ -0,0 +1 @@ +{"profile":{"vus":8,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":2548,"fails":1},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":258,"fails":0},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":2542,"fails":0}]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":44496.155406},"metrics":{"iteration_duration":{"type":"trend","contains":"time","values":{"p(50)":81.307029,"p(95)":166.36112324999993,"p(99)":237.15225758000037,"max":1275.031493,"avg":93.26953639929187}},"http_reqs":{"type":"counter","contains":"default","values":{"count":5413,"rate":121.65095951795634}},"iterations":{"type":"counter","contains":"default","values":{"count":2542,"rate":57.12853114624885}},"measured_operations":{"values":{"count":4838,"rate":108.72849476221555},"type":"counter","contains":"default"},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"rate":0,"count":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":44.84286413947879,"p(50)":38.886697,"p(95)":82.91048659999998,"p(99)":115.32284432000009,"max":2052.970693}},"data_sent":{"type":"counter","contains":"data","values":{"rate":10971.015260661687,"count":488168}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"avg":0.009686436726399407,"p(50)":0,"p(95)":0,"p(99)":0,"max":13.339376}},"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":44.415045599852135,"p(50)":38.450137,"p(95)":82.30610899999996,"p(99)":114.75960772000006,"max":2052.638627}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(99)":0.001549,"max":524.787416,"avg":0.10720693811195224,"p(50)":0.001253,"p(95)":0.0014533999999999997}},"http_req_sending":{"values":{"p(99)":0.5234946400000007,"max":3.323115,"avg":0.2039293212636244,"p(50)":0.188413,"p(95)":0.3335779999999999},"type":"trend","contains":"time"},"vus":{"type":"gauge","contains":"default","values":{"value":8,"min":0,"max":8}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":2302,"rate":51.734806726461386}},"vus_max":{"type":"gauge","contains":"default","values":{"value":8,"min":8,"max":8}},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":49.36489804385589,"p(50)":42.664478,"p(95)":86.18819210000001,"p(99)":124.96324370000004,"max":2052.970693}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.00018474043968224645,"passes":1,"fails":5412}},"failed_writes":{"type":"counter","contains":"default","values":{"count":1,"rate":0.022473851749114416}},"application_errors{status:429}":{"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default","values":{"count":0,"rate":0}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":1,"rate":0.022473851749114416},"thresholds":{"count>=0":{"ok":true}}},"http_req_duration{expected_response:true}":{"values":{"avg":44.47181317331831,"p(50)":38.88601,"p(95)":82.83867274999997,"p(99)":114.66379769000001,"max":1092.417083},"type":"trend","contains":"time"},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(99)":0,"max":1.238689,"avg":0.0018240181045630888,"p(50)":0,"p(95)":0}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":2303,"rate":51.757280578210505}},"http_req_receiving":{"type":"trend","contains":"time","values":{"avg":0.22388921836319944,"p(50)":0.180869,"p(95)":0.4766992,"p(99)":0.9231913200000004,"max":4.496023}},"application_errors":{"values":{"count":1,"rate":0.022473851749114416},"type":"counter","contains":"default"},"data_received":{"type":"counter","contains":"data","values":{"rate":164352.96338015492,"count":7313075}},"checks":{"type":"rate","contains":"default","values":{"rate":0.9998130491680688,"passes":5348,"fails":1}}},"setup_data":[{"chat":"2096181b-7347-4f52-9877-38dcf7626fbd","token":"MkhHopatCzVIJJP55A4bVYa1J56tsMqYnR7HIDgp3xs"},{"chat":"6863a6a2-f16e-4410-b7f5-535923ea8ce7","token":"P3zw1mitDKQOBsAW8Z8vJFnJx_fLL2VkOocjxH3-HRw"},{"chat":"78c6fc5b-ee3f-4d80-8dd1-da4f67202900","token":"JdIAq6-ZbLRhPSe_5bbO0pc3lXly9_2099gFsUXO8a8"},{"chat":"b8cc94f1-7497-4f0f-838f-d61bec6bebab","token":"5gsJ5RlplTFccst4QPH3ReHomkZuWfe6MJABdXYJkJ0"},{"chat":"e598e172-972a-467c-9a55-11521b83ddf5","token":"znnTklaiBohaoyUlYYOZEHG8IGaT4F-i1aCk3cUrwaA"},{"chat":"cc0dffc5-927f-4350-bfe9-d932c3178782","token":"yRn1xXfKbWqWVFgbjAJbrXLB908-KjUED8mj9guZyDo"},{"token":"DfndjzqRJFxMRe8qkfhAAEdnWvearBmYk2XiXxt9toQ","chat":"5d0b989d-e8ab-433d-a00a-10a0a8881e72"},{"chat":"07a1712f-31ea-4a26-8739-b44e0be27f5a","token":"bqye58zLxKHwUelwQ2VDxzLCs4zlFA8KRiaZTjqSh2E"},{"chat":"6cac5a46-bfe7-417b-af3e-e1f5f9f7ffcc","token":"8_7Wj77-YpqrnBP3toyHbQfiQKNc8skgRtW23SysUNU"},{"chat":"1ada04d6-199f-4196-b972-1747f57d1943","token":"RbacBD2emJ_ug55jToknU7a_zCbkudODJ2Nc-vXvT7Y"},{"chat":"76788cd0-1caa-43e6-a94b-4f5ebd856f7b","token":"4JJPt-7lj6ldRaNtvURtDUNwpnR-Wkzb-BeyvvdnpOU"},{"chat":"71a08aff-e027-4214-be5a-b5e528f2ba81","token":"hYVOOG42pOdiAJNW3lQ0XGN7-vaE84NrH4peAZQHtiw"},{"chat":"247db151-7bb7-40b8-a0e0-989039068586","token":"7gLYI4o0Ch-lkugU93Lb-GmsJ_yTT2GELfcaoCWMa3M"},{"token":"naMlsXVyxi506YuEbrlB1KlxKhzmFcIK6I-8GVbeQg4","chat":"de6a3ff1-40cb-4775-94bf-0b8f7e38fc17"},{"chat":"8380aebb-ab7d-408b-a90e-899c74d0ee18","token":"dIS4cp9tMvPpzub6Utb-HfDcSNXEX3DP6N2CvTESR-s"},{"chat":"1c839183-b363-4036-be78-f1b6d2f52058","token":"PJvefc03aZWcEVDwXGTYKbgd6zxXvJv_hEsLJP6ENb4"}]}} diff --git a/evidence/research-20261029-pool/load-single32a-20261029113131.json b/evidence/research-20261029-pool/load-single32a-20261029113131.json new file mode 100644 index 00000000..7280ef98 --- /dev/null +++ b/evidence/research-20261029-pool/load-single32a-20261029113131.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "setup_data": [ + { + "chat": "1f7aef4d-e209-4cb3-9101-07636d52aa29", + "token": "s6_cnZNC6Vk_EwF0jzYlmqfliqCQXHbeBA0A6N2PfM4" + }, + { + "chat": "b2013cda-8046-4286-b647-f8dbc49986cf", + "token": "e9Oo7Svhu8XxJov_1uFKejSy0imb9Krh4bKcwdAE4WM" + }, + { + "chat": "95744e14-45b2-4428-aa64-f86a22b31fef", + "token": "wkW05KxTnyBt_vUcU0sFP7KuimbMJO7fUcUPtpIRDWU" + }, + { + "chat": "93562667-8124-4a22-922e-3fa477e68cde", + "token": "f1MSAoegWK-c2eU0BaT3iD6eNgLo35F0y_ltx8TI1F0" + }, + { + "chat": "687b8fe6-bb6e-46ff-b19e-83973c3c84e6", + "token": "vEytMwx5EYzPTBeEPkyHV-cKvsm8mUwDA9LP9yHx12c" + }, + { + "chat": "b6003308-9f2d-44bf-b189-d8202f9d115a", + "token": "PziJQF33OMYNj-mWY-btdkcH4ZTwYJcfNGbC_DkfTgk" + }, + { + "chat": "5c7850be-dc4f-4d67-9b0b-c915cb5f086d", + "token": "HZwBQMS2ikdjoVSNkwgf3p6kGjkwcdCkBrHqwfsBH6M" + }, + { + "chat": "460a90c5-3d0a-4be1-afd5-a4eb5d756d94", + "token": "wYOJ0X69QPhD60yngXjKxkPtes8wlz5LgpzpL860bi0" + }, + { + "chat": "05c75c94-afb0-4365-8d33-8860c966c167", + "token": "nc0Pcb4F8olAT1dovJ3G42k98Unu1qLvjpczcIIeHc0" + }, + { + "chat": "e01c5e76-7697-4065-b7b3-2b1e8855f7be", + "token": "9pc36q-73Bmd8nGUYbifcAGnXsWPEvwyccCeJ1CDsPQ" + }, + { + "chat": "121111c5-2851-4b51-a928-7ce5053d37f7", + "token": "Q7iv0U0dzVUCCpQanNKIi2wLFS_ILNXk-rC73No_nPk" + }, + { + "chat": "9dc4db0c-34db-4daf-86ac-4dff665f40e2", + "token": "h10YjEdDxgRy9_YuDGVSDEXq7cJDcpojYQmb8rUtOb4" + }, + { + "chat": "7b40a5f3-bd1c-48a2-ac7b-ea6e074127d5", + "token": "KhxysVXCzeSfWJxd9FO5QOD8ukDM1jcXQGfCejTndxI" + }, + { + "chat": "14ea7e8f-45c8-4061-a0ec-6e10682be23c", + "token": "AsxjBC447BCDR23i3zOeX4GRWFElEBlEnWVKXB797yI" + }, + { + "chat": "83c3167d-1f70-47f7-98d7-3d4a48ad29c7", + "token": "4vhLxS32wO06qyLb-7SZ9X_pui5FeFJqXMkBB74EJXk" + }, + { + "chat": "c596e8a5-55f8-4ff3-bbd4-00654c587400", + "token": "mWVNVQ8oF5KmBGeGrjd0CkmzOc_5EBdlTxppKYc_GXc" + } + ], + "root_group": { + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 3931, + "fails": 8060 + }, + { + "passes": 400, + "fails": 17, + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa" + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 3906, + "fails": 8066 + } + ], + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 44842.65356 + }, + "metrics": { + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 39.06036981365562, + "p(50)": 3.2344475, + "p(95)": 105.18951534999998, + "p(99)": 287.34505665999984, + "max": 8122.032008 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 12737980, + "rate": 284059.46099858766 + } + }, + "failed_writes": { + "type": "counter", + "contains": "default", + "values": { + "count": 8060, + "rate": 179.73958631184982 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.6604074619538537, + "passes": 16143, + "fails": 8301 + } + }, + "checks": { + "contains": "default", + "values": { + "passes": 8237, + "fails": 16143, + "rate": 0.3378589007383101 + }, + "type": "rate" + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "rate": 260.087195428673, + "count": 11663 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 33.014506677441474, + "p(50)": 3.862274, + "p(95)": 112.4937897, + "p(99)": 285.82339131999726, + "max": 4000.720837 + } + }, + "data_sent": { + "contains": "data", + "values": { + "rate": 45776.840508632915, + "count": 2052755 + }, + "type": "counter" + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 81.42232875384275, + "p(50)": 8.675885999999998, + "p(95)": 210.68181255000002, + "p(99)": 426.03982260999425, + "max": 9971.131023 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.11338658042873442, + "p(50)": 0.049141, + "p(95)": 0.2631546499999999, + "p(99)": 0.6317369199999996, + "max": 30.337725 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.6598465278596017, + "p(50)": 0.203021, + "p(95)": 2.0599633499999968, + "p(99)": 9.596218509999973, + "max": 37.518641 + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 39.83360292194396, + "p(50)": 4.1182865, + "p(95)": 105.72540494999998, + "p(99)": 287.4872817199998, + "max": 8124.000618 + } + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 23709, + "rate": 528.7153662366808 + } + }, + "http_req_tls_handshaking": { + "contains": "time", + "values": { + "avg": 0.04315409998363607, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 49.002345 + }, + "type": "trend" + }, + "application_errors{status:0}": { + "contains": "default", + "values": { + "rate": 0, + "count": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter" + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 16143, + "rate": 359.99207715039597 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 11972, + "rate": 266.97795624385435 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 3603, + "rate": 80.3476091168232 + } + }, + "application_errors{status:503}": { + "contains": "default", + "values": { + "count": 16127, + "rate": 359.63527400138986 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter" + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 24444, + "rate": 545.106010894151 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 527.492637, + "max": 7139.052029, + "avg": 98.81347999373571, + "p(50)": 68.791863, + "p(95)": 137.080146 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0.001323, + "p(99)": 0.001476, + "max": 524.850614, + "avg": 0.06827082895598355, + "p(50)": 0.000269 + } + }, + "http_req_connecting": { + "values": { + "avg": 0.0032163699885452463, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 4.782629 + }, + "type": "trend", + "contains": "time" + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + } + } + } +} diff --git a/evidence/research-20261029-pool/load-single32a-20261029113131.txt b/evidence/research-20261029-pool/load-single32a-20261029113131.txt new file mode 100644 index 00000000..3798ec5a --- /dev/null +++ b/evidence/research-20261029-pool/load-single32a-20261029113131.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"setup_data":[{"chat":"1f7aef4d-e209-4cb3-9101-07636d52aa29","token":"s6_cnZNC6Vk_EwF0jzYlmqfliqCQXHbeBA0A6N2PfM4"},{"chat":"b2013cda-8046-4286-b647-f8dbc49986cf","token":"e9Oo7Svhu8XxJov_1uFKejSy0imb9Krh4bKcwdAE4WM"},{"chat":"95744e14-45b2-4428-aa64-f86a22b31fef","token":"wkW05KxTnyBt_vUcU0sFP7KuimbMJO7fUcUPtpIRDWU"},{"chat":"93562667-8124-4a22-922e-3fa477e68cde","token":"f1MSAoegWK-c2eU0BaT3iD6eNgLo35F0y_ltx8TI1F0"},{"chat":"687b8fe6-bb6e-46ff-b19e-83973c3c84e6","token":"vEytMwx5EYzPTBeEPkyHV-cKvsm8mUwDA9LP9yHx12c"},{"chat":"b6003308-9f2d-44bf-b189-d8202f9d115a","token":"PziJQF33OMYNj-mWY-btdkcH4ZTwYJcfNGbC_DkfTgk"},{"chat":"5c7850be-dc4f-4d67-9b0b-c915cb5f086d","token":"HZwBQMS2ikdjoVSNkwgf3p6kGjkwcdCkBrHqwfsBH6M"},{"chat":"460a90c5-3d0a-4be1-afd5-a4eb5d756d94","token":"wYOJ0X69QPhD60yngXjKxkPtes8wlz5LgpzpL860bi0"},{"chat":"05c75c94-afb0-4365-8d33-8860c966c167","token":"nc0Pcb4F8olAT1dovJ3G42k98Unu1qLvjpczcIIeHc0"},{"chat":"e01c5e76-7697-4065-b7b3-2b1e8855f7be","token":"9pc36q-73Bmd8nGUYbifcAGnXsWPEvwyccCeJ1CDsPQ"},{"chat":"121111c5-2851-4b51-a928-7ce5053d37f7","token":"Q7iv0U0dzVUCCpQanNKIi2wLFS_ILNXk-rC73No_nPk"},{"chat":"9dc4db0c-34db-4daf-86ac-4dff665f40e2","token":"h10YjEdDxgRy9_YuDGVSDEXq7cJDcpojYQmb8rUtOb4"},{"chat":"7b40a5f3-bd1c-48a2-ac7b-ea6e074127d5","token":"KhxysVXCzeSfWJxd9FO5QOD8ukDM1jcXQGfCejTndxI"},{"chat":"14ea7e8f-45c8-4061-a0ec-6e10682be23c","token":"AsxjBC447BCDR23i3zOeX4GRWFElEBlEnWVKXB797yI"},{"chat":"83c3167d-1f70-47f7-98d7-3d4a48ad29c7","token":"4vhLxS32wO06qyLb-7SZ9X_pui5FeFJqXMkBB74EJXk"},{"chat":"c596e8a5-55f8-4ff3-bbd4-00654c587400","token":"mWVNVQ8oF5KmBGeGrjd0CkmzOc_5EBdlTxppKYc_GXc"}],"root_group":{"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":3931,"fails":8060},{"passes":400,"fails":17,"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa"},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":3906,"fails":8066}],"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":44842.65356},"metrics":{"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":39.06036981365562,"p(50)":3.2344475,"p(95)":105.18951534999998,"p(99)":287.34505665999984,"max":8122.032008}},"data_received":{"type":"counter","contains":"data","values":{"count":12737980,"rate":284059.46099858766}},"failed_writes":{"type":"counter","contains":"default","values":{"count":8060,"rate":179.73958631184982}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.6604074619538537,"passes":16143,"fails":8301}},"checks":{"contains":"default","values":{"passes":8237,"fails":16143,"rate":0.3378589007383101},"type":"rate"},"attempted_messages":{"type":"counter","contains":"default","values":{"rate":260.087195428673,"count":11663}},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":33.014506677441474,"p(50)":3.862274,"p(95)":112.4937897,"p(99)":285.82339131999726,"max":4000.720837}},"data_sent":{"contains":"data","values":{"rate":45776.840508632915,"count":2052755},"type":"counter"},"iteration_duration":{"type":"trend","contains":"time","values":{"avg":81.42232875384275,"p(50)":8.675885999999998,"p(95)":210.68181255000002,"p(99)":426.03982260999425,"max":9971.131023}},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.11338658042873442,"p(50)":0.049141,"p(95)":0.2631546499999999,"p(99)":0.6317369199999996,"max":30.337725}},"http_req_receiving":{"type":"trend","contains":"time","values":{"avg":0.6598465278596017,"p(50)":0.203021,"p(95)":2.0599633499999968,"p(99)":9.596218509999973,"max":37.518641}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":39.83360292194396,"p(50)":4.1182865,"p(95)":105.72540494999998,"p(99)":287.4872817199998,"max":8124.000618}},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"measured_operations":{"type":"counter","contains":"default","values":{"count":23709,"rate":528.7153662366808}},"http_req_tls_handshaking":{"contains":"time","values":{"avg":0.04315409998363607,"p(50)":0,"p(95)":0,"p(99)":0,"max":49.002345},"type":"trend"},"application_errors{status:0}":{"contains":"default","values":{"rate":0,"count":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter"},"application_errors":{"type":"counter","contains":"default","values":{"count":16143,"rate":359.99207715039597}},"iterations":{"type":"counter","contains":"default","values":{"count":11972,"rate":266.97795624385435}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":3603,"rate":80.3476091168232}},"application_errors{status:503}":{"contains":"default","values":{"count":16127,"rate":359.63527400138986},"thresholds":{"count>=0":{"ok":true}},"type":"counter"},"http_reqs":{"type":"counter","contains":"default","values":{"count":24444,"rate":545.106010894151}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(99)":527.492637,"max":7139.052029,"avg":98.81347999373571,"p(50)":68.791863,"p(95)":137.080146}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(95)":0.001323,"p(99)":0.001476,"max":524.850614,"avg":0.06827082895598355,"p(50)":0.000269}},"http_req_connecting":{"values":{"avg":0.0032163699885452463,"p(50)":0,"p(95)":0,"p(99)":0,"max":4.782629},"type":"trend","contains":"time"},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}}}}} diff --git a/evidence/research-20261029-pool/load-single32b-20261029113452.json b/evidence/research-20261029-pool/load-single32b-20261029113452.json new file mode 100644 index 00000000..6d1f56e1 --- /dev/null +++ b/evidence/research-20261029-pool/load-single32b-20261029113452.json @@ -0,0 +1,373 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 5207, + "fails": 0, + "name": "message confirmed", + "path": "::message confirmed" + }, + { + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 531, + "fails": 0, + "name": "retry returns original", + "path": "::retry returns original" + }, + { + "passes": 5190, + "fails": 0, + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8" + } + ], + "name": "", + "path": "" + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 48673.739253 + }, + "metrics": { + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 5190, + "rate": 106.62833962730971 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 4952, + "rate": 101.73863927445812 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 4952, + "rate": 101.73863927445812 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 15043309, + "rate": 309064.173635947 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 0.0016582599999999893, + "max": 1012.379068, + "avg": 0.1996732418371928, + "p(50)": 0.001203, + "p(95)": 0.0014132999999999993 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 188.29500669788078, + "p(50)": 180.589137, + "p(95)": 295.59766025000005, + "p(99)": 412.67946847999997, + "max": 1761.617317 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 47.890406, + "avg": 0.09781442401091403 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 88.45134501045892, + "p(50)": 82.841394, + "p(95)": 140.58404829999986, + "p(99)": 217.11189321999984, + "max": 1545.446105 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "avg": 88.98811769068436, + "p(50)": 83.373051, + "p(95)": 141.24850055, + "p(99)": 217.5468004100001, + "max": 1546.268579 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 1002112, + "rate": 20588.350420154642 + } + }, + "http_reqs": { + "values": { + "count": 10995, + "rate": 225.89182932606363 + }, + "type": "counter", + "contains": "default" + }, + "http_req_sending": { + "contains": "time", + "values": { + "avg": 0.20672665948158267, + "p(50)": 0.178569, + "p(95)": 0.41804149999999995, + "p(99)": 0.9532230199999941, + "max": 6.672115 + }, + "type": "trend" + }, + "http_req_receiving": { + "values": { + "max": 17.954545, + "avg": 0.30640277671668886, + "p(50)": 0.172578, + "p(95)": 0.9733099999999997, + "p(99)": 2.304030539999989 + }, + "type": "trend", + "contains": "time" + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_failed": { + "values": { + "rate": 0.00027285129604365623, + "passes": 3, + "fails": 10992 + }, + "type": "rate", + "contains": "default" + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "checks": { + "contains": "default", + "values": { + "passes": 10928, + "fails": 0, + "rate": 1 + }, + "type": "rate" + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 83.352359, + "p(95)": 141.24837169999998, + "p(99)": 217.53314593999977, + "max": 1546.268579, + "avg": 88.9644744466578 + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 103.69006572051723, + "p(50)": 98.00462, + "p(95)": 169.04933884999997, + "p(99)": 243.31071381999948, + "max": 1546.268579 + } + }, + "measured_operations": { + "contains": "default", + "values": { + "count": 10406, + "rate": 213.79084820072924 + }, + "type": "counter" + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "max": 7.785228, + "avg": 0.007946846202819463, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0 + } + } + }, + "setup_data": [ + { + "chat": "95b1d11a-1100-4ba4-8bca-cf5f053f4fc6", + "token": "dnVhnopM09y0U5lI54ybRVRNpyG7KAzoQ_vXYf1kJZk" + }, + { + "chat": "b6a38c61-49a6-4d87-a430-d32dc1bd33a1", + "token": "Xzs2G2N-qg58Rk9TM1NXa4ecJLtP35TU2wSsYcGX-WY" + }, + { + "token": "3vqRI1XD4_CtkrWoDwG6g0lVS-kh1imy_NCE7JbUbm0", + "chat": "47440d28-70db-4cfa-b455-202db1f7cde6" + }, + { + "chat": "b1c48fa5-b212-4828-8a83-8735d4493eae", + "token": "M7G3i_d8vdKVG57APESHEIGZQKOHgytoi64HA8IhrZ8" + }, + { + "chat": "996e7faa-61b9-47df-be99-81870af3e211", + "token": "mwlQ-hx4_At39LazvsHd9WXmJEu3t5rksDiv0UNFL3c" + }, + { + "chat": "a2ffa145-62c3-4dd6-9ff7-6e4324a316d4", + "token": "NN8AOJJHSq6nlK4IkWNALeCLrqn6bthoP7mxAN3sS78" + }, + { + "chat": "7aa3db5d-b368-4c0c-8688-8e15ea7a95aa", + "token": "K4qAaDjhKV6KYC9BthRp_Lsh87sH8E9m9iwJpjX8YPY" + }, + { + "chat": "7cf94097-a462-4677-a55c-68907ea5de61", + "token": "8QQJBXB1Goy6Be6FL3yn1wVQa664RzNojqsTulnHaKw" + }, + { + "chat": "de617d62-4b74-4468-92e6-42080831975c", + "token": "esjGT8OGxvSuYuty_5LXjvmFGyPW3luqVoBP4Ejbohw" + }, + { + "chat": "a7b92e3c-f5cb-4378-a25e-abaf97dd9537", + "token": "HyDtjfNuv17CWv4JVqaatQDvqDQpoDjLKh01h8p_2XU" + }, + { + "chat": "8dd71c04-599f-42eb-a699-92978ed7465d", + "token": "cFlz7Wq4WB9CPCB0-fLUZUJzMPLtS2NN1uP8cdmTRJE" + }, + { + "chat": "8871bb64-3a75-42e4-9e00-e0413aef118f", + "token": "vTOR5Ws53F38L2SS3ozGgaibiiRwHxbiewW9Y39_KE0" + }, + { + "chat": "0696da39-a37c-4489-af18-ff3898e1f2c6", + "token": "KHB1zJLHXYl4HiEYoax7BVO8hJVUYxHm848f3dmfl5A" + }, + { + "token": "ITAs4nvB8KgyzWH3U9RfwddFHMDlwS34tMjnvByZEjg", + "chat": "b19235bf-cb60-49db-aeff-63ca28ddcc86" + }, + { + "chat": "49736b91-60e1-45fd-a087-987a7ff96896", + "token": "_u9gyt4CUkVaXYVbP9T5bLNnb-8zAuBaay1_k8QQCPk" + }, + { + "chat": "b366238e-bfb4-4915-b274-a775a676c1d8", + "token": "HCVdiMgyy3p0Q-S_TBZPJhAbyyUaFEOv7s78nz2Ppa0" + } + ] + } +} diff --git a/evidence/research-20261029-pool/load-single32b-20261029113452.txt b/evidence/research-20261029-pool/load-single32b-20261029113452.txt new file mode 100644 index 00000000..ffabd878 --- /dev/null +++ b/evidence/research-20261029-pool/load-single32b-20261029113452.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":5207,"fails":0,"name":"message confirmed","path":"::message confirmed"},{"id":"f737ff9008ff036f7a4b775b05a953fa","passes":531,"fails":0,"name":"retry returns original","path":"::retry returns original"},{"passes":5190,"fails":0,"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8"}],"name":"","path":""},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":48673.739253},"metrics":{"iterations":{"type":"counter","contains":"default","values":{"count":5190,"rate":106.62833962730971}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":4952,"rate":101.73863927445812}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":4952,"rate":101.73863927445812}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"data_received":{"type":"counter","contains":"data","values":{"count":15043309,"rate":309064.173635947}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(99)":0.0016582599999999893,"max":1012.379068,"avg":0.1996732418371928,"p(50)":0.001203,"p(95)":0.0014132999999999993}},"iteration_duration":{"type":"trend","contains":"time","values":{"avg":188.29500669788078,"p(50)":180.589137,"p(95)":295.59766025000005,"p(99)":412.67946847999997,"max":1761.617317}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":47.890406,"avg":0.09781442401091403}},"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":88.45134501045892,"p(50)":82.841394,"p(95)":140.58404829999986,"p(99)":217.11189321999984,"max":1545.446105}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"avg":88.98811769068436,"p(50)":83.373051,"p(95)":141.24850055,"p(99)":217.5468004100001,"max":1546.268579}},"data_sent":{"type":"counter","contains":"data","values":{"count":1002112,"rate":20588.350420154642}},"http_reqs":{"values":{"count":10995,"rate":225.89182932606363},"type":"counter","contains":"default"},"http_req_sending":{"contains":"time","values":{"avg":0.20672665948158267,"p(50)":0.178569,"p(95)":0.41804149999999995,"p(99)":0.9532230199999941,"max":6.672115},"type":"trend"},"http_req_receiving":{"values":{"max":17.954545,"avg":0.30640277671668886,"p(50)":0.172578,"p(95)":0.9733099999999997,"p(99)":2.304030539999989},"type":"trend","contains":"time"},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_failed":{"values":{"rate":0.00027285129604365623,"passes":3,"fails":10992},"type":"rate","contains":"default"},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"checks":{"contains":"default","values":{"passes":10928,"fails":0,"rate":1},"type":"rate"},"http_req_duration":{"type":"trend","contains":"time","values":{"p(50)":83.352359,"p(95)":141.24837169999998,"p(99)":217.53314593999977,"max":1546.268579,"avg":88.9644744466578}},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":103.69006572051723,"p(50)":98.00462,"p(95)":169.04933884999997,"p(99)":243.31071381999948,"max":1546.268579}},"measured_operations":{"contains":"default","values":{"count":10406,"rate":213.79084820072924},"type":"counter"},"http_req_connecting":{"type":"trend","contains":"time","values":{"max":7.785228,"avg":0.007946846202819463,"p(50)":0,"p(95)":0,"p(99)":0}}},"setup_data":[{"chat":"95b1d11a-1100-4ba4-8bca-cf5f053f4fc6","token":"dnVhnopM09y0U5lI54ybRVRNpyG7KAzoQ_vXYf1kJZk"},{"chat":"b6a38c61-49a6-4d87-a430-d32dc1bd33a1","token":"Xzs2G2N-qg58Rk9TM1NXa4ecJLtP35TU2wSsYcGX-WY"},{"token":"3vqRI1XD4_CtkrWoDwG6g0lVS-kh1imy_NCE7JbUbm0","chat":"47440d28-70db-4cfa-b455-202db1f7cde6"},{"chat":"b1c48fa5-b212-4828-8a83-8735d4493eae","token":"M7G3i_d8vdKVG57APESHEIGZQKOHgytoi64HA8IhrZ8"},{"chat":"996e7faa-61b9-47df-be99-81870af3e211","token":"mwlQ-hx4_At39LazvsHd9WXmJEu3t5rksDiv0UNFL3c"},{"chat":"a2ffa145-62c3-4dd6-9ff7-6e4324a316d4","token":"NN8AOJJHSq6nlK4IkWNALeCLrqn6bthoP7mxAN3sS78"},{"chat":"7aa3db5d-b368-4c0c-8688-8e15ea7a95aa","token":"K4qAaDjhKV6KYC9BthRp_Lsh87sH8E9m9iwJpjX8YPY"},{"chat":"7cf94097-a462-4677-a55c-68907ea5de61","token":"8QQJBXB1Goy6Be6FL3yn1wVQa664RzNojqsTulnHaKw"},{"chat":"de617d62-4b74-4468-92e6-42080831975c","token":"esjGT8OGxvSuYuty_5LXjvmFGyPW3luqVoBP4Ejbohw"},{"chat":"a7b92e3c-f5cb-4378-a25e-abaf97dd9537","token":"HyDtjfNuv17CWv4JVqaatQDvqDQpoDjLKh01h8p_2XU"},{"chat":"8dd71c04-599f-42eb-a699-92978ed7465d","token":"cFlz7Wq4WB9CPCB0-fLUZUJzMPLtS2NN1uP8cdmTRJE"},{"chat":"8871bb64-3a75-42e4-9e00-e0413aef118f","token":"vTOR5Ws53F38L2SS3ozGgaibiiRwHxbiewW9Y39_KE0"},{"chat":"0696da39-a37c-4489-af18-ff3898e1f2c6","token":"KHB1zJLHXYl4HiEYoax7BVO8hJVUYxHm848f3dmfl5A"},{"token":"ITAs4nvB8KgyzWH3U9RfwddFHMDlwS34tMjnvByZEjg","chat":"b19235bf-cb60-49db-aeff-63ca28ddcc86"},{"chat":"49736b91-60e1-45fd-a087-987a7ff96896","token":"_u9gyt4CUkVaXYVbP9T5bLNnb-8zAuBaay1_k8QQCPk"},{"chat":"b366238e-bfb4-4915-b274-a775a676c1d8","token":"HCVdiMgyy3p0Q-S_TBZPJhAbyyUaFEOv7s78nz2Ppa0"}]}} diff --git a/evidence/research-20261029-pool/load-single8a-20261029112953.json b/evidence/research-20261029-pool/load-single8a-20261029112953.json new file mode 100644 index 00000000..6a805673 --- /dev/null +++ b/evidence/research-20261029-pool/load-single8a-20261029112953.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 2786, + "fails": 17 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 301, + "fails": 1 + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 2763, + "fails": 5 + } + ] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "testRunDurationMs": 44805.120762, + "isStdOutTTY": false, + "isStdErrTTY": false + }, + "metrics": { + "http_req_waiting": { + "values": { + "max": 3991.052813, + "avg": 144.27892149098923, + "p(50)": 117.43528, + "p(95)": 226.8627668, + "p(99)": 379.59154308000063 + }, + "type": "trend", + "contains": "time" + }, + "data_sent": { + "values": { + "count": 552878, + "rate": 12339.616333963893 + }, + "type": "counter", + "contains": "data" + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 162.40502755146775, + "p(50)": 131.492881, + "p(95)": 237.366661, + "p(99)": 553.4051984999999, + "max": 3991.163753 + } + }, + "application_errors": { + "values": { + "count": 23, + "rate": 0.5133341816479758 + }, + "type": "counter", + "contains": "default" + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.996083773199387, + "passes": 5850, + "fails": 23 + } + }, + "iterations": { + "values": { + "count": 2768, + "rate": 61.77865281746074 + }, + "type": "counter", + "contains": "default" + }, + "failed_writes": { + "type": "counter", + "contains": "default", + "values": { + "count": 17, + "rate": 0.379420916870243 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.23495133383863956, + "p(50)": 0.183692, + "p(95)": 0.5354176, + "p(99)": 0.9436969600000021, + "max": 5.828276 + } + }, + "confirmed_messages": { + "values": { + "count": 2674, + "rate": 59.68067833594292 + }, + "type": "counter", + "contains": "default" + }, + "attempted_messages": { + "values": { + "count": 2691, + "rate": 60.06009925281317 + }, + "type": "counter", + "contains": "default" + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.019624694290045475, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 4.547988 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.07394712851608556, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 22.777269 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 5670, + "rate": 126.54803521495751 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 144.70494467727787, + "p(50)": 117.909319, + "p(95)": 227.304696, + "p(99)": 380.73643128000015, + "max": 3991.163753 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 752.7566454499984, + "max": 2456.465011, + "avg": 283.4518053338147, + "p(50)": 252.35518000000002, + "p(95)": 528.1196388500002 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0.185113, + "p(95)": 0.314398, + "p(99)": 0.5401648400000005, + "max": 3.375927, + "avg": 0.1910718524507325 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 8028303, + "rate": 179182.71089247777 + } + }, + "http_req_blocked": { + "values": { + "avg": 0.09645306147886099, + "p(50)": 0.001271, + "p(95)": 0.001478, + "p(99)": 0.001778, + "max": 26.982082 + }, + "type": "trend", + "contains": "time" + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 5937, + "rate": 132.5071754975666 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 225.2452824, + "p(99)": 341.31000787999983, + "max": 1952.145937, + "avg": 132.4036514000674, + "p(50)": 117.4035095 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.0038740104429846726, + "passes": 23, + "fails": 5914 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + } + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 8, + "rate": 0.17855101970364376 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + } + }, + "setup_data": [ + { + "chat": "e342dd36-2381-41c5-8d33-67bfa1d6137f", + "token": "KnJ_NAQZgcB7Y6Jarch6Lm1fs1AkOG29DmpLpI5bhuc" + }, + { + "chat": "2f068379-3e8b-4eb2-a89a-2762ae6389ab", + "token": "nimwYwBhwv6Y0eTQW6XTMthK0Yxx2tTwUXAfwW0WpPs" + }, + { + "token": "_OBF8YP4-fdYgkIDI8t2FUrsCoBRh5rDnxP2Gea2jBU", + "chat": "4036bfbc-9383-462d-86de-6214c34947dc" + }, + { + "chat": "3aa8c160-a929-4820-9768-f41dc92312d0", + "token": "rWgfGObXKMqSPz_kVWikWV1uAFRjU805fxG6EqQz6GY" + }, + { + "chat": "99182e04-ce42-4c09-9376-e3c2b77350c6", + "token": "S9THhCwiOJRa0TjLBLVqQH0x_x0vK--2agooKd4VLDk" + }, + { + "chat": "655cf77d-2701-4130-977b-2c465640d4aa", + "token": "NIlT82jsXQab9nBjnFEOt6UVZBiQ-EBR7jRXJh-bxxw" + }, + { + "chat": "fc186d2f-48f3-467b-ac27-e0ec49c8d5c8", + "token": "OezRKa2GNX4BVIk-Dqpv7nUyJ6NLDPGJYL7fRIs1EhE" + }, + { + "chat": "6aa67232-a9bc-45d0-a983-158a8dbfc9f8", + "token": "L7m9C8wXV0YRGk6vw1VohLLsy_BIxLEUk-TYAuyUpZw" + }, + { + "token": "KkBR1-2NVyEUJ4dENkRPSfxohXPdMBztdyv2IFJwVZA", + "chat": "f1693256-5dd9-48e8-9077-b91c93a57d29" + }, + { + "chat": "aa5fb30b-5b6e-421f-baf1-87cf1bff03c4", + "token": "sIW-gcPbXg6PxmqOuU66QoG_tjTxJwp3phea-2PiQ1U" + }, + { + "chat": "196c0b29-bf55-41ca-b979-18cf95146c3c", + "token": "g9fQ54y2kDuQ5rpzrlhhZTnlVNhkg0hqiHctXwdEtl0" + }, + { + "chat": "74df4a77-93ff-4629-b3ec-d06a4a54fa46", + "token": "qOPSdnvYXF_Yzqhg-8B_-hYGTRWhSRk5of5EADxiy5I" + }, + { + "chat": "3a819f5c-2b86-43de-ac71-1c46f385fc95", + "token": "T1LNa86HH8FB-zofEAAYFWbu_wj89zxUvI6rBYSK6Fs" + }, + { + "token": "XtbfTqdvWjUA1K2UvsjoegyJRDgdb6xEf0yVAytnt_8", + "chat": "e765a069-1e88-4829-8b78-0b763a0c8a2e" + }, + { + "token": "PpFGA8JAXIeMdYNO7lJUca5R41JX0OKSofRqw4DZiyU", + "chat": "23b91e1f-6cb5-4cf9-8935-cbdb9289156c" + }, + { + "chat": "828e93a1-57d6-442d-8b69-abd489d1cb8b", + "token": "pSG6AIANqIzZtCIny0I9-klUgQVz2gGVgCU3n0-2bKM" + } + ] + } +} diff --git a/evidence/research-20261029-pool/load-single8a-20261029112953.txt b/evidence/research-20261029-pool/load-single8a-20261029112953.txt new file mode 100644 index 00000000..1f386f77 --- /dev/null +++ b/evidence/research-20261029-pool/load-single8a-20261029112953.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":2786,"fails":17},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":301,"fails":1},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":2763,"fails":5}]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"testRunDurationMs":44805.120762,"isStdOutTTY":false,"isStdErrTTY":false},"metrics":{"http_req_waiting":{"values":{"max":3991.052813,"avg":144.27892149098923,"p(50)":117.43528,"p(95)":226.8627668,"p(99)":379.59154308000063},"type":"trend","contains":"time"},"data_sent":{"values":{"count":552878,"rate":12339.616333963893},"type":"counter","contains":"data"},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":162.40502755146775,"p(50)":131.492881,"p(95)":237.366661,"p(99)":553.4051984999999,"max":3991.163753}},"application_errors":{"values":{"count":23,"rate":0.5133341816479758},"type":"counter","contains":"default"},"checks":{"type":"rate","contains":"default","values":{"rate":0.996083773199387,"passes":5850,"fails":23}},"iterations":{"values":{"count":2768,"rate":61.77865281746074},"type":"counter","contains":"default"},"failed_writes":{"type":"counter","contains":"default","values":{"count":17,"rate":0.379420916870243}},"http_req_receiving":{"type":"trend","contains":"time","values":{"avg":0.23495133383863956,"p(50)":0.183692,"p(95)":0.5354176,"p(99)":0.9436969600000021,"max":5.828276}},"confirmed_messages":{"values":{"count":2674,"rate":59.68067833594292},"type":"counter","contains":"default"},"attempted_messages":{"values":{"count":2691,"rate":60.06009925281317},"type":"counter","contains":"default"},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_connecting":{"type":"trend","contains":"time","values":{"avg":0.019624694290045475,"p(50)":0,"p(95)":0,"p(99)":0,"max":4.547988}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"avg":0.07394712851608556,"p(50)":0,"p(95)":0,"p(99)":0,"max":22.777269}},"measured_operations":{"type":"counter","contains":"default","values":{"count":5670,"rate":126.54803521495751}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":144.70494467727787,"p(50)":117.909319,"p(95)":227.304696,"p(99)":380.73643128000015,"max":3991.163753}},"iteration_duration":{"type":"trend","contains":"time","values":{"p(99)":752.7566454499984,"max":2456.465011,"avg":283.4518053338147,"p(50)":252.35518000000002,"p(95)":528.1196388500002}},"http_req_sending":{"type":"trend","contains":"time","values":{"p(50)":0.185113,"p(95)":0.314398,"p(99)":0.5401648400000005,"max":3.375927,"avg":0.1910718524507325}},"data_received":{"type":"counter","contains":"data","values":{"count":8028303,"rate":179182.71089247777}},"http_req_blocked":{"values":{"avg":0.09645306147886099,"p(50)":0.001271,"p(95)":0.001478,"p(99)":0.001778,"max":26.982082},"type":"trend","contains":"time"},"http_reqs":{"type":"counter","contains":"default","values":{"count":5937,"rate":132.5071754975666}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(95)":225.2452824,"p(99)":341.31000787999983,"max":1952.145937,"avg":132.4036514000674,"p(50)":117.4035095}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.0038740104429846726,"passes":23,"fails":5914}},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":8,"rate":0.17855101970364376},"thresholds":{"count>=0":{"ok":true}}}},"setup_data":[{"chat":"e342dd36-2381-41c5-8d33-67bfa1d6137f","token":"KnJ_NAQZgcB7Y6Jarch6Lm1fs1AkOG29DmpLpI5bhuc"},{"chat":"2f068379-3e8b-4eb2-a89a-2762ae6389ab","token":"nimwYwBhwv6Y0eTQW6XTMthK0Yxx2tTwUXAfwW0WpPs"},{"token":"_OBF8YP4-fdYgkIDI8t2FUrsCoBRh5rDnxP2Gea2jBU","chat":"4036bfbc-9383-462d-86de-6214c34947dc"},{"chat":"3aa8c160-a929-4820-9768-f41dc92312d0","token":"rWgfGObXKMqSPz_kVWikWV1uAFRjU805fxG6EqQz6GY"},{"chat":"99182e04-ce42-4c09-9376-e3c2b77350c6","token":"S9THhCwiOJRa0TjLBLVqQH0x_x0vK--2agooKd4VLDk"},{"chat":"655cf77d-2701-4130-977b-2c465640d4aa","token":"NIlT82jsXQab9nBjnFEOt6UVZBiQ-EBR7jRXJh-bxxw"},{"chat":"fc186d2f-48f3-467b-ac27-e0ec49c8d5c8","token":"OezRKa2GNX4BVIk-Dqpv7nUyJ6NLDPGJYL7fRIs1EhE"},{"chat":"6aa67232-a9bc-45d0-a983-158a8dbfc9f8","token":"L7m9C8wXV0YRGk6vw1VohLLsy_BIxLEUk-TYAuyUpZw"},{"token":"KkBR1-2NVyEUJ4dENkRPSfxohXPdMBztdyv2IFJwVZA","chat":"f1693256-5dd9-48e8-9077-b91c93a57d29"},{"chat":"aa5fb30b-5b6e-421f-baf1-87cf1bff03c4","token":"sIW-gcPbXg6PxmqOuU66QoG_tjTxJwp3phea-2PiQ1U"},{"chat":"196c0b29-bf55-41ca-b979-18cf95146c3c","token":"g9fQ54y2kDuQ5rpzrlhhZTnlVNhkg0hqiHctXwdEtl0"},{"chat":"74df4a77-93ff-4629-b3ec-d06a4a54fa46","token":"qOPSdnvYXF_Yzqhg-8B_-hYGTRWhSRk5of5EADxiy5I"},{"chat":"3a819f5c-2b86-43de-ac71-1c46f385fc95","token":"T1LNa86HH8FB-zofEAAYFWbu_wj89zxUvI6rBYSK6Fs"},{"token":"XtbfTqdvWjUA1K2UvsjoegyJRDgdb6xEf0yVAytnt_8","chat":"e765a069-1e88-4829-8b78-0b763a0c8a2e"},{"token":"PpFGA8JAXIeMdYNO7lJUca5R41JX0OKSofRqw4DZiyU","chat":"23b91e1f-6cb5-4cf9-8935-cbdb9289156c"},{"chat":"828e93a1-57d6-442d-8b69-abd489d1cb8b","token":"pSG6AIANqIzZtCIny0I9-klUgQVz2gGVgCU3n0-2bKM"}]}} diff --git a/evidence/research-20261029-pool/load-single8b-20261029113315.json b/evidence/research-20261029-pool/load-single8b-20261029113315.json new file mode 100644 index 00000000..37d7b620 --- /dev/null +++ b/evidence/research-20261029-pool/load-single8b-20261029113315.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "passes": 2869, + "fails": 9987, + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e" + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 299, + "fails": 1 + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 2844, + "fails": 9995 + } + ] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 44591.474584 + }, + "metrics": { + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 19983, + "rate": 448.1349896235582 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "avg": 150.10996628620794, + "p(50)": 75.304901, + "p(95)": 165.742897, + "p(99)": 190.31036650000001, + "max": 11627.052443 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0.229872, + "p(95)": 1.8305383999999998, + "p(99)": 7.313318699999995, + "max": 35.208034, + "avg": 0.6216663946429214 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.09999524632564549, + "p(50)": 0.042031, + "p(95)": 0.23779599999999998, + "p(99)": 0.4740774799999998, + "max": 29.534114 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 10000581, + "rate": 224271.1436052922 + } + }, + "iterations": { + "values": { + "count": 12839, + "rate": 287.92499283275106 + }, + "type": "counter", + "contains": "default" + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 2647, + "rate": 59.36112283108436 + } + }, + "failed_writes": { + "contains": "default", + "values": { + "count": 9987, + "rate": 223.96657866038515 + }, + "type": "counter" + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 167.59464175999983, + "max": 11625.766546, + "avg": 36.72166618768946, + "p(50)": 2.290636, + "p(95)": 130.56769589999996 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.23127524523946913, + "passes": 6012, + "fails": 19983 + } + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 19983, + "rate": 448.1349896235582 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 130.88320579999998, + "p(99)": 168.01515669999998, + "max": 11627.052443, + "avg": 37.443327828658056, + "p(50)": 2.930929 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "max": 32, + "value": 32, + "min": 32 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 25544, + "rate": 572.8449269351034 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 26059, + "rate": 584.3942198168595 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.053963073256842804, + "p(50)": 0.000243, + "p(95)": 0.001314, + "p(99)": 0.0014788399999999965, + "max": 703.90332 + } + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "min": 0, + "max": 32, + "value": 32 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.7668367934302928, + "passes": 19983, + "fails": 6076 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0, + "p(99)": 0, + "max": 4.936425, + "avg": 0.004013690011128593, + "p(50)": 0 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 2160993, + "rate": 48462.021499853974 + } + }, + "http_req_tls_handshaking": { + "values": { + "avg": 0.022473991941363833, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 25.479402 + }, + "type": "trend", + "contains": "time" + }, + "iteration_duration": { + "contains": "time", + "values": { + "p(95)": 266.0044067999995, + "p(99)": 343.68721489999956, + "max": 11904.224531, + "avg": 76.01463507189025, + "p(50)": 6.157335 + }, + "type": "trend" + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 2.858447, + "p(95)": 134.85857299999975, + "p(99)": 171.70400019000002, + "max": 11627.052443, + "avg": 51.80089285982287 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 12634, + "rate": 283.3277014914695 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "application_errors{status:429}": { + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter" + } + }, + "setup_data": [ + { + "chat": "c86b1fee-58c2-4934-aa29-88a950c37368", + "token": "UTgLLRywOSR38KPHGUgM7ORsE29W3lOKvwvWpan5p9U" + }, + { + "chat": "349230a6-6bff-480c-bb46-52adf1c4cfbe", + "token": "M-_ZGfkdbIBmTcGVqpp9jM_k2elAAEieqtttWVZF2LY" + }, + { + "chat": "e417528c-af5f-41ab-b9ca-1b4068c30ccf", + "token": "tIUAYqpHjK_v7g_aQbLOPjrQmAiHgfe9BOLBly0yLvE" + }, + { + "chat": "5b37fb41-c5c0-46a9-9189-822c2a70520b", + "token": "D9bcPKiVPxKeewJNtvg7dMoPuy6r6I3DLNnB1bKJO9w" + }, + { + "chat": "236c6d0e-faaf-4be0-87f7-5892ff48cce9", + "token": "Ms2JOBKJ5CBVPvxGJm_5mRbTiLWPgOptmXCSAI10r2I" + }, + { + "chat": "dd938aba-7ab3-4a7e-ba2c-b8244a7a99dd", + "token": "-4ogH7kmlJSu9nACUatTc_9UEvvgGLm2ozg35fSgOhc" + }, + { + "token": "ruZ655u5OXtzPmGwrxUGAhYB_9QII22N6j9I4twTUTs", + "chat": "f95b7837-3265-4a84-af8b-939f1ef597fb" + }, + { + "chat": "46094782-f4a3-440c-9901-09673115e8c0", + "token": "Z_WaBIQv9tfqOARTVFyoL4VNpJcvq2_uM4-RyYY2eA8" + }, + { + "chat": "e27d0212-ad39-4677-bfee-1173ea71544c", + "token": "sxSJMaH7uYadu8--HKTZ6oWIDzX6c0Jdt1qr7YJKDQE" + }, + { + "token": "Xuw5d-zMzBR4c6E9GSHdRwTYm1oESLxPVk541p5UXkA", + "chat": "0e62aa6c-2dd9-4435-8a19-7024faa174e3" + }, + { + "chat": "58e54e33-743f-4614-a9e6-c350a6fa46cc", + "token": "iAw5ePDdZ4vuZb09YX1YeKEG4Khg_w_y324X4rb0vz0" + }, + { + "chat": "e9fc6687-6e30-4d13-9c92-f42e6bb043f3", + "token": "JMGxnLgn_S0aRu6pcl13cpHEUrWvqm0Q0Vn8MfaZG4Y" + }, + { + "chat": "0acb076d-2aaa-45b9-80d0-e34562e96900", + "token": "PGXS1W4z1BIOrmv3fM0Zys-aEZu6MmZXB9PHfMcJvnM" + }, + { + "chat": "9284e591-c139-4fae-8f9a-4632819bbcb8", + "token": "19VFw6Q20IpiOMn6TtBYfHUDtQ19AGylpqWW3QVR0PQ" + }, + { + "chat": "ae0a3838-1caa-49ea-8873-011768e5635d", + "token": "byTitHDFea7KU1TGkqWcJQQTUOHk2yjvgfTDlt46q5Y" + }, + { + "chat": "84f79d19-75d1-45b1-bcb8-36651590de82", + "token": "6bfB3rZ2en85G4EDjDZm8EVVymGxfFPo8Da5-vBHd5M" + } + ] + } +} diff --git a/evidence/research-20261029-pool/load-single8b-20261029113315.txt b/evidence/research-20261029-pool/load-single8b-20261029113315.txt new file mode 100644 index 00000000..174122b3 --- /dev/null +++ b/evidence/research-20261029-pool/load-single8b-20261029113315.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"passes":2869,"fails":9987,"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e"},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":299,"fails":1},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":2844,"fails":9995}]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":44591.474584},"metrics":{"application_errors":{"type":"counter","contains":"default","values":{"count":19983,"rate":448.1349896235582}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"avg":150.10996628620794,"p(50)":75.304901,"p(95)":165.742897,"p(99)":190.31036650000001,"max":11627.052443}},"http_req_receiving":{"type":"trend","contains":"time","values":{"p(50)":0.229872,"p(95)":1.8305383999999998,"p(99)":7.313318699999995,"max":35.208034,"avg":0.6216663946429214}},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.09999524632564549,"p(50)":0.042031,"p(95)":0.23779599999999998,"p(99)":0.4740774799999998,"max":29.534114}},"data_received":{"type":"counter","contains":"data","values":{"count":10000581,"rate":224271.1436052922}},"iterations":{"values":{"count":12839,"rate":287.92499283275106},"type":"counter","contains":"default"},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":2647,"rate":59.36112283108436}},"failed_writes":{"contains":"default","values":{"count":9987,"rate":223.96657866038515},"type":"counter"},"http_req_waiting":{"type":"trend","contains":"time","values":{"p(99)":167.59464175999983,"max":11625.766546,"avg":36.72166618768946,"p(50)":2.290636,"p(95)":130.56769589999996}},"checks":{"type":"rate","contains":"default","values":{"rate":0.23127524523946913,"passes":6012,"fails":19983}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":19983,"rate":448.1349896235582},"thresholds":{"count>=0":{"ok":true}}},"http_req_duration":{"type":"trend","contains":"time","values":{"p(95)":130.88320579999998,"p(99)":168.01515669999998,"max":11627.052443,"avg":37.443327828658056,"p(50)":2.930929}},"vus_max":{"type":"gauge","contains":"default","values":{"max":32,"value":32,"min":32}},"measured_operations":{"type":"counter","contains":"default","values":{"count":25544,"rate":572.8449269351034}},"http_reqs":{"type":"counter","contains":"default","values":{"count":26059,"rate":584.3942198168595}},"http_req_blocked":{"type":"trend","contains":"time","values":{"avg":0.053963073256842804,"p(50)":0.000243,"p(95)":0.001314,"p(99)":0.0014788399999999965,"max":703.90332}},"vus":{"type":"gauge","contains":"default","values":{"min":0,"max":32,"value":32}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.7668367934302928,"passes":19983,"fails":6076}},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(95)":0,"p(99)":0,"max":4.936425,"avg":0.004013690011128593,"p(50)":0}},"data_sent":{"type":"counter","contains":"data","values":{"count":2160993,"rate":48462.021499853974}},"http_req_tls_handshaking":{"values":{"avg":0.022473991941363833,"p(50)":0,"p(95)":0,"p(99)":0,"max":25.479402},"type":"trend","contains":"time"},"iteration_duration":{"contains":"time","values":{"p(95)":266.0044067999995,"p(99)":343.68721489999956,"max":11904.224531,"avg":76.01463507189025,"p(50)":6.157335},"type":"trend"},"message_latency_ms":{"type":"trend","contains":"time","values":{"p(50)":2.858447,"p(95)":134.85857299999975,"p(99)":171.70400019000002,"max":11627.052443,"avg":51.80089285982287}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":12634,"rate":283.3277014914695}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"application_errors{status:429}":{"contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter"}},"setup_data":[{"chat":"c86b1fee-58c2-4934-aa29-88a950c37368","token":"UTgLLRywOSR38KPHGUgM7ORsE29W3lOKvwvWpan5p9U"},{"chat":"349230a6-6bff-480c-bb46-52adf1c4cfbe","token":"M-_ZGfkdbIBmTcGVqpp9jM_k2elAAEieqtttWVZF2LY"},{"chat":"e417528c-af5f-41ab-b9ca-1b4068c30ccf","token":"tIUAYqpHjK_v7g_aQbLOPjrQmAiHgfe9BOLBly0yLvE"},{"chat":"5b37fb41-c5c0-46a9-9189-822c2a70520b","token":"D9bcPKiVPxKeewJNtvg7dMoPuy6r6I3DLNnB1bKJO9w"},{"chat":"236c6d0e-faaf-4be0-87f7-5892ff48cce9","token":"Ms2JOBKJ5CBVPvxGJm_5mRbTiLWPgOptmXCSAI10r2I"},{"chat":"dd938aba-7ab3-4a7e-ba2c-b8244a7a99dd","token":"-4ogH7kmlJSu9nACUatTc_9UEvvgGLm2ozg35fSgOhc"},{"token":"ruZ655u5OXtzPmGwrxUGAhYB_9QII22N6j9I4twTUTs","chat":"f95b7837-3265-4a84-af8b-939f1ef597fb"},{"chat":"46094782-f4a3-440c-9901-09673115e8c0","token":"Z_WaBIQv9tfqOARTVFyoL4VNpJcvq2_uM4-RyYY2eA8"},{"chat":"e27d0212-ad39-4677-bfee-1173ea71544c","token":"sxSJMaH7uYadu8--HKTZ6oWIDzX6c0Jdt1qr7YJKDQE"},{"token":"Xuw5d-zMzBR4c6E9GSHdRwTYm1oESLxPVk541p5UXkA","chat":"0e62aa6c-2dd9-4435-8a19-7024faa174e3"},{"chat":"58e54e33-743f-4614-a9e6-c350a6fa46cc","token":"iAw5ePDdZ4vuZb09YX1YeKEG4Khg_w_y324X4rb0vz0"},{"chat":"e9fc6687-6e30-4d13-9c92-f42e6bb043f3","token":"JMGxnLgn_S0aRu6pcl13cpHEUrWvqm0Q0Vn8MfaZG4Y"},{"chat":"0acb076d-2aaa-45b9-80d0-e34562e96900","token":"PGXS1W4z1BIOrmv3fM0Zys-aEZu6MmZXB9PHfMcJvnM"},{"chat":"9284e591-c139-4fae-8f9a-4632819bbcb8","token":"19VFw6Q20IpiOMn6TtBYfHUDtQ19AGylpqWW3QVR0PQ"},{"chat":"ae0a3838-1caa-49ea-8873-011768e5635d","token":"byTitHDFea7KU1TGkqWcJQQTUOHk2yjvgfTDlt46q5Y"},{"chat":"84f79d19-75d1-45b1-bcb8-36651590de82","token":"6bfB3rZ2en85G4EDjDZm8EVVymGxfFPo8Da5-vBHd5M"}]}} diff --git a/evidence/research-20261029-pool/nodes.txt b/evidence/research-20261029-pool/nodes.txt new file mode 100644 index 00000000..461dea77 --- /dev/null +++ b/evidence/research-20261029-pool/nodes.txt @@ -0,0 +1,4 @@ +NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME +dev.asisti.tech Ready 252d v1.33.13 100.99.166.40 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 +marlosrv0 Ready 254d v1.33.13 192.168.1.37 Ubuntu 24.04.5 LTS 6.8.0-147-generic containerd://1.7.29 +srv0.agapov.space Ready 246d v1.33.13 100.108.186.94 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 diff --git a/evidence/research-20261029-pool/pods-saturation64-20261029112756.txt b/evidence/research-20261029-pool/pods-saturation64-20261029112756.txt new file mode 100644 index 00000000..58d7f69b --- /dev/null +++ b/evidence/research-20261029-pool/pods-saturation64-20261029112756.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-84fbf9968-6xpsz 1/1 Running 0 2m26s 10.1.25.79 dev.asisti.tech diff --git a/evidence/research-20261029-pool/pods-saturation8-20261029112615.txt b/evidence/research-20261029-pool/pods-saturation8-20261029112615.txt new file mode 100644 index 00000000..70e1c4f3 --- /dev/null +++ b/evidence/research-20261029-pool/pods-saturation8-20261029112615.txt @@ -0,0 +1,3 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-84fbf9968-6xpsz 1/1 Running 0 39s 10.1.25.79 dev.asisti.tech +api-84fbf9968-mp649 1/1 Running 0 38s 10.1.25.103 dev.asisti.tech diff --git a/evidence/research-20261029-pool/pods-single32a-20261029113131.txt b/evidence/research-20261029-pool/pods-single32a-20261029113131.txt new file mode 100644 index 00000000..134aa0cd --- /dev/null +++ b/evidence/research-20261029-pool/pods-single32a-20261029113131.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-757dbc95b7-rdrq9 1/1 Running 0 40s 10.1.25.119 dev.asisti.tech diff --git a/evidence/research-20261029-pool/pods-single32b-20261029113452.txt b/evidence/research-20261029-pool/pods-single32b-20261029113452.txt new file mode 100644 index 00000000..39fa0ecd --- /dev/null +++ b/evidence/research-20261029-pool/pods-single32b-20261029113452.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-757dbc95b7-j9fg4 1/1 Running 0 39s 10.1.25.72 dev.asisti.tech diff --git a/evidence/research-20261029-pool/pods-single8a-20261029112953.txt b/evidence/research-20261029-pool/pods-single8a-20261029112953.txt new file mode 100644 index 00000000..8d44f023 --- /dev/null +++ b/evidence/research-20261029-pool/pods-single8a-20261029112953.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-84fbf9968-6xpsz 1/1 Running 0 4m15s 10.1.25.79 dev.asisti.tech diff --git a/evidence/research-20261029-pool/pods-single8b-20261029113315.txt b/evidence/research-20261029-pool/pods-single8b-20261029113315.txt new file mode 100644 index 00000000..1f66600b --- /dev/null +++ b/evidence/research-20261029-pool/pods-single8b-20261029113315.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-84fbf9968-b85fz 1/1 Running 0 38s 10.1.25.114 dev.asisti.tech diff --git a/evidence/research-20261029-pool/profiles.csv b/evidence/research-20261029-pool/profiles.csv new file mode 100644 index 00000000..35687a7b --- /dev/null +++ b/evidence/research-20261029-pool/profiles.csv @@ -0,0 +1,7 @@ +profile,run,replicas,cpu_millicores_per_replica,memory_mib_per_replica,pool,vus,duration +saturation8,saturation8-20261029112615,1,1000,512,8,8,30 +saturation64,saturation64-20261029112756,1,1000,512,8,64,30 +single8a,single8a-20261029112953,1,1000,512,8,32,30 +single32a,single32a-20261029113131,1,1000,512,32,32,30 +single8b,single8b-20261029113315,1,1000,512,8,32,30 +single32b,single32b-20261029113452,1,1000,512,32,32,30 diff --git a/evidence/research-20261029-pool/readiness-events.json b/evidence/research-20261029-pool/readiness-events.json new file mode 100644 index 00000000..b86c1e16 --- /dev/null +++ b/evidence/research-20261029-pool/readiness-events.json @@ -0,0 +1,207 @@ +{ + "apiVersion": "v1", + "items": [ + { + "apiVersion": "v1", + "count": 4, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:32:43Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-757dbc95b7-rdrq9", + "namespace": "highload-applications", + "resourceVersion": "60165351", + "uid": "d7ca7a62-36f3-4fe4-a1e0-88c551fbae0e" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:32:49Z", + "message": "Readiness probe failed: Get \"http://10.1.25.119:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:32:43Z", + "name": "api-757dbc95b7-rdrq9.18e2fccdf49385e9", + "namespace": "highload-applications", + "resourceVersion": "60165641", + "uid": "bd6b8c20-d53c-4164-a494-204786fafcc4" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 16, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:26:39Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-84fbf9968-6xpsz", + "namespace": "highload-applications", + "resourceVersion": "60164031", + "uid": "d9662039-44f8-4142-be51-e527d8368874" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:31:22Z", + "message": "Readiness probe failed: Get \"http://10.1.25.79:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:26:46Z", + "name": "api-84fbf9968-6xpsz.18e2fc7937c40c84", + "namespace": "highload-applications", + "resourceVersion": "60165291", + "uid": "a20084f7-76bd-4e55-b804-1544b8703cac" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 8, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:31:22Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-84fbf9968-6xpsz", + "namespace": "highload-applications", + "resourceVersion": "60164031", + "uid": "d9662039-44f8-4142-be51-e527d8368874" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:31:34Z", + "message": "Readiness probe failed: HTTP probe failed with statuscode: 503", + "metadata": { + "creationTimestamp": "2026-10-29T11:31:35Z", + "name": "api-84fbf9968-6xpsz.18e2fcbb3401a746", + "namespace": "highload-applications", + "resourceVersion": "60165312", + "uid": "bb948f9b-eff8-4d54-9ac4-ca51307acca9" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:31:46Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-84fbf9968-6xpsz", + "namespace": "highload-applications", + "resourceVersion": "60164031", + "uid": "d9662039-44f8-4142-be51-e527d8368874" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:31:46Z", + "message": "Readiness probe failed: Get \"http://10.1.25.79:8080/health/ready\": dial tcp 10.1.25.79:8080: connect: connection refused", + "metadata": { + "creationTimestamp": "2026-10-29T11:31:46Z", + "name": "api-84fbf9968-6xpsz.18e2fcc0ca8f23ea", + "namespace": "highload-applications", + "resourceVersion": "60165438", + "uid": "46a800fe-e43c-4c44-91bc-e1fcd24f9de3" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 6, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:34:14Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-84fbf9968-b85fz", + "namespace": "highload-applications", + "resourceVersion": "60165751", + "uid": "51c2d296-8919-4856-bfb3-57269315e7d2" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:34:24Z", + "message": "Readiness probe failed: Get \"http://10.1.25.114:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:34:14Z", + "name": "api-84fbf9968-b85fz.18e2fce343b34a0f", + "namespace": "highload-applications", + "resourceVersion": "60166051", + "uid": "9edbb542-76f2-407a-9a64-ef8d29279894" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:35:06Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-84fbf9968-b85fz", + "namespace": "highload-applications", + "resourceVersion": "60165751", + "uid": "51c2d296-8919-4856-bfb3-57269315e7d2" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:35:06Z", + "message": "Readiness probe failed: Get \"http://10.1.25.114:8080/health/ready\": dial tcp 10.1.25.114:8080: connect: invalid argument", + "metadata": { + "creationTimestamp": "2026-10-29T11:35:06Z", + "name": "api-84fbf9968-b85fz.18e2fcef5fe228ce", + "namespace": "highload-applications", + "resourceVersion": "60166225", + "uid": "6ff1a877-7f9b-4ed0-bf18-99d62fb2cd28" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + } + ], + "kind": "List", + "metadata": { + "resourceVersion": "" + } +} diff --git a/evidence/research-20261029-pool/resources-saturation64-20261029112756.txt b/evidence/research-20261029-pool/resources-saturation64-20261029112756.txt new file mode 100644 index 00000000..33612377 --- /dev/null +++ b/evidence/research-20261029-pool/resources-saturation64-20261029112756.txt @@ -0,0 +1,82 @@ +UTC 2026-10-29T11:28:49Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 3m 10Mi +postgres-0 5m 55Mi +valkey-0 10m 10Mi +valkey-1 5m 14Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:28:58Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 3m 10Mi +postgres-0 5m 55Mi +valkey-0 10m 10Mi +valkey-1 5m 14Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:29:09Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 2m 10Mi +load-saturation64-20261029112756-8lc42 27m 21Mi +postgres-0 5m 55Mi +valkey-0 11m 10Mi +valkey-1 5m 14Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:29:18Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 189m 69Mi +load-saturation64-20261029112756-8lc42 53m 23Mi +postgres-0 59m 55Mi +valkey-0 17m 10Mi +valkey-1 18m 14Mi +valkey-2 6m 3Mi +active|||3 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:29:27Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 189m 69Mi +load-saturation64-20261029112756-8lc42 53m 23Mi +postgres-0 59m 55Mi +valkey-0 17m 10Mi +valkey-1 18m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|7 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:29:34Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 441m 16Mi +load-saturation64-20261029112756-8lc42 146m 37Mi +postgres-0 59m 55Mi +valkey-0 98m 10Mi +valkey-1 18m 14Mi +valkey-2 53m 4Mi +active|||1 +idle|Client|ClientRead|7 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:29:44Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 644m 15Mi +load-saturation64-20261029112756-8lc42 511m 46Mi +postgres-0 596m 64Mi +valkey-0 152m 8Mi +valkey-1 76m 14Mi +valkey-2 85m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:29:52Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 644m 15Mi +postgres-0 596m 64Mi +valkey-0 152m 8Mi +valkey-1 76m 14Mi +valkey-2 85m 3Mi diff --git a/evidence/research-20261029-pool/resources-saturation8-20261029112615.txt b/evidence/research-20261029-pool/resources-saturation8-20261029112615.txt new file mode 100644 index 00000000..6c02a7f3 --- /dev/null +++ b/evidence/research-20261029-pool/resources-saturation8-20261029112615.txt @@ -0,0 +1,85 @@ +UTC 2026-10-29T11:27:04Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 2m 23Mi +api-84fbf9968-mp649 2m 22Mi +postgres-0 4m 45Mi +valkey-0 7m 10Mi +valkey-1 4m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:27:11Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 2m 23Mi +api-84fbf9968-mp649 2m 22Mi +postgres-0 4m 45Mi +valkey-0 7m 10Mi +valkey-1 4m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:27:20Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 54m 61Mi +api-84fbf9968-mp649 3m 22Mi +load-saturation8-20261029112615-c2rdh 87m 15Mi +postgres-0 4m 45Mi +valkey-0 9m 10Mi +valkey-1 6m 14Mi +valkey-2 16m 4Mi +active|||1 +idle|Client|ClientRead|9 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:27:27Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 54m 61Mi +api-84fbf9968-mp649 3m 22Mi +load-saturation8-20261029112615-c2rdh 87m 15Mi +postgres-0 4m 45Mi +valkey-0 9m 10Mi +valkey-1 6m 14Mi +valkey-2 16m 4Mi +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|7 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:27:35Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 161m 9Mi +api-84fbf9968-mp649 178m 9Mi +load-saturation8-20261029112615-c2rdh 67m 15Mi +postgres-0 265m 65Mi +valkey-0 65m 10Mi +valkey-1 24m 14Mi +valkey-2 16m 4Mi +active|||2 +idle|Client|ClientRead|7 +idle|||1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:27:43Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 161m 9Mi +api-84fbf9968-mp649 178m 9Mi +load-saturation8-20261029112615-c2rdh 67m 15Mi +postgres-0 265m 65Mi +valkey-0 65m 10Mi +valkey-1 24m 14Mi +valkey-2 16m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +idle in transaction|IO|WalSync|1 +UTC 2026-10-29T11:27:50Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 305m 10Mi +api-84fbf9968-mp649 293m 10Mi +load-saturation8-20261029112615-c2rdh 250m 18Mi +postgres-0 265m 65Mi +valkey-0 127m 10Mi +valkey-1 62m 14Mi +valkey-2 70m 4Mi +active|||1 +idle|Client|ClientRead|9 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-pool/resources-single32a-20261029113131.txt b/evidence/research-20261029-pool/resources-single32a-20261029113131.txt new file mode 100644 index 00000000..5956439f --- /dev/null +++ b/evidence/research-20261029-pool/resources-single32a-20261029113131.txt @@ -0,0 +1,64 @@ +UTC 2026-10-29T11:32:24Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-rdrq9 2m 22Mi +postgres-0 4m 47Mi +valkey-0 9m 8Mi +valkey-1 5m 14Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:32:32Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-rdrq9 145m 40Mi +postgres-0 4m 47Mi +valkey-0 9m 8Mi +valkey-1 5m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:32:41Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-rdrq9 145m 40Mi +load-single32a-20261029113131-n2hln 103m 23Mi +postgres-0 122m 56Mi +valkey-0 38m 8Mi +valkey-1 9m 14Mi +valkey-2 26m 3Mi +active|||1 +idle|Client|ClientRead|32 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:32:54Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-rdrq9 145m 40Mi +load-single32a-20261029113131-n2hln 103m 23Mi +postgres-0 122m 56Mi +valkey-0 38m 8Mi +valkey-1 9m 14Mi +valkey-2 26m 3Mi +active|||1 +idle|Client|ClientRead|32 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:33:02Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-rdrq9 135m 15Mi +load-single32a-20261029113131-n2hln 464m 34Mi +postgres-0 243m 125Mi +valkey-0 47m 9Mi +valkey-1 14m 14Mi +valkey-2 24m 4Mi +active|||1 +idle|Client|ClientRead|31 +idle|||1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:33:09Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-rdrq9 135m 15Mi +postgres-0 243m 125Mi +valkey-0 47m 9Mi +valkey-1 14m 14Mi +valkey-2 24m 4Mi +active|||1 +idle|Client|ClientRead|32 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-pool/resources-single32b-20261029113452.txt b/evidence/research-20261029-pool/resources-single32b-20261029113452.txt new file mode 100644 index 00000000..4d264f8e --- /dev/null +++ b/evidence/research-20261029-pool/resources-single32b-20261029113452.txt @@ -0,0 +1,80 @@ +UTC 2026-10-29T11:35:56Z +Error from server (ServiceUnavailable): the server is currently unable to handle the request (get pods.metrics.k8s.io) +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:36:03Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-j9fg4 2m 22Mi +postgres-0 4m 52Mi +valkey-0 8m 9Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|3 +idle|||1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:36:12Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-j9fg4 2m 23Mi +postgres-0 4m 52Mi +valkey-0 6m 9Mi +valkey-2 5m 4Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:36:19Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-j9fg4 156m 11Mi +postgres-0 14m 53Mi +valkey-0 33m 9Mi +valkey-2 6m 4Mi +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|31 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:36:27Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-j9fg4 156m 11Mi +postgres-0 14m 53Mi +valkey-0 33m 9Mi +valkey-2 6m 4Mi +active|Client|ClientRead|5 +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|21 +idle|||2 +idle in transaction|Client|ClientRead|3 +idle in transaction|||1 +UTC 2026-10-29T11:36:34Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-j9fg4 305m 22Mi +load-single32b-20261029113452-9hx9v 309m 30Mi +postgres-0 486m 130Mi +valkey-0 155m 10Mi +valkey-1 63m 15Mi +valkey-2 35m 4Mi +active|||3 +idle|Client|ClientRead|25 +idle|||1 +idle in transaction|Client|ClientRead|5 +UTC 2026-10-29T11:36:42Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-j9fg4 305m 22Mi +load-single32b-20261029113452-9hx9v 309m 30Mi +postgres-0 486m 130Mi +valkey-0 155m 10Mi +valkey-1 63m 15Mi +valkey-2 35m 4Mi +active|||1 +idle|Client|ClientRead|32 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:36:50Z +NAME CPU(cores) MEMORY(bytes) +api-757dbc95b7-j9fg4 728m 24Mi +postgres-0 984m 133Mi +valkey-0 155m 10Mi +valkey-1 107m 15Mi +valkey-2 65m 4Mi +active|||1 +idle|Client|ClientRead|32 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-pool/resources-single8a-20261029112953.txt b/evidence/research-20261029-pool/resources-single8a-20261029112953.txt new file mode 100644 index 00000000..744f67b0 --- /dev/null +++ b/evidence/research-20261029-pool/resources-single8a-20261029112953.txt @@ -0,0 +1,64 @@ +UTC 2026-10-29T11:30:40Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 5m 15Mi +postgres-0 45m 65Mi +valkey-0 11m 8Mi +valkey-1 5m 14Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:30:47Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 2m 15Mi +postgres-0 6m 65Mi +valkey-0 10m 8Mi +valkey-1 5m 14Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:30:55Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 2m 15Mi +postgres-0 6m 65Mi +valkey-0 10m 8Mi +valkey-1 5m 14Mi +valkey-2 7m 3Mi +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|7 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:31:03Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 192m 12Mi +load-single8a-20261029112953-dkvr4 134m 27Mi +postgres-0 50m 65Mi +valkey-0 30m 8Mi +valkey-1 16m 14Mi +valkey-2 26m 4Mi +active|||3 +idle|Client|ClientRead|6 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:31:11Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 192m 12Mi +load-single8a-20261029112953-dkvr4 134m 27Mi +postgres-0 50m 65Mi +valkey-0 30m 8Mi +valkey-1 16m 14Mi +valkey-2 26m 4Mi +active|IO|WalSync|1 +active|LWLock|WALWrite|3 +active|Lock|transactionid|1 +active|||2 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:31:18Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-6xpsz 423m 14Mi +load-single8a-20261029112953-dkvr4 430m 27Mi +postgres-0 340m 65Mi +valkey-0 110m 9Mi +valkey-1 56m 14Mi +valkey-2 26m 4Mi diff --git a/evidence/research-20261029-pool/resources-single8b-20261029113315.txt b/evidence/research-20261029-pool/resources-single8b-20261029113315.txt new file mode 100644 index 00000000..bd785958 --- /dev/null +++ b/evidence/research-20261029-pool/resources-single8b-20261029113315.txt @@ -0,0 +1,62 @@ +UTC 2026-10-29T11:34:00Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-b85fz 2m 22Mi +postgres-0 4m 50Mi +valkey-0 8m 9Mi +valkey-1 6m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:34:07Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-b85fz 2m 22Mi +postgres-0 4m 50Mi +valkey-0 8m 9Mi +valkey-1 6m 14Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:34:16Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-b85fz 2m 22Mi +postgres-0 4m 50Mi +valkey-0 8m 9Mi +valkey-1 6m 14Mi +valkey-2 6m 3Mi +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|5 +idle|||1 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:34:33Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-b85fz 249m 8Mi +postgres-0 124m 59Mi +valkey-0 35m 9Mi +valkey-2 15m 4Mi +active|IO|WalSync|1 +active|LWLock|WALWrite|3 +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:34:41Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-b85fz 249m 8Mi +postgres-0 124m 59Mi +valkey-0 35m 9Mi +valkey-2 15m 4Mi +active|Client|ClientRead|1 +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|3 +UTC 2026-10-29T11:34:48Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-b85fz 290m 13Mi +postgres-0 187m 69Mi +valkey-0 100m 9Mi +valkey-2 27m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-pool/restore-values.yaml b/evidence/research-20261029-pool/restore-values.yaml new file mode 100644 index 00000000..4e915dac --- /dev/null +++ b/evidence/research-20261029-pool/restore-values.yaml @@ -0,0 +1,61 @@ +api: + env: + DEPENDENCY_POOL_SIZE: "8" + DEPENDENCY_TIMEOUT_MS: "2000" + GOMEMLIMIT: 160MiB + REQUEST_TIMEOUT_SECONDS: "4" + SESSION_TTL_SECONDS: "3600" + SHUTDOWN_TIMEOUT_SECONDS: "5" + replicas: 2 + resources: + limits: + cpu: "1" + memory: 256Mi + requests: + cpu: 250m + memory: 128Mi +autoscaling: + cpuPercent: 60 + enabled: true + maxReplicas: 4 + minReplicas: 2 +databaseSecret: messenger-secrets +image: + digest: sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 + repository: asisti.registry.twcstorage.ru/mtusi2026lab3 +imagePullSecret: registry-pull +ingress: + className: traefik + clusterIssuer: letsencrypt-prod + host: hl.agapov.space +load: + duration: 30 + enabled: false + run: manual + script: scaling.js + vus: 32 +monitoring: + serviceMonitor: false +postgres: + image: postgres:17.6-alpine + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + storage: 2Gi +storageClass: "" +valkey: + image: valkey/valkey:8.1.3-alpine + maxmemory: 64mb + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 100m + memory: 96Mi + shards: 3 + storage: 1Gi diff --git a/evidence/research-20261029-pool/restore.txt b/evidence/research-20261029-pool/restore.txt new file mode 100644 index 00000000..05de3bba --- /dev/null +++ b/evidence/research-20261029-pool/restore.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:36:55 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 27 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-pool/rollout-saturation64.txt b/evidence/research-20261029-pool/rollout-saturation64.txt new file mode 100644 index 00000000..891e21f7 --- /dev/null +++ b/evidence/research-20261029-pool/rollout-saturation64.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:27:59 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 22 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-pool/rollout-saturation8.txt b/evidence/research-20261029-pool/rollout-saturation8.txt new file mode 100644 index 00000000..749f5b4e --- /dev/null +++ b/evidence/research-20261029-pool/rollout-saturation8.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:26:18 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 21 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-pool/rollout-single32a.txt b/evidence/research-20261029-pool/rollout-single32a.txt new file mode 100644 index 00000000..f19c43ff --- /dev/null +++ b/evidence/research-20261029-pool/rollout-single32a.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:31:34 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 24 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-pool/rollout-single32b.txt b/evidence/research-20261029-pool/rollout-single32b.txt new file mode 100644 index 00000000..0918f9f8 --- /dev/null +++ b/evidence/research-20261029-pool/rollout-single32b.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:34:55 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 26 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-pool/rollout-single8a.txt b/evidence/research-20261029-pool/rollout-single8a.txt new file mode 100644 index 00000000..8f281c79 --- /dev/null +++ b/evidence/research-20261029-pool/rollout-single8a.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:29:55 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 23 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-pool/rollout-single8b.txt b/evidence/research-20261029-pool/rollout-single8b.txt new file mode 100644 index 00000000..97f8b55f --- /dev/null +++ b/evidence/research-20261029-pool/rollout-single8b.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:33:17 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 25 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-pool/source.sha256 b/evidence/research-20261029-pool/source.sha256 new file mode 100644 index 00000000..862a7ac7 --- /dev/null +++ b/evidence/research-20261029-pool/source.sha256 @@ -0,0 +1,3 @@ +0a58dff9ad7acf8f228e0fd1c2a670bbe7e18a11360715b47659104832e34892 student-tests/load/scaling.js +dcc8dc1217792aca3385c8e3195b236058ee9b2df912e60f9af46dc51b9a6c86 charts/messenger/values.yaml +60e09dd38fd1d413b744f21b57f64ba83e49a5ae1b4251aa5bf20be033f90cfb internal/controller/http/fiber/errors.go diff --git a/evidence/research-20261029-readiness/README.md b/evidence/research-20261029-readiness/README.md new file mode 100644 index 00000000..fb7acb53 --- /dev/null +++ b/evidence/research-20261029-readiness/README.md @@ -0,0 +1,5 @@ +# Проверка гипотезы readiness + +Гипотеза: probe timeout 2 секунды недостаточен для двух последовательных проверок зависимостей с отдельными бюджетами по 2 секунды. Проверены 2 с / 2 ошибки и 5 с / 1 ошибка при 1 API, 1000m/512Mi, pool=8, 32 VU, одной ноде. + +probe2a исключён из сравнения: фактических API было две из-за перехода от HPA. Валидные probe2b, probe5a и probe5b не подтвердили устойчивого улучшения: probe2b — 160.33 сообщений/с без ошибок, probe5a — 145.07 без ошибок, probe5b — 88.07 с 17950 ошибками операций. Выбранные штатные 2 с / 2 ошибки сохранены. Изменение таймаута не устраняет реальные отказы зависимостей или сетевую нестабильность. diff --git a/evidence/research-20261029-readiness/base-revision.txt b/evidence/research-20261029-readiness/base-revision.txt new file mode 100644 index 00000000..32abb9b4 --- /dev/null +++ b/evidence/research-20261029-readiness/base-revision.txt @@ -0,0 +1 @@ +7b7e23fd029beea47e6f625a96cb98d2fe04bafb diff --git a/evidence/research-20261029-readiness/date.txt b/evidence/research-20261029-readiness/date.txt new file mode 100644 index 00000000..6c9c1356 --- /dev/null +++ b/evidence/research-20261029-readiness/date.txt @@ -0,0 +1 @@ +2026-10-29T11:37:56Z diff --git a/evidence/research-20261029-readiness/deployment-probe2a-20261029113757.json b/evidence/research-20261029-readiness/deployment-probe2a-20261029113757.json new file mode 100644 index 00000000..477a4f6d --- /dev/null +++ b/evidence/research-20261029-readiness/deployment-probe2a-20261029113757.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "23", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 39, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60167114", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:38:17Z", + "lastUpdateTime": "2026-10-29T11:38:17Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:38:17Z", + "message": "ReplicaSet \"api-84fbf9968\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 39, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/research-20261029-readiness/deployment-probe2b-20261029114146.json b/evidence/research-20261029-readiness/deployment-probe2b-20261029114146.json new file mode 100644 index 00000000..a724f734 --- /dev/null +++ b/evidence/research-20261029-readiness/deployment-probe2b-20261029114146.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "25", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 41, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60168215", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:42:04Z", + "lastUpdateTime": "2026-10-29T11:42:04Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:42:28Z", + "message": "ReplicaSet \"api-84fbf9968\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 41, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-readiness/deployment-probe5a-20261029113950.json b/evidence/research-20261029-readiness/deployment-probe5a-20261029113950.json new file mode 100644 index 00000000..8205d797 --- /dev/null +++ b/evidence/research-20261029-readiness/deployment-probe5a-20261029113950.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "24", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 40, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60167609", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 1, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 5 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:39:29Z", + "lastUpdateTime": "2026-10-29T11:39:29Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:39:59Z", + "message": "ReplicaSet \"api-6748cbfcbb\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 40, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-readiness/deployment-probe5b-20261029114403.json b/evidence/research-20261029-readiness/deployment-probe5b-20261029114403.json new file mode 100644 index 00000000..aef89cfe --- /dev/null +++ b/evidence/research-20261029-readiness/deployment-probe5b-20261029114403.json @@ -0,0 +1,217 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "26", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 42, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60168628", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "3629eac7ad08a08f6015340b29ccc00a2d76d1d1abf751a049de47ac2ac50f77", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 1, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 5 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "512Mi" + }, + "requests": { + "cpu": "1", + "memory": "512Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeSelector": { + "kubernetes.io/hostname": "dev.asisti.tech" + }, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 1, + "conditions": [ + { + "lastTransitionTime": "2026-10-29T11:43:12Z", + "lastUpdateTime": "2026-10-29T11:43:12Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:44:10Z", + "message": "ReplicaSet \"api-6748cbfcbb\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 42, + "readyReplicas": 1, + "replicas": 1, + "updatedReplicas": 1 + } +} diff --git a/evidence/research-20261029-readiness/load-probe2a-20261029113757.json b/evidence/research-20261029-readiness/load-probe2a-20261029113757.json new file mode 100644 index 00000000..63093e49 --- /dev/null +++ b/evidence/research-20261029-readiness/load-probe2a-20261029113757.json @@ -0,0 +1,373 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "setup_data": [ + { + "chat": "5b6bc5fd-11ad-4ab5-8171-e36d78a854e5", + "token": "83o0IZT_OtqyoF7jKJBuBYHJSkER-H01YNUmwTPrW18" + }, + { + "chat": "ecd8894b-30bd-4689-9809-5ca1df67ca80", + "token": "VlrppUWw5bHBLYLmXua4mX_QYs6PNRxAE4Dk8DLLliM" + }, + { + "chat": "2036772e-7e34-47cb-b61d-bc7c09a4430b", + "token": "Gu5_iWIrhIdd0I_5SkKX1G-5kVvmyy8eVybWlJ_ij0o" + }, + { + "token": "hnBQGrEyAPo4oi6ZdZEkX7eifuI8nq7q_nxYpz1mibM", + "chat": "9f1cb7e9-794b-4d9c-b994-9d6a81dba078" + }, + { + "chat": "36915d30-e389-4615-9822-8465c70520c4", + "token": "OH8rJIaUYMUlQdp_kqInugZ9pMGzI9eJHrls-4Xo4dA" + }, + { + "chat": "641d3389-4fec-4a5f-bfed-3d70200e87e7", + "token": "6TrwiL01ikSGHJi4aw62vM88_V1t1XNrZNsc7Q0COeM" + }, + { + "chat": "acfe940b-a561-4158-ab85-8ba706789ff5", + "token": "-z5R8dnain840xVNWQ_4NAdKrQ7G0ZoEeRclQpXjY24" + }, + { + "chat": "414fd4ac-779b-446a-8c55-e601872f9f0f", + "token": "La-9Jdo2MR0_IIYe5DUad6LwJuQDDpKeUTvtDfQ-aIk" + }, + { + "chat": "8460515a-e8ac-4c18-8b2b-633333a0e589", + "token": "m93sYWqVPQPrHPgGhA97GGM3NekzYj_3TNWecJh8LiE" + }, + { + "chat": "872da110-ba6e-426a-92b2-a8d7f22afbc5", + "token": "Ha6fhKfJhAvnped_ehMw8yfJ_lWPV482xZ_4NIZyDrU" + }, + { + "chat": "094dbd4f-bf01-4356-86e7-dac531f47280", + "token": "D3Muv4SI7n38A8h3AfmxpHhqbLJZZvKlNPu35y93r54" + }, + { + "chat": "61f5ceb7-fb47-4eb7-b67f-443c4a054dd8", + "token": "lkHGmJoh-tnr5CdZICO0uBWVhjbwE1nWNyCCoGpTzqY" + }, + { + "chat": "cfa3f106-a30b-48d9-a6df-82715521d92d", + "token": "yYW0HkuJW-J0UNyXkd6oIIOP-oWHa8eYNblAlOYPCLA" + }, + { + "chat": "f2a728a4-1a54-4004-ab7d-3b302567feaf", + "token": "pqNvwTrA_kEclztZrmEdD8mtI1Rj_pGTNpJBXjBngo8" + }, + { + "chat": "ca03bb04-47a1-4b8e-8c46-9047ac270c80", + "token": "xkEXool5AH9jTevnIqx3EV5wnBU4qilks1v4F69wJLA" + }, + { + "chat": "bd5e6a6b-efdf-476d-ae20-4bc055dd9940", + "token": "9L394wCInPS7oYMPvrNAaKmT7a4R-FUvW4a-9Ly68Xc" + } + ], + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 2678, + "fails": 0 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 285, + "fails": 0 + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 2662, + "fails": 0 + } + ] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 45237.35581 + }, + "metrics": { + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "max": 21.956206, + "avg": 0.07616111407980315, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0 + } + }, + "data_received": { + "values": { + "count": 7720690, + "rate": 170670.67386580748 + }, + "type": "counter", + "contains": "data" + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "vus_max": { + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + }, + "type": "gauge" + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 0.007176399999999973, + "max": 1012.199289, + "avg": 0.2765768892599784, + "p(50)": 0.001211, + "p(95)": 0.0014415999999999995 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 2662, + "rate": 58.845172365524256 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.020088786078396904, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 4.497472 + } + }, + "http_req_receiving": { + "contains": "time", + "values": { + "avg": 0.28616167024081557, + "p(50)": 0.173989, + "p(95)": 0.7985983999999999, + "p(99)": 1.9823327599999991, + "max": 17.450908 + }, + "type": "trend" + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 365.8979752580771, + "p(50)": 171.7056935, + "p(95)": 289.01490204999993, + "p(99)": 15860.12647446, + "max": 16194.347133 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 530203, + "rate": 11720.468416122487 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "passes": 0, + "fails": 5689, + "rate": 0 + } + }, + "attempted_messages": { + "values": { + "rate": 54.02614622890356, + "count": 2444 + }, + "type": "counter", + "contains": "default" + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 303.5815466325699, + "p(50)": 97.445526, + "p(95)": 157.88551219999997, + "p(99)": 15466.744984530003, + "max": 15879.39015 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 5149, + "rate": 113.82186044706401 + } + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "application_errors": { + "values": { + "count": 0, + "rate": 0 + }, + "type": "counter", + "contains": "default" + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 5689, + "rate": 125.75889766621619 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 79.534332, + "p(95)": 143.08680299999995, + "p(99)": 302.71481855999906, + "max": 15879.39015, + "avg": 171.9521881787665 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "fails": 0, + "rate": 1, + "passes": 5625 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "rate": 0, + "count": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 302.71481855999906, + "max": 15879.39015, + "avg": 171.9521881787665, + "p(50)": 79.534332, + "p(95)": 143.08680299999995 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0.1736, + "p(95)": 0.3863061999999996, + "p(99)": 0.8739133999999985, + "max": 7.819659, + "avg": 0.20183353295834072 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "max": 15879.267816, + "avg": 171.4641929755668, + "p(50)": 79.072404, + "p(95)": 142.4328879999999, + "p(99)": 302.5124085199991 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 2444, + "rate": 54.02614622890356 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + } + } + } +} diff --git a/evidence/research-20261029-readiness/load-probe2a-20261029113757.txt b/evidence/research-20261029-readiness/load-probe2a-20261029113757.txt new file mode 100644 index 00000000..564d78fd --- /dev/null +++ b/evidence/research-20261029-readiness/load-probe2a-20261029113757.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"setup_data":[{"chat":"5b6bc5fd-11ad-4ab5-8171-e36d78a854e5","token":"83o0IZT_OtqyoF7jKJBuBYHJSkER-H01YNUmwTPrW18"},{"chat":"ecd8894b-30bd-4689-9809-5ca1df67ca80","token":"VlrppUWw5bHBLYLmXua4mX_QYs6PNRxAE4Dk8DLLliM"},{"chat":"2036772e-7e34-47cb-b61d-bc7c09a4430b","token":"Gu5_iWIrhIdd0I_5SkKX1G-5kVvmyy8eVybWlJ_ij0o"},{"token":"hnBQGrEyAPo4oi6ZdZEkX7eifuI8nq7q_nxYpz1mibM","chat":"9f1cb7e9-794b-4d9c-b994-9d6a81dba078"},{"chat":"36915d30-e389-4615-9822-8465c70520c4","token":"OH8rJIaUYMUlQdp_kqInugZ9pMGzI9eJHrls-4Xo4dA"},{"chat":"641d3389-4fec-4a5f-bfed-3d70200e87e7","token":"6TrwiL01ikSGHJi4aw62vM88_V1t1XNrZNsc7Q0COeM"},{"chat":"acfe940b-a561-4158-ab85-8ba706789ff5","token":"-z5R8dnain840xVNWQ_4NAdKrQ7G0ZoEeRclQpXjY24"},{"chat":"414fd4ac-779b-446a-8c55-e601872f9f0f","token":"La-9Jdo2MR0_IIYe5DUad6LwJuQDDpKeUTvtDfQ-aIk"},{"chat":"8460515a-e8ac-4c18-8b2b-633333a0e589","token":"m93sYWqVPQPrHPgGhA97GGM3NekzYj_3TNWecJh8LiE"},{"chat":"872da110-ba6e-426a-92b2-a8d7f22afbc5","token":"Ha6fhKfJhAvnped_ehMw8yfJ_lWPV482xZ_4NIZyDrU"},{"chat":"094dbd4f-bf01-4356-86e7-dac531f47280","token":"D3Muv4SI7n38A8h3AfmxpHhqbLJZZvKlNPu35y93r54"},{"chat":"61f5ceb7-fb47-4eb7-b67f-443c4a054dd8","token":"lkHGmJoh-tnr5CdZICO0uBWVhjbwE1nWNyCCoGpTzqY"},{"chat":"cfa3f106-a30b-48d9-a6df-82715521d92d","token":"yYW0HkuJW-J0UNyXkd6oIIOP-oWHa8eYNblAlOYPCLA"},{"chat":"f2a728a4-1a54-4004-ab7d-3b302567feaf","token":"pqNvwTrA_kEclztZrmEdD8mtI1Rj_pGTNpJBXjBngo8"},{"chat":"ca03bb04-47a1-4b8e-8c46-9047ac270c80","token":"xkEXool5AH9jTevnIqx3EV5wnBU4qilks1v4F69wJLA"},{"chat":"bd5e6a6b-efdf-476d-ae20-4bc055dd9940","token":"9L394wCInPS7oYMPvrNAaKmT7a4R-FUvW4a-9Ly68Xc"}],"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":2678,"fails":0},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":285,"fails":0},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":2662,"fails":0}]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":45237.35581},"metrics":{"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"max":21.956206,"avg":0.07616111407980315,"p(50)":0,"p(95)":0,"p(99)":0}},"data_received":{"values":{"count":7720690,"rate":170670.67386580748},"type":"counter","contains":"data"},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"vus_max":{"contains":"default","values":{"value":32,"min":32,"max":32},"type":"gauge"},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(99)":0.007176399999999973,"max":1012.199289,"avg":0.2765768892599784,"p(50)":0.001211,"p(95)":0.0014415999999999995}},"iterations":{"type":"counter","contains":"default","values":{"count":2662,"rate":58.845172365524256}},"http_req_connecting":{"type":"trend","contains":"time","values":{"avg":0.020088786078396904,"p(50)":0,"p(95)":0,"p(99)":0,"max":4.497472}},"http_req_receiving":{"contains":"time","values":{"avg":0.28616167024081557,"p(50)":0.173989,"p(95)":0.7985983999999999,"p(99)":1.9823327599999991,"max":17.450908},"type":"trend"},"iteration_duration":{"type":"trend","contains":"time","values":{"avg":365.8979752580771,"p(50)":171.7056935,"p(95)":289.01490204999993,"p(99)":15860.12647446,"max":16194.347133}},"data_sent":{"type":"counter","contains":"data","values":{"count":530203,"rate":11720.468416122487}},"http_req_failed":{"type":"rate","contains":"default","values":{"passes":0,"fails":5689,"rate":0}},"attempted_messages":{"values":{"rate":54.02614622890356,"count":2444},"type":"counter","contains":"default"},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":303.5815466325699,"p(50)":97.445526,"p(95)":157.88551219999997,"p(99)":15466.744984530003,"max":15879.39015}},"measured_operations":{"type":"counter","contains":"default","values":{"count":5149,"rate":113.82186044706401}},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"application_errors":{"values":{"count":0,"rate":0},"type":"counter","contains":"default"},"http_reqs":{"type":"counter","contains":"default","values":{"count":5689,"rate":125.75889766621619}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(50)":79.534332,"p(95)":143.08680299999995,"p(99)":302.71481855999906,"max":15879.39015,"avg":171.9521881787665}},"checks":{"type":"rate","contains":"default","values":{"fails":0,"rate":1,"passes":5625}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"rate":0,"count":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_duration":{"type":"trend","contains":"time","values":{"p(99)":302.71481855999906,"max":15879.39015,"avg":171.9521881787665,"p(50)":79.534332,"p(95)":143.08680299999995}},"http_req_sending":{"type":"trend","contains":"time","values":{"p(50)":0.1736,"p(95)":0.3863061999999996,"p(99)":0.8739133999999985,"max":7.819659,"avg":0.20183353295834072}},"http_req_waiting":{"type":"trend","contains":"time","values":{"max":15879.267816,"avg":171.4641929755668,"p(50)":79.072404,"p(95)":142.4328879999999,"p(99)":302.5124085199991}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":2444,"rate":54.02614622890356}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}}}}} diff --git a/evidence/research-20261029-readiness/load-probe2b-20261029114146.json b/evidence/research-20261029-readiness/load-probe2b-20261029114146.json new file mode 100644 index 00000000..7bf640fc --- /dev/null +++ b/evidence/research-20261029-readiness/load-probe2b-20261029114146.json @@ -0,0 +1,373 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 4987, + "fails": 0 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 513, + "fails": 0 + }, + { + "passes": 4965, + "fails": 0, + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8" + } + ], + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e" + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 54454.378861 + }, + "metrics": { + "http_req_failed": { + "values": { + "fails": 10531, + "rate": 0.00037968675842429994, + "passes": 4 + }, + "type": "rate", + "contains": "default" + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 181.894479, + "p(95)": 319.0880900000001, + "p(99)": 406.6495257199995, + "max": 608.051894, + "avg": 196.05788405075597 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 4810, + "rate": 88.33082114990208 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.2553993865211189, + "p(50)": 0.179999, + "p(95)": 0.6804462999999995, + "p(99)": 1.3854514599999999, + "max": 7.788657 + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 92.3184985, + "p(95)": 159.7035873, + "p(99)": 211.03447146, + "max": 296.317341, + "avg": 99.74704451330554 + } + }, + "application_errors{status:0}": { + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "application_errors{status:503}": { + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.20819878025628386, + "p(50)": 0.001241, + "p(95)": 0.001442, + "p(99)": 0.0015903199999999997, + "max": 1024.807021 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.19730970536307524, + "p(50)": 0.187979, + "p(95)": 0.3581966999999999, + "p(99)": 0.6450867599999998, + "max": 3.336688 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 92.75789150726135, + "p(50)": 85.441347, + "p(95)": 152.2794315999999, + "p(99)": 203.34289926, + "max": 3000.129427 + } + }, + "vus": { + "values": { + "value": 32, + "min": 0, + "max": 32 + }, + "type": "gauge", + "contains": "default" + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 10535, + "rate": 193.46469871397474 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 960532, + "rate": 17639.20588373342 + } + }, + "http_req_tls_handshaking": { + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 46.742453, + "avg": 0.09879457854769816 + }, + "type": "trend", + "contains": "time" + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 203.40958330000032, + "max": 296.317341, + "avg": 92.77317693780265, + "p(50)": 85.893005, + "p(95)": 152.67121600000002 + } + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + } + }, + "http_req_duration": { + "values": { + "p(50)": 85.893005, + "p(95)": 152.7242078, + "p(99)": 203.665353, + "max": 3000.381876, + "avg": 93.2106005991457 + }, + "type": "trend", + "contains": "time" + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "rate": 264476.89425973047, + "count": 14401925 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 1, + "passes": 10465, + "fails": 0 + } + }, + "iterations": { + "contains": "default", + "values": { + "count": 4965, + "rate": 91.17724054246649 + }, + "type": "counter" + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 10115, + "rate": 185.75182035992924 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 4810, + "rate": 88.33082114990208 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0, + "p(99)": 0, + "max": 6.465628, + "avg": 0.011650741053630754, + "p(50)": 0 + } + } + }, + "setup_data": [ + { + "chat": "f9b118db-f823-4930-8ff8-f7eed5d8289a", + "token": "JUStv0hGFfnPbiNAzyfJ3hyQIaXKxw9rD-pMmo557qk" + }, + { + "token": "_UrCXK0lbM-50SCHZUKqOdVtseZZ0-eu7Sw0p1224Ac", + "chat": "f94d593c-fc6c-460a-8713-93b181e6b129" + }, + { + "chat": "e864aee5-5a3a-430a-bf17-0cdd4cbde8cb", + "token": "KEVdNatKTwTnvxkML-1ADvLoPbePA7iG6PEnpWAnSvM" + }, + { + "chat": "f697d0c3-c196-456b-b8f7-6b29a9d26297", + "token": "Xu97i_7fp8GBCjMc1ifwUYLBpz7HAhA5hsl7RvNFKXc" + }, + { + "chat": "be9b63bb-a551-4c87-b395-b516054bdc48", + "token": "hachLHDwsq-mcd_SHtJwdYjTR6aY2u6WuP19Swy2CDk" + }, + { + "chat": "8b360f96-5aba-49f2-ad48-c48dfea25fdf", + "token": "V7aGGrTFdneZvwQ4T-IiloSNlZ0MtyCH3Sh6VYTn9Cg" + }, + { + "token": "tMzXrlTJdbue4EhLfjMSlsdZIiWGCe0PRYSlxdsgsWw", + "chat": "d04374d7-9f3f-42a8-8ec9-e580ac1f09ac" + }, + { + "token": "YhKwaQ9xR9nGfGxLaXfpDSsv6AMACvW6t6ZHB2mVPt0", + "chat": "e8278e32-421e-4bd6-9976-c1fc525959e5" + }, + { + "chat": "7094ba19-c7ae-449f-a7b7-6d954cec703e", + "token": "8ghi6AHhsg6vH9nFTc2bE-knZ2oFgU_fkJfWq9fRyVs" + }, + { + "chat": "b1834219-b5cc-4e4a-a5d9-a54e84ea95f1", + "token": "RlB4ar1wHm17V3Rz1Tm04PLenGpT5GCnIs5doxRl_Os" + }, + { + "token": "LAvoTYNP_J0hGVbnfsI1uBWjsa2PhLbAeFxI3F1HqK8", + "chat": "5ba7fc56-93c8-4864-bc73-a6c37b92e147" + }, + { + "chat": "8f5c45da-8ae0-4621-87da-3e1d7fbba11e", + "token": "C3Wl88sIeM_t2osq4WIJMN54Oitn86ueZkz6fhzudNg" + }, + { + "chat": "8384ae31-48bd-4b67-bbd1-bc3f70301d4a", + "token": "u_uTx4A5Cfk4f8DkCzuj3enMubnyGDTtYE15GXnZNQA" + }, + { + "chat": "4426f32f-17cf-41c1-b726-5f65033de485", + "token": "Ap4CGuCfDEhJATpUI0PT1Rk_mMCIkZPUQ7chtJlRZ7M" + }, + { + "chat": "0909d4e0-77ba-4eb5-a9cc-2203fe3d486b", + "token": "RWpFTGro7wOrK1RSVR0qeDwl-m8jwOP-DbpnA2qMDCs" + }, + { + "chat": "e38a6dbb-0d1e-4778-b747-e42f0a4077f4", + "token": "pYaRvdGGaElZeUEk5CrsQtkk3-nHzXPwm7ZpbWgeBF0" + } + ] + } +} diff --git a/evidence/research-20261029-readiness/load-probe2b-20261029114146.txt b/evidence/research-20261029-readiness/load-probe2b-20261029114146.txt new file mode 100644 index 00000000..c307a8af --- /dev/null +++ b/evidence/research-20261029-readiness/load-probe2b-20261029114146.txt @@ -0,0 +1,4 @@ +time="2026-10-29T11:43:06Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/health/ready\": request timeout" +time="2026-10-29T11:43:10Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/health/ready\": request timeout" +time="2026-10-29T11:43:12Z" level=warning msg="setup login: 503; abandoning synthetic actor" source=console +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":4987,"fails":0},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":513,"fails":0},{"passes":4965,"fails":0,"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8"}],"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e"},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":54454.378861},"metrics":{"http_req_failed":{"values":{"fails":10531,"rate":0.00037968675842429994,"passes":4},"type":"rate","contains":"default"},"iteration_duration":{"type":"trend","contains":"time","values":{"p(50)":181.894479,"p(95)":319.0880900000001,"p(99)":406.6495257199995,"max":608.051894,"avg":196.05788405075597}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":4810,"rate":88.33082114990208}},"http_req_receiving":{"type":"trend","contains":"time","values":{"avg":0.2553993865211189,"p(50)":0.179999,"p(95)":0.6804462999999995,"p(99)":1.3854514599999999,"max":7.788657}},"message_latency_ms":{"type":"trend","contains":"time","values":{"p(50)":92.3184985,"p(95)":159.7035873,"p(99)":211.03447146,"max":296.317341,"avg":99.74704451330554}},"application_errors{status:0}":{"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default","values":{"count":0,"rate":0}},"application_errors{status:503}":{"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default","values":{"count":0,"rate":0}},"http_req_blocked":{"type":"trend","contains":"time","values":{"avg":0.20819878025628386,"p(50)":0.001241,"p(95)":0.001442,"p(99)":0.0015903199999999997,"max":1024.807021}},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.19730970536307524,"p(50)":0.187979,"p(95)":0.3581966999999999,"p(99)":0.6450867599999998,"max":3.336688}},"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":92.75789150726135,"p(50)":85.441347,"p(95)":152.2794315999999,"p(99)":203.34289926,"max":3000.129427}},"vus":{"values":{"value":32,"min":0,"max":32},"type":"gauge","contains":"default"},"http_reqs":{"type":"counter","contains":"default","values":{"count":10535,"rate":193.46469871397474}},"data_sent":{"type":"counter","contains":"data","values":{"count":960532,"rate":17639.20588373342}},"http_req_tls_handshaking":{"values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":46.742453,"avg":0.09879457854769816},"type":"trend","contains":"time"},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(99)":203.40958330000032,"max":296.317341,"avg":92.77317693780265,"p(50)":85.893005,"p(95)":152.67121600000002}},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"http_req_duration":{"values":{"p(50)":85.893005,"p(95)":152.7242078,"p(99)":203.665353,"max":3000.381876,"avg":93.2106005991457},"type":"trend","contains":"time"},"data_received":{"type":"counter","contains":"data","values":{"rate":264476.89425973047,"count":14401925}},"checks":{"type":"rate","contains":"default","values":{"rate":1,"passes":10465,"fails":0}},"iterations":{"contains":"default","values":{"count":4965,"rate":91.17724054246649},"type":"counter"},"measured_operations":{"type":"counter","contains":"default","values":{"count":10115,"rate":185.75182035992924}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":4810,"rate":88.33082114990208}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(95)":0,"p(99)":0,"max":6.465628,"avg":0.011650741053630754,"p(50)":0}}},"setup_data":[{"chat":"f9b118db-f823-4930-8ff8-f7eed5d8289a","token":"JUStv0hGFfnPbiNAzyfJ3hyQIaXKxw9rD-pMmo557qk"},{"token":"_UrCXK0lbM-50SCHZUKqOdVtseZZ0-eu7Sw0p1224Ac","chat":"f94d593c-fc6c-460a-8713-93b181e6b129"},{"chat":"e864aee5-5a3a-430a-bf17-0cdd4cbde8cb","token":"KEVdNatKTwTnvxkML-1ADvLoPbePA7iG6PEnpWAnSvM"},{"chat":"f697d0c3-c196-456b-b8f7-6b29a9d26297","token":"Xu97i_7fp8GBCjMc1ifwUYLBpz7HAhA5hsl7RvNFKXc"},{"chat":"be9b63bb-a551-4c87-b395-b516054bdc48","token":"hachLHDwsq-mcd_SHtJwdYjTR6aY2u6WuP19Swy2CDk"},{"chat":"8b360f96-5aba-49f2-ad48-c48dfea25fdf","token":"V7aGGrTFdneZvwQ4T-IiloSNlZ0MtyCH3Sh6VYTn9Cg"},{"token":"tMzXrlTJdbue4EhLfjMSlsdZIiWGCe0PRYSlxdsgsWw","chat":"d04374d7-9f3f-42a8-8ec9-e580ac1f09ac"},{"token":"YhKwaQ9xR9nGfGxLaXfpDSsv6AMACvW6t6ZHB2mVPt0","chat":"e8278e32-421e-4bd6-9976-c1fc525959e5"},{"chat":"7094ba19-c7ae-449f-a7b7-6d954cec703e","token":"8ghi6AHhsg6vH9nFTc2bE-knZ2oFgU_fkJfWq9fRyVs"},{"chat":"b1834219-b5cc-4e4a-a5d9-a54e84ea95f1","token":"RlB4ar1wHm17V3Rz1Tm04PLenGpT5GCnIs5doxRl_Os"},{"token":"LAvoTYNP_J0hGVbnfsI1uBWjsa2PhLbAeFxI3F1HqK8","chat":"5ba7fc56-93c8-4864-bc73-a6c37b92e147"},{"chat":"8f5c45da-8ae0-4621-87da-3e1d7fbba11e","token":"C3Wl88sIeM_t2osq4WIJMN54Oitn86ueZkz6fhzudNg"},{"chat":"8384ae31-48bd-4b67-bbd1-bc3f70301d4a","token":"u_uTx4A5Cfk4f8DkCzuj3enMubnyGDTtYE15GXnZNQA"},{"chat":"4426f32f-17cf-41c1-b726-5f65033de485","token":"Ap4CGuCfDEhJATpUI0PT1Rk_mMCIkZPUQ7chtJlRZ7M"},{"chat":"0909d4e0-77ba-4eb5-a9cc-2203fe3d486b","token":"RWpFTGro7wOrK1RSVR0qeDwl-m8jwOP-DbpnA2qMDCs"},{"chat":"e38a6dbb-0d1e-4778-b747-e42f0a4077f4","token":"pYaRvdGGaElZeUEk5CrsQtkk3-nHzXPwm7ZpbWgeBF0"}]}} diff --git a/evidence/research-20261029-readiness/load-probe5a-20261029113950.json b/evidence/research-20261029-readiness/load-probe5a-20261029113950.json new file mode 100644 index 00000000..3d38063f --- /dev/null +++ b/evidence/research-20261029-readiness/load-probe5a-20261029113950.json @@ -0,0 +1,373 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "options": { + "summaryTimeUnit": "", + "noColor": false, + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ] + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 64348.785066 + }, + "metrics": { + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 183.89047805, + "p(99)": 227.91660417999984, + "max": 416.153811, + "avg": 109.79651016130492, + "p(50)": 98.04979 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 104.04333617752478, + "p(50)": 91.693759, + "p(95)": 175.95552974999998, + "p(99)": 217.26459979999993, + "max": 3001.057825 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0.5819402499999999, + "p(99)": 1.0858867999999973, + "max": 197.82957, + "avg": 0.314270459413872, + "p(50)": 0.178359 + } + }, + "measured_operations": { + "contains": "default", + "values": { + "count": 9144, + "rate": 142.1005849701958 + }, + "type": "counter" + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 4472, + "rate": 69.49626159084816 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 194.042303, + "p(95)": 360.47340879999996, + "p(99)": 507.1045991, + "max": 801.247776, + "avg": 218.48342979830016 + } + }, + "application_errors{status:503}": { + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter" + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 1, + "passes": 9415, + "fails": 0 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 4352, + "rate": 67.63142451774848 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 9486, + "rate": 147.4153706285299 + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 218.69784719999987, + "max": 3001.115932, + "avg": 104.54552064473933, + "p(50)": 92.08764049999999, + "p(95)": 176.54378450000002 + } + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.18791400780097017, + "p(50)": 0.1824905, + "p(95)": 0.328721, + "p(99)": 0.5858761499999996, + "max": 5.680971 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 867545, + "rate": 13481.917321518866 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_tls_handshaking": { + "values": { + "avg": 0.07659518458781361, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 40.096467 + }, + "type": "trend", + "contains": "time" + }, + "vus_max": { + "values": { + "value": 32, + "min": 32, + "max": 32 + }, + "type": "gauge", + "contains": "default" + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 12965300, + "rate": 201484.76753216094 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 4352, + "rate": 67.63142451774848 + } + }, + "http_req_connecting": { + "contains": "time", + "values": { + "p(99)": 0, + "max": 7.041569, + "avg": 0.011908549968374448, + "p(50)": 0, + "p(95)": 0 + }, + "type": "trend" + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.0007379295804343243, + "passes": 7, + "fails": 9479 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0.001441, + "p(99)": 0.001576, + "max": 44.680786, + "avg": 0.0910056399957825, + "p(50)": 0.001239 + } + }, + "http_req_duration{expected_response:true}": { + "values": { + "avg": 103.45390451482191, + "p(50)": 92.086455, + "p(95)": 176.3376974, + "p(99)": 217.65719217999987, + "max": 416.153811 + }, + "type": "trend", + "contains": "time" + } + }, + "setup_data": [ + { + "token": "uFBtq1uyBuuOxa0GQS6ayWGhmJh2lPfX8T7KZ2Fxhww", + "chat": "3f7f81a1-210e-43ce-b61f-5880b585bf95" + }, + { + "chat": "4f90e785-35cc-4aa6-aada-211f9101b99a", + "token": "1QktxWjmAcVW6o4XRxpiwgQBseTgGNptGycvnoBn_Lc" + }, + { + "chat": "c58496ae-f334-4756-bec0-ab71f0ebfc64", + "token": "MLfPLEC0g8yGTakggGJ66T23-1EDAXRqFvRExUuz7eA" + }, + { + "chat": "42b0cc09-6543-416e-9aad-406502af0df2", + "token": "w55BAcQpzQzHOfi9rUMj5ijjhaOEL6I5XFCyNhDTgPk" + }, + { + "chat": "e2230d92-d610-450a-a492-151803a5db95", + "token": "mr2K8Mf1jgX_rF6cyAd7cuUbJ6sQamZUSO0ywn0NF_w" + }, + { + "chat": "04a32152-5865-4ee2-9915-97d609890d0e", + "token": "LST3yU-cu4rUVFRb8AoPEWzIGjA18_ML3jUB0QZT2ZQ" + }, + { + "chat": "47672539-53d1-4995-b114-34509c107525", + "token": "m1nO2gn-iyDXvf1ah2hF4YuBEl7YZQQChgOXJhAys3M" + }, + { + "chat": "c2420a16-02a8-47df-89b9-b84f9f66ecbb", + "token": "ljTaFNOKm7eGWnC5KRVsKmbqKPcnD9rDprEjJG8gHio" + }, + { + "chat": "02f49adf-da6f-4ed8-8441-a08519b58564", + "token": "-4ZXXeH7lhQJSZvdNMqqUW71PktnEvvN4Y2hmc65_H8" + }, + { + "chat": "912536ef-a25d-4531-9ef1-cd1a7fb04aec", + "token": "M_YFJMkfKAeZwSimylxxap7T2I_bY2AdOQChfSicbwY" + }, + { + "chat": "0b510057-ca4e-4d1d-ab48-c569992fd722", + "token": "dDulmCbP8L0Ci04ld1Py6ogqKFom_tLf_3VJNikW5so" + }, + { + "chat": "b17655c2-4167-4b51-8401-24adac60e652", + "token": "mDAVSpqVjWbTw9ZQ5IGPWfQkiUW_1Am0hd8vtMZNeiI" + }, + { + "chat": "0bd18883-3bd7-4932-ad55-721c21a77644", + "token": "SbN7F5vfjfYL2EEERxDR8bW9rZ03YMYCNCQqhNU9A8A" + }, + { + "token": "G5TcBhZmn3Ab126gFCuMYKrAFBsiWmc4-zxlo6iOr-o", + "chat": "f10b2b52-46d6-4020-8425-2b25ba37c0eb" + }, + { + "token": "flkfNfEE__Tlq4YnboJwhC9I0LD6iV4JrJHYSUmpqTY", + "chat": "97845113-2a00-4cf3-a55f-ada8676e04a4" + }, + { + "chat": "cff6bd2e-a5b1-49ad-8260-6cb9b290c6ec", + "token": "zg_0wnxAw4QgBgOKsvpD2yRXMZbY809TvLHD3hxxLq8" + } + ], + "root_group": { + "groups": [], + "checks": [ + { + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 4487, + "fails": 0, + "name": "message confirmed", + "path": "::message confirmed" + }, + { + "fails": 0, + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 456 + }, + { + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 4472, + "fails": 0, + "name": "history readable", + "path": "::history readable" + } + ], + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e" + } + } +} diff --git a/evidence/research-20261029-readiness/load-probe5a-20261029113950.txt b/evidence/research-20261029-readiness/load-probe5a-20261029113950.txt new file mode 100644 index 00000000..49b9068d --- /dev/null +++ b/evidence/research-20261029-readiness/load-probe5a-20261029113950.txt @@ -0,0 +1,4 @@ +time="2026-10-29T11:40:37Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/health/ready\": request timeout" +time="2026-10-29T11:40:41Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/health/ready\": request timeout" +time="2026-10-29T11:40:45Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/health/ready\": request timeout" +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"options":{"summaryTimeUnit":"","noColor":false,"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"]},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":64348.785066},"metrics":{"message_latency_ms":{"type":"trend","contains":"time","values":{"p(95)":183.89047805,"p(99)":227.91660417999984,"max":416.153811,"avg":109.79651016130492,"p(50)":98.04979}},"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":104.04333617752478,"p(50)":91.693759,"p(95)":175.95552974999998,"p(99)":217.26459979999993,"max":3001.057825}},"http_req_receiving":{"type":"trend","contains":"time","values":{"p(95)":0.5819402499999999,"p(99)":1.0858867999999973,"max":197.82957,"avg":0.314270459413872,"p(50)":0.178359}},"measured_operations":{"contains":"default","values":{"count":9144,"rate":142.1005849701958},"type":"counter"},"iterations":{"type":"counter","contains":"default","values":{"count":4472,"rate":69.49626159084816}},"iteration_duration":{"type":"trend","contains":"time","values":{"p(50)":194.042303,"p(95)":360.47340879999996,"p(99)":507.1045991,"max":801.247776,"avg":218.48342979830016}},"application_errors{status:503}":{"contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter"},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"checks":{"type":"rate","contains":"default","values":{"rate":1,"passes":9415,"fails":0}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":4352,"rate":67.63142451774848}},"http_reqs":{"type":"counter","contains":"default","values":{"count":9486,"rate":147.4153706285299}},"http_req_duration":{"type":"trend","contains":"time","values":{"p(99)":218.69784719999987,"max":3001.115932,"avg":104.54552064473933,"p(50)":92.08764049999999,"p(95)":176.54378450000002}},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.18791400780097017,"p(50)":0.1824905,"p(95)":0.328721,"p(99)":0.5858761499999996,"max":5.680971}},"data_sent":{"type":"counter","contains":"data","values":{"count":867545,"rate":13481.917321518866}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_tls_handshaking":{"values":{"avg":0.07659518458781361,"p(50)":0,"p(95)":0,"p(99)":0,"max":40.096467},"type":"trend","contains":"time"},"vus_max":{"values":{"value":32,"min":32,"max":32},"type":"gauge","contains":"default"},"data_received":{"type":"counter","contains":"data","values":{"count":12965300,"rate":201484.76753216094}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":4352,"rate":67.63142451774848}},"http_req_connecting":{"contains":"time","values":{"p(99)":0,"max":7.041569,"avg":0.011908549968374448,"p(50)":0,"p(95)":0},"type":"trend"},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.0007379295804343243,"passes":7,"fails":9479}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(95)":0.001441,"p(99)":0.001576,"max":44.680786,"avg":0.0910056399957825,"p(50)":0.001239}},"http_req_duration{expected_response:true}":{"values":{"avg":103.45390451482191,"p(50)":92.086455,"p(95)":176.3376974,"p(99)":217.65719217999987,"max":416.153811},"type":"trend","contains":"time"}},"setup_data":[{"token":"uFBtq1uyBuuOxa0GQS6ayWGhmJh2lPfX8T7KZ2Fxhww","chat":"3f7f81a1-210e-43ce-b61f-5880b585bf95"},{"chat":"4f90e785-35cc-4aa6-aada-211f9101b99a","token":"1QktxWjmAcVW6o4XRxpiwgQBseTgGNptGycvnoBn_Lc"},{"chat":"c58496ae-f334-4756-bec0-ab71f0ebfc64","token":"MLfPLEC0g8yGTakggGJ66T23-1EDAXRqFvRExUuz7eA"},{"chat":"42b0cc09-6543-416e-9aad-406502af0df2","token":"w55BAcQpzQzHOfi9rUMj5ijjhaOEL6I5XFCyNhDTgPk"},{"chat":"e2230d92-d610-450a-a492-151803a5db95","token":"mr2K8Mf1jgX_rF6cyAd7cuUbJ6sQamZUSO0ywn0NF_w"},{"chat":"04a32152-5865-4ee2-9915-97d609890d0e","token":"LST3yU-cu4rUVFRb8AoPEWzIGjA18_ML3jUB0QZT2ZQ"},{"chat":"47672539-53d1-4995-b114-34509c107525","token":"m1nO2gn-iyDXvf1ah2hF4YuBEl7YZQQChgOXJhAys3M"},{"chat":"c2420a16-02a8-47df-89b9-b84f9f66ecbb","token":"ljTaFNOKm7eGWnC5KRVsKmbqKPcnD9rDprEjJG8gHio"},{"chat":"02f49adf-da6f-4ed8-8441-a08519b58564","token":"-4ZXXeH7lhQJSZvdNMqqUW71PktnEvvN4Y2hmc65_H8"},{"chat":"912536ef-a25d-4531-9ef1-cd1a7fb04aec","token":"M_YFJMkfKAeZwSimylxxap7T2I_bY2AdOQChfSicbwY"},{"chat":"0b510057-ca4e-4d1d-ab48-c569992fd722","token":"dDulmCbP8L0Ci04ld1Py6ogqKFom_tLf_3VJNikW5so"},{"chat":"b17655c2-4167-4b51-8401-24adac60e652","token":"mDAVSpqVjWbTw9ZQ5IGPWfQkiUW_1Am0hd8vtMZNeiI"},{"chat":"0bd18883-3bd7-4932-ad55-721c21a77644","token":"SbN7F5vfjfYL2EEERxDR8bW9rZ03YMYCNCQqhNU9A8A"},{"token":"G5TcBhZmn3Ab126gFCuMYKrAFBsiWmc4-zxlo6iOr-o","chat":"f10b2b52-46d6-4020-8425-2b25ba37c0eb"},{"token":"flkfNfEE__Tlq4YnboJwhC9I0LD6iV4JrJHYSUmpqTY","chat":"97845113-2a00-4cf3-a55f-ada8676e04a4"},{"chat":"cff6bd2e-a5b1-49ad-8260-6cb9b290c6ec","token":"zg_0wnxAw4QgBgOKsvpD2yRXMZbY809TvLHD3hxxLq8"}],"root_group":{"groups":[],"checks":[{"id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":4487,"fails":0,"name":"message confirmed","path":"::message confirmed"},{"fails":0,"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":456},{"id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":4472,"fails":0,"name":"history readable","path":"::history readable"}],"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e"}}} diff --git a/evidence/research-20261029-readiness/load-probe5b-20261029114403.json b/evidence/research-20261029-readiness/load-probe5b-20261029114403.json new file mode 100644 index 00000000..739bc551 --- /dev/null +++ b/evidence/research-20261029-readiness/load-probe5b-20261029114403.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "root_group": { + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 2748, + "fails": 8976 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 287, + "fails": 0 + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 2730, + "fails": 8975 + } + ], + "name": "" + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 48265.146372 + }, + "metrics": { + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 53.976726, + "avg": 0.051124867925321664 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 0.0014861899999999986, + "max": 1022.815885, + "avg": 0.09867412765956879, + "p(50)": 0.000332, + "p(95)": 0.001348 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 11704, + "rate": 242.4938258716196 + } + }, + "checks": { + "contains": "default", + "values": { + "rate": 0.2430848372406814, + "passes": 5765, + "fails": 17951 + }, + "type": "rate" + }, + "measured_operations": { + "contains": "default", + "values": { + "count": 23512, + "rate": 487.1424157461996 + }, + "type": "counter" + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_duration{expected_response:true}": { + "values": { + "avg": 142.8760754422715, + "p(50)": 96.378041, + "p(95)": 190.4338484, + "p(99)": 244.61811164000045, + "max": 8348.125726 + }, + "type": "trend", + "contains": "time" + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "max": 30.260357, + "avg": 0.13766026902699413, + "p(50)": 0.059074, + "p(95)": 0.2692694, + "p(99)": 0.7827643399999967 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "rate": 0, + "count": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 40.19259867387115, + "p(50)": 3.0792755, + "p(95)": 138.86792120000004, + "p(99)": 194.94962489999998, + "max": 9223.74648 + } + }, + "data_sent": { + "contains": "data", + "values": { + "count": 1976024, + "rate": 40941.01330947892 + }, + "type": "counter" + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 11619, + "rate": 240.73272067689237 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 2642, + "rate": 54.73929322905152 + } + }, + "failed_writes": { + "type": "counter", + "contains": "default", + "values": { + "count": 8976, + "rate": 185.972708563197 + } + }, + "vus": { + "values": { + "value": 32, + "min": 0, + "max": 32 + }, + "type": "gauge", + "contains": "default" + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "rate": 492.7365146000391, + "count": 23782 + } + }, + "http_req_connecting": { + "contains": "time", + "values": { + "avg": 0.003927561306870743, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 4.188606 + }, + "type": "trend" + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 32, + "max": 32 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(50)": 8.438607, + "p(95)": 292.3281562, + "p(99)": 421.73497631999965, + "max": 9403.783414, + "avg": 83.65532936329453 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 17950, + "rate": 371.90397935710627 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.7548986628542596, + "passes": 17953, + "fails": 5829 + } + }, + "http_req_duration": { + "values": { + "avg": 41.16279043255401, + "p(50)": 3.936375, + "p(95)": 139.32949965, + "p(99)": 195.30290749999998, + "max": 9224.097554 + }, + "type": "trend", + "contains": "time" + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.8325314896560339, + "p(50)": 0.2419855, + "p(95)": 2.2968611, + "p(99)": 19.75594333999935, + "max": 194.209644 + } + }, + "application_errors{status:503}": { + "values": { + "count": 17950, + "rate": 371.90397935710627 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default" + }, + "data_received": { + "values": { + "count": 9568019, + "rate": 198238.68193116438 + }, + "type": "counter", + "contains": "data" + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "avg": 41.119018477407764, + "p(50)": 3.865505, + "p(95)": 140.496066, + "p(99)": 199.81785927999985, + "max": 9224.097554 + } + } + }, + "setup_data": [ + { + "chat": "07ceafee-fef6-4381-9460-d29190bea3b0", + "token": "rYvDojwz0SNZjbb01nZC-kQvF75CgB0-B1bnRDPMQHI" + }, + { + "chat": "db30f908-c35d-4ae5-a4e3-69c8c99baaf3", + "token": "XOtZizWW9r64SIV4GqJCpVOXw7VkeDpezGZguSGjMkc" + }, + { + "chat": "4933bdbd-7753-4862-a883-f28899e5fb67", + "token": "p1kmAMBYp759qIDjjf0d_78a2eicMOeU8zJ-kxkfFPA" + }, + { + "token": "q_O1wod2DOPVnI8QejC-VhCii2y8vSUFaNsfhMhvGWg", + "chat": "240f0f09-794a-4a51-9f74-46a51ad8d14f" + }, + { + "chat": "a3349463-c6de-49e3-bb96-657624afe474", + "token": "VSu-00l45rkGlz_qwr7ASV7Jg1jUc16rXiIY2rZz4VE" + }, + { + "chat": "583573ff-fc68-4f99-9676-232d007bb010", + "token": "BuYnbTIeTfg5HdNCapIy3se2ydRHwhm7OMZ7_OJTe8Y" + }, + { + "chat": "531a7e45-ed21-470f-ad39-764812f29524", + "token": "CbmstVohkxL9zanqysbkBT1XLU3bOInlV8xw3oSW60s" + }, + { + "chat": "00638361-1799-4564-9f00-8b796ceefb76", + "token": "TKqv8EtSKe3_5Uuya2s6I5vi5ZSidvT1U0GJubOJ_4k" + }, + { + "chat": "04fba53d-8567-4d05-9927-319c23abf852", + "token": "LVry-K9fj49mWw9m3DSm0teAUZw4FOyeBd5YdZ1qtJw" + }, + { + "token": "IzNAsLw087ctMkkgTkIJ9PdndrMpzanu7oW4f71ifBc", + "chat": "1fcef6d9-46e6-4b58-8a55-d2f5a30e6dfc" + }, + { + "chat": "ad0e6e7b-bbde-40d1-9fce-74a7dfc41d74", + "token": "x4el9cazDLjYOhqjkP_PZi0DpcbnE1tRMy5wWI0lvkk" + }, + { + "chat": "ce7686aa-b5eb-45ce-99ad-1b7584aa1d96", + "token": "I-hUgIWfv6rGyrPpUczLMXLrhK2KTRM0wjktXmBHm9s" + }, + { + "chat": "0e3942a8-342d-4d28-8d52-522efe316348", + "token": "FvWsRNKntHIpNZRCf3JcIVs9I6GAI8jZEGfXyGwhhxg" + }, + { + "chat": "7d247736-d38c-4522-b461-6f65cbb5708d", + "token": "0NE3SzlSXyip1I_UiSp3qBtC2BYRCsjSvvGQKGAYWdU" + }, + { + "chat": "3484f502-ff37-4b79-8586-f704905756b8", + "token": "EUlziUgzWI_88obIeOHWK7DGJDOW0S9GHLuOW0sKucM" + }, + { + "chat": "218ef382-a1b1-4403-9378-1f0349ed2ff3", + "token": "AQJ4ckP1Nrz02gR1At8DzZ0vg5davT4YBo9987Bu5g8" + } + ] + } +} diff --git a/evidence/research-20261029-readiness/load-probe5b-20261029114403.txt b/evidence/research-20261029-readiness/load-probe5b-20261029114403.txt new file mode 100644 index 00000000..6edfe821 --- /dev/null +++ b/evidence/research-20261029-readiness/load-probe5b-20261029114403.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"root_group":{"path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":2748,"fails":8976},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":287,"fails":0},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":2730,"fails":8975}],"name":""},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":48265.146372},"metrics":{"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"p(50)":0,"p(95)":0,"p(99)":0,"max":53.976726,"avg":0.051124867925321664}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(99)":0.0014861899999999986,"max":1022.815885,"avg":0.09867412765956879,"p(50)":0.000332,"p(95)":0.001348}},"iterations":{"type":"counter","contains":"default","values":{"count":11704,"rate":242.4938258716196}},"checks":{"contains":"default","values":{"rate":0.2430848372406814,"passes":5765,"fails":17951},"type":"rate"},"measured_operations":{"contains":"default","values":{"count":23512,"rate":487.1424157461996},"type":"counter"},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_duration{expected_response:true}":{"values":{"avg":142.8760754422715,"p(50)":96.378041,"p(95)":190.4338484,"p(99)":244.61811164000045,"max":8348.125726},"type":"trend","contains":"time"},"http_req_sending":{"type":"trend","contains":"time","values":{"max":30.260357,"avg":0.13766026902699413,"p(50)":0.059074,"p(95)":0.2692694,"p(99)":0.7827643399999967}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"rate":0,"count":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":40.19259867387115,"p(50)":3.0792755,"p(95)":138.86792120000004,"p(99)":194.94962489999998,"max":9223.74648}},"data_sent":{"contains":"data","values":{"count":1976024,"rate":40941.01330947892},"type":"counter"},"attempted_messages":{"type":"counter","contains":"default","values":{"count":11619,"rate":240.73272067689237}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":2642,"rate":54.73929322905152}},"failed_writes":{"type":"counter","contains":"default","values":{"count":8976,"rate":185.972708563197}},"vus":{"values":{"value":32,"min":0,"max":32},"type":"gauge","contains":"default"},"http_reqs":{"type":"counter","contains":"default","values":{"rate":492.7365146000391,"count":23782}},"http_req_connecting":{"contains":"time","values":{"avg":0.003927561306870743,"p(50)":0,"p(95)":0,"p(99)":0,"max":4.188606},"type":"trend"},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"iteration_duration":{"type":"trend","contains":"time","values":{"p(50)":8.438607,"p(95)":292.3281562,"p(99)":421.73497631999965,"max":9403.783414,"avg":83.65532936329453}},"application_errors":{"type":"counter","contains":"default","values":{"count":17950,"rate":371.90397935710627}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.7548986628542596,"passes":17953,"fails":5829}},"http_req_duration":{"values":{"avg":41.16279043255401,"p(50)":3.936375,"p(95)":139.32949965,"p(99)":195.30290749999998,"max":9224.097554},"type":"trend","contains":"time"},"http_req_receiving":{"type":"trend","contains":"time","values":{"avg":0.8325314896560339,"p(50)":0.2419855,"p(95)":2.2968611,"p(99)":19.75594333999935,"max":194.209644}},"application_errors{status:503}":{"values":{"count":17950,"rate":371.90397935710627},"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default"},"data_received":{"values":{"count":9568019,"rate":198238.68193116438},"type":"counter","contains":"data"},"message_latency_ms":{"type":"trend","contains":"time","values":{"avg":41.119018477407764,"p(50)":3.865505,"p(95)":140.496066,"p(99)":199.81785927999985,"max":9224.097554}}},"setup_data":[{"chat":"07ceafee-fef6-4381-9460-d29190bea3b0","token":"rYvDojwz0SNZjbb01nZC-kQvF75CgB0-B1bnRDPMQHI"},{"chat":"db30f908-c35d-4ae5-a4e3-69c8c99baaf3","token":"XOtZizWW9r64SIV4GqJCpVOXw7VkeDpezGZguSGjMkc"},{"chat":"4933bdbd-7753-4862-a883-f28899e5fb67","token":"p1kmAMBYp759qIDjjf0d_78a2eicMOeU8zJ-kxkfFPA"},{"token":"q_O1wod2DOPVnI8QejC-VhCii2y8vSUFaNsfhMhvGWg","chat":"240f0f09-794a-4a51-9f74-46a51ad8d14f"},{"chat":"a3349463-c6de-49e3-bb96-657624afe474","token":"VSu-00l45rkGlz_qwr7ASV7Jg1jUc16rXiIY2rZz4VE"},{"chat":"583573ff-fc68-4f99-9676-232d007bb010","token":"BuYnbTIeTfg5HdNCapIy3se2ydRHwhm7OMZ7_OJTe8Y"},{"chat":"531a7e45-ed21-470f-ad39-764812f29524","token":"CbmstVohkxL9zanqysbkBT1XLU3bOInlV8xw3oSW60s"},{"chat":"00638361-1799-4564-9f00-8b796ceefb76","token":"TKqv8EtSKe3_5Uuya2s6I5vi5ZSidvT1U0GJubOJ_4k"},{"chat":"04fba53d-8567-4d05-9927-319c23abf852","token":"LVry-K9fj49mWw9m3DSm0teAUZw4FOyeBd5YdZ1qtJw"},{"token":"IzNAsLw087ctMkkgTkIJ9PdndrMpzanu7oW4f71ifBc","chat":"1fcef6d9-46e6-4b58-8a55-d2f5a30e6dfc"},{"chat":"ad0e6e7b-bbde-40d1-9fce-74a7dfc41d74","token":"x4el9cazDLjYOhqjkP_PZi0DpcbnE1tRMy5wWI0lvkk"},{"chat":"ce7686aa-b5eb-45ce-99ad-1b7584aa1d96","token":"I-hUgIWfv6rGyrPpUczLMXLrhK2KTRM0wjktXmBHm9s"},{"chat":"0e3942a8-342d-4d28-8d52-522efe316348","token":"FvWsRNKntHIpNZRCf3JcIVs9I6GAI8jZEGfXyGwhhxg"},{"chat":"7d247736-d38c-4522-b461-6f65cbb5708d","token":"0NE3SzlSXyip1I_UiSp3qBtC2BYRCsjSvvGQKGAYWdU"},{"chat":"3484f502-ff37-4b79-8586-f704905756b8","token":"EUlziUgzWI_88obIeOHWK7DGJDOW0S9GHLuOW0sKucM"},{"chat":"218ef382-a1b1-4403-9378-1f0349ed2ff3","token":"AQJ4ckP1Nrz02gR1At8DzZ0vg5davT4YBo9987Bu5g8"}]}} diff --git a/evidence/research-20261029-readiness/nodes.txt b/evidence/research-20261029-readiness/nodes.txt new file mode 100644 index 00000000..e6b77ed4 --- /dev/null +++ b/evidence/research-20261029-readiness/nodes.txt @@ -0,0 +1,4 @@ +NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME +dev.asisti.tech Ready 252d v1.33.13 100.99.166.40 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 +marlosrv0 Ready 254d v1.33.13 192.168.1.37 Ubuntu 24.04.5 LTS 6.8.0-147-generic containerd://1.7.29 +srv0.agapov.space Ready 247d v1.33.13 100.108.186.94 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 diff --git a/evidence/research-20261029-readiness/pods-probe2a-20261029113757.txt b/evidence/research-20261029-readiness/pods-probe2a-20261029113757.txt new file mode 100644 index 00000000..4f1af143 --- /dev/null +++ b/evidence/research-20261029-readiness/pods-probe2a-20261029113757.txt @@ -0,0 +1,3 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-84fbf9968-kdhg8 1/1 Running 0 56s 10.1.25.110 dev.asisti.tech +api-84fbf9968-szvb2 1/1 Running 0 57s 10.1.25.112 dev.asisti.tech diff --git a/evidence/research-20261029-readiness/pods-probe2b-20261029114146.txt b/evidence/research-20261029-readiness/pods-probe2b-20261029114146.txt new file mode 100644 index 00000000..3bd09f1a --- /dev/null +++ b/evidence/research-20261029-readiness/pods-probe2b-20261029114146.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-84fbf9968-lhv2d 1/1 Running 2 (52s ago) 72s 10.1.25.71 dev.asisti.tech diff --git a/evidence/research-20261029-readiness/pods-probe5a-20261029113950.txt b/evidence/research-20261029-readiness/pods-probe5a-20261029113950.txt new file mode 100644 index 00000000..e53a106f --- /dev/null +++ b/evidence/research-20261029-readiness/pods-probe5a-20261029113950.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-6748cbfcbb-fxqhl 1/1 Running 0 40s 10.1.25.94 dev.asisti.tech diff --git a/evidence/research-20261029-readiness/pods-probe5b-20261029114403.txt b/evidence/research-20261029-readiness/pods-probe5b-20261029114403.txt new file mode 100644 index 00000000..a7b77679 --- /dev/null +++ b/evidence/research-20261029-readiness/pods-probe5b-20261029114403.txt @@ -0,0 +1,2 @@ +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES +api-6748cbfcbb-c9lgz 1/1 Running 0 36s 10.1.25.68 dev.asisti.tech diff --git a/evidence/research-20261029-readiness/profiles.csv b/evidence/research-20261029-readiness/profiles.csv new file mode 100644 index 00000000..cce2594f --- /dev/null +++ b/evidence/research-20261029-readiness/profiles.csv @@ -0,0 +1,5 @@ +profile,run,replicas,cpu_millicores_per_replica,memory_mib_per_replica,pool,vus,duration +probe2a,probe2a-20261029113757,1,1000,512,8,32,30 +probe5a,probe5a-20261029113950,1,1000,512,8,32,30 +probe2b,probe2b-20261029114146,1,1000,512,8,32,30 +probe5b,probe5b-20261029114403,1,1000,512,8,32,30 diff --git a/evidence/research-20261029-readiness/resources-probe2a-20261029113757.txt b/evidence/research-20261029-readiness/resources-probe2a-20261029113757.txt new file mode 100644 index 00000000..d4311c03 --- /dev/null +++ b/evidence/research-20261029-readiness/resources-probe2a-20261029113757.txt @@ -0,0 +1,59 @@ +UTC 2026-10-29T11:39:00Z +error: Metrics API not available +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:39:09Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-kdhg8 2m 22Mi +api-84fbf9968-szvb2 2m 22Mi +postgres-0 4m 57Mi +valkey-0 10m 9Mi +valkey-1 5m 15Mi +valkey-2 6m 4Mi +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|3 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:39:15Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-kdhg8 199m 9Mi +api-84fbf9968-szvb2 145m 9Mi +load-probe2a-20261029113757-ql6t5 84m 19Mi +postgres-0 114m 64Mi +valkey-0 29m 9Mi +valkey-1 17m 15Mi +valkey-2 7m 4Mi +active|IO|WalSync|1 +active|LWLock|WALWrite|1 +active|||2 +idle|Client|ClientRead|10 +idle|||1 +idle in transaction|Client|ClientRead|3 +UTC 2026-10-29T11:39:38Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-kdhg8 5m 10Mi +api-84fbf9968-szvb2 41m 10Mi +load-probe2a-20261029113757-ql6t5 10m 24Mi +postgres-0 10m 64Mi +valkey-0 39m 9Mi +valkey-1 4m 14Mi +valkey-2 6m 4Mi +active|IO|WalSync|1 +active|LWLock|WALWrite|3 +active|||3 +idle|Client|ClientRead|7 +idle|||3 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:39:45Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-kdhg8 285m 14Mi +api-84fbf9968-szvb2 204m 13Mi +load-probe2a-20261029113757-ql6t5 64m 27Mi +postgres-0 422m 94Mi +valkey-0 75m 10Mi +valkey-1 98m 15Mi +valkey-2 29m 4Mi +active|||1 +idle|Client|ClientRead|16 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-readiness/resources-probe2b-20261029114146.txt b/evidence/research-20261029-readiness/resources-probe2b-20261029114146.txt new file mode 100644 index 00000000..df83d058 --- /dev/null +++ b/evidence/research-20261029-readiness/resources-probe2b-20261029114146.txt @@ -0,0 +1,48 @@ +UTC 2026-10-29T11:43:03Z +NAME CPU(cores) MEMORY(bytes) +api-84fbf9968-lhv2d 3m 22Mi +postgres-0 3m 59Mi +valkey-0 9m 10Mi +valkey-1 6m 14Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:43:18Z +error: Metrics API not available +active|||1 +idle|Client|ClientRead|1 +idle|||1 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:43:24Z +error: Metrics API not available +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:43:30Z +error: Metrics API not available +active|||4 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:43:36Z +error: Metrics API not available +active|Client|ClientRead|1 +active|||1 +idle|Client|ClientRead|6 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:43:44Z +error: Metrics API not available +active|Client|ClientRead|1 +active|||2 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:43:50Z +error: Metrics API not available +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:43:57Z +error: Metrics API not available +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-readiness/resources-probe5a-20261029113950.txt b/evidence/research-20261029-readiness/resources-probe5a-20261029113950.txt new file mode 100644 index 00000000..295890f9 --- /dev/null +++ b/evidence/research-20261029-readiness/resources-probe5a-20261029113950.txt @@ -0,0 +1,101 @@ +UTC 2026-10-29T11:40:35Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-fxqhl 2m 22Mi +postgres-0 8m 56Mi +valkey-0 12m 10Mi +valkey-1 6m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:40:57Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-fxqhl 3m 23Mi +load-probe5a-20261029113950-d67qv 11m 15Mi +postgres-0 5m 56Mi +valkey-0 10m 10Mi +valkey-1 4m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:41:03Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-fxqhl 121m 61Mi +load-probe5a-20261029113950-d67qv 14m 17Mi +postgres-0 17m 59Mi +valkey-0 8m 10Mi +valkey-1 6m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:41:10Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-fxqhl 121m 61Mi +load-probe5a-20261029113950-d67qv 14m 17Mi +postgres-0 17m 59Mi +valkey-0 8m 10Mi +valkey-1 6m 15Mi +valkey-2 6m 4Mi +active|||2 +idle|Client|ClientRead|6 +idle|||1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:41:16Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-fxqhl 168m 11Mi +load-probe5a-20261029113950-d67qv 14m 17Mi +postgres-0 17m 59Mi +valkey-0 37m 10Mi +valkey-1 5m 15Mi +valkey-2 40m 4Mi +active|IO|WalSync|1 +active|LWLock|WALWrite|1 +active|||1 +idle|Client|ClientRead|6 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:41:23Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-fxqhl 168m 11Mi +load-probe5a-20261029113950-d67qv 14m 17Mi +postgres-0 17m 59Mi +valkey-0 37m 10Mi +valkey-1 5m 15Mi +valkey-2 40m 4Mi +active|||2 +idle|Client|ClientRead|5 +idle|||1 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:41:30Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-fxqhl 695m 15Mi +load-probe5a-20261029113950-d67qv 168m 29Mi +postgres-0 370m 75Mi +valkey-0 155m 10Mi +valkey-1 34m 15Mi +valkey-2 40m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:41:37Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-fxqhl 695m 15Mi +load-probe5a-20261029113950-d67qv 168m 29Mi +postgres-0 370m 75Mi +valkey-0 155m 10Mi +valkey-1 34m 15Mi +valkey-2 40m 4Mi +active|||2 +idle|Client|ClientRead|6 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:41:43Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-fxqhl 695m 15Mi +postgres-0 370m 75Mi +valkey-0 155m 10Mi +valkey-1 34m 15Mi +valkey-2 40m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-readiness/resources-probe5b-20261029114403.txt b/evidence/research-20261029-readiness/resources-probe5b-20261029114403.txt new file mode 100644 index 00000000..48c148ae --- /dev/null +++ b/evidence/research-20261029-readiness/resources-probe5b-20261029114403.txt @@ -0,0 +1,89 @@ +UTC 2026-10-29T11:44:46Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-c9lgz 3m 23Mi +postgres-0 12m 62Mi +valkey-0 9m 10Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:44:53Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-c9lgz 3m 23Mi +postgres-0 5m 62Mi +valkey-0 9m 10Mi +valkey-1 5m 15Mi +valkey-2 6m 4Mi +active|||1 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:44:59Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-c9lgz 2m 23Mi +load-probe5b-20261029114403-phwgc 48m 18Mi +postgres-0 40m 69Mi +valkey-0 21m 10Mi +valkey-1 8m 15Mi +valkey-2 8m 4Mi +active|||1 +idle|Client|ClientRead|3 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:45:06Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-c9lgz 2m 23Mi +load-probe5b-20261029114403-phwgc 48m 18Mi +postgres-0 40m 69Mi +valkey-0 21m 10Mi +valkey-1 8m 15Mi +valkey-2 8m 4Mi +active|||1 +idle|Client|ClientRead|4 +idle|||1 +idle in transaction|Client|ClientRead|3 +idle in transaction|||1 +UTC 2026-10-29T11:45:13Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-c9lgz 2m 23Mi +load-probe5b-20261029114403-phwgc 48m 18Mi +postgres-0 40m 69Mi +valkey-0 21m 10Mi +valkey-1 8m 15Mi +valkey-2 8m 4Mi +active|IO|WalSync|1 +active|||1 +idle|Client|ClientRead|7 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:45:19Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-c9lgz 282m 12Mi +load-probe5b-20261029114403-phwgc 26m 18Mi +postgres-0 347m 81Mi +valkey-0 76m 10Mi +valkey-1 50m 15Mi +valkey-2 30m 5Mi +active|IO|WalWrite|1 +active|||3 +idle|Client|ClientRead|2 +idle in transaction|Client|ClientRead|4 +UTC 2026-10-29T11:45:26Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-c9lgz 282m 12Mi +load-probe5b-20261029114403-phwgc 26m 18Mi +postgres-0 347m 81Mi +valkey-0 76m 10Mi +valkey-1 50m 15Mi +valkey-2 30m 5Mi +active|||1 +idle|Client|ClientRead|7 +idle in transaction|Client|ClientRead|2 +UTC 2026-10-29T11:45:36Z +NAME CPU(cores) MEMORY(bytes) +api-6748cbfcbb-c9lgz 503m 13Mi +load-probe5b-20261029114403-phwgc 330m 30Mi +postgres-0 347m 81Mi +valkey-0 131m 10Mi +valkey-1 50m 15Mi +valkey-2 43m 4Mi +active|||1 +idle|Client|ClientRead|8 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029-readiness/restore-values.yaml b/evidence/research-20261029-readiness/restore-values.yaml new file mode 100644 index 00000000..4e915dac --- /dev/null +++ b/evidence/research-20261029-readiness/restore-values.yaml @@ -0,0 +1,61 @@ +api: + env: + DEPENDENCY_POOL_SIZE: "8" + DEPENDENCY_TIMEOUT_MS: "2000" + GOMEMLIMIT: 160MiB + REQUEST_TIMEOUT_SECONDS: "4" + SESSION_TTL_SECONDS: "3600" + SHUTDOWN_TIMEOUT_SECONDS: "5" + replicas: 2 + resources: + limits: + cpu: "1" + memory: 256Mi + requests: + cpu: 250m + memory: 128Mi +autoscaling: + cpuPercent: 60 + enabled: true + maxReplicas: 4 + minReplicas: 2 +databaseSecret: messenger-secrets +image: + digest: sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 + repository: asisti.registry.twcstorage.ru/mtusi2026lab3 +imagePullSecret: registry-pull +ingress: + className: traefik + clusterIssuer: letsencrypt-prod + host: hl.agapov.space +load: + duration: 30 + enabled: false + run: manual + script: scaling.js + vus: 32 +monitoring: + serviceMonitor: false +postgres: + image: postgres:17.6-alpine + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + storage: 2Gi +storageClass: "" +valkey: + image: valkey/valkey:8.1.3-alpine + maxmemory: 64mb + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 100m + memory: 96Mi + shards: 3 + storage: 1Gi diff --git a/evidence/research-20261029-readiness/restore.txt b/evidence/research-20261029-readiness/restore.txt new file mode 100644 index 00000000..72776e4f --- /dev/null +++ b/evidence/research-20261029-readiness/restore.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:45:43 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 32 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-readiness/rollout-probe2a.txt b/evidence/research-20261029-readiness/rollout-probe2a.txt new file mode 100644 index 00000000..04d28ab0 --- /dev/null +++ b/evidence/research-20261029-readiness/rollout-probe2a.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:37:58 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 28 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-readiness/rollout-probe2b.txt b/evidence/research-20261029-readiness/rollout-probe2b.txt new file mode 100644 index 00000000..3e88dca9 --- /dev/null +++ b/evidence/research-20261029-readiness/rollout-probe2b.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:41:47 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 30 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-readiness/rollout-probe5a.txt b/evidence/research-20261029-readiness/rollout-probe5a.txt new file mode 100644 index 00000000..8e52bac9 --- /dev/null +++ b/evidence/research-20261029-readiness/rollout-probe5a.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:39:52 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 29 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-readiness/rollout-probe5b.txt b/evidence/research-20261029-readiness/rollout-probe5b.txt new file mode 100644 index 00000000..4f389573 --- /dev/null +++ b/evidence/research-20261029-readiness/rollout-probe5b.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:44:05 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 31 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029-readiness/source.sha256 b/evidence/research-20261029-readiness/source.sha256 new file mode 100644 index 00000000..b6c26a83 --- /dev/null +++ b/evidence/research-20261029-readiness/source.sha256 @@ -0,0 +1,3 @@ +0a58dff9ad7acf8f228e0fd1c2a670bbe7e18a11360715b47659104832e34892 student-tests/load/scaling.js +c0506f65b976d54273f3e2fb3404b732929a276263ff8974c2a6ab6e27820b8b charts/messenger/values.yaml +60e09dd38fd1d413b744f21b57f64ba83e49a5ae1b4251aa5bf20be033f90cfb internal/controller/http/fiber/errors.go diff --git a/evidence/research-20261029-readiness/values-probe5b-20261029114403.json b/evidence/research-20261029-readiness/values-probe5b-20261029114403.json new file mode 100644 index 00000000..b11f8826 --- /dev/null +++ b/evidence/research-20261029-readiness/values-probe5b-20261029114403.json @@ -0,0 +1 @@ +{"api":{"env":{"DEPENDENCY_POOL_SIZE":"8","DEPENDENCY_TIMEOUT_MS":"2000","GOMEMLIMIT":"80MiB","REQUEST_TIMEOUT_SECONDS":"4","SESSION_TTL_SECONDS":"3600","SHUTDOWN_TIMEOUT_SECONDS":"5"},"nodeSelector":{"kubernetes.io/hostname":"dev.asisti.tech"},"readiness":{"failureThreshold":1,"timeoutSeconds":5},"replicas":1,"resources":{"limits":{"cpu":"1000m","memory":"512Mi"},"requests":{"cpu":"1000m","memory":"512Mi"}}},"autoscaling":{"cpuPercent":60,"enabled":false,"maxReplicas":4,"minReplicas":2},"databaseSecret":"messenger-secrets","image":{"digest":"sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3","repository":"asisti.registry.twcstorage.ru/mtusi2026lab3"},"imagePullSecret":"registry-pull","ingress":{"className":"traefik","clusterIssuer":"letsencrypt-prod","host":"hl.agapov.space"},"load":{"duration":30,"enabled":false,"run":"manual","script":"scaling.js","vus":32},"monitoring":{"serviceMonitor":false},"postgres":{"image":"postgres:17.6-alpine","resources":{"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"250m","memory":"256Mi"}},"storage":"2Gi"},"storageClass":"","valkey":{"image":"valkey/valkey:8.1.3-alpine","maxmemory":"64mb","resources":{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"100m","memory":"96Mi"}},"shards":3,"storage":"1Gi"}} diff --git a/evidence/research-20261029/README.md b/evidence/research-20261029/README.md new file mode 100644 index 00000000..c7cc3c96 --- /dev/null +++ b/evidence/research-20261029/README.md @@ -0,0 +1,5 @@ +# Предварительная серия, не полная матрица + +Первый запуск 29.10.2026 остановился на подготовке fixed4: POST chat вернул 503. fixed1 и fixed2 содержат реальные измерения, но серия не завершена. Helm restore.txt подтверждает восстановление обычных значений. Эти результаты не подменяют окончательную матрицу research-20261029-final. + +Изменение следующего запуска касается подготовки: до пяти независимых попыток создать синтетического участника с новым именем. Нагрузка после setup сохраняет прежние операции и настройки. Неуспешные частичные fixtures остаются синтетическими и не используются при измерении. diff --git a/evidence/research-20261029/base-revision.txt b/evidence/research-20261029/base-revision.txt new file mode 100644 index 00000000..32abb9b4 --- /dev/null +++ b/evidence/research-20261029/base-revision.txt @@ -0,0 +1 @@ +7b7e23fd029beea47e6f625a96cb98d2fe04bafb diff --git a/evidence/research-20261029/dataset-during.txt b/evidence/research-20261029/dataset-during.txt new file mode 100644 index 00000000..c3cf3b56 --- /dev/null +++ b/evidence/research-20261029/dataset-during.txt @@ -0,0 +1,3 @@ +users|114 +chats|72 +messages|6541 diff --git a/evidence/research-20261029/date.txt b/evidence/research-20261029/date.txt new file mode 100644 index 00000000..db041ee5 --- /dev/null +++ b/evidence/research-20261029/date.txt @@ -0,0 +1 @@ +2026-10-29T10:56:32Z diff --git a/evidence/research-20261029/deployment-fixed4.json b/evidence/research-20261029/deployment-fixed4.json new file mode 100644 index 00000000..41b39b28 --- /dev/null +++ b/evidence/research-20261029/deployment-fixed4.json @@ -0,0 +1,214 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "8", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 14, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60157738", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "25be752194917b470e363f8148d7f90539ac1e677c53d10066d788634e0933dc", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "256Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T11:02:31Z", + "message": "ReplicaSet \"api-54f7cc6f98\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + }, + { + "lastTransitionTime": "2026-10-29T11:02:48Z", + "lastUpdateTime": "2026-10-29T11:02:48Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + } + ], + "observedGeneration": 14, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/research-20261029/load-fixed1-20261029105633.json b/evidence/research-20261029/load-fixed1-20261029105633.json new file mode 100644 index 00000000..862741e9 --- /dev/null +++ b/evidence/research-20261029/load-fixed1-20261029105633.json @@ -0,0 +1,381 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "metrics": { + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 22079, + "rate": 495.9949471155564 + } + }, + "message_latency_ms": { + "contains": "time", + "values": { + "avg": 13.097947987539532, + "p(50)": 1.574717, + "p(95)": 85.50984919999995, + "p(99)": 150.3723336400002, + "max": 4011.296367 + }, + "type": "trend" + }, + "application_errors{status:503}": { + "type": "counter", + "contains": "default", + "values": { + "count": 40380, + "rate": 907.1187990636427 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "count": 3618694, + "rate": 81292.35649972287 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 21829, + "rate": 490.37880794354277 + } + }, + "failed_writes": { + "type": "counter", + "contains": "default", + "values": { + "count": 20200, + "rate": 453.7840450987019 + } + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 44441, + "rate": 998.3473637738322 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.4209481391957903, + "p(50)": 0.147274, + "p(95)": 1.23312, + "p(99)": 5.622513199999918, + "max": 118.223969 + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 147.37608119999996, + "max": 17217.0233, + "avg": 19.97902145071003, + "p(50)": 1.591889, + "p(95)": 85.015744 + } + }, + "data_received": { + "type": "counter", + "contains": "data", + "values": { + "count": 9011186, + "rate": 202432.2987236035 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 1629, + "rate": 36.59476284484086 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 39.50049771819362, + "p(50)": 3.621493, + "p(95)": 173.62030449999978, + "p(99)": 313.30770866000023, + "max": 17333.339227 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 40405, + "rate": 907.680412980844 + } + }, + "vus_max": { + "contains": "default", + "values": { + "max": 32, + "value": 32, + "min": 32 + }, + "type": "gauge" + }, + "http_req_sending": { + "contains": "time", + "values": { + "avg": 0.07879365720843365, + "p(50)": 0.041363, + "p(95)": 0.210379, + "p(99)": 0.4355294, + "max": 22.5541 + }, + "type": "trend" + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "max": 1023.04951, + "avg": 0.048188861209238244, + "p(50)": 0.000248, + "p(95)": 0.001254, + "p(99)": 0.0014515999999999984 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 43840, + "rate": 984.8461652043114 + } + }, + "checks": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.08983398283513166, + "passes": 3988, + "fails": 40405 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "http_req_duration{expected_response:true}": { + "values": { + "avg": 118.0205892210109, + "p(50)": 87.690635, + "p(95)": 171.703979, + "p(99)": 224.8572748, + "max": 13464.977187 + }, + "type": "trend", + "contains": "time" + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0.9091829616795302, + "passes": 40405, + "fails": 4036 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 19.47927965430555, + "p(50)": 1.243483, + "p(95)": 84.549855, + "p(99)": 146.88012539999997, + "max": 17216.730576 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0, + "p(99)": 0, + "max": 10.083099, + "avg": 0.0023669291870119934, + "p(50)": 0 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "p(95)": 0, + "p(99)": 0, + "max": 50.075135, + "avg": 0.022014142323530078, + "p(50)": 0 + } + } + }, + "setup_data": [ + { + "chat": "c8c60bf0-7fcf-4274-8b50-5d6adb564946", + "token": "9duDXrD58v_2NMgZJPkHLRmyL3yOTElmvPgIUNjrcpo" + }, + { + "chat": "6edc3423-cc40-4723-85df-666ce0084329", + "token": "qRoW49ozXDobXzljQbTs39uLF8t2p-YQaDZVXh71CHg" + }, + { + "chat": "3470a12f-8e0b-4c2a-bd00-a53932d57586", + "token": "VabW8enBhdNe6fjbucW4wwTIlFYWJOTgG9VWLvs0cKs" + }, + { + "chat": "eb77134a-7a8c-4e82-a813-7379ff2fcdce", + "token": "7BjAAIUh3fw9J8wFFKpQMrWFH7L7mZem1nJDS2XvDQE" + }, + { + "chat": "7add9a73-e585-4e74-abff-dbc89c020615", + "token": "Y-8KJ9qP1srzvI1sqkx582GjLLcsYgkmesNzmHiw_Tc" + }, + { + "chat": "99414aa5-12e8-4d37-b7dd-63e4e80d99b6", + "token": "BCGZMDIFIHUJsorwX8l8BseiECDcFB695YQiqb8D37U" + }, + { + "chat": "dd34730f-2132-4f29-bbd1-a0514bd9e0df", + "token": "m1JXce2774OyAdePY1qkSHSMxr-3wZyVDtu86JyVefQ" + }, + { + "chat": "390a5c9e-ab33-44bb-a119-dde6b21ed707", + "token": "_zK3HD9XEllUjAxL_57AIm_bJstke50j2-SJidJbYIo" + }, + { + "chat": "49a1267e-21d8-46ea-9a25-919fe009c38e", + "token": "joGOpp-HBHpoiIeKrvpzq_QoRjIRAB5Vydfg4TIV3w0" + }, + { + "chat": "7558462d-fd6f-4104-8705-6257588c8a84", + "token": "edkhBYTzEC-UVVW1sO-brVT_ffH6kl9BZURMkXVDY1U" + }, + { + "chat": "4e355da1-f8a3-4f25-94eb-2350a2ae2808", + "token": "V1UrP-D1Ly0DsVAGVcYv1FdNMMkF5-xU1RUU9RZ5Qww" + }, + { + "chat": "36563727-64ed-469e-8d13-06574d327670", + "token": "qJHdSFhBA_Jgv3xIOqeuMoyNSTZpyJOw9BJu1hVnQlo" + }, + { + "chat": "2f19d4b5-bb30-45a9-8474-0fa5451f7e92", + "token": "_F52VbiEjVQQkAdWr30jaouL62c8M-skg3oMG9RBW6U" + }, + { + "chat": "c7602fae-761a-43b0-be07-b00bbd93d439", + "token": "kdTG_Al_X57k8w2CTaxGHl7eEvTTuS3Z4pcBlpWLyzw" + }, + { + "token": "XA_2iuThB_iaqHTToHO2fxQ1efVsIs2kLH5Mfhjcgic", + "chat": "89b7a31c-e581-4841-9e32-c234405a162f" + }, + { + "chat": "17ce6209-1f8b-4337-8901-88fd95c14a18", + "token": "8FB4pw0IYWKkCIfwB3P5QL84PzaTIZyENYsJrww-7fA" + } + ], + "root_group": { + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 1902, + "fails": 20200 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 205, + "fails": 7 + }, + { + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 1881, + "fails": 20198, + "name": "history readable" + } + ], + "name": "" + }, + "options": { + "summaryTimeUnit": "", + "noColor": false, + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ] + }, + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 44514.566385 + } + } +} diff --git a/evidence/research-20261029/load-fixed1-20261029105633.txt b/evidence/research-20261029/load-fixed1-20261029105633.txt new file mode 100644 index 00000000..8ed0a62f --- /dev/null +++ b/evidence/research-20261029/load-fixed1-20261029105633.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"metrics":{"iterations":{"type":"counter","contains":"default","values":{"count":22079,"rate":495.9949471155564}},"message_latency_ms":{"contains":"time","values":{"avg":13.097947987539532,"p(50)":1.574717,"p(95)":85.50984919999995,"p(99)":150.3723336400002,"max":4011.296367},"type":"trend"},"application_errors{status:503}":{"type":"counter","contains":"default","values":{"count":40380,"rate":907.1187990636427},"thresholds":{"count>=0":{"ok":true}}},"data_sent":{"type":"counter","contains":"data","values":{"count":3618694,"rate":81292.35649972287}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":21829,"rate":490.37880794354277}},"failed_writes":{"type":"counter","contains":"default","values":{"count":20200,"rate":453.7840450987019}},"http_reqs":{"type":"counter","contains":"default","values":{"count":44441,"rate":998.3473637738322}},"http_req_receiving":{"type":"trend","contains":"time","values":{"avg":0.4209481391957903,"p(50)":0.147274,"p(95)":1.23312,"p(99)":5.622513199999918,"max":118.223969}},"http_req_duration":{"type":"trend","contains":"time","values":{"p(99)":147.37608119999996,"max":17217.0233,"avg":19.97902145071003,"p(50)":1.591889,"p(95)":85.015744}},"data_received":{"type":"counter","contains":"data","values":{"count":9011186,"rate":202432.2987236035}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":1629,"rate":36.59476284484086}},"iteration_duration":{"type":"trend","contains":"time","values":{"avg":39.50049771819362,"p(50)":3.621493,"p(95)":173.62030449999978,"p(99)":313.30770866000023,"max":17333.339227}},"application_errors":{"type":"counter","contains":"default","values":{"count":40405,"rate":907.680412980844}},"vus_max":{"contains":"default","values":{"max":32,"value":32,"min":32},"type":"gauge"},"http_req_sending":{"contains":"time","values":{"avg":0.07879365720843365,"p(50)":0.041363,"p(95)":0.210379,"p(99)":0.4355294,"max":22.5541},"type":"trend"},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"http_req_blocked":{"type":"trend","contains":"time","values":{"max":1023.04951,"avg":0.048188861209238244,"p(50)":0.000248,"p(95)":0.001254,"p(99)":0.0014515999999999984}},"measured_operations":{"type":"counter","contains":"default","values":{"count":43840,"rate":984.8461652043114}},"checks":{"type":"rate","contains":"default","values":{"rate":0.08983398283513166,"passes":3988,"fails":40405}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"http_req_duration{expected_response:true}":{"values":{"avg":118.0205892210109,"p(50)":87.690635,"p(95)":171.703979,"p(99)":224.8572748,"max":13464.977187},"type":"trend","contains":"time"},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0.9091829616795302,"passes":40405,"fails":4036}},"http_req_waiting":{"type":"trend","contains":"time","values":{"avg":19.47927965430555,"p(50)":1.243483,"p(95)":84.549855,"p(99)":146.88012539999997,"max":17216.730576}},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(95)":0,"p(99)":0,"max":10.083099,"avg":0.0023669291870119934,"p(50)":0}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"p(95)":0,"p(99)":0,"max":50.075135,"avg":0.022014142323530078,"p(50)":0}}},"setup_data":[{"chat":"c8c60bf0-7fcf-4274-8b50-5d6adb564946","token":"9duDXrD58v_2NMgZJPkHLRmyL3yOTElmvPgIUNjrcpo"},{"chat":"6edc3423-cc40-4723-85df-666ce0084329","token":"qRoW49ozXDobXzljQbTs39uLF8t2p-YQaDZVXh71CHg"},{"chat":"3470a12f-8e0b-4c2a-bd00-a53932d57586","token":"VabW8enBhdNe6fjbucW4wwTIlFYWJOTgG9VWLvs0cKs"},{"chat":"eb77134a-7a8c-4e82-a813-7379ff2fcdce","token":"7BjAAIUh3fw9J8wFFKpQMrWFH7L7mZem1nJDS2XvDQE"},{"chat":"7add9a73-e585-4e74-abff-dbc89c020615","token":"Y-8KJ9qP1srzvI1sqkx582GjLLcsYgkmesNzmHiw_Tc"},{"chat":"99414aa5-12e8-4d37-b7dd-63e4e80d99b6","token":"BCGZMDIFIHUJsorwX8l8BseiECDcFB695YQiqb8D37U"},{"chat":"dd34730f-2132-4f29-bbd1-a0514bd9e0df","token":"m1JXce2774OyAdePY1qkSHSMxr-3wZyVDtu86JyVefQ"},{"chat":"390a5c9e-ab33-44bb-a119-dde6b21ed707","token":"_zK3HD9XEllUjAxL_57AIm_bJstke50j2-SJidJbYIo"},{"chat":"49a1267e-21d8-46ea-9a25-919fe009c38e","token":"joGOpp-HBHpoiIeKrvpzq_QoRjIRAB5Vydfg4TIV3w0"},{"chat":"7558462d-fd6f-4104-8705-6257588c8a84","token":"edkhBYTzEC-UVVW1sO-brVT_ffH6kl9BZURMkXVDY1U"},{"chat":"4e355da1-f8a3-4f25-94eb-2350a2ae2808","token":"V1UrP-D1Ly0DsVAGVcYv1FdNMMkF5-xU1RUU9RZ5Qww"},{"chat":"36563727-64ed-469e-8d13-06574d327670","token":"qJHdSFhBA_Jgv3xIOqeuMoyNSTZpyJOw9BJu1hVnQlo"},{"chat":"2f19d4b5-bb30-45a9-8474-0fa5451f7e92","token":"_F52VbiEjVQQkAdWr30jaouL62c8M-skg3oMG9RBW6U"},{"chat":"c7602fae-761a-43b0-be07-b00bbd93d439","token":"kdTG_Al_X57k8w2CTaxGHl7eEvTTuS3Z4pcBlpWLyzw"},{"token":"XA_2iuThB_iaqHTToHO2fxQ1efVsIs2kLH5Mfhjcgic","chat":"89b7a31c-e581-4841-9e32-c234405a162f"},{"chat":"17ce6209-1f8b-4337-8901-88fd95c14a18","token":"8FB4pw0IYWKkCIfwB3P5QL84PzaTIZyENYsJrww-7fA"}],"root_group":{"path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":1902,"fails":20200},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":205,"fails":7},{"path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":1881,"fails":20198,"name":"history readable"}],"name":""},"options":{"summaryTimeUnit":"","noColor":false,"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"]},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":44514.566385}}} diff --git a/evidence/research-20261029/load-fixed2-20261029105833.json b/evidence/research-20261029/load-fixed2-20261029105833.json new file mode 100644 index 00000000..1c4788d0 --- /dev/null +++ b/evidence/research-20261029/load-fixed2-20261029105833.json @@ -0,0 +1,373 @@ +{ + "profile": { + "vus": 32, + "seconds": 30, + "warmup_seconds": 5, + "drain_seconds": 5, + "users": 16 + }, + "summary": { + "state": { + "isStdOutTTY": false, + "isStdErrTTY": false, + "testRunDurationMs": 45255.708247 + }, + "metrics": { + "checks": { + "contains": "default", + "values": { + "rate": 1, + "passes": 8345, + "fails": 0 + }, + "type": "rate" + }, + "http_req_sending": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.19132248016203945, + "p(50)": 0.127061, + "p(95)": 0.3955431999999998, + "p(99)": 1.29405884, + "max": 19.155584 + } + }, + "http_req_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 112.29785262206552, + "p(50)": 86.520001, + "p(95)": 228.33532659999997, + "p(99)": 494.5202958399996, + "max": 1474.495154 + } + }, + "data_received": { + "values": { + "count": 11480752, + "rate": 253686.27394669177 + }, + "type": "counter", + "contains": "data" + }, + "http_reqs": { + "type": "counter", + "contains": "default", + "values": { + "count": 8393, + "rate": 185.45726771509254 + } + }, + "http_req_duration{expected_response:true}": { + "type": "trend", + "contains": "time", + "values": { + "avg": 112.29785262206552, + "p(50)": 86.520001, + "p(95)": 228.33532659999997, + "p(99)": 494.5202958399996, + "max": 1474.495154 + } + }, + "attempted_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 3814, + "rate": 84.27666139227486 + } + }, + "application_errors{status:429}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "message_latency_ms": { + "type": "trend", + "contains": "time", + "values": { + "max": 1474.495154, + "avg": 133.09072025642362, + "p(50)": 104.40111999999999, + "p(95)": 252.26227369999998, + "p(99)": 545.8374000899996 + } + }, + "data_sent": { + "type": "counter", + "contains": "data", + "values": { + "rate": 17050.48997992759, + "count": 771632 + } + }, + "iterations": { + "type": "counter", + "contains": "default", + "values": { + "count": 3958, + "rate": 87.4585804380241 + } + }, + "measured_operations": { + "type": "counter", + "contains": "default", + "values": { + "count": 8022, + "rate": 177.25940684028026 + } + }, + "http_req_failed": { + "type": "rate", + "contains": "default", + "values": { + "rate": 0, + "passes": 0, + "fails": 8393 + } + }, + "http_req_waiting": { + "type": "trend", + "contains": "time", + "values": { + "p(99)": 493.6457210399996, + "max": 1472.956636, + "avg": 111.75939546145578, + "p(50)": 86.042615, + "p(95)": 227.74144959999995 + } + }, + "http_req_blocked": { + "type": "trend", + "contains": "time", + "values": { + "max": 1069.777577, + "avg": 0.4059274680090553, + "p(50)": 0.00082, + "p(95)": 0.0013733999999999997, + "p(99)": 0.003630199999999992 + } + }, + "confirmed_messages": { + "type": "counter", + "contains": "default", + "values": { + "count": 3814, + "rate": 84.27666139227486 + } + }, + "http_req_receiving": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.3471346804479915, + "p(50)": 0.170749, + "p(95)": 1.1181307999999996, + "p(99)": 2.6177550799999993, + "max": 16.454896 + } + }, + "iteration_duration": { + "type": "trend", + "contains": "time", + "values": { + "avg": 236.52024523370324, + "p(50)": 205.350779, + "p(95)": 431.8582000999999, + "p(99)": 935.8667843199955, + "max": 1867.295818 + } + }, + "application_errors": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + } + }, + "application_errors{status:0}": { + "type": "counter", + "contains": "default", + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + } + }, + "vus": { + "type": "gauge", + "contains": "default", + "values": { + "value": 32, + "min": 0, + "max": 32 + } + }, + "application_errors{status:503}": { + "values": { + "count": 0, + "rate": 0 + }, + "thresholds": { + "count>=0": { + "ok": true + } + }, + "type": "counter", + "contains": "default" + }, + "vus_max": { + "type": "gauge", + "contains": "default", + "values": { + "min": 32, + "max": 32, + "value": 32 + } + }, + "http_req_tls_handshaking": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.2594542579530561, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 265.689513 + } + }, + "http_req_connecting": { + "type": "trend", + "contains": "time", + "values": { + "avg": 0.01689568890742285, + "p(50)": 0, + "p(95)": 0, + "p(99)": 0, + "max": 7.397876 + } + } + }, + "setup_data": [ + { + "chat": "1feea1c0-1a58-4f09-be38-70929069e8bb", + "token": "rDw3EJH_XEADE8b5mkS7cfRdyFA0Qx_ApEPbuMsD8k8" + }, + { + "chat": "010ef4b5-1353-4fef-a889-644dc08973dc", + "token": "DVKZdQDcgdMzq-8tvYsvDZ5TuoeVLKc1Aa4HRlUtlQA" + }, + { + "token": "u-PWgUJ5wfEpLyO1DvF9OFuaprl2sbWc--Xa9Y4u6tg", + "chat": "1c16a1c1-9549-44e9-b6a5-4d519f2c2d83" + }, + { + "chat": "39f17cc2-e70c-4e56-ac2e-a9221535c293", + "token": "zvep40wpWWTbsAiw9pmGSBT3_XM5M-LYMuddfjkP3Ys" + }, + { + "chat": "30b0c47a-3147-4419-8338-9afb6a1bf5e8", + "token": "llQRzs6heT3ZavaRbciMD-Re1EQCjqM1HvVAI3Qo_FU" + }, + { + "chat": "9397ceab-333b-4e22-8198-af5c1d7d5913", + "token": "n2i3dL-4G-Ip21_jSF8UF1x0qHZBwu8vjrreyW1W0QM" + }, + { + "chat": "cf817bc1-d522-49bf-a05d-895b8a78f8fd", + "token": "IVosfZSIwJbvi-mgZ_i6r_IkcI9AD1mRl0ucwgNq6w4" + }, + { + "chat": "9637a37a-310f-41eb-ad60-b1896f55538a", + "token": "0i50hwhoT3XpgdL7eAe3GJx8ZLFXdQgem1AyrIL_JEY" + }, + { + "chat": "40aa0558-844d-4a49-8ecf-509abe415e96", + "token": "6fgA785h3vUVRIOCLS9zBeIB1Cd4S016OfQd-43NLOw" + }, + { + "chat": "e8a490b6-d8b3-4aed-9ecc-11df2e75ebe3", + "token": "sARolZ65RIkIJ3WhVNjiKQbRq9eddpNl3f_brvGvbNs" + }, + { + "chat": "ed5afd74-0369-41bf-b0a9-b5081f696bc1", + "token": "yNIq5wwnngB4_fU1WOTcU0xLbVX2OSWyDv8FgVbQTBg" + }, + { + "chat": "c1a3b314-443d-4f27-a096-891bf5912714", + "token": "N6L7tdvpNzeP85ij3l_X_AZpnrF-1goVFJNX2hhsycA" + }, + { + "chat": "c5c39d45-5139-4b05-bf0d-92a4c3b3d3b9", + "token": "zpYcXhXYXbc6ITLB_BGcloCYMDkuzie78uiQXluD7Ec" + }, + { + "chat": "b4ee9195-ceb6-4b55-a1f1-a89f4c64c589", + "token": "IoM5BXfH571YD6HxVb2zPsWvTNJ7Vktk1fsgFyeXqNM" + }, + { + "chat": "94243ef1-d911-4e7d-a8a1-2bfcfe3f03d9", + "token": "TRhjPnNVv5bz54oL7v4MZAPNxIR37zEpfbaJBuj9Kyo" + }, + { + "chat": "3b1988a1-b29b-4c89-a33b-82ef50ca17e3", + "token": "Ro6tGbRQY16QV7f5ppeCmnedh8c4FsL2AHc3n78sgZc" + } + ], + "root_group": { + "name": "", + "path": "", + "id": "d41d8cd98f00b204e9800998ecf8427e", + "groups": [], + "checks": [ + { + "name": "message confirmed", + "path": "::message confirmed", + "id": "d4155de45199bf62b8c3d5ba8866ac6e", + "passes": 3975, + "fails": 0 + }, + { + "name": "retry returns original", + "path": "::retry returns original", + "id": "f737ff9008ff036f7a4b775b05a953fa", + "passes": 412, + "fails": 0 + }, + { + "name": "history readable", + "path": "::history readable", + "id": "e5d19d1d900950fc71ea4c99c2bee0f8", + "passes": 3958, + "fails": 0 + } + ] + }, + "options": { + "summaryTrendStats": [ + "avg", + "p(50)", + "p(95)", + "p(99)", + "max" + ], + "summaryTimeUnit": "", + "noColor": false + } + } +} diff --git a/evidence/research-20261029/load-fixed2-20261029105833.txt b/evidence/research-20261029/load-fixed2-20261029105833.txt new file mode 100644 index 00000000..813363f3 --- /dev/null +++ b/evidence/research-20261029/load-fixed2-20261029105833.txt @@ -0,0 +1 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":45255.708247},"metrics":{"checks":{"contains":"default","values":{"rate":1,"passes":8345,"fails":0},"type":"rate"},"http_req_sending":{"type":"trend","contains":"time","values":{"avg":0.19132248016203945,"p(50)":0.127061,"p(95)":0.3955431999999998,"p(99)":1.29405884,"max":19.155584}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":112.29785262206552,"p(50)":86.520001,"p(95)":228.33532659999997,"p(99)":494.5202958399996,"max":1474.495154}},"data_received":{"values":{"count":11480752,"rate":253686.27394669177},"type":"counter","contains":"data"},"http_reqs":{"type":"counter","contains":"default","values":{"count":8393,"rate":185.45726771509254}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"avg":112.29785262206552,"p(50)":86.520001,"p(95)":228.33532659999997,"p(99)":494.5202958399996,"max":1474.495154}},"attempted_messages":{"type":"counter","contains":"default","values":{"count":3814,"rate":84.27666139227486}},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"message_latency_ms":{"type":"trend","contains":"time","values":{"max":1474.495154,"avg":133.09072025642362,"p(50)":104.40111999999999,"p(95)":252.26227369999998,"p(99)":545.8374000899996}},"data_sent":{"type":"counter","contains":"data","values":{"rate":17050.48997992759,"count":771632}},"iterations":{"type":"counter","contains":"default","values":{"count":3958,"rate":87.4585804380241}},"measured_operations":{"type":"counter","contains":"default","values":{"count":8022,"rate":177.25940684028026}},"http_req_failed":{"type":"rate","contains":"default","values":{"rate":0,"passes":0,"fails":8393}},"http_req_waiting":{"type":"trend","contains":"time","values":{"p(99)":493.6457210399996,"max":1472.956636,"avg":111.75939546145578,"p(50)":86.042615,"p(95)":227.74144959999995}},"http_req_blocked":{"type":"trend","contains":"time","values":{"max":1069.777577,"avg":0.4059274680090553,"p(50)":0.00082,"p(95)":0.0013733999999999997,"p(99)":0.003630199999999992}},"confirmed_messages":{"type":"counter","contains":"default","values":{"count":3814,"rate":84.27666139227486}},"http_req_receiving":{"type":"trend","contains":"time","values":{"avg":0.3471346804479915,"p(50)":0.170749,"p(95)":1.1181307999999996,"p(99)":2.6177550799999993,"max":16.454896}},"iteration_duration":{"type":"trend","contains":"time","values":{"avg":236.52024523370324,"p(50)":205.350779,"p(95)":431.8582000999999,"p(99)":935.8667843199955,"max":1867.295818}},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"vus":{"type":"gauge","contains":"default","values":{"value":32,"min":0,"max":32}},"application_errors{status:503}":{"values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter","contains":"default"},"vus_max":{"type":"gauge","contains":"default","values":{"min":32,"max":32,"value":32}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"avg":0.2594542579530561,"p(50)":0,"p(95)":0,"p(99)":0,"max":265.689513}},"http_req_connecting":{"type":"trend","contains":"time","values":{"avg":0.01689568890742285,"p(50)":0,"p(95)":0,"p(99)":0,"max":7.397876}}},"setup_data":[{"chat":"1feea1c0-1a58-4f09-be38-70929069e8bb","token":"rDw3EJH_XEADE8b5mkS7cfRdyFA0Qx_ApEPbuMsD8k8"},{"chat":"010ef4b5-1353-4fef-a889-644dc08973dc","token":"DVKZdQDcgdMzq-8tvYsvDZ5TuoeVLKc1Aa4HRlUtlQA"},{"token":"u-PWgUJ5wfEpLyO1DvF9OFuaprl2sbWc--Xa9Y4u6tg","chat":"1c16a1c1-9549-44e9-b6a5-4d519f2c2d83"},{"chat":"39f17cc2-e70c-4e56-ac2e-a9221535c293","token":"zvep40wpWWTbsAiw9pmGSBT3_XM5M-LYMuddfjkP3Ys"},{"chat":"30b0c47a-3147-4419-8338-9afb6a1bf5e8","token":"llQRzs6heT3ZavaRbciMD-Re1EQCjqM1HvVAI3Qo_FU"},{"chat":"9397ceab-333b-4e22-8198-af5c1d7d5913","token":"n2i3dL-4G-Ip21_jSF8UF1x0qHZBwu8vjrreyW1W0QM"},{"chat":"cf817bc1-d522-49bf-a05d-895b8a78f8fd","token":"IVosfZSIwJbvi-mgZ_i6r_IkcI9AD1mRl0ucwgNq6w4"},{"chat":"9637a37a-310f-41eb-ad60-b1896f55538a","token":"0i50hwhoT3XpgdL7eAe3GJx8ZLFXdQgem1AyrIL_JEY"},{"chat":"40aa0558-844d-4a49-8ecf-509abe415e96","token":"6fgA785h3vUVRIOCLS9zBeIB1Cd4S016OfQd-43NLOw"},{"chat":"e8a490b6-d8b3-4aed-9ecc-11df2e75ebe3","token":"sARolZ65RIkIJ3WhVNjiKQbRq9eddpNl3f_brvGvbNs"},{"chat":"ed5afd74-0369-41bf-b0a9-b5081f696bc1","token":"yNIq5wwnngB4_fU1WOTcU0xLbVX2OSWyDv8FgVbQTBg"},{"chat":"c1a3b314-443d-4f27-a096-891bf5912714","token":"N6L7tdvpNzeP85ij3l_X_AZpnrF-1goVFJNX2hhsycA"},{"chat":"c5c39d45-5139-4b05-bf0d-92a4c3b3d3b9","token":"zpYcXhXYXbc6ITLB_BGcloCYMDkuzie78uiQXluD7Ec"},{"chat":"b4ee9195-ceb6-4b55-a1f1-a89f4c64c589","token":"IoM5BXfH571YD6HxVb2zPsWvTNJ7Vktk1fsgFyeXqNM"},{"chat":"94243ef1-d911-4e7d-a8a1-2bfcfe3f03d9","token":"TRhjPnNVv5bz54oL7v4MZAPNxIR37zEpfbaJBuj9Kyo"},{"chat":"3b1988a1-b29b-4c89-a33b-82ef50ca17e3","token":"Ro6tGbRQY16QV7f5ppeCmnedh8c4FsL2AHc3n78sgZc"}],"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[{"name":"message confirmed","path":"::message confirmed","id":"d4155de45199bf62b8c3d5ba8866ac6e","passes":3975,"fails":0},{"name":"retry returns original","path":"::retry returns original","id":"f737ff9008ff036f7a4b775b05a953fa","passes":412,"fails":0},{"name":"history readable","path":"::history readable","id":"e5d19d1d900950fc71ea4c99c2bee0f8","passes":3958,"fails":0}]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false}}} diff --git a/evidence/research-20261029/load-fixed4-20261029110021.txt b/evidence/research-20261029/load-fixed4-20261029110021.txt new file mode 100644 index 00000000..26b8eebc --- /dev/null +++ b/evidence/research-20261029/load-fixed4-20261029110021.txt @@ -0,0 +1,2 @@ +{"profile":{"vus":32,"seconds":30,"warmup_seconds":5,"drain_seconds":5,"users":16},"summary":{"metrics":{"data_received":{"type":"counter","contains":"data","values":{"count":17626,"rate":1217.3039501253575}},"application_errors{status:0}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}},"application_errors":{"type":"counter","contains":"default","values":{"count":0,"rate":0}},"vus_max":{"type":"gauge","contains":"default","values":{"value":32,"min":32,"max":32}},"http_req_failed":{"values":{"rate":0.023809523809523808,"passes":1,"fails":41},"type":"rate","contains":"default"},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"p(99)":674.0106492,"max":687.569354,"avg":283.18361153658526,"p(50)":284.208662,"p(95)":586.691066}},"http_req_blocked":{"type":"trend","contains":"time","values":{"p(99)":336.2059710899979,"max":569.826329,"avg":13.5687459047619,"p(50)":0.001005,"p(95)":0.001827199999999998}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"avg":0.3292637857142857,"p(50)":0,"p(95)":0,"p(99)":8.159156609999949,"max":13.829079}},"http_req_receiving":{"contains":"time","values":{"p(95)":0.44896049999999965,"p(99)":1.0334104199999976,"max":1.285289,"avg":0.2205079761904762,"p(50)":0.1569235},"type":"trend"},"vus":{"type":"gauge","contains":"default","values":{"value":0,"min":0,"max":0}},"data_sent":{"type":"counter","contains":"data","values":{"count":7190,"rate":496.5627709861182}},"http_reqs":{"type":"counter","contains":"default","values":{"count":42,"rate":2.900644837471066}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":330.7324318809523,"p(50)":298.326058,"p(95)":650.3235156999997,"p(99)":1627.241534079994,"max":2280.234066}},"http_req_sending":{"type":"trend","contains":"time","values":{"max":0.746168,"avg":0.2487437857142857,"p(50)":0.2300245,"p(95)":0.41498954999999993,"p(99)":0.6258170099999989}},"http_req_waiting":{"type":"trend","contains":"time","values":{"max":2279.777719,"avg":330.2631801190476,"p(50)":297.450258,"p(95)":649.6964502499998,"p(99)":1626.8369430199941}},"application_errors{status:503}":{"contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}},"type":"counter"},"http_req_connecting":{"values":{"avg":0.07830409523809523,"p(50)":0,"p(95)":0,"p(99)":1.9403754799999877,"max":3.288772},"type":"trend","contains":"time"},"application_errors{status:429}":{"type":"counter","contains":"default","values":{"count":0,"rate":0},"thresholds":{"count>=0":{"ok":true}}}},"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[],"checks":[]},"options":{"summaryTrendStats":["avg","p(50)","p(95)","p(99)","max"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":false,"isStdErrTTY":false,"testRunDurationMs":14479.538983}}} +time="2026-10-29T11:02:21Z" level=error msg="Error: chat: 503\n\tat setup (file:///scripts/scaling.js:39:40(163))\n" hint="script exception" diff --git a/evidence/research-20261029/nodes.txt b/evidence/research-20261029/nodes.txt new file mode 100644 index 00000000..461dea77 --- /dev/null +++ b/evidence/research-20261029/nodes.txt @@ -0,0 +1,4 @@ +NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME +dev.asisti.tech Ready 252d v1.33.13 100.99.166.40 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 +marlosrv0 Ready 254d v1.33.13 192.168.1.37 Ubuntu 24.04.5 LTS 6.8.0-147-generic containerd://1.7.29 +srv0.agapov.space Ready 246d v1.33.13 100.108.186.94 Ubuntu 24.04.4 LTS 6.8.0-139-generic containerd://1.7.29 diff --git a/evidence/research-20261029/profiles.csv b/evidence/research-20261029/profiles.csv new file mode 100644 index 00000000..0e7498a6 --- /dev/null +++ b/evidence/research-20261029/profiles.csv @@ -0,0 +1,4 @@ +profile,run,replicas,cpu_millicores_per_replica,memory_mib_per_replica,pool,vus,duration +fixed1,fixed1-20261029105633,1,1000,512,8,32,30 +fixed2,fixed2-20261029105833,2,500,256,8,32,30 +fixed4,fixed4-20261029110021,4,250,128,8,32,30 diff --git a/evidence/research-20261029/readiness-events.json b/evidence/research-20261029/readiness-events.json new file mode 100644 index 00000000..62edab74 --- /dev/null +++ b/evidence/research-20261029/readiness-events.json @@ -0,0 +1,372 @@ +{ + "apiVersion": "v1", + "items": [ + { + "apiVersion": "v1", + "count": 12, + "eventTime": null, + "firstTimestamp": "2026-10-29T10:54:29Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-4xgnf", + "namespace": "highload-applications", + "resourceVersion": "60155132", + "uid": "90295b43-464f-4a5c-8b88-1ec0b476f40e" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T10:55:51Z", + "message": "Readiness probe failed: Get \"http://10.1.25.112:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T10:54:36Z", + "name": "api-54f7cc6f98-4xgnf.18e2fab7f0b1f4f5", + "namespace": "highload-applications", + "resourceVersion": "60155546", + "uid": "061062ea-64b4-4692-96d9-49100f681333" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T10:56:39Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-4xgnf", + "namespace": "highload-applications", + "resourceVersion": "60155132", + "uid": "90295b43-464f-4a5c-8b88-1ec0b476f40e" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T10:56:39Z", + "message": "Readiness probe failed: Get \"http://10.1.25.112:8080/health/ready\": dial tcp 10.1.25.112:8080: connect: invalid argument", + "metadata": { + "creationTimestamp": "2026-10-29T10:56:39Z", + "name": "api-54f7cc6f98-4xgnf.18e2fad636c81e2e", + "namespace": "highload-applications", + "resourceVersion": "60155760", + "uid": "e29177f3-ce15-47dc-b765-2d0846988cb5" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 9, + "eventTime": null, + "firstTimestamp": "2026-10-29T10:55:39Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-crhmd", + "namespace": "highload-applications", + "resourceVersion": "60155431", + "uid": "ddbfb114-c312-4f42-abc4-31ed3e9c7097" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T10:56:39Z", + "message": "Readiness probe failed: Get \"http://10.1.112.108:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T10:55:39Z", + "name": "api-54f7cc6f98-crhmd.18e2fac832d84b47", + "namespace": "highload-applications", + "resourceVersion": "60155754", + "uid": "a7799297-29e8-4f12-b885-05f058136a94" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 4, + "eventTime": null, + "firstTimestamp": "2026-10-29T10:54:30Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-txlh4", + "namespace": "highload-applications", + "resourceVersion": "60154930", + "uid": "e9c4add7-fd67-4650-a4a2-29ca5b9fd550" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T10:55:29Z", + "message": "Readiness probe failed: Get \"http://10.1.112.79:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T10:54:30Z", + "name": "api-54f7cc6f98-txlh4.18e2fab834bf2a49", + "namespace": "highload-applications", + "resourceVersion": "60155407", + "uid": "4d2bce6d-aed8-4833-aef4-54a830b74a7c" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T10:55:34Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-54f7cc6f98-txlh4", + "namespace": "highload-applications", + "resourceVersion": "60154930", + "uid": "e9c4add7-fd67-4650-a4a2-29ca5b9fd550" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T10:55:34Z", + "message": "Readiness probe failed: Get \"http://10.1.112.79:8080/health/ready\": dial tcp 10.1.112.79:8080: connect: connection refused", + "metadata": { + "creationTimestamp": "2026-10-29T10:55:34Z", + "name": "api-54f7cc6f98-txlh4.18e2fac72c04b76f", + "namespace": "highload-applications", + "resourceVersion": "60155456", + "uid": "8bb722ab-ed21-49fc-bc75-1c179c1fc14e" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T10:56:40Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-6fc45595fc-lzz7z", + "namespace": "highload-applications", + "resourceVersion": "60155699", + "uid": "8e5a9917-010b-4be5-bc15-21e54b5c8a2f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T10:56:40Z", + "message": "Startup probe failed: Get \"http://10.1.25.94:8080/health/ready\": dial tcp 10.1.25.94:8080: connect: connection refused", + "metadata": { + "creationTimestamp": "2026-10-29T10:56:40Z", + "name": "api-6fc45595fc-lzz7z.18e2fad66e1ebb48", + "namespace": "highload-applications", + "resourceVersion": "60155778", + "uid": "e0116806-66b7-4388-84af-239264979e5a" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 6, + "eventTime": null, + "firstTimestamp": "2026-10-29T10:56:59Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-6fc45595fc-lzz7z", + "namespace": "highload-applications", + "resourceVersion": "60155699", + "uid": "8e5a9917-010b-4be5-bc15-21e54b5c8a2f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T10:58:10Z", + "message": "Readiness probe failed: Get \"http://10.1.25.94:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T10:57:06Z", + "name": "api-6fc45595fc-lzz7z.18e2fadacd905ce6", + "namespace": "highload-applications", + "resourceVersion": "60156106", + "uid": "4702ce30-cfa8-46a9-90cf-91fc6b584f53" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 8, + "eventTime": null, + "firstTimestamp": "2026-10-29T10:58:10Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-6fc45595fc-lzz7z", + "namespace": "highload-applications", + "resourceVersion": "60155699", + "uid": "8e5a9917-010b-4be5-bc15-21e54b5c8a2f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T10:58:22Z", + "message": "Readiness probe failed: HTTP probe failed with statuscode: 503", + "metadata": { + "creationTimestamp": "2026-10-29T10:58:20Z", + "name": "api-6fc45595fc-lzz7z.18e2faeb726a6238", + "namespace": "highload-applications", + "resourceVersion": "60156137", + "uid": "cc075469-262a-4320-8d62-8db989f93fb4" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 1, + "eventTime": null, + "firstTimestamp": "2026-10-29T10:58:48Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-6fc45595fc-lzz7z", + "namespace": "highload-applications", + "resourceVersion": "60155699", + "uid": "8e5a9917-010b-4be5-bc15-21e54b5c8a2f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T10:58:48Z", + "message": "Readiness probe failed: Get \"http://10.1.25.94:8080/health/ready\": dial tcp 10.1.25.94:8080: connect: connection refused", + "metadata": { + "creationTimestamp": "2026-10-29T10:58:48Z", + "name": "api-6fc45595fc-lzz7z.18e2faf44b78f857", + "namespace": "highload-applications", + "resourceVersion": "60156376", + "uid": "d5517348-4aa9-4bce-ad19-3d2321d38e31" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "dev.asisti.tech", + "source": { + "component": "kubelet", + "host": "dev.asisti.tech" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 2, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:00:08Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-7f5b6b9d85-bs7mv", + "namespace": "highload-applications", + "resourceVersion": "60156221", + "uid": "240bf47a-6297-4cd8-86ef-fe011a81b4c4" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:00:10Z", + "message": "Readiness probe failed: Get \"http://10.1.131.46:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:00:13Z", + "name": "api-7f5b6b9d85-bs7mv.18e2fb06c7a9f8a3", + "namespace": "highload-applications", + "resourceVersion": "60156674", + "uid": "00ccd6d5-02db-4ad6-a5e5-c9538288a28d" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "srv0.agapov.space", + "source": { + "component": "kubelet", + "host": "srv0.agapov.space" + }, + "type": "Warning" + }, + { + "apiVersion": "v1", + "count": 3, + "eventTime": null, + "firstTimestamp": "2026-10-29T11:00:07Z", + "involvedObject": { + "apiVersion": "v1", + "fieldPath": "spec.containers{api}", + "kind": "Pod", + "name": "api-7f5b6b9d85-zvv5p", + "namespace": "highload-applications", + "resourceVersion": "60156310", + "uid": "f9985b3b-236f-4a24-aea3-cb6fdc2cdd0f" + }, + "kind": "Event", + "lastTimestamp": "2026-10-29T11:00:11Z", + "message": "Readiness probe failed: Get \"http://10.1.112.80:8080/health/ready\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "metadata": { + "creationTimestamp": "2026-10-29T11:00:07Z", + "name": "api-7f5b6b9d85-zvv5p.18e2fb069d2ec010", + "namespace": "highload-applications", + "resourceVersion": "60156658", + "uid": "85473d6e-7990-4c07-9857-13ddbb3a44f7" + }, + "reason": "Unhealthy", + "reportingComponent": "kubelet", + "reportingInstance": "marlosrv0", + "source": { + "component": "kubelet", + "host": "marlosrv0" + }, + "type": "Warning" + } + ], + "kind": "List", + "metadata": { + "resourceVersion": "" + } +} diff --git a/evidence/research-20261029/resources-fixed1-20261029105633.txt b/evidence/research-20261029/resources-fixed1-20261029105633.txt new file mode 100644 index 00000000..170b48eb --- /dev/null +++ b/evidence/research-20261029/resources-fixed1-20261029105633.txt @@ -0,0 +1,79 @@ +UTC 2026-10-29T10:57:39Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-lzz7z 3m 22Mi +postgres-0 6m 25Mi +valkey-0 7m 8Mi +valkey-1 5m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|1 +UTC 2026-10-29T10:57:45Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-lzz7z 2m 22Mi +postgres-0 6m 25Mi +valkey-0 7m 8Mi +valkey-1 6m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|1 +UTC 2026-10-29T10:57:52Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-lzz7z 2m 22Mi +postgres-0 6m 25Mi +valkey-0 7m 8Mi +valkey-1 6m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|4 +UTC 2026-10-29T10:57:58Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-lzz7z 2m 22Mi +postgres-0 6m 25Mi +valkey-0 7m 8Mi +valkey-1 6m 13Mi +valkey-2 6m 3Mi +active|||2 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|1 +idle in transaction|||1 +UTC 2026-10-29T10:58:04Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-lzz7z 235m 8Mi +load-fixed1-20261029105633-qb7n9 78m 19Mi +postgres-0 115m 33Mi +valkey-0 48m 8Mi +valkey-1 12m 13Mi +valkey-2 6m 3Mi +active|Client|ClientRead|1 +active|IO|WalSync|1 +active|||2 +idle|Client|ClientRead|1 +idle in transaction|Client|ClientRead|3 +idle in transaction|||1 +UTC 2026-10-29T10:58:11Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-lzz7z 235m 8Mi +load-fixed1-20261029105633-qb7n9 78m 19Mi +postgres-0 115m 33Mi +valkey-0 48m 8Mi +valkey-1 12m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|8 +UTC 2026-10-29T10:58:27Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-lzz7z 259m 12Mi +load-fixed1-20261029105633-qb7n9 264m 29Mi +postgres-0 250m 43Mi +valkey-0 84m 8Mi +valkey-1 69m 13Mi +valkey-2 46m 3Mi +active|||1 +idle|Client|ClientRead|8 +UTC 2026-10-29T10:58:33Z +NAME CPU(cores) MEMORY(bytes) +api-6fc45595fc-lzz7z 259m 12Mi +postgres-0 250m 43Mi +valkey-0 35m 8Mi +valkey-1 3m 13Mi +valkey-2 22m 3Mi diff --git a/evidence/research-20261029/resources-fixed2-20261029105833.txt b/evidence/research-20261029/resources-fixed2-20261029105833.txt new file mode 100644 index 00000000..4223f07f --- /dev/null +++ b/evidence/research-20261029/resources-fixed2-20261029105833.txt @@ -0,0 +1,109 @@ +UTC 2026-10-29T10:59:20Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-bs7mv 3m 22Mi +api-7f5b6b9d85-zvv5p 3m 22Mi +postgres-0 9m 27Mi +valkey-0 7m 8Mi +valkey-1 6m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|2 +UTC 2026-10-29T10:59:26Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-bs7mv 3m 22Mi +api-7f5b6b9d85-zvv5p 3m 22Mi +postgres-0 9m 27Mi +valkey-0 7m 8Mi +valkey-1 6m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|5 +UTC 2026-10-29T10:59:33Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-bs7mv 50m 61Mi +api-7f5b6b9d85-zvv5p 2m 22Mi +postgres-0 16m 28Mi +valkey-0 31m 8Mi +valkey-1 5m 13Mi +valkey-2 8m 3Mi +active|||1 +idle|Client|ClientRead|5 +UTC 2026-10-29T10:59:39Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-bs7mv 50m 61Mi +api-7f5b6b9d85-zvv5p 2m 22Mi +postgres-0 16m 28Mi +valkey-0 31m 8Mi +valkey-1 5m 13Mi +valkey-2 8m 3Mi +active|Client|ClientRead|1 +active|||1 +idle|Client|ClientRead|10 +idle in transaction|Client|ClientRead|4 +idle in transaction|||1 +UTC 2026-10-29T10:59:45Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-bs7mv 145m 10Mi +api-7f5b6b9d85-zvv5p 125m 10Mi +load-fixed2-20261029105833-gd8x5 67m 18Mi +postgres-0 374m 63Mi +valkey-0 93m 8Mi +valkey-1 12m 14Mi +valkey-2 36m 3Mi +active|Client|ClientRead|2 +active|IO|WalSync|1 +active|LWLock|WALWrite|1 +active|||5 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|2 +idle in transaction|||1 +UTC 2026-10-29T10:59:52Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-bs7mv 145m 10Mi +api-7f5b6b9d85-zvv5p 125m 10Mi +load-fixed2-20261029105833-gd8x5 67m 18Mi +postgres-0 374m 63Mi +valkey-0 93m 8Mi +valkey-1 12m 14Mi +valkey-2 36m 3Mi +active|Lock|transactionid|1 +active|||1 +idle|Client|ClientRead|11 +idle in transaction|Client|ClientRead|4 +UTC 2026-10-29T10:59:59Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-bs7mv 427m 11Mi +api-7f5b6b9d85-zvv5p 419m 15Mi +load-fixed2-20261029105833-gd8x5 310m 29Mi +postgres-0 767m 65Mi +valkey-0 149m 8Mi +valkey-1 81m 14Mi +valkey-2 75m 3Mi +active|||3 +idle|Client|ClientRead|8 +idle|||1 +idle in transaction|Client|ClientRead|4 +idle in transaction|||1 +UTC 2026-10-29T11:00:06Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-bs7mv 427m 11Mi +api-7f5b6b9d85-zvv5p 419m 15Mi +load-fixed2-20261029105833-gd8x5 310m 29Mi +postgres-0 767m 65Mi +valkey-0 149m 8Mi +valkey-1 81m 14Mi +valkey-2 75m 3Mi +active|||1 +idle|Client|ClientRead|13 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:00:14Z +NAME CPU(cores) MEMORY(bytes) +api-7f5b6b9d85-bs7mv 427m 11Mi +api-7f5b6b9d85-zvv5p 272m 15Mi +postgres-0 371m 55Mi +valkey-0 149m 8Mi +valkey-1 93m 14Mi +valkey-2 48m 3Mi +active|||1 +idle|Client|ClientRead|11 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029/resources-fixed4-20261029110021.txt b/evidence/research-20261029/resources-fixed4-20261029110021.txt new file mode 100644 index 00000000..43dbf243 --- /dev/null +++ b/evidence/research-20261029/resources-fixed4-20261029110021.txt @@ -0,0 +1,47 @@ +UTC 2026-10-29T11:01:47Z +Error from server (ServiceUnavailable): the server is currently unable to handle the request (get pods.metrics.k8s.io) +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:02:01Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-2j5qf 3m 22Mi +api-855b9f4fb5-vkmkv 2m 22Mi +postgres-0 8m 35Mi +valkey-0 8m 9Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:02:07Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-2j5qf 3m 22Mi +api-855b9f4fb5-vkmkv 2m 22Mi +postgres-0 8m 35Mi +valkey-0 8m 9Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|4 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:02:14Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-2j5qf 3m 22Mi +api-855b9f4fb5-vkmkv 2m 22Mi +postgres-0 8m 35Mi +valkey-0 8m 9Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|1 +UTC 2026-10-29T11:02:20Z +NAME CPU(cores) MEMORY(bytes) +api-855b9f4fb5-2j5qf 18m 61Mi +api-855b9f4fb5-vkmkv 3m 23Mi +load-fixed4-20261029110021-6kzss 42m 19Mi +postgres-0 19m 37Mi +valkey-0 8m 9Mi +valkey-1 6m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|5 +idle in transaction|Client|ClientRead|1 diff --git a/evidence/research-20261029/restore-values.yaml b/evidence/research-20261029/restore-values.yaml new file mode 100644 index 00000000..4e915dac --- /dev/null +++ b/evidence/research-20261029/restore-values.yaml @@ -0,0 +1,61 @@ +api: + env: + DEPENDENCY_POOL_SIZE: "8" + DEPENDENCY_TIMEOUT_MS: "2000" + GOMEMLIMIT: 160MiB + REQUEST_TIMEOUT_SECONDS: "4" + SESSION_TTL_SECONDS: "3600" + SHUTDOWN_TIMEOUT_SECONDS: "5" + replicas: 2 + resources: + limits: + cpu: "1" + memory: 256Mi + requests: + cpu: 250m + memory: 128Mi +autoscaling: + cpuPercent: 60 + enabled: true + maxReplicas: 4 + minReplicas: 2 +databaseSecret: messenger-secrets +image: + digest: sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 + repository: asisti.registry.twcstorage.ru/mtusi2026lab3 +imagePullSecret: registry-pull +ingress: + className: traefik + clusterIssuer: letsencrypt-prod + host: hl.agapov.space +load: + duration: 30 + enabled: false + run: manual + script: scaling.js + vus: 32 +monitoring: + serviceMonitor: false +postgres: + image: postgres:17.6-alpine + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + storage: 2Gi +storageClass: "" +valkey: + image: valkey/valkey:8.1.3-alpine + maxmemory: 64mb + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 100m + memory: 96Mi + shards: 3 + storage: 1Gi diff --git a/evidence/research-20261029/restore.txt b/evidence/research-20261029/restore.txt new file mode 100644 index 00000000..3b9d354d --- /dev/null +++ b/evidence/research-20261029/restore.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:02:26 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 7 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029/rollout-fixed1.txt b/evidence/research-20261029/rollout-fixed1.txt new file mode 100644 index 00000000..55849476 --- /dev/null +++ b/evidence/research-20261029/rollout-fixed1.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 13:56:34 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 4 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029/rollout-fixed2.txt b/evidence/research-20261029/rollout-fixed2.txt new file mode 100644 index 00000000..1920a4c2 --- /dev/null +++ b/evidence/research-20261029/rollout-fixed2.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 13:58:35 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 5 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029/rollout-fixed4.txt b/evidence/research-20261029/rollout-fixed4.txt new file mode 100644 index 00000000..39e8165d --- /dev/null +++ b/evidence/research-20261029/rollout-fixed4.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 14:00:22 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 6 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/research-20261029/source.sha256 b/evidence/research-20261029/source.sha256 new file mode 100644 index 00000000..0f94fb32 --- /dev/null +++ b/evidence/research-20261029/source.sha256 @@ -0,0 +1,3 @@ +8fdd5ea6ef1d21ada68f6bc3068ccf3d8da8d2280634017bc9b44e877565ed79 student-tests/load/scaling.js +dcc8dc1217792aca3385c8e3195b236058ee9b2df912e60f9af46dc51b9a6c86 charts/messenger/values.yaml +60e09dd38fd1d413b744f21b57f64ba83e49a5ae1b4251aa5bf20be033f90cfb internal/controller/http/fiber/errors.go diff --git a/evidence/research-20261029/values-fixed1.json b/evidence/research-20261029/values-fixed1.json new file mode 100644 index 00000000..0fdce262 --- /dev/null +++ b/evidence/research-20261029/values-fixed1.json @@ -0,0 +1 @@ +{"api":{"env":{"DEPENDENCY_POOL_SIZE":"8","DEPENDENCY_TIMEOUT_MS":"2000","GOMEMLIMIT":"80MiB","REQUEST_TIMEOUT_SECONDS":"4","SESSION_TTL_SECONDS":"3600","SHUTDOWN_TIMEOUT_SECONDS":"5"},"replicas":1,"resources":{"limits":{"cpu":"1000m","memory":"512Mi"},"requests":{"cpu":"1000m","memory":"512Mi"}}},"autoscaling":{"cpuPercent":60,"enabled":false,"maxReplicas":4,"minReplicas":2},"databaseSecret":"messenger-secrets","image":{"digest":"sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3","repository":"asisti.registry.twcstorage.ru/mtusi2026lab3"},"imagePullSecret":"registry-pull","ingress":{"className":"traefik","clusterIssuer":"letsencrypt-prod","host":"hl.agapov.space"},"load":{"duration":30,"enabled":false,"run":"manual","script":"scaling.js","vus":32},"monitoring":{"serviceMonitor":false},"postgres":{"image":"postgres:17.6-alpine","resources":{"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"250m","memory":"256Mi"}},"storage":"2Gi"},"storageClass":"","valkey":{"image":"valkey/valkey:8.1.3-alpine","maxmemory":"64mb","resources":{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"100m","memory":"96Mi"}},"shards":3,"storage":"1Gi"}} diff --git a/evidence/research-20261029/values-fixed2.json b/evidence/research-20261029/values-fixed2.json new file mode 100644 index 00000000..0635c03d --- /dev/null +++ b/evidence/research-20261029/values-fixed2.json @@ -0,0 +1 @@ +{"api":{"env":{"DEPENDENCY_POOL_SIZE":"8","DEPENDENCY_TIMEOUT_MS":"2000","GOMEMLIMIT":"80MiB","REQUEST_TIMEOUT_SECONDS":"4","SESSION_TTL_SECONDS":"3600","SHUTDOWN_TIMEOUT_SECONDS":"5"},"replicas":2,"resources":{"limits":{"cpu":"500m","memory":"256Mi"},"requests":{"cpu":"500m","memory":"256Mi"}}},"autoscaling":{"cpuPercent":60,"enabled":false,"maxReplicas":4,"minReplicas":2},"databaseSecret":"messenger-secrets","image":{"digest":"sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3","repository":"asisti.registry.twcstorage.ru/mtusi2026lab3"},"imagePullSecret":"registry-pull","ingress":{"className":"traefik","clusterIssuer":"letsencrypt-prod","host":"hl.agapov.space"},"load":{"duration":30,"enabled":false,"run":"manual","script":"scaling.js","vus":32},"monitoring":{"serviceMonitor":false},"postgres":{"image":"postgres:17.6-alpine","resources":{"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"250m","memory":"256Mi"}},"storage":"2Gi"},"storageClass":"","valkey":{"image":"valkey/valkey:8.1.3-alpine","maxmemory":"64mb","resources":{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"100m","memory":"96Mi"}},"shards":3,"storage":"1Gi"}} diff --git a/evidence/resources-idempotency-20261016084724.txt b/evidence/resources-idempotency-20261016084724.txt new file mode 100644 index 00000000..a60dce59 --- /dev/null +++ b/evidence/resources-idempotency-20261016084724.txt @@ -0,0 +1,20 @@ +UTC 2026-10-16T08:47:24Z +NAME CPU(cores) MEMORY(bytes) +api-647dcfd499-6lh86 18m 59Mi +api-647dcfd499-vrnnv 10m 23Mi +postgres-0 15m 27Mi +valkey-0 18m 3Mi +valkey-1 5m 3Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|3 +UTC 2026-10-16T08:47:30Z +NAME CPU(cores) MEMORY(bytes) +api-647dcfd499-6lh86 9m 59Mi +api-647dcfd499-vrnnv 3m 23Mi +postgres-0 5m 27Mi +valkey-0 12m 3Mi +valkey-1 5m 3Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|6 diff --git a/evidence/resources-rolling-20261016.txt b/evidence/resources-rolling-20261016.txt new file mode 100644 index 00000000..278f6635 --- /dev/null +++ b/evidence/resources-rolling-20261016.txt @@ -0,0 +1,63 @@ +UTC 2026-10-16T08:50:15Z +NAME CPU(cores) MEMORY(bytes) +api-647dcfd499-ksc82 2m 22Mi +api-647dcfd499-tz465 2m 22Mi +postgres-0 5m 28Mi +valkey-0 7m 5Mi +valkey-1 5m 3Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|2 +UTC 2026-10-16T08:50:20Z +NAME CPU(cores) MEMORY(bytes) +api-647dcfd499-ksc82 2m 22Mi +api-647dcfd499-tz465 2m 22Mi +postgres-0 5m 28Mi +valkey-0 7m 5Mi +valkey-1 5m 3Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|5 +UTC 2026-10-16T08:50:27Z +NAME CPU(cores) MEMORY(bytes) +api-647dcfd499-ksc82 86m 9Mi +api-647dcfd499-tz465 67m 7Mi +load-rolling-20261016-fznwl 68m 14Mi +postgres-0 94m 38Mi +valkey-0 34m 5Mi +valkey-1 5m 3Mi +valkey-2 21m 3Mi +active|||1 +idle|Client|ClientRead|3 +UTC 2026-10-16T08:50:38Z +NAME CPU(cores) MEMORY(bytes) +api-647dcfd499-ksc82 86m 9Mi +api-647dcfd499-tz465 67m 7Mi +load-rolling-20261016-fznwl 68m 14Mi +postgres-0 94m 38Mi +valkey-0 34m 5Mi +valkey-1 5m 3Mi +valkey-2 21m 3Mi +active|||1 +idle|Client|ClientRead|7 +UTC 2026-10-16T08:50:44Z +NAME CPU(cores) MEMORY(bytes) +api-647dcfd499-ksc82 68m 10Mi +api-647dcfd499-tz465 68m 7Mi +load-rolling-20261016-fznwl 55m 16Mi +postgres-0 77m 40Mi +valkey-0 60m 6Mi +valkey-1 13m 3Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|6 +UTC 2026-10-16T08:50:52Z +NAME CPU(cores) MEMORY(bytes) +api-647dcfd499-tz465 68m 7Mi +load-rolling-20261016-fznwl 55m 16Mi +postgres-0 77m 40Mi +valkey-0 60m 6Mi +valkey-1 13m 3Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|4 diff --git a/evidence/restart-after.txt b/evidence/restart-after.txt new file mode 100644 index 00000000..44ace47b --- /dev/null +++ b/evidence/restart-after.txt @@ -0,0 +1,7 @@ +NAME UID +api-647dcfd499-ksc82 91cdb519-3f11-4824-ba5e-3013a0a4e27e +api-647dcfd499-tz465 baec4045-bd34-44d2-88ac-3789f92a7be8 +postgres-0 03c4f32c-b0b0-46af-bf8b-4466a7ffeddf +valkey-0 bd0c9b06-7b2b-409c-9210-47fe4a5a4716 +valkey-1 899391b6-0120-489e-b766-38a00b500f68 +valkey-2 bf1f5110-6de8-46b4-9ffe-98f554df8fc5 diff --git a/evidence/restart-before.txt b/evidence/restart-before.txt new file mode 100644 index 00000000..83033747 --- /dev/null +++ b/evidence/restart-before.txt @@ -0,0 +1,7 @@ +NAME UID +api-647dcfd499-6lh86 7b711baf-e2ba-4b23-93eb-07ca8f7db918 +api-647dcfd499-vrnnv ce8f8307-4d12-4e03-8354-157e262c4e48 +postgres-0 1f6ebfb6-7a2a-43b7-a61b-c887f5b2e235 +valkey-0 d0d2a5ac-4fad-47e9-ab50-5169d09ecec5 +valkey-1 fbd7523d-2088-4c52-b455-72b92910ef06 +valkey-2 a6681afc-3adb-4f40-8842-d32b5a7a583b diff --git a/evidence/review-20261029/413-body.json b/evidence/review-20261029/413-body.json new file mode 100644 index 00000000..db0aab39 --- /dev/null +++ b/evidence/review-20261029/413-body.json @@ -0,0 +1 @@ +{"error":{"code":"payload_too_large","message":"request body is too large","request_id":"845b65a5-6688-4309-9619-71a317302ca5"}} \ No newline at end of file diff --git a/evidence/review-20261029/413-headers.txt b/evidence/review-20261029/413-headers.txt new file mode 100644 index 00000000..0689f08b --- /dev/null +++ b/evidence/review-20261029/413-headers.txt @@ -0,0 +1,7 @@ +HTTP/2 413 +content-type: application/json +date: Thu, 29 Oct 2026 10:57:54 GMT +x-instance-id: api-6fc45595fc-lzz7z +x-request-id: 845b65a5-6688-4309-9619-71a317302ca5 +content-length: 128 + diff --git a/evidence/review-20261029/README.md b/evidence/review-20261029/README.md new file mode 100644 index 00000000..4f6a4d2b --- /dev/null +++ b/evidence/review-20261029/README.md @@ -0,0 +1,20 @@ +# Исправления 29.10.2026 + +Образ исправления: digest в image.json; исходная ревизия 7b7e23f плюс diff итогового коммита. Результаты сборки и развёртывания сохранены, Kubernetes release lab2 / highload-applications. + +- body-limit.txt: настоящий TCP-запрос превышает BodyLimit и проверяет 413, X-Instance-Id и согласованный X-Request-Id. +- 413-headers.txt и 413-body.json: тот же контракт подтверждён через публичный HTTPS. +- coverage.txt, coverage-per-file.json: race, реальные PostgreSQL/Valkey, процесс и SIGTERM; 59 исполняемых файлов, минимум 90%. +- lint.txt, vet.txt, contract.txt: статические проверки и неизменный контракт. +- initial-api.json, targets.txt: две исходные реплики. +- failover-1-20261029105415-*: остановлена api-54f7cc6f98-7c56z; 44 подтверждённых сообщения включая исходное, 42 чтения, 5 ошибок операций, восстановление 0.190 с. +- failover-2-20261029105524-*: остановлена api-54f7cc6f98-txlh4; 21 подтверждённое сообщение включая исходное, 19 чтений, 7 ошибок операций, восстановление 2.547 с. +- load-failover-*.txt: запросы через Traefik; перед каждым отказом наблюдались две реплики, после — подтверждена сохранность всех сообщений, отсутствие дублей и использование прежней сессии. Между отказами первая реплика восстановлена Deployment; второй setup повторно проверил две реплики. +- smoke.txt: неуспешный прогон во время первого отказа (503), не используется как положительное доказательство. +- smoke-after.txt: публичный smoke после восстановления PASS. + +Первый сборщик summary использовал отсутствующий в Ruby 2.6 filter_map. Ошибка касалась обработки уже полученного успешного k6-результата; после замены на map/compact исходный лог обработан, проверка продолжена со второй сохранённой целью. Исходная ошибка сохранена в both-replicas.txt. + +Время восстановления считается от момента перед kubectl get/delete до первой успешной записи через другую реплику. Ошибки включают записи и чтения. RPS в summary использует номинальное окно 25 секунд и не включает начальную запись; запрос, начатый в конце окна, может завершиться чуть позже. Потеря узла/БД в этих сценариях не моделируется. + +После всех нагрузочных серий rollout завершился (final-rollout.txt). Финальные публичные smoke и повтор завершились connection/TLS failure: final-smoke.txt, final-smoke-retry.txt. Это отдельный текущий инфраструктурный сбой; прежний smoke-after PASS не доказывает стабильность доступа в конце исследования. final-deployment.json фиксирует состояние Deployment после восстановления. diff --git a/evidence/review-20261029/body-limit.txt b/evidence/review-20261029/body-limit.txt new file mode 100644 index 00000000..9822c59c --- /dev/null +++ b/evidence/review-20261029/body-limit.txt @@ -0,0 +1 @@ +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/controller/http/fiber 1.084s diff --git a/evidence/review-20261029/both-replicas.txt b/evidence/review-20261029/both-replicas.txt new file mode 100644 index 00000000..665ee8a1 --- /dev/null +++ b/evidence/review-20261029/both-replicas.txt @@ -0,0 +1,3 @@ +scripts/summarize-failover.rb:5:in `
': undefined method `filter_map' for # (NoMethodError) +Did you mean? filter +{"target":"api-54f7cc6f98-txlh4","started_epoch_ms":1793271329571,"confirmed":21,"reads":19,"errors":7,"pass":true,"recovery_seconds":2.547,"confirmed_rps":0.8} diff --git a/evidence/review-20261029/build.txt b/evidence/review-20261029/build.txt new file mode 100644 index 00000000..7dcbc40c --- /dev/null +++ b/evidence/review-20261029/build.txt @@ -0,0 +1,65 @@ +#0 building with "asisti-builder" instance using docker-container driver + +#1 [internal] load build definition from Dockerfile +#1 transferring dockerfile: 583B done +#1 DONE 0.0s + +#2 [internal] load metadata for docker.io/library/golang:1.26.1-alpine3.23 +#2 DONE 3.3s + +#3 [internal] load .dockerignore +#3 transferring context: 145B done +#3 DONE 0.0s + +#4 [build 1/7] FROM docker.io/library/golang:1.26.1-alpine3.23@sha256:2389ebfa5b7f43eeafbd6be0c3700cc46690ef842ad962f6c5bd6be49ed82039 +#4 resolve docker.io/library/golang:1.26.1-alpine3.23@sha256:2389ebfa5b7f43eeafbd6be0c3700cc46690ef842ad962f6c5bd6be49ed82039 done +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 329.68kB 0.0s done +#5 DONE 0.0s + +#6 [build 2/7] WORKDIR /src +#6 CACHED + +#7 [build 3/7] COPY go.mod go.sum ./ +#7 DONE 0.1s + +#8 [build 4/7] RUN go mod download +#8 DONE 56.6s + +#9 [build 5/7] COPY cmd/ ./cmd/ +#9 DONE 0.1s + +#10 [build 6/7] COPY internal/ ./internal/ +#10 DONE 0.0s + +#11 [build 7/7] RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/server ./cmd/server +#11 DONE 97.0s + +#12 [runtime 1/1] COPY --from=build /out/server /server +#12 DONE 0.1s + +#13 exporting to image +#13 exporting layers +#13 exporting layers 0.8s done +#13 exporting manifest sha256:ce262dcd1c98aff40067305e210037ae421e1da62f825a9066cdb13776f848d4 done +#13 exporting config sha256:9be8ec92531a22d2cef260b08669df6e8169d846aa47aaa709d50f1e602285cb done +#13 exporting attestation manifest sha256:e9483b1d5c76897b691143a16c09250fe5d0849edc41a42345792f8d1ea6cb3c 0.0s done +#13 exporting manifest list sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 0.0s done +#13 pushing layers +#13 ... + +#14 [auth] mtusi2026lab3:pull,push token for asisti.registry.twcstorage.ru +#14 DONE 0.0s + +#13 exporting to image +#13 pushing layers 19.7s done +#13 pushing manifest for asisti.registry.twcstorage.ru/mtusi2026lab3:review-20261029@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 +#13 pushing manifest for asisti.registry.twcstorage.ru/mtusi2026lab3:review-20261029@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3 1.2s done +#13 DONE 21.7s + +#15 resolving provenance for metadata file +#15 DONE 0.0s + +View build details: docker-desktop://dashboard/build/asisti-builder/asisti-builder0/ccwfu2v84bvpitu67b53xiunu diff --git a/evidence/review-20261029/contract.txt b/evidence/review-20261029/contract.txt new file mode 100644 index 00000000..9a553306 --- /dev/null +++ b/evidence/review-20261029/contract.txt @@ -0,0 +1,2 @@ +python3 scripts/check_contract.py +PASS: offline skeleton structure, local refs and Python syntax; application NOT tested. diff --git a/evidence/review-20261029/coverage-per-file.json b/evidence/review-20261029/coverage-per-file.json new file mode 100644 index 00000000..8c42e0d4 --- /dev/null +++ b/evidence/review-20261029/coverage-per-file.json @@ -0,0 +1,75 @@ +{"threshold_per_file":90,"files":[ +{"file":"internal/service/cursor.go","statements":0,"covered":0,"percent":null,"sha256":"cba6026849467d3662994d59983dd0d6a5ffbe9d934ff539115fd2669b89013f"}, +{"file":"cmd/server/app.go","statements":9,"covered":9,"percent":100.00000000,"sha256":"447460bce6ad010ecc4f191873cad6980f6d7c2a7665eed756d85d40aa0fad70"}, +{"file":"internal/service/production/members.go","statements":19,"covered":19,"percent":100.00000000,"sha256":"578da47ba2567a4fc44de3e087b2e60a6da17e0585ca6215187d5aa5783bfdc7"}, +{"file":"internal/service/production/errors.go","statements":5,"covered":5,"percent":100.00000000,"sha256":"723b0824177b313746dd02fcc9809403b75be128d98520dd69b8fc7cb0244b72"}, +{"file":"internal/controller/interface.go","statements":0,"covered":0,"percent":null,"sha256":"24b6b06d6fab919cd2130697b44fd0d358265184dca0ca8362e0b4fcc2ae5a68"}, +{"file":"internal/service/interface.go","statements":0,"covered":0,"percent":null,"sha256":"1012793cc519112340ee14dac945597da411d5b9f78ce5da6a25dd73ea72d8f6"}, +{"file":"internal/admission/limiter.go","statements":16,"covered":16,"percent":100.00000000,"sha256":"a373c9539167a4b7c35d45334d35ffd4e9d124c1740c88c12094fededd9643b4"}, +{"file":"internal/service/production/service.go","statements":10,"covered":10,"percent":100.00000000,"sha256":"7b24930b8fd7342b0373d687bb775163c332e6620ccc893516f865c433b59056"}, +{"file":"internal/hashring/ring.go","statements":21,"covered":20,"percent":95.23809524,"sha256":"e205901cec2e66011ec764b70879b0eb0d28a78c4dea8913a9fb30c2d778fa8c"}, +{"file":"internal/cursor/codec.go","statements":39,"covered":37,"percent":94.87179487,"sha256":"678e197744fb2fc4b51715f51593b98761125bbaddbe4cb1b7032bd6b173ef04"}, +{"file":"internal/controller/http/fiber/headers.go","statements":0,"covered":0,"percent":null,"sha256":"d32a9a01a8b391f4d986e14947a25a0504f4363335ea1524df05e0dd8e9e61bd"}, +{"file":"internal/store/memory/capacity.go","statements":7,"covered":7,"percent":100.00000000,"sha256":"4dbced908f9d1e802ece79d2a436cbbaa2bff807a19a5fc4bc658eb3f361a5e7"}, +{"file":"cmd/server/persistence.go","statements":18,"covered":18,"percent":100.00000000,"sha256":"a9bfa3bcc68d1b045ec21c193118bb209dfd7bdcbee3cbd28efc5573dc6db3c8"}, +{"file":"internal/service/errors.go","statements":0,"covered":0,"percent":null,"sha256":"f7fd9ca5335f9119d5ed1714c39c3d19e840528a0248fda5d08f60a10d2060ac"}, +{"file":"cmd/server/main.go","statements":3,"covered":3,"percent":100.00000000,"sha256":"c22d8cdf4ce31fde29945e967d3f025e280a7dc4d2022329d51be972d2a0f495"}, +{"file":"internal/controller/http/fiber/routes.go","statements":60,"covered":60,"percent":100.00000000,"sha256":"455d0b2a3fe2f7de947d499e99e660360395338a87d9225b5f8ac525862434fe"}, +{"file":"internal/controller/http/fiber/health.go","statements":7,"covered":7,"percent":100.00000000,"sha256":"813db79a23f6b093ccc510444c883b53f7f98e7d26c927441089f57c73fea12d"}, +{"file":"internal/config/controller.go","statements":25,"covered":24,"percent":96.00000000,"sha256":"c2736f1438746ff293197e002e4352a316987fee9c1307c3cc4190120971098c"}, +{"file":"internal/controller/http/fiber/metrics.go","statements":20,"covered":18,"percent":90.00000000,"sha256":"54db82201697bdfcc65712afe61b650f8f0885fc65222dc4cc6d1c3bb07d82dd"}, +{"file":"internal/config/memory.go","statements":11,"covered":11,"percent":100.00000000,"sha256":"86cdf9e90b576f4484946bfd9605333fc52077f38d3a39c5d71ddca4cdeecda0"}, +{"file":"internal/service/production/creation.go","statements":19,"covered":19,"percent":100.00000000,"sha256":"766f920addddaccdec25fae78728af56a825ab8c57eae29cc8839d85ab5a648f"}, +{"file":"internal/controller/http/fiber/configure.go","statements":7,"covered":7,"percent":100.00000000,"sha256":"be356cf26c228958d51f5bafa4305d7325e81ab01065575acbc9b2d7a6ddd4bd"}, +{"file":"internal/service/production/pages.go","statements":17,"covered":16,"percent":94.11764706,"sha256":"d4db6f0ad1caabc66f8bbb365e56cc84930047b640619bbe5f4e58fce0644877"}, +{"file":"internal/service/authentication/service.go","statements":48,"covered":47,"percent":97.91666667,"sha256":"8300ff37fbce6ce2985375e8c42c6d1793017b36cec8f27b0c0dc80ef2671b85"}, +{"file":"internal/password/password.go","statements":18,"covered":17,"percent":94.44444444,"sha256":"fe2df6990331573bbf0202ebc81c58263a7c16a29b713eefa0f0e852e4ee4a76"}, +{"file":"internal/controller/http/fiber/lifecycle.go","statements":24,"covered":22,"percent":91.66666667,"sha256":"f39cf7a0049a2ed39d6cc1fcc66b44656d9d6120914d0e973b032e12f3d0de08"}, +{"file":"cmd/server/logger.go","statements":10,"covered":9,"percent":90.00000000,"sha256":"93cd37b8e2ec1e6088b82f348a59e6862951f8462df4cd5448562489b05dce1f"}, +{"file":"internal/valkey/client.go","statements":35,"covered":34,"percent":97.14285714,"sha256":"67f32fa5bda94388c0a5fef87e93680a77a513de3a3b7522a38659acde088357"}, +{"file":"internal/strictjson/decode.go","statements":37,"covered":36,"percent":97.29729730,"sha256":"ef9bfaf3bd684fded87c92a15b3e5c706a794caf04cc4ef711c4185e9c7fb12a"}, +{"file":"internal/store/memory/messages.go","statements":19,"covered":18,"percent":94.73684211,"sha256":"36328ae3809af4fd0d10f4ab892e32c4643ad0c6b062aa9924ffd9e51c767500"}, +{"file":"internal/service/production/messages.go","statements":18,"covered":18,"percent":100.00000000,"sha256":"f25725720d7035a688ae4c5aaad34c6e78f3336fd927469570dc8a9a262608cd"}, +{"file":"internal/service/production/pagination.go","statements":21,"covered":21,"percent":100.00000000,"sha256":"eac2861f1743b692f7a6910949dad933d52db9b0211f3422dce09b3c7de49a49"}, +{"file":"internal/store/postgres/idempotency.go","statements":21,"covered":19,"percent":90.47619048,"sha256":"24d463067d1b51eaad5f7b21013be2ab836dea78f7314469779e2336cf57cb9c"}, +{"file":"internal/store/postgres/chats.go","statements":26,"covered":24,"percent":92.30769231,"sha256":"f191cc4d00d13a1e9c46323d545f3310ac2e7d23bb93d76060e282d1fbd220f3"}, +{"file":"internal/service/production/validation.go","statements":13,"covered":13,"percent":100.00000000,"sha256":"33970978507498dbba8e599ac20f7139a10f82705f86a7e058e668742ebefba2"}, +{"file":"internal/service/production/chats.go","statements":22,"covered":22,"percent":100.00000000,"sha256":"a6fce9188c52032fbc035bb08fc06c23b59fabf1534dc0a26205de72609ffbb6"}, +{"file":"internal/config/config.go","statements":17,"covered":17,"percent":100.00000000,"sha256":"8cb675a0bef8b1645071e4cb85b79a467620e99b375db5d8d3e16a54b4c5b5fa"}, +{"file":"cmd/server/commands.go","statements":16,"covered":16,"percent":100.00000000,"sha256":"2631df45b82c7cf99626ae6fe6c5b05ef18254b487d034ad98af26792e569bc8"}, +{"file":"internal/config/environment.go","statements":14,"covered":14,"percent":100.00000000,"sha256":"027761b059b76898a84318ec1a8b43158d8bafd6e0b15b52efbe902b4d8c5ea3"}, +{"file":"internal/valkey/cache.go","statements":19,"covered":18,"percent":94.73684211,"sha256":"25d3a4a4b47fbfedb5c9b31541f8818c7cee46407ba58d1068bdcd4590e72f12"}, +{"file":"internal/service/auth.go","statements":0,"covered":0,"percent":null,"sha256":"a6b0eb6d5759bf87bb2737ae07c9c916c749a107e6acb3542b63461363eb892f"}, +{"file":"internal/valkey/admission.go","statements":45,"covered":45,"percent":100.00000000,"sha256":"d2a4a93a0cffaadb18e94292f67a20e1d5113654e2f5ad55dae5d0009d74f4bb"}, +{"file":"internal/controller/http/fiber/auth.go","statements":29,"covered":29,"percent":100.00000000,"sha256":"8a7687d7ee133290f2bbead47796830caad1439990b60e940b625fede74a6837"}, +{"file":"cmd/server/healthcheck.go","statements":19,"covered":18,"percent":94.73684211,"sha256":"c62b7a6897b300e25fdcfd6650cd256f008207146f1a45c00d77f0db1ab01575"}, +{"file":"internal/store/memory/ordering.go","statements":6,"covered":6,"percent":100.00000000,"sha256":"93ce30f07bb6f056c9a355831b0e0ae7ec5a2cb0fa817bddeb17727c96edb491"}, +{"file":"internal/service/cache.go","statements":0,"covered":0,"percent":null,"sha256":"70bcf36246dc5cff0e3a726f20859dbab85d346dc35664c9f4ae125c23d8bfc9"}, +{"file":"internal/store/memory/chats.go","statements":31,"covered":31,"percent":100.00000000,"sha256":"9404b9576e041ad1d6fa4d297245c5224b7cc6f70272b7c99e9d531e7450519a"}, +{"file":"internal/controller/http/fiber/decode.go","statements":6,"covered":6,"percent":100.00000000,"sha256":"b02e9a9118e9ad0458ae98e79d6bc4d9a65f885bc4f6734a5a84d0cd9fa954f1"}, +{"file":"internal/controller/http/fiber/controller.go","statements":13,"covered":13,"percent":100.00000000,"sha256":"e6cba36cd5cb84e0f9b5dd2f1607704d3556f12c6a9cc92caa515e6d146338a3"}, +{"file":"internal/controller/http/fiber/public_errors.go","statements":13,"covered":13,"percent":100.00000000,"sha256":"18e1bbaa5ac64311e208c23ca3eca3fc543b48f5187b22313735b7df83603ce3"}, +{"file":"internal/controller/http/fiber/handlers.go","statements":37,"covered":36,"percent":97.29729730,"sha256":"0bdd0cfe8578e0e163cfe8945c57615b91d1990770a4d46a03c88c94996a0083"}, +{"file":"internal/store/postgres/sessions.go","statements":13,"covered":13,"percent":100.00000000,"sha256":"889a63b51b29012f4ae5499d1c0577fe29f2f2959b05629f8e123715cfc1f75f"}, +{"file":"internal/admission/distributed.go","statements":0,"covered":0,"percent":null,"sha256":"41ef40897886c0878cbfe52f6716bdcb8433fb7eaddcfff298e1d54c55db423d"}, +{"file":"internal/store/interface.go","statements":0,"covered":0,"percent":null,"sha256":"15ada2fcbbb06ce210e1978b0c2aa4316e9786c6b0252ceec80e169ae08c0fe9"}, +{"file":"internal/controller/http/fiber/middleware.go","statements":39,"covered":38,"percent":97.43589744,"sha256":"af6796f95b1e89cb053d2440b803d66d1a722280b8c46dc1a99a99fa92ac824a"}, +{"file":"internal/config/logger.go","statements":7,"covered":7,"percent":100.00000000,"sha256":"3a69e20a00fa2ed816f344a990e9e0ef0077e1607d4207858b4b00e4ff5d1988"}, +{"file":"internal/controller/http/fiber/errors.go","statements":29,"covered":29,"percent":100.00000000,"sha256":"60e09dd38fd1d413b744f21b57f64ba83e49a5ae1b4251aa5bf20be033f90cfb"}, +{"file":"internal/controller/http/fiber/error_codes.go","statements":0,"covered":0,"percent":null,"sha256":"3351a019c43d0360ee0fd68afabb5200422d065ae7bd908b1c0a5c02a0c1ad41"}, +{"file":"internal/store/postgres/store.go","statements":61,"covered":56,"percent":91.80327869,"sha256":"f50dbf2409c511f3b4b3cc72555a80e621e1ca1e4e314112ead35e1a34623de1"}, +{"file":"internal/store/postgres/users.go","statements":21,"covered":20,"percent":95.23809524,"sha256":"8c77a2ebc8e7cdf4bcaad173feb413fcfe2691e50bc61b0e70a5e8748f167ce6"}, +{"file":"internal/service/production/users.go","statements":19,"covered":19,"percent":100.00000000,"sha256":"b61747c3e5d7bee523ba82817a6a450e7f978fda4df10b8870d53a01bc4742d9"}, +{"file":"internal/model/http/models.go","statements":0,"covered":0,"percent":null,"sha256":"8c183b065bc3ab4cad20570eab79f334ca75a3309186fdf832fb1aa598894465"}, +{"file":"internal/model/dto/models.go","statements":0,"covered":0,"percent":null,"sha256":"23c3b9cf3de49c015a0eac85e19fb287ffdd3133de16035f74db34ec9a6df220"}, +{"file":"internal/config/persistence.go","statements":15,"covered":15,"percent":100.00000000,"sha256":"28c61d23db4ca2ef7ed952451f465318865076d2393eaa94ff5d7bb339c4c06b"}, +{"file":"internal/store/postgres/messages.go","statements":29,"covered":27,"percent":93.10344828,"sha256":"114f7f6dd12feb80e709e704a83f59d8c7f33fbd62e3a137f53219fa5f03d046"}, +{"file":"internal/model/dto/session.go","statements":0,"covered":0,"percent":null,"sha256":"896a694b0c217240343077d4287f4a6e447338c38571abbebcb3d16a519137fb"}, +{"file":"internal/controller/http/fiber/dependencies.go","statements":0,"covered":0,"percent":null,"sha256":"6ee07f110bdb29d8d2191ab8889ba60474b33a5b225739875c8a57d8434be15d"}, +{"file":"internal/store/memory/store.go","statements":3,"covered":3,"percent":100.00000000,"sha256":"973e451d35a79af4614a8727439bfdf5c72b55e03d904b59cb3f39ce0edcb83b"}, +{"file":"internal/service/production/access.go","statements":27,"covered":27,"percent":100.00000000,"sha256":"260f7c77bdbcb1913ebd487e531aa6bb1621d10cd1c4cad91ab34d11cd4fec16"}, +{"file":"internal/controller/fx.go","statements":1,"covered":1,"percent":100.00000000,"sha256":"af72da25fea9811c13a50c8133e9e8b35e070c5295069c40c0ae89cdc0aff19a"}, +{"file":"internal/store/memory/users.go","statements":22,"covered":21,"percent":95.45454545,"sha256":"494a5c8dda4d6a158bc3629f735c12cef36abfb19353d65380e0e4696de9284a"}, +{"file":"internal/controller/http/fiber/mapping.go","statements":19,"covered":19,"percent":100.00000000,"sha256":"cd79419f940868066dffbcc3cd8a024d4e0c9113785f89d7a3f2d6ff57223597"}, +{"file":"internal/controller/http/fiber/error_registry.go","statements":2,"covered":2,"percent":100.00000000,"sha256":"9d5da8d98ece2706e324cb2deca915e0811b6ad98f7aaac5805ca0f3cc0a1f9a"} +],"passed":true} diff --git a/evidence/review-20261029/coverage.txt b/evidence/review-20261029/coverage.txt new file mode 100644 index 00000000..218d6408 --- /dev/null +++ b/evidence/review-20261029/coverage.txt @@ -0,0 +1,95 @@ +GO="go" scripts/coverage.sh +warning: GOCOVERDIR not set, no coverage data emitted +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/cmd/server 3.093s coverage: 32.4% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/admission 2.051s coverage: 1.3% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config 2.048s coverage: 7.0% of statements in ./... + gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/controller coverage: 0.0% of statements +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/controller/http/fiber 2.423s coverage: 54.0% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor 2.568s coverage: 3.1% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/hashring 3.197s coverage: 1.7% of statements in ./... +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto [no test files] +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/http [no test files] +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/password 3.196s coverage: 1.4% of statements in ./... +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service [no test files] +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service/authentication 2.226s coverage: 4.5% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service/production 2.572s coverage: 18.0% of statements in ./... +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store [no test files] +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/memory 2.220s coverage: 7.7% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/postgres 3.680s coverage: 13.3% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/strictjson 2.539s coverage: 3.0% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/valkey 2.635s coverage: 9.7% of statements in ./... +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/student-tests 2.434s coverage: 0.0% of statements in ./... +PASS: lab3 public API scenario; infrastructure and grading evidence remain separate. + N/A internal/service/cursor.go + 100.00% cmd/server/app.go + 100.00% internal/service/production/members.go + 100.00% internal/service/production/errors.go + N/A internal/controller/interface.go + N/A internal/service/interface.go + 100.00% internal/admission/limiter.go + 100.00% internal/service/production/service.go + 95.24% internal/hashring/ring.go + 94.87% internal/cursor/codec.go + N/A internal/controller/http/fiber/headers.go + 100.00% internal/store/memory/capacity.go + 100.00% cmd/server/persistence.go + N/A internal/service/errors.go + 100.00% cmd/server/main.go + 100.00% internal/controller/http/fiber/routes.go + 100.00% internal/controller/http/fiber/health.go + 96.00% internal/config/controller.go + 90.00% internal/controller/http/fiber/metrics.go + 100.00% internal/config/memory.go + 100.00% internal/service/production/creation.go + 100.00% internal/controller/http/fiber/configure.go + 94.12% internal/service/production/pages.go + 97.92% internal/service/authentication/service.go + 94.44% internal/password/password.go + 91.67% internal/controller/http/fiber/lifecycle.go + 90.00% cmd/server/logger.go + 97.14% internal/valkey/client.go + 97.30% internal/strictjson/decode.go + 94.74% internal/store/memory/messages.go + 100.00% internal/service/production/messages.go + 100.00% internal/service/production/pagination.go + 90.48% internal/store/postgres/idempotency.go + 92.31% internal/store/postgres/chats.go + 100.00% internal/service/production/validation.go + 100.00% internal/service/production/chats.go + 100.00% internal/config/config.go + 100.00% cmd/server/commands.go + 100.00% internal/config/environment.go + 94.74% internal/valkey/cache.go + N/A internal/service/auth.go + 100.00% internal/valkey/admission.go + 100.00% internal/controller/http/fiber/auth.go + 94.74% cmd/server/healthcheck.go + 100.00% internal/store/memory/ordering.go + N/A internal/service/cache.go + 100.00% internal/store/memory/chats.go + 100.00% internal/controller/http/fiber/decode.go + 100.00% internal/controller/http/fiber/controller.go + 100.00% internal/controller/http/fiber/public_errors.go + 97.30% internal/controller/http/fiber/handlers.go + 100.00% internal/store/postgres/sessions.go + N/A internal/admission/distributed.go + N/A internal/store/interface.go + 97.44% internal/controller/http/fiber/middleware.go + 100.00% internal/config/logger.go + 100.00% internal/controller/http/fiber/errors.go + N/A internal/controller/http/fiber/error_codes.go + 91.80% internal/store/postgres/store.go + 95.24% internal/store/postgres/users.go + 100.00% internal/service/production/users.go + N/A internal/model/http/models.go + N/A internal/model/dto/models.go + 100.00% internal/config/persistence.go + 93.10% internal/store/postgres/messages.go + N/A internal/model/dto/session.go + N/A internal/controller/http/fiber/dependencies.go + 100.00% internal/store/memory/store.go + 100.00% internal/service/production/access.go + 100.00% internal/controller/fx.go + 95.45% internal/store/memory/users.go + 100.00% internal/controller/http/fiber/mapping.go + 100.00% internal/controller/http/fiber/error_registry.go diff --git a/evidence/review-20261029/deploy.txt b/evidence/review-20261029/deploy.txt new file mode 100644 index 00000000..feed43cb --- /dev/null +++ b/evidence/review-20261029/deploy.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Thu Oct 29 13:53:12 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 3 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/review-20261029/failover-1-20261029105415-delete.txt b/evidence/review-20261029/failover-1-20261029105415-delete.txt new file mode 100644 index 00000000..5cc6b346 --- /dev/null +++ b/evidence/review-20261029/failover-1-20261029105415-delete.txt @@ -0,0 +1 @@ +pod "api-54f7cc6f98-7c56z" deleted from highload-applications namespace diff --git a/evidence/review-20261029/failover-1-20261029105415-run.txt b/evidence/review-20261029/failover-1-20261029105415-run.txt new file mode 100644 index 00000000..d177a0f6 --- /dev/null +++ b/evidence/review-20261029/failover-1-20261029105415-run.txt @@ -0,0 +1,2 @@ +configmap/load-scripts configured +job.batch/load-failover-1-20261029105415 created diff --git a/evidence/review-20261029/failover-1-20261029105415-stop-epoch.txt b/evidence/review-20261029/failover-1-20261029105415-stop-epoch.txt new file mode 100644 index 00000000..3512ea0b --- /dev/null +++ b/evidence/review-20261029/failover-1-20261029105415-stop-epoch.txt @@ -0,0 +1 @@ +1793271261.339473 diff --git a/evidence/review-20261029/failover-1-20261029105415-summary.json b/evidence/review-20261029/failover-1-20261029105415-summary.json new file mode 100644 index 00000000..5f8ef757 --- /dev/null +++ b/evidence/review-20261029/failover-1-20261029105415-summary.json @@ -0,0 +1,10 @@ +{ + "target": "api-54f7cc6f98-7c56z", + "started_epoch_ms": 1793271259858, + "confirmed": 44, + "reads": 42, + "errors": 5, + "pass": true, + "recovery_seconds": 0.19, + "confirmed_rps": 1.72 +} diff --git a/evidence/review-20261029/failover-1-20261029105415-target.json b/evidence/review-20261029/failover-1-20261029105415-target.json new file mode 100644 index 00000000..1067a01f --- /dev/null +++ b/evidence/review-20261029/failover-1-20261029105415-target.json @@ -0,0 +1,329 @@ +{ + "apiVersion": "v1", + "kind": "Pod", + "metadata": { + "annotations": { + "checksum/config": "25be752194917b470e363f8148d7f90539ac1e677c53d10066d788634e0933dc", + "cni.projectcalico.org/containerID": "c9f317c330be89a87aabd36ab90ea573f7472d51084b1e685eb5b11362a91557", + "cni.projectcalico.org/podIP": "10.1.25.114/32", + "cni.projectcalico.org/podIPs": "10.1.25.114/32", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": "2026-10-29T10:53:14Z", + "generateName": "api-54f7cc6f98-", + "generation": 1, + "labels": { + "app": "api", + "pod-template-hash": "54f7cc6f98" + }, + "name": "api-54f7cc6f98-7c56z", + "namespace": "highload-applications", + "ownerReferences": [ + { + "apiVersion": "apps/v1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "ReplicaSet", + "name": "api-54f7cc6f98", + "uid": "9a9710e1-f5e8-456c-a8d9-6a6a06fe4839" + } + ], + "resourceVersion": "60154912", + "uid": "9ba114d8-8300-4035-8f6e-4a488ef1b88e" + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "256Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File", + "volumeMounts": [ + { + "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", + "name": "kube-api-access-ddq2s", + "readOnly": true + } + ] + } + ], + "dnsPolicy": "ClusterFirst", + "enableServiceLinks": true, + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeName": "dev.asisti.tech", + "preemptionPolicy": "PreemptLowerPriority", + "priority": 0, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "serviceAccount": "default", + "serviceAccountName": "default", + "terminationGracePeriodSeconds": 20, + "tolerations": [ + { + "effect": "NoExecute", + "key": "node.kubernetes.io/not-ready", + "operator": "Exists", + "tolerationSeconds": 300 + }, + { + "effect": "NoExecute", + "key": "node.kubernetes.io/unreachable", + "operator": "Exists", + "tolerationSeconds": 300 + } + ], + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ], + "volumes": [ + { + "name": "kube-api-access-ddq2s", + "projected": { + "defaultMode": 420, + "sources": [ + { + "serviceAccountToken": { + "expirationSeconds": 3607, + "path": "token" + } + }, + { + "configMap": { + "items": [ + { + "key": "ca.crt", + "path": "ca.crt" + } + ], + "name": "kube-root-ca.crt" + } + }, + { + "downwardAPI": { + "items": [ + { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.namespace" + }, + "path": "namespace" + } + ] + } + } + ] + } + } + ] + }, + "status": { + "conditions": [ + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:19Z", + "status": "True", + "type": "PodReadyToStartContainers" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:14Z", + "status": "True", + "type": "Initialized" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:35Z", + "status": "True", + "type": "Ready" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:35Z", + "status": "True", + "type": "ContainersReady" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:14Z", + "status": "True", + "type": "PodScheduled" + } + ], + "containerStatuses": [ + { + "allocatedResources": { + "cpu": "250m", + "memory": "128Mi" + }, + "containerID": "containerd://4631cb93f41b3636e0662a05dae721ef528e603889d8bfb964d9988d33b4cd82", + "image": "sha256:9be8ec92531a22d2cef260b08669df6e8169d846aa47aaa709d50f1e602285cb", + "imageID": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "lastState": {}, + "name": "api", + "ready": true, + "resources": { + "limits": { + "cpu": "1", + "memory": "256Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "restartCount": 0, + "started": true, + "state": { + "running": { + "startedAt": "2026-10-29T10:53:33Z" + } + }, + "volumeMounts": [ + { + "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", + "name": "kube-api-access-ddq2s", + "readOnly": true, + "recursiveReadOnly": "Disabled" + } + ] + } + ], + "hostIP": "100.99.166.40", + "hostIPs": [ + { + "ip": "100.99.166.40" + } + ], + "phase": "Running", + "podIP": "10.1.25.114", + "podIPs": [ + { + "ip": "10.1.25.114" + } + ], + "qosClass": "Burstable", + "startTime": "2026-10-29T10:53:14Z" + } +} diff --git a/evidence/review-20261029/failover-2-20261029105524-delete.txt b/evidence/review-20261029/failover-2-20261029105524-delete.txt new file mode 100644 index 00000000..dae4a4dc --- /dev/null +++ b/evidence/review-20261029/failover-2-20261029105524-delete.txt @@ -0,0 +1 @@ +pod "api-54f7cc6f98-txlh4" deleted from highload-applications namespace diff --git a/evidence/review-20261029/failover-2-20261029105524-restored.txt b/evidence/review-20261029/failover-2-20261029105524-restored.txt new file mode 100644 index 00000000..35f0316d --- /dev/null +++ b/evidence/review-20261029/failover-2-20261029105524-restored.txt @@ -0,0 +1 @@ +deployment "api" successfully rolled out diff --git a/evidence/review-20261029/failover-2-20261029105524-run.txt b/evidence/review-20261029/failover-2-20261029105524-run.txt new file mode 100644 index 00000000..cd6310c5 --- /dev/null +++ b/evidence/review-20261029/failover-2-20261029105524-run.txt @@ -0,0 +1,2 @@ +configmap/load-scripts configured +job.batch/load-failover-2-20261029105524 created diff --git a/evidence/review-20261029/failover-2-20261029105524-stop-epoch.txt b/evidence/review-20261029/failover-2-20261029105524-stop-epoch.txt new file mode 100644 index 00000000..09dd250d --- /dev/null +++ b/evidence/review-20261029/failover-2-20261029105524-stop-epoch.txt @@ -0,0 +1 @@ +1793271332.256543 diff --git a/evidence/review-20261029/failover-2-20261029105524-summary.json b/evidence/review-20261029/failover-2-20261029105524-summary.json new file mode 100644 index 00000000..61ce6552 --- /dev/null +++ b/evidence/review-20261029/failover-2-20261029105524-summary.json @@ -0,0 +1,10 @@ +{ + "target": "api-54f7cc6f98-txlh4", + "started_epoch_ms": 1793271329571, + "confirmed": 21, + "reads": 19, + "errors": 7, + "pass": true, + "recovery_seconds": 2.547, + "confirmed_rps": 0.8 +} diff --git a/evidence/review-20261029/failover-2-20261029105524-target.json b/evidence/review-20261029/failover-2-20261029105524-target.json new file mode 100644 index 00000000..6e91c7c7 --- /dev/null +++ b/evidence/review-20261029/failover-2-20261029105524-target.json @@ -0,0 +1,329 @@ +{ + "apiVersion": "v1", + "kind": "Pod", + "metadata": { + "annotations": { + "checksum/config": "25be752194917b470e363f8148d7f90539ac1e677c53d10066d788634e0933dc", + "cni.projectcalico.org/containerID": "64c7decc0fbadc6eb0b82c66ce1b69fc6e2ef13c27607b8b0cc621c1464300b0", + "cni.projectcalico.org/podIP": "10.1.112.79/32", + "cni.projectcalico.org/podIPs": "10.1.112.79/32", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": "2026-10-29T10:53:35Z", + "generateName": "api-54f7cc6f98-", + "generation": 1, + "labels": { + "app": "api", + "pod-template-hash": "54f7cc6f98" + }, + "name": "api-54f7cc6f98-txlh4", + "namespace": "highload-applications", + "ownerReferences": [ + { + "apiVersion": "apps/v1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "ReplicaSet", + "name": "api-54f7cc6f98", + "uid": "9a9710e1-f5e8-456c-a8d9-6a6a06fe4839" + } + ], + "resourceVersion": "60155416", + "uid": "e9c4add7-fd67-4650-a4a2-29ca5b9fd550" + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "256Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File", + "volumeMounts": [ + { + "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", + "name": "kube-api-access-mnrp5", + "readOnly": true + } + ] + } + ], + "dnsPolicy": "ClusterFirst", + "enableServiceLinks": true, + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeName": "marlosrv0", + "preemptionPolicy": "PreemptLowerPriority", + "priority": 0, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "serviceAccount": "default", + "serviceAccountName": "default", + "terminationGracePeriodSeconds": 20, + "tolerations": [ + { + "effect": "NoExecute", + "key": "node.kubernetes.io/not-ready", + "operator": "Exists", + "tolerationSeconds": 300 + }, + { + "effect": "NoExecute", + "key": "node.kubernetes.io/unreachable", + "operator": "Exists", + "tolerationSeconds": 300 + } + ], + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ], + "volumes": [ + { + "name": "kube-api-access-mnrp5", + "projected": { + "defaultMode": 420, + "sources": [ + { + "serviceAccountToken": { + "expirationSeconds": 3607, + "path": "token" + } + }, + { + "configMap": { + "items": [ + { + "key": "ca.crt", + "path": "ca.crt" + } + ], + "name": "kube-root-ca.crt" + } + }, + { + "downwardAPI": { + "items": [ + { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.namespace" + }, + "path": "namespace" + } + ] + } + } + ] + } + } + ] + }, + "status": { + "conditions": [ + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:39Z", + "status": "True", + "type": "PodReadyToStartContainers" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:35Z", + "status": "True", + "type": "Initialized" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:55:30Z", + "status": "True", + "type": "Ready" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:55:30Z", + "status": "True", + "type": "ContainersReady" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:35Z", + "status": "True", + "type": "PodScheduled" + } + ], + "containerStatuses": [ + { + "allocatedResources": { + "cpu": "250m", + "memory": "128Mi" + }, + "containerID": "containerd://dd8482e1e67dc153f5787894d4974b39d5e7fead678a7e6695974297d0b75591", + "image": "sha256:9be8ec92531a22d2cef260b08669df6e8169d846aa47aaa709d50f1e602285cb", + "imageID": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "lastState": {}, + "name": "api", + "ready": true, + "resources": { + "limits": { + "cpu": "1", + "memory": "256Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "restartCount": 0, + "started": true, + "state": { + "running": { + "startedAt": "2026-10-29T10:53:39Z" + } + }, + "volumeMounts": [ + { + "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", + "name": "kube-api-access-mnrp5", + "readOnly": true, + "recursiveReadOnly": "Disabled" + } + ] + } + ], + "hostIP": "192.168.1.37", + "hostIPs": [ + { + "ip": "192.168.1.37" + } + ], + "phase": "Running", + "podIP": "10.1.112.79", + "podIPs": [ + { + "ip": "10.1.112.79" + } + ], + "qosClass": "Burstable", + "startTime": "2026-10-29T10:53:35Z" + } +} diff --git a/evidence/review-20261029/final-deployment.json b/evidence/review-20261029/final-deployment.json new file mode 100644 index 00000000..7e4bddfa --- /dev/null +++ b/evidence/review-20261029/final-deployment.json @@ -0,0 +1,214 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "deployment.kubernetes.io/revision": "34", + "meta.helm.sh/release-name": "lab2", + "meta.helm.sh/release-namespace": "highload-applications" + }, + "creationTimestamp": "2026-10-16T07:38:22Z", + "generation": 52, + "labels": { + "app.kubernetes.io/managed-by": "Helm" + }, + "name": "api", + "namespace": "highload-applications", + "resourceVersion": "60177495", + "uid": "5e9bf549-45c6-40b4-b86e-d5d14a1cb5bc" + }, + "spec": { + "progressDeadlineSeconds": 600, + "replicas": 2, + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "app": "api" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 0 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "annotations": { + "checksum/config": "25be752194917b470e363f8148d7f90539ac1e677c53d10066d788634e0933dc", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": null, + "labels": { + "app": "api" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "256Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "terminationGracePeriodSeconds": 20, + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ] + } + } + }, + "status": { + "availableReplicas": 2, + "conditions": [ + { + "lastTransitionTime": "2026-10-16T07:38:22Z", + "lastUpdateTime": "2026-10-29T12:21:54Z", + "message": "ReplicaSet \"api-54f7cc6f98\" has successfully progressed.", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + }, + { + "lastTransitionTime": "2026-10-29T12:24:53Z", + "lastUpdateTime": "2026-10-29T12:24:53Z", + "message": "Deployment has minimum availability.", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + } + ], + "observedGeneration": 52, + "readyReplicas": 2, + "replicas": 2, + "updatedReplicas": 2 + } +} diff --git a/evidence/review-20261029/final-rollout.txt b/evidence/review-20261029/final-rollout.txt new file mode 100644 index 00000000..35f0316d --- /dev/null +++ b/evidence/review-20261029/final-rollout.txt @@ -0,0 +1 @@ +deployment "api" successfully rolled out diff --git a/evidence/review-20261029/final-smoke-retry.txt b/evidence/review-20261029/final-smoke-retry.txt new file mode 100644 index 00000000..d64ab8ff --- /dev/null +++ b/evidence/review-20261029/final-smoke-retry.txt @@ -0,0 +1,3 @@ +python3 tests/smoke.py --base-url "https://hl.agapov.space" +FAIL: POST /api/v1/auth/sessions: connection/TLS failure (URLError) +make: *** [test] Error 1 diff --git a/evidence/review-20261029/final-smoke.txt b/evidence/review-20261029/final-smoke.txt new file mode 100644 index 00000000..c1486ae1 --- /dev/null +++ b/evidence/review-20261029/final-smoke.txt @@ -0,0 +1,3 @@ +python3 tests/smoke.py --base-url "https://hl.agapov.space" +FAIL: POST /api/v1/users: connection/TLS failure (URLError) +make: *** [test] Error 1 diff --git a/evidence/review-20261029/go-version.txt b/evidence/review-20261029/go-version.txt new file mode 100644 index 00000000..f24c583a --- /dev/null +++ b/evidence/review-20261029/go-version.txt @@ -0,0 +1 @@ +go version go1.27.1 darwin/arm64 diff --git a/evidence/review-20261029/helm-lint.txt b/evidence/review-20261029/helm-lint.txt new file mode 100644 index 00000000..da8e6a67 --- /dev/null +++ b/evidence/review-20261029/helm-lint.txt @@ -0,0 +1,4 @@ +==> Linting charts/messenger +[INFO] Chart.yaml: icon is recommended + +1 chart(s) linted, 0 chart(s) failed diff --git a/evidence/review-20261029/helm-version.txt b/evidence/review-20261029/helm-version.txt new file mode 100644 index 00000000..9efc478f --- /dev/null +++ b/evidence/review-20261029/helm-version.txt @@ -0,0 +1 @@ +v4.3.1+gc0d08d0 diff --git a/evidence/review-20261029/image.json b/evidence/review-20261029/image.json new file mode 100644 index 00000000..9afcdf46 --- /dev/null +++ b/evidence/review-20261029/image.json @@ -0,0 +1,20 @@ +{ + "buildx.build.provenance": { + "buildType": "", + "invocation": { + "configSource": {}, + "parameters": {}, + "environment": { + "platform": "" + } + } + }, + "buildx.build.ref": "asisti-builder/asisti-builder0/ccwfu2v84bvpitu67b53xiunu", + "containerimage.descriptor": { + "mediaType": "application/vnd.oci.image.index.v1+json", + "digest": "sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "size": 855 + }, + "containerimage.digest": "sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "image.name": "asisti.registry.twcstorage.ru/mtusi2026lab3:review-20261029" +} \ No newline at end of file diff --git a/evidence/review-20261029/initial-api.json b/evidence/review-20261029/initial-api.json new file mode 100644 index 00000000..accf8bee --- /dev/null +++ b/evidence/review-20261029/initial-api.json @@ -0,0 +1,667 @@ +{ + "apiVersion": "v1", + "items": [ + { + "apiVersion": "v1", + "kind": "Pod", + "metadata": { + "annotations": { + "checksum/config": "25be752194917b470e363f8148d7f90539ac1e677c53d10066d788634e0933dc", + "cni.projectcalico.org/containerID": "c9f317c330be89a87aabd36ab90ea573f7472d51084b1e685eb5b11362a91557", + "cni.projectcalico.org/podIP": "10.1.25.114/32", + "cni.projectcalico.org/podIPs": "10.1.25.114/32", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": "2026-10-29T10:53:14Z", + "generateName": "api-54f7cc6f98-", + "generation": 1, + "labels": { + "app": "api", + "pod-template-hash": "54f7cc6f98" + }, + "name": "api-54f7cc6f98-7c56z", + "namespace": "highload-applications", + "ownerReferences": [ + { + "apiVersion": "apps/v1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "ReplicaSet", + "name": "api-54f7cc6f98", + "uid": "9a9710e1-f5e8-456c-a8d9-6a6a06fe4839" + } + ], + "resourceVersion": "60154912", + "uid": "9ba114d8-8300-4035-8f6e-4a488ef1b88e" + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "256Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File", + "volumeMounts": [ + { + "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", + "name": "kube-api-access-ddq2s", + "readOnly": true + } + ] + } + ], + "dnsPolicy": "ClusterFirst", + "enableServiceLinks": true, + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeName": "dev.asisti.tech", + "preemptionPolicy": "PreemptLowerPriority", + "priority": 0, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "serviceAccount": "default", + "serviceAccountName": "default", + "terminationGracePeriodSeconds": 20, + "tolerations": [ + { + "effect": "NoExecute", + "key": "node.kubernetes.io/not-ready", + "operator": "Exists", + "tolerationSeconds": 300 + }, + { + "effect": "NoExecute", + "key": "node.kubernetes.io/unreachable", + "operator": "Exists", + "tolerationSeconds": 300 + } + ], + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ], + "volumes": [ + { + "name": "kube-api-access-ddq2s", + "projected": { + "defaultMode": 420, + "sources": [ + { + "serviceAccountToken": { + "expirationSeconds": 3607, + "path": "token" + } + }, + { + "configMap": { + "items": [ + { + "key": "ca.crt", + "path": "ca.crt" + } + ], + "name": "kube-root-ca.crt" + } + }, + { + "downwardAPI": { + "items": [ + { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.namespace" + }, + "path": "namespace" + } + ] + } + } + ] + } + } + ] + }, + "status": { + "conditions": [ + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:19Z", + "status": "True", + "type": "PodReadyToStartContainers" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:14Z", + "status": "True", + "type": "Initialized" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:35Z", + "status": "True", + "type": "Ready" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:35Z", + "status": "True", + "type": "ContainersReady" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:14Z", + "status": "True", + "type": "PodScheduled" + } + ], + "containerStatuses": [ + { + "allocatedResources": { + "cpu": "250m", + "memory": "128Mi" + }, + "containerID": "containerd://4631cb93f41b3636e0662a05dae721ef528e603889d8bfb964d9988d33b4cd82", + "image": "sha256:9be8ec92531a22d2cef260b08669df6e8169d846aa47aaa709d50f1e602285cb", + "imageID": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "lastState": {}, + "name": "api", + "ready": true, + "resources": { + "limits": { + "cpu": "1", + "memory": "256Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "restartCount": 0, + "started": true, + "state": { + "running": { + "startedAt": "2026-10-29T10:53:33Z" + } + }, + "volumeMounts": [ + { + "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", + "name": "kube-api-access-ddq2s", + "readOnly": true, + "recursiveReadOnly": "Disabled" + } + ] + } + ], + "hostIP": "100.99.166.40", + "hostIPs": [ + { + "ip": "100.99.166.40" + } + ], + "phase": "Running", + "podIP": "10.1.25.114", + "podIPs": [ + { + "ip": "10.1.25.114" + } + ], + "qosClass": "Burstable", + "startTime": "2026-10-29T10:53:14Z" + } + }, + { + "apiVersion": "v1", + "kind": "Pod", + "metadata": { + "annotations": { + "checksum/config": "25be752194917b470e363f8148d7f90539ac1e677c53d10066d788634e0933dc", + "cni.projectcalico.org/containerID": "64c7decc0fbadc6eb0b82c66ce1b69fc6e2ef13c27607b8b0cc621c1464300b0", + "cni.projectcalico.org/podIP": "10.1.112.79/32", + "cni.projectcalico.org/podIPs": "10.1.112.79/32", + "kubectl.kubernetes.io/restartedAt": "2026-10-16T11:50:37+03:00" + }, + "creationTimestamp": "2026-10-29T10:53:35Z", + "generateName": "api-54f7cc6f98-", + "generation": 1, + "labels": { + "app": "api", + "pod-template-hash": "54f7cc6f98" + }, + "name": "api-54f7cc6f98-txlh4", + "namespace": "highload-applications", + "ownerReferences": [ + { + "apiVersion": "apps/v1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "ReplicaSet", + "name": "api-54f7cc6f98", + "uid": "9a9710e1-f5e8-456c-a8d9-6a6a06fe4839" + } + ], + "resourceVersion": "60154970", + "uid": "e9c4add7-fd67-4650-a4a2-29ca5b9fd550" + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "INSTANCE_ID", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.name" + } + } + }, + { + "name": "CURSOR_SIGNING_KEY", + "valueFrom": { + "secretKeyRef": { + "key": "cursor-key", + "name": "messenger-secrets" + } + } + }, + { + "name": "DATABASE_URL", + "valueFrom": { + "secretKeyRef": { + "key": "database-url", + "name": "messenger-secrets" + } + } + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "messenger-config" + } + } + ], + "image": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "imagePullPolicy": "IfNotPresent", + "lifecycle": { + "preStop": { + "sleep": { + "seconds": 3 + } + } + }, + "livenessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/health/live", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 5, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "api", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "readinessProbe": { + "failureThreshold": 2, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 2 + }, + "resources": { + "limits": { + "cpu": "1", + "memory": "256Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "securityContext": { + "allowPrivilegeEscalation": false, + "capabilities": { + "drop": [ + "ALL" + ] + }, + "readOnlyRootFilesystem": true + }, + "startupProbe": { + "failureThreshold": 30, + "httpGet": { + "path": "/health/ready", + "port": 8080, + "scheme": "HTTP" + }, + "periodSeconds": 2, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File", + "volumeMounts": [ + { + "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", + "name": "kube-api-access-mnrp5", + "readOnly": true + } + ] + } + ], + "dnsPolicy": "ClusterFirst", + "enableServiceLinks": true, + "imagePullSecrets": [ + { + "name": "registry-pull" + } + ], + "nodeName": "marlosrv0", + "preemptionPolicy": "PreemptLowerPriority", + "priority": 0, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": { + "runAsNonRoot": true, + "runAsUser": 65532, + "seccompProfile": { + "type": "RuntimeDefault" + } + }, + "serviceAccount": "default", + "serviceAccountName": "default", + "terminationGracePeriodSeconds": 20, + "tolerations": [ + { + "effect": "NoExecute", + "key": "node.kubernetes.io/not-ready", + "operator": "Exists", + "tolerationSeconds": 300 + }, + { + "effect": "NoExecute", + "key": "node.kubernetes.io/unreachable", + "operator": "Exists", + "tolerationSeconds": 300 + } + ], + "topologySpreadConstraints": [ + { + "labelSelector": { + "matchLabels": { + "app": "api" + } + }, + "maxSkew": 1, + "topologyKey": "kubernetes.io/hostname", + "whenUnsatisfiable": "ScheduleAnyway" + } + ], + "volumes": [ + { + "name": "kube-api-access-mnrp5", + "projected": { + "defaultMode": 420, + "sources": [ + { + "serviceAccountToken": { + "expirationSeconds": 3607, + "path": "token" + } + }, + { + "configMap": { + "items": [ + { + "key": "ca.crt", + "path": "ca.crt" + } + ], + "name": "kube-root-ca.crt" + } + }, + { + "downwardAPI": { + "items": [ + { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.namespace" + }, + "path": "namespace" + } + ] + } + } + ] + } + } + ] + }, + "status": { + "conditions": [ + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:39Z", + "status": "True", + "type": "PodReadyToStartContainers" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:35Z", + "status": "True", + "type": "Initialized" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:40Z", + "status": "True", + "type": "Ready" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:40Z", + "status": "True", + "type": "ContainersReady" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2026-10-29T10:53:35Z", + "status": "True", + "type": "PodScheduled" + } + ], + "containerStatuses": [ + { + "allocatedResources": { + "cpu": "250m", + "memory": "128Mi" + }, + "containerID": "containerd://dd8482e1e67dc153f5787894d4974b39d5e7fead678a7e6695974297d0b75591", + "image": "sha256:9be8ec92531a22d2cef260b08669df6e8169d846aa47aaa709d50f1e602285cb", + "imageID": "asisti.registry.twcstorage.ru/mtusi2026lab3@sha256:6f1cf88f0a53728819d0489804b4155942c1cc78596307e43f2adc2ad527f0e3", + "lastState": {}, + "name": "api", + "ready": true, + "resources": { + "limits": { + "cpu": "1", + "memory": "256Mi" + }, + "requests": { + "cpu": "250m", + "memory": "128Mi" + } + }, + "restartCount": 0, + "started": true, + "state": { + "running": { + "startedAt": "2026-10-29T10:53:39Z" + } + }, + "volumeMounts": [ + { + "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", + "name": "kube-api-access-mnrp5", + "readOnly": true, + "recursiveReadOnly": "Disabled" + } + ] + } + ], + "hostIP": "192.168.1.37", + "hostIPs": [ + { + "ip": "192.168.1.37" + } + ], + "phase": "Running", + "podIP": "10.1.112.79", + "podIPs": [ + { + "ip": "10.1.112.79" + } + ], + "qosClass": "Burstable", + "startTime": "2026-10-29T10:53:35Z" + } + } + ], + "kind": "List", + "metadata": { + "resourceVersion": "" + } +} diff --git a/evidence/review-20261029/kubernetes-version.json b/evidence/review-20261029/kubernetes-version.json new file mode 100644 index 00000000..b86321cb --- /dev/null +++ b/evidence/review-20261029/kubernetes-version.json @@ -0,0 +1,29 @@ +{ + "clientVersion": { + "major": "1", + "minor": "37", + "gitVersion": "v1.37.1", + "gitCommit": "f78e722310e50bcaca9276be22276d9e91d91308", + "gitTreeState": "clean", + "buildDate": "2026-09-23T17:06:22Z", + "goVersion": "go1.26.8", + "compiler": "gc", + "platform": "darwin/arm64" + }, + "kustomizeVersion": "v5.8.1", + "serverVersion": { + "major": "1", + "minor": "33", + "emulationMajor": "1", + "emulationMinor": "33", + "minCompatibilityMajor": "1", + "minCompatibilityMinor": "32", + "gitVersion": "v1.33.13", + "gitCommit": "c029d48d28322ad0369aabdcf8b656fd3195cd30", + "gitTreeState": "clean", + "buildDate": "2026-06-22T07:16:30Z", + "goVersion": "go1.25.11", + "compiler": "gc", + "platform": "linux/amd64" + } +} diff --git a/evidence/review-20261029/lint.txt b/evidence/review-20261029/lint.txt new file mode 100644 index 00000000..6a3ebaa7 --- /dev/null +++ b/evidence/review-20261029/lint.txt @@ -0,0 +1 @@ +0 issues. diff --git a/evidence/review-20261029/load-failover-1-20261029105415.txt b/evidence/review-20261029/load-failover-1-20261029105415.txt new file mode 100644 index 00000000..5cde67ab --- /dev/null +++ b/evidence/review-20261029/load-failover-1-20261029105415.txt @@ -0,0 +1,29 @@ +time="2026-10-29T10:54:19Z" level=info msg="READY_TO_STOP api-54f7cc6f98-7c56z" source=console +time="2026-10-29T10:54:29Z" level=warning msg="Request Failed" error="Post \"https://hl.agapov.space/api/v1/chats/180f9552-ab33-4ee2-917c-47b3a9c17ed8/messages\": request timeout" +time="2026-10-29T10:54:31Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/api/v1/chats/180f9552-ab33-4ee2-917c-47b3a9c17ed8/messages?limit=100\": request timeout" +time="2026-10-29T10:54:33Z" level=warning msg="Request Failed" error="Post \"https://hl.agapov.space/api/v1/chats/180f9552-ab33-4ee2-917c-47b3a9c17ed8/messages\": request timeout" +time="2026-10-29T10:54:35Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/api/v1/chats/180f9552-ab33-4ee2-917c-47b3a9c17ed8/messages?limit=100\": request timeout" +time="2026-10-29T10:54:37Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/api/v1/chats/180f9552-ab33-4ee2-917c-47b3a9c17ed8/messages?limit=100\": request timeout" +time="2026-10-29T10:54:44Z" level=info msg="{\"target\":\"api-54f7cc6f98-7c56z\",\"started_epoch_ms\":1793271259858,\"confirmed\":44,\"reads\":42,\"errors\":5,\"events\":[{\"seconds\":0.602,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":1.191,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":1.671,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":1.969,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":2.61,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":3.313,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":4.104,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":4.584,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":4.835,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":5.156,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":5.41,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":5.64,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":5.866,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":6.084,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":6.294,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":6.477,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":6.709,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":6.906,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":7.081,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":15.6,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":17.893,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":18.63,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":19.066,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":19.505,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":20.093,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":20.642,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":21.21,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":21.538,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":21.937,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":22.234,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":22.503,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":22.801,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":23.015,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":23.197,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":23.365,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":23.542,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":23.723,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":23.914,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":24.095,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":24.293,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":24.517,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":24.71,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":24.897,\"instance\":\"api-54f7cc6f98-4xgnf\"}],\"pass\":true}" source=console + + + █ TOTAL RESULTS + + HTTP + http_req_duration..............: avg=193.89ms min=24.17ms med=78.6ms max=2s p(90)=317.93ms p(95)=506.05ms + { expected_response:true }...: avg=111.7ms min=24.17ms med=76.47ms max=591.34ms p(90)=246.96ms p(95)=351.41ms + http_req_failed................: 4.34% 5 out of 115 + http_reqs......................: 115 4.163984/s + + EXECUTION + iteration_duration.............: avg=25.11s min=25.11s med=25.11s max=25.11s p(90)=25.11s p(95)=25.11s + iterations.....................: 1 0.036209/s + vus............................: 1 min=0 max=1 + vus_max........................: 1 min=1 max=1 + + NETWORK + data_received..................: 246 kB 8.9 kB/s + data_sent......................: 11 kB 387 B/s + + + diff --git a/evidence/review-20261029/load-failover-2-20261029105524.txt b/evidence/review-20261029/load-failover-2-20261029105524.txt new file mode 100644 index 00000000..053d1ae5 --- /dev/null +++ b/evidence/review-20261029/load-failover-2-20261029105524.txt @@ -0,0 +1,31 @@ +time="2026-10-29T10:55:29Z" level=info msg="READY_TO_STOP api-54f7cc6f98-txlh4" source=console +time="2026-10-29T10:55:38Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/api/v1/chats/c92c898b-5596-47dd-90a8-8b54b127762a/messages?limit=100\": request timeout" +time="2026-10-29T10:55:40Z" level=warning msg="Request Failed" error="Post \"https://hl.agapov.space/api/v1/chats/c92c898b-5596-47dd-90a8-8b54b127762a/messages\": request timeout" +time="2026-10-29T10:55:42Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/api/v1/chats/c92c898b-5596-47dd-90a8-8b54b127762a/messages?limit=100\": request timeout" +time="2026-10-29T10:55:44Z" level=warning msg="Request Failed" error="Post \"https://hl.agapov.space/api/v1/chats/c92c898b-5596-47dd-90a8-8b54b127762a/messages\": request timeout" +time="2026-10-29T10:55:46Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/api/v1/chats/c92c898b-5596-47dd-90a8-8b54b127762a/messages?limit=100\": request timeout" +time="2026-10-29T10:55:48Z" level=warning msg="Request Failed" error="Post \"https://hl.agapov.space/api/v1/chats/c92c898b-5596-47dd-90a8-8b54b127762a/messages\": request timeout" +time="2026-10-29T10:55:50Z" level=warning msg="Request Failed" error="Get \"https://hl.agapov.space/api/v1/chats/c92c898b-5596-47dd-90a8-8b54b127762a/messages?limit=100\": request timeout" +time="2026-10-29T10:55:54Z" level=info msg="{\"target\":\"api-54f7cc6f98-txlh4\",\"started_epoch_ms\":1793271329571,\"confirmed\":21,\"reads\":19,\"errors\":7,\"events\":[{\"seconds\":0.319,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":0.62,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":0.97,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":1.344,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":1.72,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":2.045,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":2.375,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":2.935,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":3.505,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":4.182,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":4.823,\"instance\":\"api-54f7cc6f98-txlh4\"},{\"seconds\":5.233,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":5.61,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":6.016,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":6.439,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":21.401,\"instance\":\"api-54f7cc6f98-crhmd\"},{\"seconds\":23.434,\"instance\":\"api-54f7cc6f98-crhmd\"},{\"seconds\":23.911,\"instance\":\"api-54f7cc6f98-crhmd\"},{\"seconds\":24.409,\"instance\":\"api-54f7cc6f98-4xgnf\"},{\"seconds\":24.827,\"instance\":\"api-54f7cc6f98-4xgnf\"}],\"pass\":true}" source=console + + + █ TOTAL RESULTS + + HTTP + http_req_duration..............: avg=357.73ms min=67.9ms med=126.26ms max=2s p(90)=1.7s p(95)=2s + { expected_response:true }...: avg=178.02ms min=67.9ms med=121.99ms max=1.7s p(90)=274.92ms p(95)=380.46ms + http_req_failed................: 9.85% 7 out of 71 + http_reqs......................: 71 2.545285/s + + EXECUTION + iteration_duration.............: avg=25.26s min=25.26s med=25.26s max=25.26s p(90)=25.26s p(95)=25.26s + iterations.....................: 1 0.035849/s + vus............................: 1 min=0 max=1 + vus_max........................: 1 min=1 max=1 + + NETWORK + data_received..................: 74 kB 2.6 kB/s + data_sent......................: 6.5 kB 231 B/s + + + diff --git a/evidence/review-20261029/resources-failover-1-20261029105415.txt b/evidence/review-20261029/resources-failover-1-20261029105415.txt new file mode 100644 index 00000000..c2ddb991 --- /dev/null +++ b/evidence/review-20261029/resources-failover-1-20261029105415.txt @@ -0,0 +1,50 @@ +UTC 2026-10-29T10:54:17Z +NAME CPU(cores) MEMORY(bytes) +api-54f7cc6f98-7c56z 3m 22Mi +api-54f7cc6f98-txlh4 2m 22Mi +postgres-0 5m 26Mi +valkey-0 8m 8Mi +valkey-1 5m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|2 +UTC 2026-10-29T10:54:23Z +NAME CPU(cores) MEMORY(bytes) +api-54f7cc6f98-7c56z 3m 22Mi +api-54f7cc6f98-txlh4 2m 22Mi +postgres-0 5m 26Mi +valkey-0 8m 8Mi +valkey-1 5m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|3 +UTC 2026-10-29T10:54:30Z +NAME CPU(cores) MEMORY(bytes) +api-54f7cc6f98-txlh4 2m 22Mi +postgres-0 5m 26Mi +valkey-0 8m 8Mi +valkey-1 5m 13Mi +valkey-2 6m 3Mi +active|||1 +idle|Client|ClientRead|2 +UTC 2026-10-29T10:54:41Z +NAME CPU(cores) MEMORY(bytes) +api-54f7cc6f98-txlh4 20m 42Mi +load-failover-1-20261029105415-hng87 36m 51Mi +postgres-0 34m 30Mi +valkey-0 18m 8Mi +valkey-1 8m 13Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|3 +UTC 2026-10-29T10:54:48Z +NAME CPU(cores) MEMORY(bytes) +api-54f7cc6f98-4xgnf 4m 43Mi +api-54f7cc6f98-txlh4 20m 42Mi +load-failover-1-20261029105415-hng87 11m 51Mi +postgres-0 34m 30Mi +valkey-0 9m 8Mi +valkey-1 8m 13Mi +valkey-2 10m 3Mi +active|||1 +idle|Client|ClientRead|3 diff --git a/evidence/review-20261029/resources-failover-2-20261029105524.txt b/evidence/review-20261029/resources-failover-2-20261029105524.txt new file mode 100644 index 00000000..a779165c --- /dev/null +++ b/evidence/review-20261029/resources-failover-2-20261029105524.txt @@ -0,0 +1,39 @@ +UTC 2026-10-29T10:55:26Z +NAME CPU(cores) MEMORY(bytes) +api-54f7cc6f98-4xgnf 6m 43Mi +api-54f7cc6f98-txlh4 12m 7Mi +postgres-0 6m 30Mi +valkey-0 13m 8Mi +valkey-1 5m 13Mi +valkey-2 8m 3Mi +active|||1 +idle|Client|ClientRead|3 +UTC 2026-10-29T10:55:33Z +NAME CPU(cores) MEMORY(bytes) +api-54f7cc6f98-4xgnf 3m 43Mi +api-54f7cc6f98-txlh4 3m 7Mi +postgres-0 4m 30Mi +valkey-0 8m 8Mi +valkey-1 6m 13Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|4 +UTC 2026-10-29T10:55:39Z +NAME CPU(cores) MEMORY(bytes) +api-54f7cc6f98-4xgnf 3m 43Mi +postgres-0 4m 30Mi +valkey-0 8m 8Mi +valkey-1 6m 13Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|2 +UTC 2026-10-29T10:55:56Z +NAME CPU(cores) MEMORY(bytes) +api-54f7cc6f98-4xgnf 21m 44Mi +load-failover-2-20261029105524-bq2wx 30m 11Mi +postgres-0 16m 27Mi +valkey-0 10m 8Mi +valkey-1 10m 13Mi +valkey-2 7m 3Mi +active|||1 +idle|Client|ClientRead|3 diff --git a/evidence/review-20261029/smoke-after.txt b/evidence/review-20261029/smoke-after.txt new file mode 100644 index 00000000..4fe323c6 --- /dev/null +++ b/evidence/review-20261029/smoke-after.txt @@ -0,0 +1,2 @@ +python3 tests/smoke.py --base-url "https://hl.agapov.space" +PASS: lab3 public API scenario; infrastructure and grading evidence remain separate. diff --git a/evidence/review-20261029/smoke.txt b/evidence/review-20261029/smoke.txt new file mode 100644 index 00000000..c3d30e0e --- /dev/null +++ b/evidence/review-20261029/smoke.txt @@ -0,0 +1,3 @@ +python3 tests/smoke.py --base-url "https://hl.agapov.space" +FAIL: GET /api/v1/users/me: expected [200], received 503 +make: *** [test] Error 1 diff --git a/evidence/review-20261029/targets.txt b/evidence/review-20261029/targets.txt new file mode 100644 index 00000000..c28f6886 --- /dev/null +++ b/evidence/review-20261029/targets.txt @@ -0,0 +1,2 @@ +api-54f7cc6f98-7c56z +api-54f7cc6f98-txlh4 diff --git a/evidence/review-20261029/vet.txt b/evidence/review-20261029/vet.txt new file mode 100644 index 00000000..e69de29b diff --git a/evidence/shared-contract.txt b/evidence/shared-contract.txt new file mode 100644 index 00000000..9a553306 --- /dev/null +++ b/evidence/shared-contract.txt @@ -0,0 +1,2 @@ +python3 scripts/check_contract.py +PASS: offline skeleton structure, local refs and Python syntax; application NOT tested. diff --git a/evidence/shared-dependency-faults.txt b/evidence/shared-dependency-faults.txt new file mode 100644 index 00000000..01e8d3b7 --- /dev/null +++ b/evidence/shared-dependency-faults.txt @@ -0,0 +1,28 @@ +UTC 2026-10-16T08:49:24Z +a57cbcf3292d91164abc24ed101e9712a93b835d +f191cc4d00d13a1e9c46323d545f3310ac2e7d23bb93d76060e282d1fbd220f3 internal/store/postgres/chats.go +a8fa0da216b564121068bb44ee0f6e1daa7aa64ba54c301d0888db00f57596da internal/store/postgres/errors_test.go +24d463067d1b51eaad5f7b21013be2ab836dea78f7314469779e2336cf57cb9c internal/store/postgres/idempotency.go +30578fb46580b52acbb449615463f2f761571ff8cc86702b69f3fbd5af951b97 internal/store/postgres/idempotency_test.go +114f7f6dd12feb80e709e704a83f59d8c7f33fbd62e3a137f53219fa5f03d046 internal/store/postgres/messages.go +889a63b51b29012f4ae5499d1c0577fe29f2f2959b05629f8e123715cfc1f75f internal/store/postgres/sessions.go +f50dbf2409c511f3b4b3cc72555a80e621e1ca1e4e314112ead35e1a34623de1 internal/store/postgres/store.go +9bc4948a301a171c2dbf57264a9aee27bfc543536b93a7c540b359ed7721816e internal/store/postgres/store_test.go +8c77a2ebc8e7cdf4bcaad173feb413fcfe2691e50bc61b0e70a5e8748f167ce6 internal/store/postgres/users.go +f7fd9ca5335f9119d5ed1714c39c3d19e840528a0248fda5d08f60a10d2060ac internal/service/errors.go +15ada2fcbbb06ce210e1978b0c2aa4316e9786c6b0252ceec80e169ae08c0fe9 internal/store/interface.go +18e1bbaa5ac64311e208c23ca3eca3fc543b48f5187b22313735b7df83603ce3 internal/controller/http/fiber/public_errors.go +0570f1d2ed6082580c5a7a6133477d6eac47baf76781250d496669bab86e8cf6 scripts/test-faults.sh +PASS: postgres stop authenticated history => 503 unavailable (0.001602s) +PASS: postgres stop rejects anonymous/spoofed/malformed/unknown identity; liveness=200 readiness=503 +PASS: postgres stop recovery preserves the original session and message +PASS: postgres pause authenticated history => 503 unavailable (0.508766s) +PASS: postgres pause rejects anonymous/spoofed/malformed/unknown identity; liveness=200 readiness=503 +PASS: postgres pause recovery preserves the original session and message +PASS: valkey stop authenticated history => 503 unavailable (0.502885s) +PASS: valkey stop rejects anonymous/spoofed/malformed/unknown identity; liveness=200 readiness=503 +PASS: valkey stop recovery preserves the original session and message +PASS: valkey pause authenticated history => 503 unavailable (0.508144s) +PASS: valkey pause rejects anonymous/spoofed/malformed/unknown identity; liveness=200 readiness=503 +PASS: valkey pause recovery preserves the original session and message +PASS: real dependency fault scenarios completed diff --git a/evidence/shared-deploy.txt b/evidence/shared-deploy.txt new file mode 100644 index 00000000..1dfaed65 --- /dev/null +++ b/evidence/shared-deploy.txt @@ -0,0 +1,8 @@ +Release "lab2" has been upgraded. Happy Helming! +NAME: lab2 +LAST DEPLOYED: Fri Oct 16 11:44:51 2026 +NAMESPACE: highload-applications +STATUS: deployed +REVISION: 2 +DESCRIPTION: Upgrade complete +TEST SUITE: None diff --git a/evidence/shared-failover-1.txt b/evidence/shared-failover-1.txt new file mode 100644 index 00000000..c352c5c5 --- /dev/null +++ b/evidence/shared-failover-1.txt @@ -0,0 +1,4 @@ +python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "https://hl.agapov.space" +Executing explicit failover hook; hook output suppressed to avoid leaking secrets. +{"observed_instances_before": 2, "successful_writes": 48, "failed_attempts": 0, "first_recovery_seconds": 0.801} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/shared-failover-2-retry.txt b/evidence/shared-failover-2-retry.txt new file mode 100644 index 00000000..d405b60f --- /dev/null +++ b/evidence/shared-failover-2-retry.txt @@ -0,0 +1,3 @@ +python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "https://hl.agapov.space" +FAIL: GET /api/v1/users/me: connection/TLS failure (TimeoutError) +make: *** [test-failover] Error 1 diff --git a/evidence/shared-failover-2.txt b/evidence/shared-failover-2.txt new file mode 100644 index 00000000..d405b60f --- /dev/null +++ b/evidence/shared-failover-2.txt @@ -0,0 +1,3 @@ +python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "https://hl.agapov.space" +FAIL: GET /api/v1/users/me: connection/TLS failure (TimeoutError) +make: *** [test-failover] Error 1 diff --git a/evidence/shared-go-tests.txt b/evidence/shared-go-tests.txt new file mode 100644 index 00000000..1e97b36b --- /dev/null +++ b/evidence/shared-go-tests.txt @@ -0,0 +1,19 @@ +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/cmd/server 0.429s +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/admission (cached) +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config (cached) +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/controller [no test files] +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/controller/http/fiber 0.389s +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor (cached) +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/hashring (cached) +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto [no test files] +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/http [no test files] +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/password (cached) +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service [no test files] +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service/authentication 0.283s +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service/production 0.292s +? gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store [no test files] +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/memory (cached) +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/postgres 0.331s +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/strictjson (cached) +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/valkey (cached) +ok gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/student-tests 0.299s diff --git a/evidence/shared-helm.txt b/evidence/shared-helm.txt new file mode 100644 index 00000000..ddb771d3 --- /dev/null +++ b/evidence/shared-helm.txt @@ -0,0 +1,6 @@ +helm lint charts/messenger -f "charts/messenger/values.yaml" +==> Linting charts/messenger +[INFO] Chart.yaml: icon is recommended + +1 chart(s) linted, 0 chart(s) failed +helm template "lab2" charts/messenger -n "highload-applications" -f "charts/messenger/values.yaml" > /dev/null diff --git a/evidence/shared-idempotency.txt b/evidence/shared-idempotency.txt new file mode 100644 index 00000000..01cf76c2 --- /dev/null +++ b/evidence/shared-idempotency.txt @@ -0,0 +1,3 @@ +RUN="idempotency-$(date -u +%Y%m%d%H%M%S)" LOAD_SCRIPT=idempotency.js scripts/run-load.sh +configmap/load-scripts created +job.batch/load-idempotency-20261016084724 created diff --git a/evidence/shared-image-build.txt b/evidence/shared-image-build.txt new file mode 100644 index 00000000..6c47902f --- /dev/null +++ b/evidence/shared-image-build.txt @@ -0,0 +1,69 @@ +#0 building with "asisti-builder" instance using docker-container driver + +#1 [internal] load build definition from Dockerfile +#1 transferring dockerfile: 583B done +#1 DONE 0.0s + +#2 [internal] load metadata for docker.io/library/golang:1.26.1-alpine3.23 +#2 DONE 2.4s + +#3 [internal] load .dockerignore +#3 transferring context: 145B done +#3 DONE 0.0s + +#4 [build 1/7] FROM docker.io/library/golang:1.26.1-alpine3.23@sha256:2389ebfa5b7f43eeafbd6be0c3700cc46690ef842ad962f6c5bd6be49ed82039 +#4 resolve docker.io/library/golang:1.26.1-alpine3.23@sha256:2389ebfa5b7f43eeafbd6be0c3700cc46690ef842ad962f6c5bd6be49ed82039 done +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 327.16kB 0.0s done +#5 DONE 0.0s + +#6 [build 2/7] WORKDIR /src +#6 CACHED + +#7 [build 3/7] COPY go.mod go.sum ./ +#7 CACHED + +#8 [build 4/7] RUN go mod download +#8 CACHED + +#9 [build 5/7] COPY cmd/ ./cmd/ +#9 CACHED + +#10 [build 6/7] COPY internal/ ./internal/ +#10 DONE 0.1s + +#11 [build 7/7] RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/server ./cmd/server +#11 DONE 60.5s + +#12 [runtime 1/1] COPY --from=build /out/server /server +#12 DONE 0.1s + +#13 exporting to image +#13 exporting layers +#13 exporting layers 0.8s done +#13 exporting manifest sha256:797eb64e6c596d1b0be84484b7e304ae93907134dad5d29b6946ef0a331647e4 +#13 exporting manifest sha256:797eb64e6c596d1b0be84484b7e304ae93907134dad5d29b6946ef0a331647e4 done +#13 exporting config sha256:a3db374ae207a2072c13c15e4d1510d8d512c5b52e451b0cb965a326c75683fe 0.0s done +#13 exporting attestation manifest sha256:71b5c81e64cd4b587a4a90a68fc94403d32e6358a5d6c29de0c3f932478bf32b 0.0s done +#13 exporting manifest list sha256:a73799010550ab2008b984ed9d0bfa8dfdd9bb963cb948bc91713748b24c3889 done +#13 DONE 0.9s + +#13 exporting to image +#13 pushing layers +#13 ... + +#14 [auth] mtusi2026lab3:pull,push token for asisti.registry.twcstorage.ru +#14 DONE 0.0s + +#13 exporting to image +#13 pushing layers 3.0s done +#13 pushing manifest for asisti.registry.twcstorage.ru/mtusi2026lab3:shared-release-20261016@sha256:a73799010550ab2008b984ed9d0bfa8dfdd9bb963cb948bc91713748b24c3889 +#13 pushing manifest for asisti.registry.twcstorage.ru/mtusi2026lab3:shared-release-20261016@sha256:a73799010550ab2008b984ed9d0bfa8dfdd9bb963cb948bc91713748b24c3889 1.2s done +#13 DONE 5.2s + +#15 resolving provenance for metadata file +#15 DONE 0.0s + +View build details: docker-desktop://dashboard/build/asisti-builder/asisti-builder0/sewpq07wbv5yc2egvuscmyjuk diff --git a/evidence/shared-persistence.txt b/evidence/shared-persistence.txt new file mode 100644 index 00000000..156dfca2 --- /dev/null +++ b/evidence/shared-persistence.txt @@ -0,0 +1,3 @@ +python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "https://hl.agapov.space" +Executing explicit persistence hook; hook output suppressed to avoid leaking secrets. +PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/shared-pvc-after.txt b/evidence/shared-pvc-after.txt new file mode 100644 index 00000000..dcc7de1a --- /dev/null +++ b/evidence/shared-pvc-after.txt @@ -0,0 +1,8 @@ +NAME UID +data-lab3-postgres-0 feec6037-1856-4548-a23c-e756d7465c6a +data-lab3-valkey-0 220d6ffd-beeb-4330-b96d-35bf741ff4d5 +data-lab3-valkey-1 b54ff66a-7edd-43c7-b622-88cf3ca7c4a1 +data-postgres-0 b592cc47-82be-4635-afa4-d65e3246e82a +data-valkey-0 fafeeae5-f6f6-487d-ba50-15d50f9678c7 +data-valkey-1 a39c3e41-fae2-4096-b83f-807aada803e9 +data-valkey-2 ad5c9d15-ae01-409e-ad11-7f7f7b42e7fe diff --git a/evidence/shared-pvc-before.txt b/evidence/shared-pvc-before.txt new file mode 100644 index 00000000..dcc7de1a --- /dev/null +++ b/evidence/shared-pvc-before.txt @@ -0,0 +1,8 @@ +NAME UID +data-lab3-postgres-0 feec6037-1856-4548-a23c-e756d7465c6a +data-lab3-valkey-0 220d6ffd-beeb-4330-b96d-35bf741ff4d5 +data-lab3-valkey-1 b54ff66a-7edd-43c7-b622-88cf3ca7c4a1 +data-postgres-0 b592cc47-82be-4635-afa4-d65e3246e82a +data-valkey-0 fafeeae5-f6f6-487d-ba50-15d50f9678c7 +data-valkey-1 a39c3e41-fae2-4096-b83f-807aada803e9 +data-valkey-2 ad5c9d15-ae01-409e-ad11-7f7f7b42e7fe diff --git a/evidence/shared-ready.json b/evidence/shared-ready.json new file mode 100644 index 00000000..1a36cf5f --- /dev/null +++ b/evidence/shared-ready.json @@ -0,0 +1 @@ +{"status":"ok"} \ No newline at end of file diff --git a/evidence/shared-releases.txt b/evidence/shared-releases.txt new file mode 100644 index 00000000..543dfcfe --- /dev/null +++ b/evidence/shared-releases.txt @@ -0,0 +1,2 @@ +NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION +lab2 highload-applications 2 2026-10-16 11:44:51.753981 +0300 MSK deployed messenger-0.1.0 lab3 diff --git a/evidence/shared-rolling.txt b/evidence/shared-rolling.txt new file mode 100644 index 00000000..95608497 --- /dev/null +++ b/evidence/shared-rolling.txt @@ -0,0 +1,2 @@ +configmap/load-scripts configured +job.batch/load-rolling-20261016 created diff --git a/evidence/shared-rollout.txt b/evidence/shared-rollout.txt new file mode 100644 index 00000000..35f0316d --- /dev/null +++ b/evidence/shared-rollout.txt @@ -0,0 +1 @@ +deployment "api" successfully rolled out diff --git a/evidence/shared-smoke.txt b/evidence/shared-smoke.txt new file mode 100644 index 00000000..4fe323c6 --- /dev/null +++ b/evidence/shared-smoke.txt @@ -0,0 +1,2 @@ +python3 tests/smoke.py --base-url "https://hl.agapov.space" +PASS: lab3 public API scenario; infrastructure and grading evidence remain separate. diff --git a/evidence/shared-source-snapshot.txt b/evidence/shared-source-snapshot.txt new file mode 100644 index 00000000..fa276188 --- /dev/null +++ b/evidence/shared-source-snapshot.txt @@ -0,0 +1,19 @@ +447460bce6ad010ecc4f191873cad6980f6d7c2a7665eed756d85d40aa0fad70 cmd/server/app.go +11113c1772bb6d76c8be9f06415ec431404479ac52e3c950cf851d3beffbef49 cmd/server/app_test.go +2631df45b82c7cf99626ae6fe6c5b05ef18254b487d034ad98af26792e569bc8 cmd/server/commands.go +c62b7a6897b300e25fdcfd6650cd256f008207146f1a45c00d77f0db1ab01575 cmd/server/healthcheck.go +dd07b30c1e4c7b25253be83f1e9dea3c12829ca071176529b6772fd4564057eb cmd/server/healthcheck_test.go +93cd37b8e2ec1e6088b82f348a59e6862951f8462df4cd5448562489b05dce1f cmd/server/logger.go +c22d8cdf4ce31fde29945e967d3f025e280a7dc4d2022329d51be972d2a0f495 cmd/server/main.go +a9bfa3bcc68d1b045ec21c193118bb209dfd7bdcbee3cbd28efc5573dc6db3c8 cmd/server/persistence.go +b337101e2112a1710509d1dc24f8f4b558983a2dcc0719ee001605a2232524cd cmd/server/persistence_test.go +f191cc4d00d13a1e9c46323d545f3310ac2e7d23bb93d76060e282d1fbd220f3 internal/store/postgres/chats.go +a8fa0da216b564121068bb44ee0f6e1daa7aa64ba54c301d0888db00f57596da internal/store/postgres/errors_test.go +24d463067d1b51eaad5f7b21013be2ab836dea78f7314469779e2336cf57cb9c internal/store/postgres/idempotency.go +30578fb46580b52acbb449615463f2f761571ff8cc86702b69f3fbd5af951b97 internal/store/postgres/idempotency_test.go +114f7f6dd12feb80e709e704a83f59d8c7f33fbd62e3a137f53219fa5f03d046 internal/store/postgres/messages.go +889a63b51b29012f4ae5499d1c0577fe29f2f2959b05629f8e123715cfc1f75f internal/store/postgres/sessions.go +f50dbf2409c511f3b4b3cc72555a80e621e1ca1e4e314112ead35e1a34623de1 internal/store/postgres/store.go +9bc4948a301a171c2dbf57264a9aee27bfc543536b93a7c540b359ed7721816e internal/store/postgres/store_test.go +8c77a2ebc8e7cdf4bcaad173feb413fcfe2691e50bc61b0e70a5e8748f167ce6 internal/store/postgres/users.go +f9cb55f2ea75799e6bf438aef7c7cd760b33d997ef75888feda2e6358622d5e9 charts/messenger/values.yaml diff --git a/evidence/shared-state.txt b/evidence/shared-state.txt new file mode 100644 index 00000000..ee5f6c6b --- /dev/null +++ b/evidence/shared-state.txt @@ -0,0 +1,20 @@ +NAME READY STATUS RESTARTS AGE +pod/api-56cdb6bc9b-fkkmp 1/1 Running 0 76s +pod/api-56cdb6bc9b-rsrlb 1/1 Running 0 79s +pod/load-idempotency-20261016084724-ph422 0/1 Completed 0 4m32s +pod/load-rolling-20261016-fznwl 0/1 Completed 0 102s +pod/metrics-server-db8d46c89-92mbs 1/1 Running 0 18h +pod/migrate-2-c56fc 0/1 Completed 0 7m2s +pod/postgres-0 1/1 Running 0 2m37s +pod/valkey-0 1/1 Running 0 2m31s +pod/valkey-1 1/1 Running 0 2m34s +pod/valkey-2 1/1 Running 0 2m37s + +NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE +horizontalpodautoscaler.autoscaling/api Deployment/api cpu: 1%/60% 2 4 2 7m2s + +NAME CLASS HOSTS ADDRESS PORTS AGE +ingress.networking.k8s.io/messenger traefik hl.agapov.space 80, 443 7m2s + +NAME READY SECRET AGE +certificate.cert-manager.io/messenger-tls True messenger-tls 7m2s diff --git a/evidence/shared-static.txt b/evidence/shared-static.txt new file mode 100644 index 00000000..3a23d6ec --- /dev/null +++ b/evidence/shared-static.txt @@ -0,0 +1,2 @@ +go vet ./...: PASS +golangci-lint run ./...: 0 issues diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..e00553e2 --- /dev/null +++ b/go.mod @@ -0,0 +1,44 @@ +module gitea.privcloud.tech/vlad_marlo/mtusi2026lab3 + +go 1.26.1 + +require ( + github.com/gofiber/fiber/v2 v2.52.12 + github.com/google/uuid v1.6.0 + github.com/jackc/pgx/v5 v5.9.1 + github.com/prometheus/client_golang v1.23.2 + github.com/redis/go-redis/v9 v9.17.2 + github.com/valyala/fasthttp v1.51.0 + go.lab260.ru/fielderr v0.0.0-20260609150058-2f9540b99e41 + go.uber.org/fx v1.24.0 + go.uber.org/zap v1.27.1 + golang.org/x/crypto v0.49.0 +) + +require ( + github.com/andybalholm/brotli v1.1.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/klauspost/compress v1.18.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/prometheus/client_model v0.6.2 // indirect + github.com/prometheus/common v0.66.1 // indirect + github.com/prometheus/procfs v0.16.1 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/tcplisten v1.0.0 // indirect + go.uber.org/dig v1.19.0 // indirect + go.uber.org/multierr v1.10.0 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect + golang.org/x/sync v0.20.0 // indirect + golang.org/x/sys v0.42.0 // indirect + golang.org/x/text v0.35.0 // indirect + google.golang.org/protobuf v1.36.8 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..dac9b09e --- /dev/null +++ b/go.sum @@ -0,0 +1,105 @@ +github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/gofiber/fiber/v2 v2.52.12 h1:0LdToKclcPOj8PktUdIKo9BUohjjwfnQl42Dhw8/WUw= +github.com/gofiber/fiber/v2 v2.52.12/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.9.1 h1:uwrxJXBnx76nyISkhr33kQLlUqjv7et7b9FjCen/tdc= +github.com/jackc/pgx/v5 v5.9.1/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= +github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= +github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= +github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= +github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/redis/go-redis/v9 v9.17.2 h1:P2EGsA4qVIM3Pp+aPocCJ7DguDHhqrXNhVcEp4ViluI= +github.com/redis/go-redis/v9 v9.17.2/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= +github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= +github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= +github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +go.lab260.ru/fielderr v0.0.0-20260609150058-2f9540b99e41 h1:kHFUC/1OnQ05ShJW1wjCAbrSa/XxylAgEnZ75BholE4= +go.lab260.ru/fielderr v0.0.0-20260609150058-2f9540b99e41/go.mod h1:OQKs2tIkkTxUjzewIMsqChKuHPWDjIgUz+SYqdhR9rM= +go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= +go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= +go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= +go.uber.org/fx v1.24.0/go.mod h1:AmDeGyS+ZARGKM4tlH4FY2Jr63VjbEDJHtqXTGP5hbo= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= +go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= +go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= +golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= +golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= +google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= +google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/infra/metrics-server/components.yaml b/infra/metrics-server/components.yaml new file mode 100644 index 00000000..54d5bee5 --- /dev/null +++ b/infra/metrics-server/components.yaml @@ -0,0 +1,203 @@ +# Source: metrics-server v0.8.1/components.yaml; workload namespace adapted to highload-applications. +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + k8s-app: metrics-server + name: metrics-server + namespace: highload-applications +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + k8s-app: metrics-server + rbac.authorization.k8s.io/aggregate-to-admin: "true" + rbac.authorization.k8s.io/aggregate-to-edit: "true" + rbac.authorization.k8s.io/aggregate-to-view: "true" + name: system:aggregated-metrics-reader +rules: +- apiGroups: + - metrics.k8s.io + resources: + - pods + - nodes + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + k8s-app: metrics-server + name: system:metrics-server +rules: +- apiGroups: + - "" + resources: + - nodes/metrics + verbs: + - get +- apiGroups: + - "" + resources: + - pods + - nodes + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + k8s-app: metrics-server + name: metrics-server-auth-reader + namespace: kube-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: extension-apiserver-authentication-reader +subjects: +- kind: ServiceAccount + name: metrics-server + namespace: highload-applications +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + k8s-app: metrics-server + name: metrics-server:system:auth-delegator +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: system:auth-delegator +subjects: +- kind: ServiceAccount + name: metrics-server + namespace: highload-applications +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + k8s-app: metrics-server + name: system:metrics-server +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: system:metrics-server +subjects: +- kind: ServiceAccount + name: metrics-server + namespace: highload-applications +--- +apiVersion: v1 +kind: Service +metadata: + labels: + k8s-app: metrics-server + name: metrics-server + namespace: highload-applications +spec: + ports: + - appProtocol: https + name: https + port: 443 + protocol: TCP + targetPort: https + selector: + k8s-app: metrics-server +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + k8s-app: metrics-server + name: metrics-server + namespace: highload-applications +spec: + selector: + matchLabels: + k8s-app: metrics-server + strategy: + rollingUpdate: + maxUnavailable: 0 + template: + metadata: + labels: + k8s-app: metrics-server + spec: + containers: + - args: + - --cert-dir=/tmp + - --secure-port=10250 + - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname + - --kubelet-use-node-status-port + - --metric-resolution=15s + image: registry.k8s.io/metrics-server/metrics-server:v0.8.1 + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + httpGet: + path: /livez + port: https + scheme: HTTPS + periodSeconds: 10 + name: metrics-server + ports: + - containerPort: 10250 + name: https + protocol: TCP + readinessProbe: + failureThreshold: 3 + httpGet: + path: /readyz + port: https + scheme: HTTPS + initialDelaySeconds: 20 + periodSeconds: 10 + resources: + requests: + cpu: 100m + memory: 200Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + seccompProfile: + type: RuntimeDefault + volumeMounts: + - mountPath: /tmp + name: tmp-dir + nodeSelector: + kubernetes.io/os: linux + priorityClassName: system-cluster-critical + serviceAccountName: metrics-server + volumes: + - emptyDir: {} + name: tmp-dir +--- +apiVersion: apiregistration.k8s.io/v1 +kind: APIService +metadata: + labels: + k8s-app: metrics-server + name: v1beta1.metrics.k8s.io +spec: + group: metrics.k8s.io + groupPriorityMinimum: 100 + insecureSkipTLSVerify: true + service: + name: metrics-server + namespace: highload-applications + version: v1beta1 + versionPriority: 100 diff --git a/infra/metrics-server/kustomization.yaml b/infra/metrics-server/kustomization.yaml new file mode 100644 index 00000000..9a0b325f --- /dev/null +++ b/infra/metrics-server/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - components.yaml +patches: + - target: + kind: Deployment + name: metrics-server + patch: |- + - op: add + path: /spec/template/spec/containers/0/args/- + value: --kubelet-certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt diff --git a/infra/monitoring/grafana-dashboard.json b/infra/monitoring/grafana-dashboard.json new file mode 100644 index 00000000..7b9caa4a --- /dev/null +++ b/infra/monitoring/grafana-dashboard.json @@ -0,0 +1,106 @@ +{ + "title": "Lab 3 — API scaling", + "uid": "highload-lab3", + "schemaVersion": 39, + "version": 1, + "refresh": "15s", + "time": { + "from": "now-30m", + "to": "now" + }, + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "panels": [ + { + "id": 1, + "type": "timeseries", + "title": "HTTP requests/s", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 12, + "h": 8 + }, + "targets": [ + { + "refId": "A", + "expr": "sum(rate(messenger_http_requests_total[2m])) by (status_class)" + } + ] + }, + { + "id": 2, + "type": "timeseries", + "title": "Latency p95, seconds", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 0, + "w": 12, + "h": 8 + }, + "targets": [ + { + "refId": "A", + "expr": "histogram_quantile(0.95, sum(rate(messenger_http_duration_seconds_bucket[2m])) by (le))" + } + ] + }, + { + "id": 3, + "type": "timeseries", + "title": "In-flight requests", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 8, + "w": 12, + "h": 8 + }, + "targets": [ + { + "refId": "A", + "expr": "sum(messenger_http_in_flight) by (pod)" + } + ] + }, + { + "id": 4, + "type": "timeseries", + "title": "API replicas", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 8, + "w": 12, + "h": 8 + }, + "targets": [ + { + "refId": "A", + "expr": "kube_deployment_status_replicas_available{namespace=\"highload-applications\",deployment=\"api\"}" + } + ] + } + ] +} diff --git a/infra/monitoring/prometheus-scrape.yaml b/infra/monitoring/prometheus-scrape.yaml new file mode 100644 index 00000000..fcb47ab9 --- /dev/null +++ b/infra/monitoring/prometheus-scrape.yaml @@ -0,0 +1,19 @@ +# Add this job to an existing Prometheus in namespace monitoring. +# Its service account needs Kubernetes service/endpoints/pod discovery permissions. +scrape_configs: + - job_name: api + scrape_interval: 15s + scrape_timeout: 3s + kubernetes_sd_configs: + - role: endpoints + namespaces: + names: [highload-applications] + relabel_configs: + - source_labels: [__meta_kubernetes_service_name] + regex: api + action: keep + - source_labels: [__meta_kubernetes_endpoint_port_name] + regex: http + action: keep + - source_labels: [__meta_kubernetes_pod_name] + target_label: pod diff --git a/internal/admission/distributed.go b/internal/admission/distributed.go new file mode 100644 index 00000000..c268f976 --- /dev/null +++ b/internal/admission/distributed.go @@ -0,0 +1,18 @@ +package admission + +import ( + "context" + "errors" +) + +// ErrRate means the request exhausted a shared rate budget. +var ErrRate = errors.New("shared request rate exceeded") + +// ErrSlots means the request exhausted a shared concurrency budget. +var ErrSlots = errors.New("shared execution slots exhausted") + +// Distributed defines request admission independently of the backing database. +type Distributed interface { + // Enter reserves global/group or user/group budgets and returns a release operation. + Enter(ctx context.Context, group, user string) (func(), error) +} diff --git a/internal/admission/limiter.go b/internal/admission/limiter.go new file mode 100644 index 00000000..97e7f2ac --- /dev/null +++ b/internal/admission/limiter.go @@ -0,0 +1,73 @@ +// Package admission bounds request rate and concurrent execution independently of transport. +package admission + +import ( + "fmt" + "sync" + "time" +) + +// Options defines the rate and execution bounds for one limiter. +type Options struct { + // MaxInFlight limits concurrent executions without an admission queue. + MaxInFlight int + // RequestsPerSecond is the token refill rate. + RequestsPerSecond int + // Burst is the maximum number of immediately available tokens. + Burst int +} + +// Limiter owns synchronization for the token bucket and execution slots. +// It knows neither HTTP response codes nor application shutdown state. +type Limiter struct { + mu sync.Mutex + rate float64 + burst float64 + tokens float64 + lastRefill time.Time + slots chan struct{} +} + +// New validates limits and creates a full token bucket with bounded execution slots. +func New(cfg Options) (*Limiter, error) { + if cfg.MaxInFlight <= 0 || cfg.RequestsPerSecond <= 0 || cfg.Burst <= 0 { + return nil, fmt.Errorf("admission limits must be positive") + } + return &Limiter{ + rate: float64(cfg.RequestsPerSecond), + burst: float64(cfg.Burst), + tokens: float64(cfg.Burst), + lastRefill: time.Now(), + slots: make(chan struct{}, cfg.MaxInFlight), + }, nil +} + +// Allow refills the token bucket and consumes a token when one is available. +func (limiter *Limiter) Allow(now time.Time) bool { + limiter.mu.Lock() + defer limiter.mu.Unlock() + elapsed := max(0, now.Sub(limiter.lastRefill).Seconds()) + limiter.tokens = min(limiter.burst, limiter.tokens+elapsed*limiter.rate) + limiter.lastRefill = now + if limiter.tokens < 1 { + return false + } + limiter.tokens-- + return true +} + +// Acquire reserves an execution slot without waiting. +func (limiter *Limiter) Acquire() bool { + select { + case limiter.slots <- struct{}{}: + return true + default: + return false + } +} + +// Release returns an execution slot previously reserved by Acquire. +// Each successful Acquire must be paired with exactly one Release. +func (limiter *Limiter) Release() { + <-limiter.slots +} diff --git a/internal/admission/limiter_test.go b/internal/admission/limiter_test.go new file mode 100644 index 00000000..9fcb7e47 --- /dev/null +++ b/internal/admission/limiter_test.go @@ -0,0 +1,148 @@ +package admission + +import ( + "testing" + "testing/synctest" + "time" +) + +// TestLimiter_Allow checks token exhaustion and refill with deterministic time. +func TestLimiter_Allow(t *testing.T) { + cases := []struct { + name string + elapsed time.Duration + want bool + }{ + {"Negative: exhausted bucket", 0, false}, + {"Negative: partial token", time.Millisecond * 500, false}, + {"Positive: refilled token", time.Second, true}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + // Arrange. + limiter := newTestLimiter(t, Options{MaxInFlight: 1, RequestsPerSecond: 1, Burst: 1}) + if !limiter.Allow(time.Now()) { + t.Fatal("fixture token missing") + } + time.Sleep(tc.elapsed) + + // Act. + got := limiter.Allow(time.Now()) + + // Assert. + if got != tc.want { + t.Fatalf("Allow after %s=%v, want=%v", tc.elapsed, got, tc.want) + } + }) + }) + } +} + +// TestLimiter_Acquire checks available, occupied and released execution slots independently. +func TestLimiter_Acquire(t *testing.T) { + t.Run("Positive: free slot", func(t *testing.T) { + // Arrange. + limiter := newTestLimiter(t, Options{MaxInFlight: 1, RequestsPerSecond: 1, Burst: 1}) + + want := true + + // Act. + got := limiter.Acquire() + if got { + t.Cleanup(limiter.Release) + } + + // Assert. + if got != want { + t.Fatalf("Acquire=%v, want=%v", got, want) + } + }) + + t.Run("Negative: occupied slot", func(t *testing.T) { + // Arrange. + limiter := newTestLimiter(t, Options{MaxInFlight: 1, RequestsPerSecond: 1, Burst: 1}) + + if !limiter.Acquire() { + t.Fatal("fixture slot unavailable") + } + + t.Cleanup(limiter.Release) + + want := false + + // Act. + got := limiter.Acquire() + if got { + t.Cleanup(limiter.Release) + } + + // Assert. + if got != want { + t.Fatalf("Acquire=%v, want=%v", got, want) + } + }) + + t.Run("Positive: released slot", func(t *testing.T) { + // Arrange. + limiter := newTestLimiter(t, Options{MaxInFlight: 1, RequestsPerSecond: 1, Burst: 1}) + + if !limiter.Acquire() { + t.Fatal("fixture slot unavailable") + } + + limiter.Release() + + want := true + + // Act. + got := limiter.Acquire() + if got { + t.Cleanup(limiter.Release) + } + + // Assert. + if got != want { + t.Fatalf("Acquire=%v, want=%v", got, want) + } + }) +} + +// newTestLimiter creates a limiter or fails the test on invalid settings. +func newTestLimiter(t *testing.T, options Options) *Limiter { + t.Helper() + limiter, err := New(options) + if err != nil { + t.Fatal(err) + } + return limiter +} + +// TestLimiter_New rejects each nonpositive limit independently. +func TestLimiter_New(t *testing.T) { + cases := []struct { + name string + options Options + }{ + {"Negative: zero concurrency", Options{MaxInFlight: 0, RequestsPerSecond: 1, Burst: 1}}, + {"Negative: negative concurrency", Options{MaxInFlight: -1, RequestsPerSecond: 1, Burst: 1}}, + {"Negative: zero refill rate", Options{MaxInFlight: 1, RequestsPerSecond: 0, Burst: 1}}, + {"Negative: negative refill rate", Options{MaxInFlight: 1, RequestsPerSecond: -1, Burst: 1}}, + {"Negative: zero burst", Options{MaxInFlight: 1, RequestsPerSecond: 1, Burst: 0}}, + {"Negative: negative burst", Options{MaxInFlight: 1, RequestsPerSecond: 1, Burst: -1}}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + options := tc.options + + // Act. + limiter, err := New(options) + + // Assert. + if err == nil || limiter != nil { + t.Fatalf("invalid options accepted: %v, %v", limiter, err) + } + }) + } +} diff --git a/internal/config/config.go b/internal/config/config.go new file mode 100644 index 00000000..339faacc --- /dev/null +++ b/internal/config/config.go @@ -0,0 +1,53 @@ +// Package config loads and validates the environment configuration of the application. +package config + +import "fmt" + +// Config groups settings by the component that consumes them. +type Config struct { + // HTTP configures the listener, request limits and shutdown deadline. + HTTP *Controller + // Memory configures the capacity of the process-local store. + Memory *Memory + // Logger configures structured process logging. + Logger *Logger +} + +// Default returns independent configuration sections with the documented defaults. +func Default() *Config { + return &Config{ + HTTP: defaultController(), + Memory: defaultMemory(), + Logger: &Logger{Level: "info"}, + } +} + +// New loads environment overrides and rejects invalid settings before startup. +func New() (*Config, error) { + cfg := Default() + if err := cfg.HTTP.loadEnvironment(); err != nil { + return nil, err + } + if err := cfg.Memory.loadEnvironment(); err != nil { + return nil, err + } + cfg.Logger.loadEnvironment() + if err := cfg.Validate(); err != nil { + return nil, err + } + return cfg, nil +} + +// Validate verifies the presence and invariants of each configuration section. +func (cfg *Config) Validate() error { + if cfg == nil || cfg.HTTP == nil || cfg.Memory == nil || cfg.Logger == nil { + return fmt.Errorf("HTTP, Memory and Logger configuration sections are required") + } + if err := cfg.HTTP.Validate(); err != nil { + return err + } + if err := cfg.Memory.Validate(); err != nil { + return err + } + return cfg.Logger.Validate() +} diff --git a/internal/config/config_test.go b/internal/config/config_test.go new file mode 100644 index 00000000..83969917 --- /dev/null +++ b/internal/config/config_test.go @@ -0,0 +1,241 @@ +package config + +import "testing" + +// TestConfig_New checks individual environment overrides and invalid settings. +func TestConfig_New(t *testing.T) { + t.Run("Positive: APP_PORT override", func(t *testing.T) { + // Arrange. + t.Setenv("APP_PORT", "18080") + + // Act. + cfg, err := New() + + // Assert. + if err != nil { + t.Fatal(err) + } + if cfg.HTTP.Port != 18080 { + t.Fatalf("APP_PORT=%v, want=%v", cfg.HTTP.Port, 18080) + } + }) + t.Run("Positive: REQUEST_TIMEOUT_SECONDS override", func(t *testing.T) { + // Arrange. + t.Setenv("REQUEST_TIMEOUT_SECONDS", "4") + + // Act. + cfg, err := New() + + // Assert. + if err != nil { + t.Fatal(err) + } + if cfg.HTTP.TimeoutSeconds != 4 { + t.Fatalf("REQUEST_TIMEOUT_SECONDS=%v, want=%v", cfg.HTTP.TimeoutSeconds, 4) + } + }) + t.Run("Positive: MAX_MESSAGES override", func(t *testing.T) { + // Arrange. + t.Setenv("MAX_MESSAGES", "25") + + // Act. + cfg, err := New() + + // Assert. + if err != nil { + t.Fatal(err) + } + if cfg.Memory.MaxMessages != 25 { + t.Fatalf("MAX_MESSAGES=%v, want=%v", cfg.Memory.MaxMessages, 25) + } + }) + t.Run("Positive: REQUESTS_PER_SECOND override", func(t *testing.T) { + // Arrange. + t.Setenv("REQUESTS_PER_SECOND", "12") + + // Act. + cfg, err := New() + + // Assert. + if err != nil { + t.Fatal(err) + } + if cfg.HTTP.Admission.RequestsPerSecond != 12 { + t.Fatalf("REQUESTS_PER_SECOND=%v, want=%v", cfg.HTTP.Admission.RequestsPerSecond, 12) + } + }) + t.Run("Positive: LOG_LEVEL override", func(t *testing.T) { + // Arrange. + t.Setenv("LOG_LEVEL", "debug") + + // Act. + cfg, err := New() + + // Assert. + if err != nil { + t.Fatal(err) + } + if cfg.Logger.Level != "debug" { + t.Fatalf("LOG_LEVEL=%v, want=%v", cfg.Logger.Level, "debug") + } + }) + cases := []struct { + name string + key string + value string + }{ + {"port exceeds TCP range", "APP_PORT", "65536"}, + {"zero message capacity", "MAX_MESSAGES", "0"}, + {"nonnumeric body limit", "MAX_BODY_BYTES", "bad"}, + {"shutdown deadline exceeds bound", "SHUTDOWN_TIMEOUT_SECONDS", "10"}, + {"hostname instead of bind IP", "APP_HOST", "hostname"}, + } + for _, tc := range cases { + t.Run("Negative: "+tc.name, func(t *testing.T) { + // Arrange. + t.Setenv(tc.key, tc.value) + + // Act. + cfg, err := New() + + // Assert. + if err == nil || cfg != nil { + t.Fatalf("invalid %s=%q returned config=%+v, error=%v", tc.key, tc.value, cfg, err) + } + }) + } +} + +// TestConfig_Validate rejects one missing section or invalid component per scenario. +func TestConfig_Validate(t *testing.T) { + t.Run("Negative: nil config", func(t *testing.T) { + // Arrange. + var cfg *Config + + // Act. + err := cfg.Validate() + + // Assert. + if err == nil { + t.Fatalf("accepted %s", "nil config") + } + }) + + t.Run("Negative: missing HTTP", func(t *testing.T) { + // Arrange. + cfg := Default() + + cfg.HTTP = nil + + // Act. + err := cfg.Validate() + + // Assert. + if err == nil { + t.Fatalf("accepted %s", "missing HTTP") + } + }) + + t.Run("Negative: missing Memory", func(t *testing.T) { + // Arrange. + cfg := Default() + + cfg.Memory = nil + + // Act. + err := cfg.Validate() + + // Assert. + if err == nil { + t.Fatalf("accepted %s", "missing Memory") + } + }) + + t.Run("Negative: missing Logger", func(t *testing.T) { + // Arrange. + cfg := Default() + + cfg.Logger = nil + + // Act. + err := cfg.Validate() + + // Assert. + if err == nil { + t.Fatalf("accepted %s", "missing Logger") + } + }) + + t.Run("Negative: unknown log level", func(t *testing.T) { + // Arrange. + cfg := Default() + + cfg.Logger.Level = "unknown" + + // Act. + err := cfg.Validate() + + // Assert. + if err == nil { + t.Fatalf("accepted %s", "unknown log level") + } + }) + + t.Run("Negative: zero storage capacity", func(t *testing.T) { + // Arrange. + cfg := Default() + + cfg.Memory.MaxUsers = 0 + + // Act. + err := cfg.Validate() + + // Assert. + if err == nil { + t.Fatalf("accepted %s", "zero storage capacity") + } + }) + + t.Run("Negative: zero concurrency", func(t *testing.T) { + // Arrange. + cfg := Default() + + cfg.HTTP.Admission.MaxInFlight = 0 + + // Act. + err := cfg.Validate() + + // Assert. + if err == nil { + t.Fatalf("accepted %s", "zero concurrency") + } + }) +} + +// TestLogger_Validate rejects an absent logging section without panicking. +func TestLogger_Validate(t *testing.T) { + // Arrange. + var cfg *Logger + + // Act. + err := cfg.Validate() + + // Assert. + if err == nil { + t.Fatal("nil logger accepted") + } +} + +// TestMemory_Validate rejects absent storage settings without panicking. +func TestMemory_Validate(t *testing.T) { + // Arrange. + var cfg *Memory + + // Act. + err := cfg.Validate() + + // Assert. + if err == nil { + t.Fatal("nil memory configuration accepted") + } +} diff --git a/internal/config/controller.go b/internal/config/controller.go new file mode 100644 index 00000000..865663b6 --- /dev/null +++ b/internal/config/controller.go @@ -0,0 +1,160 @@ +package config + +import ( + "fmt" + "net" + "os" + "strconv" + "time" +) + +const ( + maxTCPPort = 65535 + maxShutdownTimeoutSeconds = 9 + maxRequestTimeoutSeconds = 15 +) + +// Controller contains settings owned exclusively by the HTTP transport. +type Controller struct { + // InstanceID identifies this API process to the load balancer diagnostics. + InstanceID string + // Host is the IP address on which the listener binds. + Host string + // Port is the TCP port, in the range 1..65535. + Port int + // TimeoutSeconds limits request reads, response writes and idle connections. + TimeoutSeconds int + // ShutdownTimeoutSeconds bounds draining of active requests; it must not exceed nine seconds. + ShutdownTimeoutSeconds int + // MaxBodyBytes is the maximum accepted request body size before decoding. + MaxBodyBytes int + // MaxConnections bounds simultaneous connections handled by fasthttp. + MaxConnections int + // Admission controls business request throughput and execution concurrency. + Admission Admission +} + +// Admission defines shared request policies; health endpoints bypass them. +type Admission struct { + // MaxInFlight is the maximum number of executing requests, with no waiting queue. + MaxInFlight int + // RequestsPerSecond is the token refill rate for the global admission bucket. + RequestsPerSecond int + // Burst is the bucket capacity and maximum immediate request burst. + Burst int + // AuthRate limits public registration/login attempts per second. + AuthRate int + // AuthSlots bounds concurrent password KDF work globally. + AuthSlots int + // UserRate limits each authenticated account across all groups. + UserRate int + // UserSlots bounds concurrency across one account's groups. + UserSlots int + // UserWriteRate limits one account's write attempts per second. + UserWriteRate int + // UserWriteSlots bounds one account's concurrent writes. + UserWriteSlots int + // UserAuthRate limits session-management operations per account. + UserAuthRate int + // UserAuthSlots bounds one account's session-management concurrency. + UserAuthSlots int +} + +// defaultController returns the default listener, timeout and admission settings. +func defaultController() *Controller { + return &Controller{ + Host: "0.0.0.0", + Port: 8080, + TimeoutSeconds: 3, + ShutdownTimeoutSeconds: 5, + MaxBodyBytes: 64 << 10, + MaxConnections: 256, + Admission: Admission{ + MaxInFlight: 32, + RequestsPerSecond: 1000, + Burst: 100, + AuthRate: 100, + AuthSlots: 4, + UserRate: 100, + UserSlots: 8, + UserWriteRate: 50, + UserWriteSlots: 4, + UserAuthRate: 20, + UserAuthSlots: 2, + }, + } +} + +// loadEnvironment applies environment overrides to this configuration section. +func (cfg *Controller) loadEnvironment() error { + cfg.InstanceID = os.Getenv("INSTANCE_ID") + if host, exists := os.LookupEnv("APP_HOST"); exists { + cfg.Host = host + } + return loadIntegers( + integerSetting{"APP_PORT", &cfg.Port}, + integerSetting{"REQUEST_TIMEOUT_SECONDS", &cfg.TimeoutSeconds}, + integerSetting{"SHUTDOWN_TIMEOUT_SECONDS", &cfg.ShutdownTimeoutSeconds}, + integerSetting{"MAX_BODY_BYTES", &cfg.MaxBodyBytes}, + integerSetting{"MAX_CONNECTIONS", &cfg.MaxConnections}, + integerSetting{"MAX_IN_FLIGHT", &cfg.Admission.MaxInFlight}, + integerSetting{"REQUESTS_PER_SECOND", &cfg.Admission.RequestsPerSecond}, + integerSetting{"REQUEST_BURST", &cfg.Admission.Burst}, + integerSetting{"AUTH_RATE", &cfg.Admission.AuthRate}, + integerSetting{"AUTH_SLOTS", &cfg.Admission.AuthSlots}, + integerSetting{"USER_RATE", &cfg.Admission.UserRate}, + integerSetting{"USER_SLOTS", &cfg.Admission.UserSlots}, + integerSetting{"USER_WRITE_RATE", &cfg.Admission.UserWriteRate}, + integerSetting{"USER_WRITE_SLOTS", &cfg.Admission.UserWriteSlots}, + integerSetting{"USER_AUTH_RATE", &cfg.Admission.UserAuthRate}, + integerSetting{"USER_AUTH_SLOTS", &cfg.Admission.UserAuthSlots}, + ) +} + +// Validate checks listener addresses, timeouts and admission bounds. +func (cfg *Controller) Validate() error { + if cfg == nil { + return fmt.Errorf("HTTP configuration is required") + } + if cfg.TimeoutSeconds > maxRequestTimeoutSeconds { + return fmt.Errorf("REQUEST_TIMEOUT_SECONDS must not exceed %d", maxRequestTimeoutSeconds) + } + if net.ParseIP(cfg.Host) == nil { + return fmt.Errorf("APP_HOST must be an IP address") + } + if cfg.Port < 1 || cfg.Port > maxTCPPort { + return fmt.Errorf("APP_PORT must be 1..%d", maxTCPPort) + } + if cfg.ShutdownTimeoutSeconds < 1 || cfg.ShutdownTimeoutSeconds > maxShutdownTimeoutSeconds { + return fmt.Errorf("SHUTDOWN_TIMEOUT_SECONDS must be 1..%d", maxShutdownTimeoutSeconds) + } + settings := []integerSetting{ + {"REQUEST_TIMEOUT_SECONDS", &cfg.TimeoutSeconds}, + {"MAX_BODY_BYTES", &cfg.MaxBodyBytes}, + {"MAX_CONNECTIONS", &cfg.MaxConnections}, + {"MAX_IN_FLIGHT", &cfg.Admission.MaxInFlight}, + {"REQUESTS_PER_SECOND", &cfg.Admission.RequestsPerSecond}, + {"REQUEST_BURST", &cfg.Admission.Burst}, + } + for _, setting := range settings { + if err := validatePositive(setting.name, *setting.target); err != nil { + return err + } + } + return nil +} + +// Bind returns the listener address, including brackets for IPv6 hosts. +func (cfg *Controller) Bind() string { + return net.JoinHostPort(cfg.Host, strconv.Itoa(cfg.Port)) +} + +// Timeout returns the configured read, write and idle timeout. +func (cfg *Controller) Timeout() time.Duration { + return time.Duration(cfg.TimeoutSeconds) * time.Second +} + +// ShutdownTimeout returns the maximum time allowed to drain active requests. +func (cfg *Controller) ShutdownTimeout() time.Duration { + return time.Duration(cfg.ShutdownTimeoutSeconds) * time.Second +} diff --git a/internal/config/environment.go b/internal/config/environment.go new file mode 100644 index 00000000..db5dfd83 --- /dev/null +++ b/internal/config/environment.go @@ -0,0 +1,41 @@ +package config + +import ( + "fmt" + "os" + "strconv" +) + +const maxConfiguredInteger = 1 << 30 + +type integerSetting struct { + name string + target *int +} + +// loadIntegers parses configured integer overrides and reports invalid values. +func loadIntegers(settings ...integerSetting) error { + for _, setting := range settings { + raw, exists := os.LookupEnv(setting.name) + if !exists { + continue + } + value, err := strconv.Atoi(raw) + if err != nil { + return fmt.Errorf("%s must be an integer", setting.name) + } + if err := validatePositive(setting.name, value); err != nil { + return err + } + *setting.target = value + } + return nil +} + +// validatePositive checks that a setting is positive and within the supported range. +func validatePositive(name string, value int) error { + if value < 1 || value > maxConfiguredInteger { + return fmt.Errorf("%s must be between 1 and %d", name, maxConfiguredInteger) + } + return nil +} diff --git a/internal/config/logger.go b/internal/config/logger.go new file mode 100644 index 00000000..58f2450b --- /dev/null +++ b/internal/config/logger.go @@ -0,0 +1,32 @@ +package config + +import ( + "fmt" + "os" +) + +// Logger configures the minimum severity written as structured JSON to stderr. +type Logger struct { + // Level is one of debug, info, warn or error; the default is info. + Level string +} + +// loadEnvironment applies environment overrides to this configuration section. +func (cfg *Logger) loadEnvironment() { + if level, exists := os.LookupEnv("LOG_LEVEL"); exists { + cfg.Level = level + } +} + +// Validate rejects unsupported levels rather than silently changing verbosity. +func (cfg *Logger) Validate() error { + if cfg == nil { + return fmt.Errorf("Logger configuration is required") + } + switch cfg.Level { + case "debug", "info", "warn", "error": + return nil + default: + return fmt.Errorf("LOG_LEVEL must be debug, info, warn or error") + } +} diff --git a/internal/config/memory.go b/internal/config/memory.go new file mode 100644 index 00000000..401e67d1 --- /dev/null +++ b/internal/config/memory.go @@ -0,0 +1,54 @@ +package config + +import "fmt" + +// Memory defines logical capacity limits; MaxStateBytes is not a measurement of RSS. +type Memory struct { + // MaxUsers limits the number of registered users. + MaxUsers int + // MaxChats limits the number of immutable chats. + MaxChats int + // MaxMessages limits the total number of messages across all chats. + MaxMessages int + // MaxStateBytes limits the logical storage budget, including estimated record overhead. + MaxStateBytes int +} + +// defaultMemory returns the default storage capacity limits. +func defaultMemory() *Memory { + return &Memory{ + MaxUsers: 10000, + MaxChats: 10000, + MaxMessages: 100000, + MaxStateBytes: 32 << 20, + } +} + +// loadEnvironment applies environment overrides to this configuration section. +func (cfg *Memory) loadEnvironment() error { + return loadIntegers( + integerSetting{"MAX_USERS", &cfg.MaxUsers}, + integerSetting{"MAX_CHATS", &cfg.MaxChats}, + integerSetting{"MAX_MESSAGES", &cfg.MaxMessages}, + integerSetting{"MAX_STATE_BYTES", &cfg.MaxStateBytes}, + ) +} + +// Validate rejects disabled, negative and excessively large storage limits. +func (cfg *Memory) Validate() error { + if cfg == nil { + return fmt.Errorf("Memory configuration is required") + } + settings := []integerSetting{ + {"MAX_USERS", &cfg.MaxUsers}, + {"MAX_CHATS", &cfg.MaxChats}, + {"MAX_MESSAGES", &cfg.MaxMessages}, + {"MAX_STATE_BYTES", &cfg.MaxStateBytes}, + } + for _, setting := range settings { + if err := validatePositive(setting.name, *setting.target); err != nil { + return err + } + } + return nil +} diff --git a/internal/config/persistence.go b/internal/config/persistence.go new file mode 100644 index 00000000..6950d4d2 --- /dev/null +++ b/internal/config/persistence.go @@ -0,0 +1,55 @@ +package config + +import ( + "fmt" + "os" + "strings" +) + +// Persistence contains database, cache and session settings. +type Persistence struct { + // CursorKey is the shared base64 signing key supplied through a secret. + CursorKey string + // DatabaseURL identifies the PostgreSQL database. + DatabaseURL string + // Shards maps stable identities to Valkey addresses. + Shards map[string]string + // Coordinator names the stable global admission shard. + Coordinator string + // PoolSize bounds connections per dependency. + PoolSize int + // TimeoutMilliseconds bounds each dependency operation. + TimeoutMilliseconds int + // SessionTTLSeconds sets the absolute session lifetime. + SessionTTLSeconds int +} + +// NewPersistence loads dependency settings separately from HTTP configuration. +func NewPersistence() (*Persistence, error) { + cfg := &Persistence{ + CursorKey: os.Getenv("CURSOR_SIGNING_KEY"), + DatabaseURL: os.Getenv("DATABASE_URL"), + Coordinator: os.Getenv("VALKEY_COORDINATOR"), + Shards: make(map[string]string), + PoolSize: 8, + TimeoutMilliseconds: 1000, + SessionTTLSeconds: 3600, + } + if cfg.Coordinator == "" { + cfg.Coordinator = "shard0" + } + for _, entry := range strings.Split(os.Getenv("VALKEY_SHARDS"), ",") { + id, address, ok := strings.Cut(entry, "=") + if !ok || id == "" || address == "" || cfg.Shards[id] != "" { + return nil, fmt.Errorf("VALKEY_SHARDS requires unique id=address entries") + } + cfg.Shards[id] = address + } + if cfg.DatabaseURL == "" || cfg.Shards[cfg.Coordinator] == "" { + return nil, fmt.Errorf("DATABASE_URL and a configured VALKEY_COORDINATOR are required") + } + if err := loadIntegers(integerSetting{"DEPENDENCY_POOL_SIZE", &cfg.PoolSize}, integerSetting{"DEPENDENCY_TIMEOUT_MS", &cfg.TimeoutMilliseconds}, integerSetting{"SESSION_TTL_SECONDS", &cfg.SessionTTLSeconds}); err != nil { + return nil, err + } + return cfg, nil +} diff --git a/internal/config/persistence_test.go b/internal/config/persistence_test.go new file mode 100644 index 00000000..6f9b63f4 --- /dev/null +++ b/internal/config/persistence_test.go @@ -0,0 +1,34 @@ +package config + +import "testing" + +// TestPersistenceConfiguration validates independent environment configurations. +func TestPersistenceConfiguration(t *testing.T) { + cases := []struct { + name string + database string + shards string + coordinator string + ttl string + valid bool + }{ + {"defaults", "postgres://localhost/test", "shard0=localhost:6379", "", "3600", true}, + {"missing database", "", "shard0=localhost:6379", "", "3600", false}, + {"missing coordinator", "postgres://localhost/test", "shard1=localhost:6379", "shard0", "3600", false}, + {"duplicate shard", "postgres://localhost/test", "shard0=a,shard0=b", "", "3600", false}, + {"invalid topology", "postgres://localhost/test", "wrong", "", "3600", false}, + {"invalid ttl", "postgres://localhost/test", "shard0=a", "", "no", false}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + t.Setenv("DATABASE_URL", tc.database) + t.Setenv("VALKEY_SHARDS", tc.shards) + t.Setenv("VALKEY_COORDINATOR", tc.coordinator) + t.Setenv("SESSION_TTL_SECONDS", tc.ttl) + _, err := NewPersistence() + if (err == nil) != tc.valid { + t.Fatalf("unexpected validation result: %v", err) + } + }) + } +} diff --git a/internal/controller/fx.go b/internal/controller/fx.go new file mode 100644 index 00000000..e99b2264 --- /dev/null +++ b/internal/controller/fx.go @@ -0,0 +1,8 @@ +package controller + +import "go.uber.org/fx" + +// RunControllerFx lets Fx own startup, signal handling and graceful shutdown. +func RunControllerFx(lc fx.Lifecycle, ctrl Controller) { + lc.Append(fx.Hook{OnStart: ctrl.Start, OnStop: ctrl.Stop}) +} diff --git a/internal/controller/http/fiber/auth.go b/internal/controller/http/fiber/auth.go new file mode 100644 index 00000000..88e4d383 --- /dev/null +++ b/internal/controller/http/fiber/auth.go @@ -0,0 +1,76 @@ +package fiber + +import ( + "encoding/base64" + "net/http" + "strings" + + "github.com/gofiber/fiber/v2" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +const identityKey = "authenticated-user" + +// HandleLogin structurally decodes Basic credentials and delegates authentication. +func (ctrl *Controller) HandleLogin(ctx *fiber.Ctx) error { + scheme, encoded, ok := strings.Cut(ctx.Get(fiber.HeaderAuthorization), " ") + if !ok || !strings.EqualFold(scheme, "Basic") { + return service.ErrUnauthorized + } + decoded, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return service.ErrUnauthorized + } + username, password, ok := strings.Cut(string(decoded), ":") + if !ok { + return service.ErrUnauthorized + } + if len(ctx.Body()) != 0 { + return service.ErrInvalid + } + session, err := ctrl.auth.Login(ctx.UserContext(), username, password) + if err != nil { + return err + } + return ctx.Status(http.StatusCreated).JSON(fiber.Map{ + "token": session.Token, + "token_type": "Bearer", + "expires_at": session.ExpiresAt, + "user": userResponse(session.User), + }) +} + +// HandleLogout revokes the current authenticated token before returning no content. +func (ctrl *Controller) HandleLogout(ctx *fiber.Ctx) error { + if err := ctrl.auth.Logout(ctx.UserContext(), bearer(ctx)); err != nil { + return err + } + return ctx.SendStatus(http.StatusNoContent) +} + +// bearer extracts a Bearer token without interpreting its identity or validity. +func bearer(ctx *fiber.Ctx) string { + scheme, token, ok := strings.Cut(ctx.Get(fiber.HeaderAuthorization), " ") + if !ok || !strings.EqualFold(scheme, "Bearer") { + return "" + } + return token +} + +// identity reads only the identity produced by successful session authentication. +func identity(ctx *fiber.Ctx) string { + value, _ := ctx.Locals(identityKey).(string) + return value +} + +// requestGroup selects a bounded policy group from the HTTP operation. +func requestGroup(ctx *fiber.Ctx) string { + if ctx.Path() == "/api/v1/users" || strings.HasPrefix(ctx.Path(), "/api/v1/auth/") { + return "auth" + } + if ctx.Method() == http.MethodGet { + return "read" + } + return "write" +} diff --git a/internal/controller/http/fiber/auth_test.go b/internal/controller/http/fiber/auth_test.go new file mode 100644 index 00000000..52795d4d --- /dev/null +++ b/internal/controller/http/fiber/auth_test.go @@ -0,0 +1,161 @@ +package fiber + +import ( + "context" + "encoding/base64" + "io" + "net/http" + "net/http/httptest" + "strings" + "testing" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +type sessionFixture struct { + fixtureAuthentication + login func(string, string) (dto.SessionDTO, error) + logoutError error +} + +// Login delegates the credentials decoded by the controller to the arranged scenario. +func (f sessionFixture) Login(_ context.Context, username, password string) (dto.SessionDTO, error) { + return f.login(username, password) +} + +// Logout returns the prescribed revocation outcome. +func (f sessionFixture) Logout(context.Context, string) error { + return f.logoutError +} + +// TestLoginHTTPChecksBasicEncoding verifies independent wire-level login scenarios. +func TestLoginHTTPChecksBasicEncoding(t *testing.T) { + cases := []struct { + name string + header string + body string + status int + }{ + {"missing header", "", "", http.StatusUnauthorized}, + {"wrong scheme", "Bearer abc", "", http.StatusUnauthorized}, + {"bad base64", "Basic %%%", "", http.StatusUnauthorized}, + {"no delimiter", "Basic " + base64.StdEncoding.EncodeToString([]byte("alice")), "", http.StatusUnauthorized}, + {"unexpected body", "Basic " + base64.StdEncoding.EncodeToString([]byte("alice:long-password:ok")), "{}", http.StatusBadRequest}, + {"valid colon in password", "Basic " + base64.StdEncoding.EncodeToString([]byte("alice:long-password:ok")), "", http.StatusCreated}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + ctrl := testController(t, nil) + ctrl.auth = sessionFixture{login: func(username, password string) (dto.SessionDTO, error) { + if username != "alice" || password != "long-password:ok" { + t.Fatal("credentials altered") + } + return dto.SessionDTO{Token: "opaque", ExpiresAt: time.Now().UTC().Add(time.Hour), User: dto.UserDTO{ID: uuid.New(), Username: "alice"}}, nil + }} + req := httptest.NewRequest(http.MethodPost, "/api/v1/auth/sessions", strings.NewReader(tc.body)) + req.Header.Set("Authorization", tc.header) + response, err := ctrl.server.Test(req) + if err != nil { + t.Fatal(err) + } + defer func() { + _ = response.Body.Close() + }() + if response.StatusCode != tc.status { + t.Fatalf("got %d want %d", response.StatusCode, tc.status) + } + if tc.status == http.StatusUnauthorized && response.Header.Get("WWW-Authenticate") != `Basic realm="messenger", charset="UTF-8"` { + t.Fatal("missing Basic challenge") + } + }) + } +} + +// TestLoginInvalidCredentialsUsesBasicChallenge checks the service rejection mapping. +func TestLoginInvalidCredentialsUsesBasicChallenge(t *testing.T) { + ctrl := testController(t, nil) + ctrl.auth = sessionFixture{login: func(string, string) (dto.SessionDTO, error) { + return dto.SessionDTO{}, service.ErrUnauthorized + }} + req := httptest.NewRequest(http.MethodPost, "/api/v1/auth/sessions", nil) + req.SetBasicAuth("alice", "invalid-password") + response, err := ctrl.server.Test(req) + if err != nil { + t.Fatal(err) + } + defer func() { + _ = response.Body.Close() + }() + if response.StatusCode != http.StatusUnauthorized || response.Header.Get("WWW-Authenticate") != `Basic realm="messenger", charset="UTF-8"` { + t.Fatal("incorrect login rejection") + } +} + +// TestLogoutHTTPReturnsNoContent checks the authenticated revocation response. +func TestLogoutHTTPReturnsNoContent(t *testing.T) { + ctrl := testController(t, nil) + actor := user(t, ctrl) + req := httptest.NewRequest(http.MethodDelete, "/api/v1/auth/sessions/current", nil) + req.Header.Set("Authorization", "Bearer "+actor) + response, err := ctrl.server.Test(req) + if err != nil { + t.Fatal(err) + } + defer func() { + _ = response.Body.Close() + }() + body, err := io.ReadAll(response.Body) + if err != nil || response.StatusCode != http.StatusNoContent || len(body) != 0 { + t.Fatalf("invalid logout response: %v", err) + } +} + +// TestLogoutHTTPPreservesFailure ensures an unsuccessful revoke does not claim success. +func TestLogoutHTTPPreservesFailure(t *testing.T) { + ctrl := testController(t, nil) + actor := user(t, ctrl) + ctrl.auth = sessionFixture{fixtureAuthentication: fixtureAuthentication{ctrl.service}, logoutError: context.DeadlineExceeded} + status, _, err := request(ctrl, http.MethodDelete, "/api/v1/auth/sessions/current", actor, nil) + if err != nil || status != http.StatusInternalServerError { + t.Fatalf("revocation failure hidden: %d %v", status, err) + } +} + +// TestLegacyIdentityDoesNotAuthenticate verifies the lab1 header cannot grant access. +func TestLegacyIdentityDoesNotAuthenticate(t *testing.T) { + ctrl := testController(t, nil) + actor := user(t, ctrl) + req := httptest.NewRequest(http.MethodGet, "/api/v1/users/me", nil) + req.Header.Set("X-User-Id", actor) + response, err := ctrl.server.Test(req) + if err != nil { + t.Fatal(err) + } + defer func() { + _ = response.Body.Close() + }() + if response.StatusCode != http.StatusUnauthorized || response.Header.Get("WWW-Authenticate") != `Bearer realm="messenger"` { + t.Fatal("legacy identity granted access or missing challenge") + } +} + +type unavailableReadiness struct{} + +// Ping simulates an unavailable mandatory dependency for readiness mapping. +func (unavailableReadiness) Ping(context.Context) error { + return context.DeadlineExceeded +} + +// TestReadinessRejectsDependencyFailure verifies readiness reflects mandatory infrastructure. +func TestReadinessRejectsDependencyFailure(t *testing.T) { + ctrl := testController(t, nil) + ctrl.readiness = unavailableReadiness{} + status, _, err := request(ctrl, http.MethodGet, "/health/ready", "", nil) + if err != nil || status != http.StatusServiceUnavailable { + t.Fatalf("incorrect readiness: %d %v", status, err) + } +} diff --git a/internal/controller/http/fiber/body_limit_test.go b/internal/controller/http/fiber/body_limit_test.go new file mode 100644 index 00000000..72833d5a --- /dev/null +++ b/internal/controller/http/fiber/body_limit_test.go @@ -0,0 +1,68 @@ +package fiber + +import ( + "context" + "encoding/json" + "net" + "net/http" + "strings" + "testing" + "time" + + "github.com/gofiber/fiber/v2" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + httpmodel "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/http" +) + +// TestBodyLimitInstanceHeader verifies parser-generated 413 responses over a real TCP listener. +func TestBodyLimitInstanceHeader(t *testing.T) { + // Arrange. + ctrl := testController(t, func(cfg *config.Config) { + cfg.HTTP.InstanceID = "body-limit-test-instance" + }) + ctrl.cfg.Host = "127.0.0.1" + ctrl.cfg.Port = 0 + address := make(chan string, 1) + ctrl.server.Hooks().OnListen(func(data fiber.ListenData) error { + address <- net.JoinHostPort(data.Host, data.Port) + return nil + }) + if err := ctrl.Start(t.Context()); err != nil { + t.Fatal(err) + } + t.Cleanup(func() { + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + if err := ctrl.Stop(ctx); err != nil { + t.Error(err) + } + }) + client := &http.Client{Timeout: 3 * time.Second} + + // Act. + response, err := client.Post("http://"+<-address+"/api/v1/users", "application/json", strings.NewReader(strings.Repeat("x", ctrl.cfg.MaxBodyBytes+1))) + if err != nil { + t.Fatal(err) + } + defer func() { + if err := response.Body.Close(); err != nil { + t.Error(err) + } + }() + + // Assert. + if response.StatusCode != http.StatusRequestEntityTooLarge { + t.Fatalf("status=%d", response.StatusCode) + } + if instance := response.Header.Get("X-Instance-Id"); instance != ctrl.instanceID { + t.Fatalf("instance=%q, want %q", instance, ctrl.instanceID) + } + var body httpmodel.ErrorResponse + if err := json.NewDecoder(response.Body).Decode(&body); err != nil { + t.Fatal(err) + } + if body.Error.Code != "payload_too_large" || body.Error.RequestID == "" || body.Error.RequestID != response.Header.Get(headerRequestID) { + t.Fatalf("invalid error envelope: %+v", body) + } +} diff --git a/internal/controller/http/fiber/chats_test.go b/internal/controller/http/fiber/chats_test.go new file mode 100644 index 00000000..d1660ba1 --- /dev/null +++ b/internal/controller/http/fiber/chats_test.go @@ -0,0 +1,312 @@ +package fiber + +import ( + "net/http" + "net/url" + "reflect" + "testing" + + "github.com/google/uuid" +) + +// TestController_ChatsCreate checks membership and request validation in isolated chats. +func TestController_ChatsCreate(t *testing.T) { + t.Run("Positive: caller included", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + payload := mustJSON(t, map[string]any{"title": "Team", "member_ids": []string{actor}}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusCreated, body) + if body["title"] != "Team" || !reflect.DeepEqual(body["member_ids"], []any{actor}) { + t.Fatalf("chat fields changed: %v", body) + } + }) + + t.Run("Negative: empty members", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + payload := mustJSON(t, map[string]any{"title": "Team", "member_ids": []string{}}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: duplicate members", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + payload := mustJSON(t, map[string]any{"title": "Team", "member_ids": []string{actor, actor}}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: caller omitted", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + outsider := user(t, ctrl) + payload := mustJSON(t, map[string]any{"title": "Team", "member_ids": []string{outsider}}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: unknown member", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + payload := mustJSON(t, map[string]any{"title": "Team", "member_ids": []string{actor, uuid.NewString()}}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: malformed member ID", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + payload := mustJSON(t, map[string]any{"title": "Team", "member_ids": []string{actor, "invalid"}}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: blank title", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + payload := mustJSON(t, map[string]any{"title": " ", "member_ids": []string{actor}}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: malformed JSON", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + payload := []byte(`{`) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) +} + +// TestController_ChatsGetByID checks access and the returned chat identity. +func TestController_ChatsGetByID(t *testing.T) { + t.Run("Positive: member reads chat", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + id := chat(t, ctrl, owner) + actor, target := owner, id + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/chats/"+target, actor, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusOK, body) + if body["id"] != id || body["title"] != "Чат" { + t.Fatalf("wrong chat: %v", body) + } + }) + + t.Run("Negative: outsider", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + id := chat(t, ctrl, owner) + actor, target := user(t, ctrl), id + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/chats/"+target, actor, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusNotFound, body) + assertErrorCode(t, body, "not_found") + }) + + t.Run("Negative: unknown chat", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + actor, target := owner, uuid.NewString() + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/chats/"+target, actor, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusNotFound, body) + assertErrorCode(t, body, "not_found") + }) + + t.Run("Negative: malformed chat ID", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + actor, target := owner, "invalid" + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/chats/"+target, actor, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: authentication precedes ID parsing", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor, target := "", "invalid" + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/chats/"+target, actor, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusUnauthorized, body) + assertErrorCode(t, body, "unauthorized") + }) +} + +// TestController_ChatsGetPage checks that foreign memberships remain absent from lists. +func TestController_ChatsGetPage(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + chat(t, ctrl, owner) + outsider := user(t, ctrl) + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/chats", outsider, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusOK, body) + if len(body["items"].([]any)) != 0 || body["next_cursor"] != nil { + t.Fatalf("foreign chat leaked: %v", body) + } +} + +// TestController_ChatPagination recovers every chat exactly once across page boundaries. +func TestController_ChatPagination(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + expected := make(map[string]bool) + for range 15 { + expected[chat(t, ctrl, actor)] = true + } + + // Act. + items := history(t, ctrl, actor, "/api/v1/chats") + + // Assert. + if len(items) != len(expected) { + t.Fatalf("got %d chats, want %d", len(items), len(expected)) + } + for _, item := range items { + id := item.(map[string]any)["id"].(string) + if !expected[id] { + t.Fatalf("duplicate or unexpected chat %s", id) + } + delete(expected, id) + } +} + +// TestController_ChatCursorScope rejects a continuation issued for another user's list. +func TestController_ChatCursorScope(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + outsider := user(t, ctrl) + chat(t, ctrl, owner) + chat(t, ctrl, owner) + page := call(t, ctrl, http.MethodGet, "/api/v1/chats?limit=1", owner, nil, http.StatusOK) + token := page["next_cursor"].(string) + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/chats?cursor="+url.QueryEscape(token), outsider, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") +} diff --git a/internal/controller/http/fiber/configure.go b/internal/controller/http/fiber/configure.go new file mode 100644 index 00000000..1f3da39a --- /dev/null +++ b/internal/controller/http/fiber/configure.go @@ -0,0 +1,37 @@ +package fiber + +import ( + "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/middleware/recover" +) + +// configure initializes the HTTP server, middleware and routes. +func (ctrl *Controller) configure() { + ctrl.createServer() + ctrl.initMiddlewares() + ctrl.initRoutes() +} + +// createServer creates Fiber with the configured transport limits and error handler. +func (ctrl *Controller) createServer() { + timeout := ctrl.cfg.Timeout() + ctrl.server = fiber.New(fiber.Config{ + AppName: "messenger-lab1", + DisableStartupMessage: true, + Immutable: true, + CaseSensitive: true, + StrictRouting: true, + BodyLimit: ctrl.cfg.MaxBodyBytes, + Concurrency: ctrl.cfg.MaxConnections, + ReadTimeout: timeout, + WriteTimeout: timeout, + IdleTimeout: timeout, + ErrorHandler: ctrl.handleErr, + }) +} + +// initMiddlewares registers request logging and panic recovery middleware. +func (ctrl *Controller) initMiddlewares() { + ctrl.server.Use(ctrl.request) + ctrl.server.Use(recover.New()) +} diff --git a/internal/controller/http/fiber/controller.go b/internal/controller/http/fiber/controller.go new file mode 100644 index 00000000..8946c275 --- /dev/null +++ b/internal/controller/http/fiber/controller.go @@ -0,0 +1,65 @@ +// Package fiber implements the messenger HTTP transport using Fiber. +package fiber + +import ( + "fmt" + "sync/atomic" + + "github.com/gofiber/fiber/v2" + "github.com/google/uuid" + "go.lab260.ru/fielderr" + "go.uber.org/zap" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/admission" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/controller" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// Controller owns the HTTP server and delegates business operations to Service. +// Its configuration is copied at construction and must not change during serving. +// Fx manages its listener through Start and Stop. +type Controller struct { + metrics *httpMetrics + log *zap.Logger + cfg config.Controller + service service.Service + server *fiber.App + errorRegistry *fielderr.Registry + admission admission.Distributed + auth service.Authentication + readiness Readiness + stopping atomic.Bool + instanceID string + serveDone chan error +} + +var _ controller.Controller = (*Controller)(nil) + +// New validates dependencies and prepares the server without opening a listener. +// Routing, middleware and Fiber configuration are installed by configure. +func New(log *zap.Logger, cfg *config.Controller, svc service.Service, registry *fielderr.Registry, limiter admission.Distributed, auth service.Authentication, readiness Readiness) (*Controller, error) { + if err := cfg.Validate(); err != nil { + return nil, err + } + if log == nil || svc == nil || registry == nil || limiter == nil || auth == nil || readiness == nil { + return nil, fmt.Errorf("HTTP logger, service, error registry and admission limiter are required") + } + ctrl := &Controller{ + metrics: newHTTPMetrics(), + log: log.Named("controller.http.fiber"), + cfg: *cfg, + service: svc, + errorRegistry: registry, + admission: limiter, + auth: auth, + readiness: readiness, + serveDone: make(chan error, 1), + } + ctrl.instanceID = cfg.InstanceID + if ctrl.instanceID == "" { + ctrl.instanceID = uuid.NewString() + } + ctrl.configure() + return ctrl, nil +} diff --git a/internal/controller/http/fiber/controller_test.go b/internal/controller/http/fiber/controller_test.go new file mode 100644 index 00000000..c4c20369 --- /dev/null +++ b/internal/controller/http/fiber/controller_test.go @@ -0,0 +1,320 @@ +package fiber + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "net/http" + "net/http/httptest" + "net/url" + "reflect" + "strings" + "sync" + "testing" + + "github.com/google/uuid" + "go.uber.org/zap" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/admission" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service/production" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/memory" +) + +// testController creates an integration fixture with the real controller, service and store. +func testController(t *testing.T, change func(*config.Config)) *Controller { + t.Helper() + cfg := config.Default() + cfg.HTTP.Admission.RequestsPerSecond = 100000 + cfg.HTTP.Admission.Burst = 100000 + if change != nil { + change(cfg) + } + repo, err := memory.New(cfg.Memory) + if err != nil { + t.Fatal(err) + } + codec, err := cursor.New() + if err != nil { + t.Fatal(err) + } + svc, err := production.New(repo, codec) + if err != nil { + t.Fatal(err) + } + registry, err := NewErrorRegistry() + if err != nil { + t.Fatal(err) + } + limiter, err := admission.New(admission.Options{ + MaxInFlight: cfg.HTTP.Admission.MaxInFlight, + RequestsPerSecond: cfg.HTTP.Admission.RequestsPerSecond, + Burst: cfg.HTTP.Admission.Burst, + }) + if err != nil { + t.Fatal(err) + } + ctrl, err := New(zap.NewNop(), cfg.HTTP, svc, registry, &fixtureAdmission{limiter}, fixtureAuthentication{svc}, fixtureReadiness{}) + if err != nil { + t.Fatal(err) + } + return ctrl +} + +// request sends a raw test request and decodes its response. +func request(ctrl *Controller, method, path, actor string, body []byte) (int, map[string]any, error) { + req := httptest.NewRequest(method, path, bytes.NewReader(body)) + req.Header.Set("Idempotency-Key", uuid.NewString()) + if body != nil { + req.Header.Set("Content-Type", "application/json") + } + if actor != "" { + req.Header.Set("Authorization", "Bearer "+actor) + } + resp, err := ctrl.server.Test(req, 10000) + if err != nil { + return 0, nil, err + } + defer func() { + _ = resp.Body.Close() + }() + b, err := io.ReadAll(resp.Body) + if err != nil { + return 0, nil, err + } + var data map[string]any + if err = json.Unmarshal(b, &data); err != nil { + return resp.StatusCode, nil, fmt.Errorf("invalid JSON response: %w", err) + } + if resp.Header.Get("X-Request-Id") == "" { + return resp.StatusCode, data, fmt.Errorf("missing request ID") + } + if resp.StatusCode >= http.StatusBadRequest { + envelope, ok := data["error"].(map[string]any) + if !ok || envelope["request_id"] != resp.Header.Get("X-Request-Id") { + return resp.StatusCode, data, fmt.Errorf("invalid error envelope") + } + } + return resp.StatusCode, data, nil +} + +// call sends a JSON test request and checks its expected HTTP status. +func call(t *testing.T, ctrl *Controller, method, path, actor string, body any, want int) map[string]any { + t.Helper() + var b []byte + var err error + if raw, ok := body.([]byte); ok { + b = raw + } else if body != nil { + b, err = json.Marshal(body) + if err != nil { + t.Fatal(err) + } + } + status, data, err := request(ctrl, method, path, actor, b) + if err != nil { + t.Fatal(err) + } + if status != want { + t.Fatalf("%s %s: got %d want %d: %v", method, path, status, want, data) + } + return data +} + +// user creates a test user and returns its identifier. +func user(t *testing.T, c *Controller) string { + t.Helper() + r := call(t, c, http.MethodPost, "/api/v1/users", "", map[string]any{"username": "u_" + uuid.New().String()[:8], "display_name": "Алиса 👋", "password": "fixture-password-123"}, http.StatusCreated) + return r["id"].(string) +} + +// chat creates a test chat containing the supplied user. +func chat(t *testing.T, c *Controller, u string) string { + t.Helper() + r := call(t, c, http.MethodPost, "/api/v1/chats", u, map[string]any{"title": "Чат", "member_ids": []string{u}}, http.StatusCreated) + return r["id"].(string) +} + +// TestDuplicateUsernameRace checks username uniqueness under concurrent requests. +func TestDuplicateUsernameRace(t *testing.T) { + // Arrange. + c := testController(t, nil) + results := make(chan int, 10) + failures := make(chan error, 10) + var wg sync.WaitGroup + // Act. + for range 10 { + wg.Go(func() { + status, _, err := request(c, http.MethodPost, "/api/v1/users", "", []byte(`{"username":"same","display_name":"User","password":"fixture-password-123"}`)) + if err != nil { + failures <- err + } + results <- status + }) + } + wg.Wait() + close(results) + close(failures) + // Assert. + for err := range failures { + t.Error(err) + } + created, conflicts := 0, 0 + for s := range results { + switch s { + case http.StatusCreated: + created++ + case http.StatusConflict: + conflicts++ + default: + t.Errorf("unexpected %d", s) + } + } + if created != 1 || conflicts != 9 { + t.Fatalf("created=%d conflicts=%d", created, conflicts) + } +} + +// history collects all test messages by following pagination cursors. +func history(t *testing.T, c *Controller, u, path string) []any { + t.Helper() + var items []any + next := path + "?limit=7" + for range 100 { + r := call(t, c, http.MethodGet, next, u, nil, http.StatusOK) + items = append(items, r["items"].([]any)...) + if r["next_cursor"] == nil { + return items + } + next = path + "?limit=7&cursor=" + url.QueryEscape(r["next_cursor"].(string)) + } + t.Fatal("pagination never finished") + return nil +} + +// TestConcurrent100Messages10Clients recovers the exact acknowledged records after concurrent writes. +func TestConcurrent100Messages10Clients(t *testing.T) { + // Arrange. + const clients = 10 + const messagesPerClient = 10 + const total = clients * messagesPerClient + ctrl := testController(t, nil) + actor := user(t, ctrl) + chatID := chat(t, ctrl, actor) + path := "/api/v1/chats/" + chatID + "/messages" + acknowledgements := make(chan map[string]any, total) + failures := make(chan error, total) + var writers sync.WaitGroup + + // Act. + for client := range clients { + writers.Go(func() { + for index := range messagesPerClient { + text := fmt.Sprintf("client %d message %d", client, index) + payload, err := json.Marshal(map[string]string{"text": text}) + if err != nil { + failures <- err + continue + } + status, body, err := request(ctrl, http.MethodPost, path, actor, payload) + if err != nil { + failures <- err + continue + } + if status != http.StatusCreated || body["text"] != text || body["sender_id"] != actor || body["chat_id"] != chatID { + failures <- fmt.Errorf("incorrect acknowledgement: status=%d, body=%v", status, body) + continue + } + acknowledgements <- body + } + }) + } + writers.Wait() + close(failures) + close(acknowledgements) + + // Assert. + for err := range failures { + t.Error(err) + } + if t.Failed() { + t.FailNow() + } + expected := make(map[string]map[string]any, total) + for message := range acknowledgements { + id, ok := message["id"].(string) + if !ok || id == "" { + t.Fatalf("invalid message ID: %v", message) + } + if _, duplicate := expected[id]; duplicate { + t.Fatalf("duplicate acknowledgement ID %s", id) + } + expected[id] = message + } + if len(expected) != total { + t.Fatalf("acknowledged=%d, want=%d", len(expected), total) + } + items := history(t, ctrl, actor, path) + if len(items) != total { + t.Fatalf("recovered=%d, want=%d", len(items), total) + } + for _, item := range items { + message := item.(map[string]any) + id := message["id"].(string) + if !reflect.DeepEqual(message, expected[id]) { + t.Fatalf("stored record differs from acknowledgement: got=%v, want=%v", message, expected[id]) + } + delete(expected, id) + } +} + +// TestUnsupportedMediaType checks rejection of unsupported request content types. +func TestUnsupportedMediaType(t *testing.T) { + // Arrange. + c := testController(t, nil) + req := httptest.NewRequest(http.MethodPost, "/api/v1/users", strings.NewReader(`{}`)) + req.Header.Set("Content-Type", "text/plain") + // Act. + r, e := c.server.Test(req) + + // Assert. + if e != nil { + t.Fatal(e) + } + defer func() { + _ = r.Body.Close() + }() + if r.StatusCode != http.StatusUnsupportedMediaType { + t.Fatalf("status %d", r.StatusCode) + } +} + +// TestConfigIndependentState prevents one application instance from accepting another's identity. +func TestConfigIndependentState(t *testing.T) { + // Arrange. + first := testController(t, nil) + actor := user(t, first) + second := testController(t, nil) + + // Act. + status, body, err := request(second, http.MethodGet, "/api/v1/users/me", actor, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusUnauthorized, body) + assertErrorCode(t, body, "unauthorized") +} + +// mustJSON encodes fixture payloads and reports preparation failures at the caller. +func mustJSON(t *testing.T, value any) []byte { + t.Helper() + payload, err := json.Marshal(value) + if err != nil { + t.Fatal(err) + } + return payload +} diff --git a/internal/controller/http/fiber/decode.go b/internal/controller/http/fiber/decode.go new file mode 100644 index 00000000..5ab57a37 --- /dev/null +++ b/internal/controller/http/fiber/decode.go @@ -0,0 +1,22 @@ +package fiber + +import ( + "mime" + + "github.com/gofiber/fiber/v2" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/strictjson" +) + +// decode checks HTTP media type and maps strict JSON decoding errors to API input errors. +func decode(ctx *fiber.Ctx, target any, requiredFields ...string) error { + mediaType, _, err := mime.ParseMediaType(ctx.Get(fiber.HeaderContentType)) + if err != nil || mediaType != fiber.MIMEApplicationJSON { + return errMedia + } + if err := strictjson.DecodeObject(ctx.Body(), target, requiredFields...); err != nil { + return service.ErrInvalid + } + return nil +} diff --git a/internal/controller/http/fiber/dependencies.go b/internal/controller/http/fiber/dependencies.go new file mode 100644 index 00000000..58a3a74d --- /dev/null +++ b/internal/controller/http/fiber/dependencies.go @@ -0,0 +1,9 @@ +package fiber + +import "context" + +// Readiness checks the dependencies required by the synchronous request path. +type Readiness interface { + // Ping reports whether requests can be safely served. + Ping(context.Context) error +} diff --git a/internal/controller/http/fiber/error_codes.go b/internal/controller/http/fiber/error_codes.go new file mode 100644 index 00000000..64decfa0 --- /dev/null +++ b/internal/controller/http/fiber/error_codes.go @@ -0,0 +1,22 @@ +package fiber + +const ( + // codeInvalid identifies malformed or invalid request input. + codeInvalid = "invalid_request" + // codeUnauthorized identifies an unresolved user identity. + codeUnauthorized = "unauthorized" + // codeNotFound deliberately covers both absent and inaccessible resources. + codeNotFound = "not_found" + // codeConflict identifies a violated uniqueness constraint. + codeConflict = "conflict" + // codeUnavailable identifies temporary admission or persistent capacity exhaustion. + codeUnavailable = "unavailable" + // codeRateLimited identifies exhaustion of the request token bucket. + codeRateLimited = "rate_limited" + // codeTooLarge identifies a request exceeding the transport byte budget. + codeTooLarge = "payload_too_large" + // codeMedia identifies an unsupported request media type. + codeMedia = "unsupported_media_type" + // codeInternal identifies a hidden unexpected failure. + codeInternal = "internal_error" +) diff --git a/internal/controller/http/fiber/error_registry.go b/internal/controller/http/fiber/error_registry.go new file mode 100644 index 00000000..d5e10075 --- /dev/null +++ b/internal/controller/http/fiber/error_registry.go @@ -0,0 +1,33 @@ +package fiber + +import ( + "net/http" + + "go.lab260.ru/fielderr" +) + +// NewErrorRegistry returns an immutable mapping of application statuses to HTTP codes. +// The registry is injected rather than installed in process-global state, allowing +// independent application instances in integration tests. +func NewErrorRegistry() (*fielderr.Registry, error) { + return fielderr.NewRegistry( + statusDefinition(codeInvalid, http.StatusBadRequest), + statusDefinition(codeUnauthorized, http.StatusUnauthorized), + statusDefinition(codeNotFound, http.StatusNotFound), + statusDefinition(codeConflict, http.StatusConflict), + statusDefinition(codeTooLarge, http.StatusRequestEntityTooLarge), + statusDefinition(codeMedia, http.StatusUnsupportedMediaType), + statusDefinition(codeRateLimited, http.StatusTooManyRequests), + statusDefinition(codeUnavailable, http.StatusServiceUnavailable), + statusDefinition(codeInternal, http.StatusInternalServerError), + ) +} + +// statusDefinition associates an application error code with its HTTP status. +func statusDefinition(name string, httpStatus int) fielderr.StatusDefinition { + return fielderr.StatusDefinition{ + Code: fielderr.NewStatusCode(name), + Name: name, + HTTPStatus: httpStatus, + } +} diff --git a/internal/controller/http/fiber/errors.go b/internal/controller/http/fiber/errors.go new file mode 100644 index 00000000..4a9a5795 --- /dev/null +++ b/internal/controller/http/fiber/errors.go @@ -0,0 +1,73 @@ +package fiber + +import ( + "errors" + "net/http" + + "github.com/gofiber/fiber/v2" + "github.com/google/uuid" + "go.lab260.ru/fielderr" + "go.uber.org/zap" + + httpmodel "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/http" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// handleErr normalizes a failure and writes the public error envelope. +func (ctrl *Controller) handleErr(ctx *fiber.Ctx, err error) error { + // Parser failures such as BodyLimit rejection bypass request middleware. + ctx.Set("X-Instance-Id", ctrl.instanceID) + requestID := ctx.GetRespHeader(headerRequestID) + if requestID == "" { + requestID = uuid.NewString() + ctx.Set(headerRequestID, requestID) + } + err = publicError(normalizeTransportError(err)) + status, ok := fielderr.HTTPStatusFrom(ctrl.errorRegistry, err) + if !ok { + err = errInternal + status = http.StatusInternalServerError + } + if status == http.StatusUnauthorized { + challenge := `Bearer realm="messenger"` + if ctx.Path() == "/api/v1/auth/sessions" && ctx.Method() == http.MethodPost { + challenge = `Basic realm="messenger", charset="UTF-8"` + } + ctx.Set(fiber.HeaderWWWAuthenticate, challenge) + } + if status == http.StatusInternalServerError { + ctrl.log.Error("unexpected request failure", zap.String("request_id", requestID)) + } + return ctx.Status(status).JSON(errorResponse(err, requestID)) +} + +// normalizeTransportError maps Fiber failures to transport-independent application errors. +func normalizeTransportError(err error) error { + transportError, ok := errors.AsType[*fiber.Error](err) + if !ok { + return err + } + switch transportError.Code { + case http.StatusRequestEntityTooLarge: + return errTooLarge + case http.StatusNotFound, http.StatusMethodNotAllowed: + return service.ErrNotFound + case http.StatusBadRequest, http.StatusRequestTimeout, http.StatusRequestHeaderFieldsTooLarge: + return service.ErrInvalid + default: + return errInternal + } +} + +// errorResponse builds the public error envelope with its request identifier. +func errorResponse(err error, requestID string) httpmodel.ErrorResponse { + status, _ := fielderr.Status(err) + message, _ := fielderr.PublicMessage(err) + return httpmodel.ErrorResponse{ + Error: httpmodel.ErrorDetail{ + Code: status.String(), + Message: message, + RequestID: requestID, + }, + } +} diff --git a/internal/controller/http/fiber/errors_test.go b/internal/controller/http/fiber/errors_test.go new file mode 100644 index 00000000..1cde1271 --- /dev/null +++ b/internal/controller/http/fiber/errors_test.go @@ -0,0 +1,107 @@ +package fiber + +import ( + "encoding/json" + "errors" + "net/http" + "testing" + + "github.com/gofiber/fiber/v2" + "github.com/valyala/fasthttp" + "go.lab260.ru/fielderr" + + httpmodel "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/http" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// TestTransportErrorMapping checks safe API errors for framework-generated failures. +func TestTransportErrorMapping(t *testing.T) { + t.Run("large body", func(t *testing.T) { + if normalizeTransportError(fiber.ErrRequestEntityTooLarge) != errTooLarge { + t.Fatal("incorrect body-limit error") + } + }) + t.Run("method not allowed", func(t *testing.T) { + if normalizeTransportError(fiber.ErrMethodNotAllowed) != service.ErrNotFound { + t.Fatal("unexpected method error") + } + }) + t.Run("invalid request", func(t *testing.T) { + if normalizeTransportError(fiber.ErrBadRequest) != service.ErrInvalid { + t.Fatal("unexpected input error") + } + }) + t.Run("unexpected framework failure", func(t *testing.T) { + if normalizeTransportError(fiber.ErrInternalServerError) != errInternal { + t.Fatal("unexpected failure escaped normalization") + } + }) +} + +// TestController_handleErr writes a safe, correlated fallback response. +func TestController_handleErr(t *testing.T) { + t.Run("Negative: unknown internal error", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + raw := &fasthttp.RequestCtx{} + ctx := ctrl.server.AcquireCtx(raw) + defer ctrl.server.ReleaseCtx(ctx) + + // Act. + err := ctrl.handleErr(ctx, errors.New("private storage secret")) + + // Assert. + if err != nil { + t.Fatal(err) + } + if raw.Response.StatusCode() != http.StatusInternalServerError { + t.Fatalf("status=%d", raw.Response.StatusCode()) + } + var body httpmodel.ErrorResponse + if err := json.Unmarshal(raw.Response.Body(), &body); err != nil { + t.Fatal(err) + } + requestID := string(raw.Response.Header.Peek(headerRequestID)) + if requestID == "" || body.Error.RequestID != requestID { + t.Fatalf("uncorrelated error: %+v, header=%q", body, requestID) + } + if body.Error.Code != "internal_error" || body.Error.Message != "internal server error" { + t.Fatalf("unsafe fallback: %+v", body) + } + }) + + t.Run("Negative: missing status mapping", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + registry, err := fielderr.NewRegistry() + if err != nil { + t.Fatal(err) + } + ctrl.errorRegistry = registry + raw := &fasthttp.RequestCtx{} + ctx := ctrl.server.AcquireCtx(raw) + defer ctrl.server.ReleaseCtx(ctx) + + // Act. + err = ctrl.handleErr(ctx, service.ErrInvalid) + + // Assert. + if err != nil { + t.Fatal(err) + } + if raw.Response.StatusCode() != http.StatusInternalServerError { + t.Fatalf("status=%d", raw.Response.StatusCode()) + } + var body httpmodel.ErrorResponse + if err := json.Unmarshal(raw.Response.Body(), &body); err != nil { + t.Fatal(err) + } + requestID := string(raw.Response.Header.Peek(headerRequestID)) + if requestID == "" || body.Error.RequestID != requestID { + t.Fatalf("uncorrelated error: %+v, header=%q", body, requestID) + } + if body.Error.Code != "internal_error" || body.Error.Message != "internal server error" { + t.Fatalf("unsafe fallback: %+v", body) + } + }) +} diff --git a/internal/controller/http/fiber/fixtures_auth_test.go b/internal/controller/http/fiber/fixtures_auth_test.go new file mode 100644 index 00000000..7212eb67 --- /dev/null +++ b/internal/controller/http/fiber/fixtures_auth_test.go @@ -0,0 +1,61 @@ +package fiber + +import ( + "context" + "time" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/admission" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// fixtureAuthentication isolates HTTP decoding and business authorization from session persistence. +type fixtureAuthentication struct { + service service.Service +} + +// Register delegates profile validation to the real business service. +func (f fixtureAuthentication) Register(ctx context.Context, request dto.UsersCreateRequestDTO, _ string) (dto.UserDTO, error) { + return f.service.UsersCreate(ctx, request) +} + +// Authenticate uses fixture tokens equal to user IDs exclusively in controller tests. +func (f fixtureAuthentication) Authenticate(ctx context.Context, token string) (string, error) { + return token, f.service.UsersCheckIdentity(ctx, token) +} + +// Login is deliberately unsupported by this fixture; real login has separate integration coverage. +func (f fixtureAuthentication) Login(context.Context, string, string) (dto.SessionDTO, error) { + return dto.SessionDTO{}, service.ErrUnauthorized +} + +// Logout accepts the fixture session without persistent side effects. +func (f fixtureAuthentication) Logout(context.Context, string) error { + return nil +} + +type fixtureReadiness struct{} + +// Ping marks isolated controller fixtures ready without external resources. +func (fixtureReadiness) Ping(context.Context) error { + return nil +} + +type fixtureAdmission struct { + *admission.Limiter +} + +// Enter adapts the deterministic local policy fixture to the distributed boundary. +func (f *fixtureAdmission) Enter(_ context.Context, _, user string) (func(), error) { + if user != "" { + return func() { + }, nil + } + if !f.Allow(time.Now()) { + return nil, admission.ErrRate + } + if !f.Acquire() { + return nil, admission.ErrSlots + } + return f.Release, nil +} diff --git a/internal/controller/http/fiber/handlers.go b/internal/controller/http/fiber/handlers.go new file mode 100644 index 00000000..bb48549d --- /dev/null +++ b/internal/controller/http/fiber/handlers.go @@ -0,0 +1,97 @@ +package fiber + +import ( + "net/http" + + "github.com/gofiber/fiber/v2" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + httpmodel "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/http" +) + +// HandleUsersCreate decodes registration input and returns the created user. +func (ctrl *Controller) HandleUsersCreate(ctx *fiber.Ctx) error { + var request httpmodel.UsersCreateRequest + if err := decode(ctx, &request, "username", "display_name", "password"); err != nil { + return err + } + user, err := ctrl.auth.Register(ctx.UserContext(), dto.UsersCreateRequestDTO{ + Username: request.Username, + DisplayName: request.DisplayName, + }, request.Password) + if err != nil { + return err + } + return ctx.Status(http.StatusCreated).JSON(userResponse(user)) +} + +// HandleUsersGetMe returns the account selected by the validated session. +func (ctrl *Controller) HandleUsersGetMe(ctx *fiber.Ctx) error { + user, err := ctrl.service.UsersGetMe(ctx.UserContext(), identity(ctx)) + if err != nil { + return err + } + return ctx.Status(http.StatusOK).JSON(userResponse(user)) +} + +// HandleChatsCreate decodes the chat payload and returns the new chat. +func (ctrl *Controller) HandleChatsCreate(ctx *fiber.Ctx) error { + var request httpmodel.ChatsCreateRequest + if err := decode(ctx, &request, "title", "member_ids"); err != nil { + return err + } + chat, err := ctrl.service.ChatsCreate(ctx.UserContext(), dto.ChatsCreateRequestDTO{ + UserID: identity(ctx), + Title: request.Title, + MemberIDs: request.MemberIDs, + }) + if err != nil { + return err + } + return ctx.Status(http.StatusCreated).JSON(chatResponse(chat)) +} + +// HandleChatsGetByID delegates chat authorization and maps the accessible chat. +func (ctrl *Controller) HandleChatsGetByID(ctx *fiber.Ctx) error { + chat, err := ctrl.service.ChatsGetByID(ctx.UserContext(), identity(ctx), ctx.Params("chat_id")) + if err != nil { + return err + } + return ctx.Status(http.StatusOK).JSON(chatResponse(chat)) +} + +// HandleChatsGetPage returns the service's page of visible chats. +func (ctrl *Controller) HandleChatsGetPage(ctx *fiber.Ctx) error { + page, err := ctrl.service.ChatsGetPage(ctx.UserContext(), pageRequest(ctx)) + if err != nil { + return err + } + return ctx.Status(http.StatusOK).JSON(chatPageResponse(page)) +} + +// HandleMessagesCreate decodes text; the service derives and authorizes the sender. +func (ctrl *Controller) HandleMessagesCreate(ctx *fiber.Ctx) error { + var request httpmodel.MessagesCreateRequest + if err := decode(ctx, &request, "text"); err != nil { + return err + } + message, err := ctrl.service.MessagesCreate(ctx.UserContext(), dto.MessagesCreateRequestDTO{ + IdempotencyKey: ctx.Get("Idempotency-Key"), + UserID: identity(ctx), + ChatID: ctx.Params("chat_id"), + Text: request.Text, + }) + if err != nil { + return err + } + return ctx.Status(http.StatusCreated).JSON(messageResponse(message)) +} + +// HandleMessagesGetPage returns the service's ordered history page. +func (ctrl *Controller) HandleMessagesGetPage(ctx *fiber.Ctx) error { + page, err := ctrl.service.MessagesGetPage(ctx.UserContext(), pageRequest(ctx)) + if err != nil { + return err + } + return ctx.Status(http.StatusOK).JSON(messagePageResponse(page)) +} diff --git a/internal/controller/http/fiber/headers.go b/internal/controller/http/fiber/headers.go new file mode 100644 index 00000000..d6991683 --- /dev/null +++ b/internal/controller/http/fiber/headers.go @@ -0,0 +1,7 @@ +package fiber + +const ( + headerUserID = "X-User-Id" + headerRequestID = "X-Request-Id" + retryAfterSeconds = 1 +) diff --git a/internal/controller/http/fiber/health.go b/internal/controller/http/fiber/health.go new file mode 100644 index 00000000..c800b21a --- /dev/null +++ b/internal/controller/http/fiber/health.go @@ -0,0 +1,28 @@ +package fiber + +import ( + "github.com/gofiber/fiber/v2" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// handleLive reports that the server process is running. +func (ctrl *Controller) handleLive(ctx *fiber.Ctx) error { + return ctx.JSON(fiber.Map{"status": "ok"}) +} + +// handleReady reports readiness unless shutdown has started. +func (ctrl *Controller) handleReady(ctx *fiber.Ctx) error { + if ctrl.stopping.Load() { + return errBusy + } + if err := ctrl.readiness.Ping(ctx.UserContext()); err != nil { + return errBusy + } + return ctrl.handleLive(ctx) +} + +// handleNotFound returns the application error for an unmatched route. +func (ctrl *Controller) handleNotFound(_ *fiber.Ctx) error { + return service.ErrNotFound +} diff --git a/internal/controller/http/fiber/lifecycle.go b/internal/controller/http/fiber/lifecycle.go new file mode 100644 index 00000000..455e213f --- /dev/null +++ b/internal/controller/http/fiber/lifecycle.go @@ -0,0 +1,70 @@ +package fiber + +import ( + "context" + "net" + "sync" + + "go.uber.org/zap" +) + +// Start opens the listener synchronously so Fx observes bind errors immediately. +// It must be called once per Controller; Stop terminates the serving goroutine. +func (ctrl *Controller) Start(ctx context.Context) error { + listener, err := net.Listen("tcp", ctrl.cfg.Bind()) + if err != nil { + return err + } + ready := make(chan struct{}) + go ctrl.serve(&acceptingListener{Listener: listener, ready: ready}) + select { + case <-ready: + ctrl.log.Info("http listener started", zap.String("address", listener.Addr().String())) + return nil + case err := <-ctrl.serveDone: + return err + case <-ctx.Done(): + _ = listener.Close() + return ctx.Err() + } +} + +// acceptingListener signals after fasthttp registers the listener and enters its +// accept loop. An OnListen hook runs earlier and cannot guarantee safe immediate Stop. +type acceptingListener struct { + // Listener is the bound socket owned by the HTTP lifecycle. + net.Listener + ready chan struct{} + once sync.Once +} + +// Accept marks the server as started before waiting for the next connection. +func (listener *acceptingListener) Accept() (net.Conn, error) { + listener.once.Do(func() { + close(listener.ready) + }) + return listener.Listener.Accept() +} + +// serve serves the listener and publishes its terminal result to the lifecycle. +func (ctrl *Controller) serve(listener net.Listener) { + ctrl.serveDone <- ctrl.server.Listener(listener) +} + +// Stop disables admission, closes the listener and drains active requests. +// The configured timeout is bounded by the caller's Fx shutdown context. +func (ctrl *Controller) Stop(ctx context.Context) error { + ctrl.stopping.Store(true) + ctx, cancel := context.WithTimeout(ctx, ctrl.cfg.ShutdownTimeout()) + defer cancel() + if err := ctrl.server.ShutdownWithContext(ctx); err != nil { + return err + } + select { + case err := <-ctrl.serveDone: + ctrl.log.Info("http listener stopped") + return err + case <-ctx.Done(): + return ctx.Err() + } +} diff --git a/internal/controller/http/fiber/lifecycle_test.go b/internal/controller/http/fiber/lifecycle_test.go new file mode 100644 index 00000000..ed9e1b47 --- /dev/null +++ b/internal/controller/http/fiber/lifecycle_test.go @@ -0,0 +1,132 @@ +package fiber + +import ( + "context" + "errors" + "net" + "net/http" + "testing" + "time" + + "github.com/gofiber/fiber/v2" +) + +// TestImmediateShutdown checks the startup/stop race without waiting for a first request. +func TestImmediateShutdown(t *testing.T) { + const repetitions = 10 + const stopDeadline = time.Second + for range repetitions { + // Arrange. + ctrl := testController(t, nil) + // Select an ephemeral test port after validating the normal application config. + ctrl.cfg.Host = "127.0.0.1" + ctrl.cfg.Port = 0 + if err := ctrl.Start(t.Context()); err != nil { + t.Fatal(err) + } + ctx, cancel := context.WithTimeout(t.Context(), stopDeadline) + // Act. + err := ctrl.Stop(ctx) + cancel() + // Assert. + if err != nil { + t.Fatalf("immediate shutdown leaked the listener or serve goroutine: %v", err) + } + } +} + +// TestController_Stop_ActiveRequestDeadline bounds draining while a real handler is still running. +func TestController_Stop_ActiveRequestDeadline(t *testing.T) { + // Arrange. + const deadline = 3 * time.Second + ctrl := testController(t, nil) + ctrl.cfg.Host = "127.0.0.1" + ctrl.cfg.Port = 0 + // Install one controlled handler to test lifecycle independently of business routes. + ctrl.createServer() + entered := make(chan struct{}) + release := make(chan struct{}) + address := make(chan string, 1) + ctrl.server.Hooks().OnListen(func(data fiber.ListenData) error { + address <- net.JoinHostPort(data.Host, data.Port) + return nil + }) + ctrl.server.Get("/blocked", func(ctx *fiber.Ctx) error { + close(entered) + <-release + return ctx.SendStatus(http.StatusOK) + }) + if err := ctrl.Start(t.Context()); err != nil { + t.Fatal(err) + } + client := &http.Client{Timeout: deadline} + completed := make(chan error, 1) + go func() { + response, err := client.Get("http://" + <-address + "/blocked") + if err == nil { + err = response.Body.Close() + } + completed <- err + }() + t.Cleanup(func() { + close(release) + select { + case err := <-completed: + if err != nil { + t.Error(err) + } + case <-time.After(deadline): + t.Error("blocked request did not terminate after release") + } + stopCtx, cancel := context.WithTimeout(context.Background(), deadline) + defer cancel() + if err := ctrl.Stop(stopCtx); err != nil { + t.Error(err) + } + }) + select { + case <-entered: + case <-time.After(deadline): + t.Fatal("request did not reach handler") + } + ctx, cancel := context.WithCancel(t.Context()) + cancel() + + // Act. + err := ctrl.Stop(ctx) + + // Assert. + if !errors.Is(err, context.Canceled) { + t.Fatalf("expected canceled drain, got %v", err) + } + if !ctrl.stopping.Load() { + t.Fatal("shutdown did not disable admission") + } +} + +// TestCanceledStartup closes its socket while server initialization is still blocked. +func TestCanceledStartup(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + ctrl.cfg.Host = "127.0.0.1" + ctrl.cfg.Port = 0 + release := make(chan struct{}) + ctrl.server.Hooks().OnListen(func(_ fiber.ListenData) error { + <-release + return nil + }) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + // Act. + err := ctrl.Start(ctx) + close(release) + // Assert. + if !errors.Is(err, context.Canceled) { + t.Fatalf("expected canceled startup, got %v", err) + } + select { + case <-ctrl.serveDone: + case <-time.After(time.Second): + t.Fatal("serving goroutine leaked after canceled startup") + } +} diff --git a/internal/controller/http/fiber/mapping.go b/internal/controller/http/fiber/mapping.go new file mode 100644 index 00000000..3ceae8c8 --- /dev/null +++ b/internal/controller/http/fiber/mapping.go @@ -0,0 +1,77 @@ +package fiber + +import ( + "github.com/gofiber/fiber/v2" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + httpmodel "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/http" +) + +// userResponse converts a user DTO into its HTTP representation. +func userResponse(user dto.UserDTO) httpmodel.UserResponse { + return httpmodel.UserResponse{ + ID: user.ID.String(), + Username: user.Username, + DisplayName: user.DisplayName, + CreatedAt: user.CreatedAt, + } +} + +// chatResponse converts a chat DTO and its member identifiers into an HTTP response. +func chatResponse(chat dto.ChatDTO) httpmodel.ChatResponse { + members := make([]string, len(chat.MemberIDs)) + for index, id := range chat.MemberIDs { + members[index] = id.String() + } + return httpmodel.ChatResponse{ + ID: chat.ID.String(), + Title: chat.Title, + MemberIDs: members, + CreatedAt: chat.CreatedAt, + } +} + +// messageResponse converts a message DTO into its HTTP representation. +func messageResponse(message dto.MessageDTO) httpmodel.MessageResponse { + return httpmodel.MessageResponse{ + ID: message.ID.String(), + ChatID: message.ChatID.String(), + SenderID: message.SenderID.String(), + Text: message.Text, + CreatedAt: message.CreatedAt, + } +} + +// pageRequest extracts identity, resource and pagination parameters from the request. +func pageRequest(ctx *fiber.Ctx) dto.PageRequestDTO { + return dto.PageRequestDTO{ + UserID: identity(ctx), + ChatID: ctx.Params("chat_id"), + Limit: ctx.Query("limit"), + Cursor: ctx.Query("cursor"), + } +} + +// chatPageResponse converts a page of chat DTOs into an HTTP response. +func chatPageResponse(page dto.ChatPageDTO) httpmodel.ChatPageResponse { + response := httpmodel.ChatPageResponse{ + Items: make([]httpmodel.ChatResponse, len(page.Items)), + NextCursor: page.NextCursor, + } + for index, chat := range page.Items { + response.Items[index] = chatResponse(chat) + } + return response +} + +// messagePageResponse converts a page of message DTOs into an HTTP response. +func messagePageResponse(page dto.MessagePageDTO) httpmodel.MessagePageResponse { + response := httpmodel.MessagePageResponse{ + Items: make([]httpmodel.MessageResponse, len(page.Items)), + NextCursor: page.NextCursor, + } + for index, message := range page.Items { + response.Items[index] = messageResponse(message) + } + return response +} diff --git a/internal/controller/http/fiber/messages_test.go b/internal/controller/http/fiber/messages_test.go new file mode 100644 index 00000000..9efe0664 --- /dev/null +++ b/internal/controller/http/fiber/messages_test.go @@ -0,0 +1,270 @@ +package fiber + +import ( + "net/http" + "net/url" + "strings" + "testing" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" +) + +// TestController_MessagesCreate checks message validation and identity-derived sender fields. +func TestController_MessagesCreate(t *testing.T) { + t.Run("Positive: Unicode at rune limit", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + id := chat(t, ctrl, owner) + actor := owner + text := strings.Repeat("界", 4000) + payload := mustJSON(t, map[string]string{"text": text}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats/"+id+"/messages", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusCreated, body) + if body["sender_id"] != owner || body["chat_id"] != id || body["text"] != text { + t.Fatalf("message fields changed: %v", body) + } + }) + + t.Run("Negative: empty text", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + id := chat(t, ctrl, owner) + actor := owner + payload := mustJSON(t, map[string]string{"text": ""}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats/"+id+"/messages", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: whitespace text", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + id := chat(t, ctrl, owner) + actor := owner + payload := mustJSON(t, map[string]string{"text": " \n\t"}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats/"+id+"/messages", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: text exceeds rune limit", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + id := chat(t, ctrl, owner) + actor := owner + payload := mustJSON(t, map[string]string{"text": strings.Repeat("界", 4001)}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats/"+id+"/messages", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: sender spoof", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + id := chat(t, ctrl, owner) + actor := owner + outsider := user(t, ctrl) + payload := mustJSON(t, map[string]string{"text": "hello", "sender_id": outsider}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats/"+id+"/messages", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") + }) + + t.Run("Negative: outsider", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + id := chat(t, ctrl, owner) + actor := user(t, ctrl) + payload := mustJSON(t, map[string]string{"text": "hello"}) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats/"+id+"/messages", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusNotFound, body) + assertErrorCode(t, body, "not_found") + }) + + t.Run("Negative: authentication precedes JSON decoding", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + owner := user(t, ctrl) + id := chat(t, ctrl, owner) + actor := "" + payload := []byte(`{`) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/chats/"+id+"/messages", actor, payload) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusUnauthorized, body) + assertErrorCode(t, body, "unauthorized") + }) +} + +// TestController_MessagesGetPage rejects invalid pagination separately from access failures. +func TestController_MessagesGetPage(t *testing.T) { + cases := []struct { + name string + query string + outsider bool + status int + code string + }{ + {"Negative: zero limit", "limit=0", false, http.StatusBadRequest, "invalid_request"}, + {"Negative: limit above maximum", "limit=101", false, http.StatusBadRequest, "invalid_request"}, + {"Negative: negative limit", "limit=-1", false, http.StatusBadRequest, "invalid_request"}, + {"Negative: nonnumeric limit", "limit=x", false, http.StatusBadRequest, "invalid_request"}, + {"Negative: fractional limit", "limit=1.0", false, http.StatusBadRequest, "invalid_request"}, + {"Negative: malformed cursor", "cursor=invalid", false, http.StatusBadRequest, "invalid_request"}, + {"Negative: outsider", "", true, http.StatusNotFound, "not_found"}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + id := chat(t, ctrl, actor) + if tc.outsider { + actor = user(t, ctrl) + } + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/chats/"+id+"/messages?"+tc.query, actor, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, tc.status, body) + assertErrorCode(t, body, tc.code) + }) + } +} + +// TestController_MessageCursorScope rejects a continuation from another chat's history. +func TestController_MessageCursorScope(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + first := chat(t, ctrl, actor) + second := chat(t, ctrl, actor) + path := "/api/v1/chats/" + first + "/messages" + for _, text := range []string{"first", "second"} { + call(t, ctrl, http.MethodPost, path, actor, map[string]string{"text": text}, http.StatusCreated) + } + page := call(t, ctrl, http.MethodGet, path+"?limit=1", actor, nil, http.StatusOK) + token := page["next_cursor"].(string) + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/chats/"+second+"/messages?cursor="+url.QueryEscape(token), actor, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusBadRequest, body) + assertErrorCode(t, body, "invalid_request") +} + +// TestController_MessagePageLimitChange preserves continuation when the client changes page size. +func TestController_MessagePageLimitChange(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + path := "/api/v1/chats/" + chat(t, ctrl, actor) + "/messages" + for _, text := range []string{"first", "second", "third"} { + call(t, ctrl, http.MethodPost, path, actor, map[string]string{"text": text}, http.StatusCreated) + } + first := call(t, ctrl, http.MethodGet, path+"?limit=1", actor, nil, http.StatusOK) + token := first["next_cursor"].(string) + + // Act. + status, body, err := request(ctrl, http.MethodGet, path+"?limit=100&cursor="+url.QueryEscape(token), actor, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusOK, body) + items := body["items"].([]any) + if len(items) != 2 || body["next_cursor"] != nil { + t.Fatalf("unexpected final page: %v", body) + } + if items[0].(map[string]any)["text"] != "second" || items[1].(map[string]any)["text"] != "third" { + t.Fatalf("lost order or skipped messages: %v", items) + } +} + +// TestController_MessageCapacity preserves acknowledged data after rejecting an overflow write. +func TestController_MessageCapacity(t *testing.T) { + // Arrange. + ctrl := testController(t, func(cfg *config.Config) { + cfg.Memory.MaxMessages = 2 + }) + actor := user(t, ctrl) + path := "/api/v1/chats/" + chat(t, ctrl, actor) + "/messages" + first := call(t, ctrl, http.MethodPost, path, actor, map[string]string{"text": "first"}, http.StatusCreated) + second := call(t, ctrl, http.MethodPost, path, actor, map[string]string{"text": "second"}, http.StatusCreated) + + // Act. + status, body, err := request(ctrl, http.MethodPost, path, actor, []byte(`{"text":"rejected"}`)) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusServiceUnavailable, body) + assertErrorCode(t, body, "unavailable") + items := history(t, ctrl, actor, path) + if len(items) != 2 || items[0].(map[string]any)["id"] != first["id"] || items[1].(map[string]any)["id"] != second["id"] { + t.Fatalf("overflow changed acknowledged messages: %v", items) + } +} diff --git a/internal/controller/http/fiber/metrics.go b/internal/controller/http/fiber/metrics.go new file mode 100644 index 00000000..448b7f76 --- /dev/null +++ b/internal/controller/http/fiber/metrics.go @@ -0,0 +1,61 @@ +package fiber + +import ( + "net/http" + "time" + + "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/middleware/adaptor" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" +) + +// httpMetrics owns a per-server registry with bounded labels and no user identifiers. +type httpMetrics struct { + registry *prometheus.Registry + requests *prometheus.CounterVec + duration *prometheus.HistogramVec + active prometheus.Gauge +} + +// newHTTPMetrics creates independent collectors so multiple test servers do not share state. +func newHTTPMetrics() *httpMetrics { + metrics := &httpMetrics{ + registry: prometheus.NewRegistry(), + requests: prometheus.NewCounterVec(prometheus.CounterOpts{Name: "messenger_http_requests_total", Help: "Completed requests by route, method and status class."}, []string{"route", "method", "status_class"}), + duration: prometheus.NewHistogramVec(prometheus.HistogramOpts{Name: "messenger_http_duration_seconds", Help: "Completed request latency.", Buckets: prometheus.DefBuckets}, []string{"route", "method"}), + active: prometheus.NewGauge(prometheus.GaugeOpts{Name: "messenger_http_in_flight", Help: "Currently executing HTTP requests."}), + } + metrics.registry.MustRegister(metrics.requests, metrics.duration, metrics.active) + return metrics +} + +// observe records bounded route patterns, methods and status classes after error handling. +func (m *httpMetrics) observe(ctx *fiber.Ctx, elapsed time.Duration) { + route := "unmatched" + if ctx.Route() != nil && ctx.Route().Path != "/" { + route = ctx.Route().Path + } + method := ctx.Method() + switch method { + case http.MethodGet, http.MethodPost, http.MethodDelete, http.MethodHead, http.MethodOptions: + default: + method = "other" + } + status := "5xx" + switch ctx.Response().StatusCode() / 100 { + case 2: + status = "2xx" + case 3: + status = "3xx" + case 4: + status = "4xx" + } + m.requests.WithLabelValues(route, method, status).Inc() + m.duration.WithLabelValues(route, method).Observe(elapsed.Seconds()) +} + +// handleMetrics exposes this process's Prometheus registry without external backend calls. +func (ctrl *Controller) handleMetrics(ctx *fiber.Ctx) error { + return adaptor.HTTPHandler(promhttp.HandlerFor(ctrl.metrics.registry, promhttp.HandlerOpts{}))(ctx) +} diff --git a/internal/controller/http/fiber/metrics_test.go b/internal/controller/http/fiber/metrics_test.go new file mode 100644 index 00000000..9f2d4e96 --- /dev/null +++ b/internal/controller/http/fiber/metrics_test.go @@ -0,0 +1,73 @@ +package fiber + +import ( + "io" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +// TestMetricsEndpoint exposes completed requests without token or user labels. +func TestMetricsEndpoint(t *testing.T) { + ctrl := testController(t, nil) + call(t, ctrl, http.MethodGet, "/health/live", "", nil, http.StatusOK) + resp, err := ctrl.server.Test(httptest.NewRequest(http.MethodGet, "/metrics", nil)) + if err != nil { + t.Fatal(err) + } + defer func() { + _ = resp.Body.Close() + }() + body, err := io.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + if resp.StatusCode != http.StatusOK || !strings.Contains(string(body), "messenger_http_requests_total") || !strings.Contains(string(body), "messenger_http_duration_seconds_bucket") { + t.Fatalf("invalid metrics response: status %d", resp.StatusCode) + } + if resp.Header.Get("X-Instance-Id") == "" { + t.Fatal("metrics response lacks instance ID") + } +} + +// TestInstanceIdentityRemainsStable verifies errors and successes identify the same process. +func TestInstanceIdentityRemainsStable(t *testing.T) { + ctrl := testController(t, nil) + var instance string + for _, path := range []string{"/health/live", "/unknown"} { + resp, err := ctrl.server.Test(httptest.NewRequest(http.MethodGet, path, nil)) + if err != nil { + t.Fatal(err) + } + if instance == "" { + instance = resp.Header.Get("X-Instance-Id") + } + if instance == "" || resp.Header.Get("X-Instance-Id") != instance { + t.Fatal("unstable instance identity") + } + if err := resp.Body.Close(); err != nil { + t.Fatal(err) + } + } +} + +// TestMissingIdempotencyHeader rejects an otherwise valid authenticated write. +func TestMissingIdempotencyHeader(t *testing.T) { + ctrl := testController(t, nil) + caller := user(t, ctrl) + room := chat(t, ctrl, caller) + req := httptest.NewRequest(http.MethodPost, "/api/v1/chats/"+room+"/messages", strings.NewReader(`{"text":"valid"}`)) + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Authorization", "Bearer "+caller) + resp, err := ctrl.server.Test(req) + if err != nil { + t.Fatal(err) + } + defer func() { + _ = resp.Body.Close() + }() + if resp.StatusCode != http.StatusBadRequest { + t.Fatalf("missing key accepted: %d", resp.StatusCode) + } +} diff --git a/internal/controller/http/fiber/middleware.go b/internal/controller/http/fiber/middleware.go new file mode 100644 index 00000000..0e79d61e --- /dev/null +++ b/internal/controller/http/fiber/middleware.go @@ -0,0 +1,87 @@ +package fiber + +import ( + "context" + "errors" + "strconv" + "time" + + "github.com/gofiber/fiber/v2" + "github.com/google/uuid" + "go.uber.org/zap" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/admission" +) + +// request assigns a request identifier, handles errors and logs the completed request. +func (ctrl *Controller) request(ctx *fiber.Ctx) error { + ctx.Set(headerRequestID, uuid.NewString()) + ctx.Set("X-Instance-Id", ctrl.instanceID) + started := time.Now() + ctrl.metrics.active.Inc() + defer ctrl.metrics.active.Dec() + err := ctx.Next() + if err != nil { + err = ctrl.handleErr(ctx, err) + } + ctrl.logRequest(ctx, time.Since(started)) + if ctx.Path() != "/metrics" { + ctrl.metrics.observe(ctx, time.Since(started)) + } + return err +} + +// logRequest logs request metadata without including message contents. +func (ctrl *Controller) logRequest(ctx *fiber.Ctx, elapsed time.Duration) { + route := "unmatched" + if ctx.Route() != nil { + route = ctx.Route().Path + } + ctrl.log.Info("http request", + zap.String("method", ctx.Method()), + zap.String("route", route), + zap.Int("status", ctx.Response().StatusCode()), + zap.String("request_id", ctx.GetRespHeader(headerRequestID)), + zap.Duration("duration", elapsed), + ) +} + +// admit reserves global budgets and bounds downstream request work. +func (ctrl *Controller) admit(ctx *fiber.Ctx) error { + if ctrl.stopping.Load() { + return errBusy + } + requestCtx, cancel := context.WithTimeout(ctx.UserContext(), ctrl.cfg.Timeout()) + defer cancel() + ctx.SetUserContext(requestCtx) + release, err := ctrl.admission.Enter(requestCtx, requestGroup(ctx), "") + if err != nil { + return admissionError(ctx, err) + } + defer release() + return ctx.Next() +} + +// requireIdentity resolves the session before reserving per-user budgets. +func (ctrl *Controller) requireIdentity(ctx *fiber.Ctx) error { + user, err := ctrl.auth.Authenticate(ctx.UserContext(), bearer(ctx)) + if err != nil { + return err + } + ctx.Locals(identityKey, user) + release, err := ctrl.admission.Enter(ctx.UserContext(), requestGroup(ctx), user) + if err != nil { + return admissionError(ctx, err) + } + defer release() + return ctx.Next() +} + +// admissionError maps policy rejection and backend failure into HTTP-owned errors. +func admissionError(ctx *fiber.Ctx, err error) error { + ctx.Set(fiber.HeaderRetryAfter, strconv.Itoa(retryAfterSeconds)) + if errors.Is(err, admission.ErrRate) { + return errRateLimited + } + return errBusy +} diff --git a/internal/controller/http/fiber/middleware_test.go b/internal/controller/http/fiber/middleware_test.go new file mode 100644 index 00000000..653205db --- /dev/null +++ b/internal/controller/http/fiber/middleware_test.go @@ -0,0 +1,211 @@ +package fiber + +import ( + "net/http" + "testing" + "testing/synctest" + "time" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" +) + +// TestController_InFlightAdmission checks rejection, recovery and health exemption independently. +func TestController_InFlightAdmission(t *testing.T) { + cases := []struct { + name string + release bool + path string + status int + }{ + {"Negative: occupied execution slot", false, "/api/v1/users/me", http.StatusServiceUnavailable}, + {"Positive: released execution slot", true, "/api/v1/users/me", http.StatusUnauthorized}, + {"Positive: health bypasses occupied slot", false, "/health/live", http.StatusOK}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + ctrl := testController(t, func(cfg *config.Config) { + cfg.HTTP.Admission.MaxInFlight = 1 + }) + if !ctrl.admission.(*fixtureAdmission).Acquire() { + t.Fatal("fixture could not reserve slot") + } + if tc.release { + ctrl.admission.(*fixtureAdmission).Release() + } else { + t.Cleanup(ctrl.admission.(*fixtureAdmission).Release) + } + + // Act. + status, body, err := request(ctrl, http.MethodGet, tc.path, "", nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, tc.status, body) + }) + } +} + +// TestController_RateAdmission checks exhausted tokens without timing-dependent HTTP setup. +func TestController_RateAdmission(t *testing.T) { + t.Run("/api/v1/users/me", func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + // Arrange. + ctrl := testController(t, func(cfg *config.Config) { + cfg.HTTP.Admission.RequestsPerSecond = 1 + cfg.HTTP.Admission.Burst = 1 + }) + if !ctrl.admission.(*fixtureAdmission).Allow(time.Now()) { + t.Fatal("fixture token missing") + } + expected := http.StatusTooManyRequests + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/users/me", "", nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, expected, body) + }) + }) + + t.Run("/health/ready", func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + // Arrange. + ctrl := testController(t, func(cfg *config.Config) { + cfg.HTTP.Admission.RequestsPerSecond = 1 + cfg.HTTP.Admission.Burst = 1 + }) + if !ctrl.admission.(*fixtureAdmission).Allow(time.Now()) { + t.Fatal("fixture token missing") + } + expected := http.StatusOK + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/health/ready", "", nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, expected, body) + }) + }) +} + +// TestController_Draining checks each endpoint's admission policy during shutdown. +func TestController_Draining(t *testing.T) { + cases := []struct { + name string + path string + status int + }{ + {"Negative: readiness disabled", "/health/ready", http.StatusServiceUnavailable}, + {"Positive: liveness remains available", "/health/live", http.StatusOK}, + {"Negative: business requests rejected", "/api/v1/users/me", http.StatusServiceUnavailable}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + ctrl.stopping.Store(true) + + // Act. + status, body, err := request(ctrl, http.MethodGet, tc.path, "", nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, tc.status, body) + }) + } +} + +// TestController_UnknownRoute checks the public fallback for an unmatched path. +func TestController_UnknownRoute(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/missing", "", nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusNotFound, body) + assertErrorCode(t, body, "not_found") +} + +// TestController_New rejects each missing dependency independently. +func TestController_New(t *testing.T) { + t.Run("Negative: missing configuration", func(t *testing.T) { + // Arrange. + fixture := testController(t, nil) + + // Act. + ctrl, err := New(fixture.log, nil, fixture.service, fixture.errorRegistry, fixture.admission, fixture.auth, fixture.readiness) + + // Assert. + if err == nil || ctrl != nil { + t.Fatalf("incomplete controller accepted: %v, %v", ctrl, err) + } + }) + + t.Run("Negative: missing logger", func(t *testing.T) { + // Arrange. + fixture := testController(t, nil) + + // Act. + ctrl, err := New(nil, &fixture.cfg, fixture.service, fixture.errorRegistry, fixture.admission, fixture.auth, fixture.readiness) + + // Assert. + if err == nil || ctrl != nil { + t.Fatalf("incomplete controller accepted: %v, %v", ctrl, err) + } + }) + + t.Run("Negative: missing service", func(t *testing.T) { + // Arrange. + fixture := testController(t, nil) + + // Act. + ctrl, err := New(fixture.log, &fixture.cfg, nil, fixture.errorRegistry, fixture.admission, fixture.auth, fixture.readiness) + + // Assert. + if err == nil || ctrl != nil { + t.Fatalf("incomplete controller accepted: %v, %v", ctrl, err) + } + }) + + t.Run("Negative: missing registry", func(t *testing.T) { + // Arrange. + fixture := testController(t, nil) + + // Act. + ctrl, err := New(fixture.log, &fixture.cfg, fixture.service, nil, fixture.admission, fixture.auth, fixture.readiness) + + // Assert. + if err == nil || ctrl != nil { + t.Fatalf("incomplete controller accepted: %v, %v", ctrl, err) + } + }) + + t.Run("Negative: missing limiter", func(t *testing.T) { + // Arrange. + fixture := testController(t, nil) + + // Act. + ctrl, err := New(fixture.log, &fixture.cfg, fixture.service, fixture.errorRegistry, nil, fixture.auth, fixture.readiness) + + // Assert. + if err == nil || ctrl != nil { + t.Fatalf("incomplete controller accepted: %v, %v", ctrl, err) + } + }) +} diff --git a/internal/controller/http/fiber/public_errors.go b/internal/controller/http/fiber/public_errors.go new file mode 100644 index 00000000..416974c3 --- /dev/null +++ b/internal/controller/http/fiber/public_errors.go @@ -0,0 +1,51 @@ +package fiber + +import ( + "errors" + + "go.lab260.ru/fielderr" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +var ( + errBusy = publicFailure(codeUnavailable, "server is busy") + errRateLimited = publicFailure(codeRateLimited, "request rate exceeded") + errTooLarge = publicFailure(codeTooLarge, "request body is too large") + errMedia = publicFailure(codeMedia, "expected application/json") + errInternal = publicFailure(codeInternal, "internal server error") +) + +// publicFailure creates a transport-owned error with a safe API message. +func publicFailure(code, message string) error { + return fielderr.WithStatus(errors.New(message), fielderr.NewStatusCode(code), message) +} + +// publicError maps application failures into the public API envelope. +// Unknown errors receive a fixed response without exposing their details. +func publicError(err error) error { + switch { + case errors.Is(err, service.ErrUnavailable): + return publicFailure(codeUnavailable, "dependency unavailable") + case errors.Is(err, service.ErrInvalid): + return fielderr.WithStatus(err, fielderr.NewStatusCode(codeInvalid), "invalid request") + case errors.Is(err, service.ErrUnauthorized): + return fielderr.WithStatus(err, fielderr.NewStatusCode(codeUnauthorized), "unknown user identity") + case errors.Is(err, service.ErrNotFound): + return fielderr.WithStatus(err, fielderr.NewStatusCode(codeNotFound), "resource not found") + case errors.Is(err, service.ErrConflict): + return fielderr.WithStatus(err, fielderr.NewStatusCode(codeConflict), "username already exists") + case errors.Is(err, service.ErrCapacity): + return fielderr.WithStatus(err, fielderr.NewStatusCode(codeUnavailable), "in-memory storage capacity reached") + case errors.Is(err, errBusy): + return errBusy + case errors.Is(err, errRateLimited): + return errRateLimited + case errors.Is(err, errTooLarge): + return errTooLarge + case errors.Is(err, errMedia): + return errMedia + default: + return errInternal + } +} diff --git a/internal/controller/http/fiber/public_errors_test.go b/internal/controller/http/fiber/public_errors_test.go new file mode 100644 index 00000000..d26ff3f6 --- /dev/null +++ b/internal/controller/http/fiber/public_errors_test.go @@ -0,0 +1,43 @@ +package fiber + +import ( + "errors" + "fmt" + "testing" + + "go.lab260.ru/fielderr" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// TestPublicErrorSafety maps wrapped application failures without exposing internal details. +func TestPublicErrorSafety(t *testing.T) { + t.Run("wrapped application error", func(t *testing.T) { + err := publicError(fmt.Errorf("private database detail: %w", service.ErrConflict)) + response := errorResponse(err, "request") + if response.Error.Code != codeConflict || response.Error.Message != "username already exists" { + t.Fatalf("unexpected response: %+v", response) + } + }) + t.Run("unknown error", func(t *testing.T) { + err := publicError(errors.New("private database detail")) + if err != errInternal { + t.Fatalf("unexpected public error: %v", err) + } + }) + t.Run("foreign public status", func(t *testing.T) { + err := fielderr.WithStatus(errors.New("private detail"), fielderr.NewStatusCode(codeInvalid), "private detail") + if publicError(err) != errInternal { + t.Fatal("untrusted error metadata reached the public response") + } + }) +} + +// TestPublicErrorUnavailable keeps dependency details out of the public envelope. +func TestPublicErrorUnavailable(t *testing.T) { + err := publicError(fmt.Errorf("private database detail: %w", service.ErrUnavailable)) + response := errorResponse(err, "request") + if response.Error.Code != codeUnavailable || response.Error.Message != "dependency unavailable" { + t.Fatalf("unexpected response: %+v", response) + } +} diff --git a/internal/controller/http/fiber/routes.go b/internal/controller/http/fiber/routes.go new file mode 100644 index 00000000..d2e160f7 --- /dev/null +++ b/internal/controller/http/fiber/routes.go @@ -0,0 +1,23 @@ +package fiber + +// initRoutes registers health endpoints and authenticated application routes. +func (ctrl *Controller) initRoutes() { + ctrl.server.Get("/metrics", ctrl.handleMetrics) + ctrl.server.Get("/health/live", ctrl.handleLive) + ctrl.server.Get("/health/ready", ctrl.handleReady) + ctrl.server.Use(ctrl.admit) + ctrl.server.Post("/api/v1/users", ctrl.HandleUsersCreate) + + ctrl.server.Post("/api/v1/auth/sessions", ctrl.HandleLogin) + + api := ctrl.server.Group("/api/v1", ctrl.requireIdentity) + api.Delete("/auth/sessions/current", ctrl.HandleLogout) + api.Get("/users/me", ctrl.HandleUsersGetMe) + api.Post("/chats", ctrl.HandleChatsCreate) + api.Get("/chats", ctrl.HandleChatsGetPage) + api.Get("/chats/:chat_id", ctrl.HandleChatsGetByID) + api.Post("/chats/:chat_id/messages", ctrl.HandleMessagesCreate) + api.Get("/chats/:chat_id/messages", ctrl.HandleMessagesGetPage) + + ctrl.server.Use(ctrl.handleNotFound) +} diff --git a/internal/controller/http/fiber/users_test.go b/internal/controller/http/fiber/users_test.go new file mode 100644 index 00000000..61d7e35d --- /dev/null +++ b/internal/controller/http/fiber/users_test.go @@ -0,0 +1,130 @@ +package fiber + +import ( + "net/http" + "strings" + "testing" + + "github.com/google/uuid" +) + +// TestController_UsersCreate checks one registration contract scenario per subtest. +func TestController_UsersCreate(t *testing.T) { + cases := []struct { + name string + body string + status int + }{ + {"Positive: valid Unicode display name", `{"password":"fixture-password-123","username":"alice","display_name":"Алиса 👋"}`, http.StatusCreated}, + {"Positive: display name at rune limit", `{"password":"fixture-password-123","username":"alice","display_name":"` + strings.Repeat("👋", 100) + `"}`, http.StatusCreated}, + {"Negative: display name exceeds rune limit", `{"password":"fixture-password-123","username":"alice","display_name":"` + strings.Repeat("👋", 101) + `"}`, http.StatusBadRequest}, + {"Negative: uppercase username", `{"password":"fixture-password-123","username":"Alice","display_name":"Alice"}`, http.StatusBadRequest}, + {"Negative: malformed JSON", `{`, http.StatusBadRequest}, + {"Negative: null root", `null`, http.StatusBadRequest}, + {"Negative: array root", `[]`, http.StatusBadRequest}, + {"Negative: missing fields", `{}`, http.StatusBadRequest}, + {"Negative: null field", `{"password":"fixture-password-123","username":"alice","display_name":null}`, http.StatusBadRequest}, + {"Negative: wrong field type", `{"password":"fixture-password-123","username":5,"display_name":"Alice"}`, http.StatusBadRequest}, + {"Negative: unknown field", `{"password":"fixture-password-123","username":"alice","display_name":"Alice","unknown":"secret"}`, http.StatusBadRequest}, + {"Negative: field name case", `{"password":"fixture-password-123","Username":"alice","display_name":"Alice"}`, http.StatusBadRequest}, + {"Negative: duplicate field", `{"password":"fixture-password-123","username":"alice","username":"bob","display_name":"Alice"}`, http.StatusBadRequest}, + {"Negative: trailing object", `{"password":"fixture-password-123","username":"alice","display_name":"Alice"} {}`, http.StatusBadRequest}, + {"Negative: invalid UTF-8", "{\"username\":\"alice\",\"display_name\":\"\xff\"}", http.StatusBadRequest}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + + // Act. + status, body, err := request(ctrl, http.MethodPost, "/api/v1/users", "", []byte(tc.body)) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, tc.status, body) + if tc.status == http.StatusBadRequest { + assertErrorCode(t, body, "invalid_request") + return + } + if body["username"] != "alice" || body["display_name"] == "" { + t.Fatalf("registration fields changed: %v", body) + } + if _, err := uuid.Parse(body["id"].(string)); err != nil { + t.Fatalf("invalid assigned ID: %v", err) + } + }) + } +} + +// TestController_UsersGetMe verifies profile selection and authentication failures. +func TestController_UsersGetMe(t *testing.T) { + t.Run("Positive: own profile", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + actor := user(t, ctrl) + identity := actor + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/users/me", identity, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusOK, body) + if body["id"] != actor || body["display_name"] != "Алиса 👋" { + t.Fatalf("wrong profile: %v", body) + } + }) + + t.Run("Negative: missing identity", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + identity := "" + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/users/me", identity, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusUnauthorized, body) + assertErrorCode(t, body, "unauthorized") + }) + + t.Run("Negative: unknown identity", func(t *testing.T) { + // Arrange. + ctrl := testController(t, nil) + identity := uuid.NewString() + + // Act. + status, body, err := request(ctrl, http.MethodGet, "/api/v1/users/me", identity, nil) + + // Assert. + if err != nil { + t.Fatal(err) + } + assertHTTPStatus(t, status, http.StatusUnauthorized, body) + assertErrorCode(t, body, "unauthorized") + }) +} + +// assertHTTPStatus reports the response body alongside a mismatched status. +func assertHTTPStatus(t *testing.T, got, want int, body map[string]any) { + t.Helper() + if got != want { + t.Fatalf("status=%d, want=%d, body=%v", got, want, body) + } +} + +// assertErrorCode checks the documented error classification independently of status. +func assertErrorCode(t *testing.T, body map[string]any, want string) { + t.Helper() + envelope, ok := body["error"].(map[string]any) + if !ok || envelope["code"] != want { + t.Fatalf("error=%v, want code %q", body, want) + } +} diff --git a/internal/controller/interface.go b/internal/controller/interface.go new file mode 100644 index 00000000..46e9af5f --- /dev/null +++ b/internal/controller/interface.go @@ -0,0 +1,12 @@ +// Package controller connects transport lifecycles to Fx. +package controller + +import "context" + +// Controller is a process-owned transport server. +type Controller interface { + // Start acquires the listener and reports startup errors to the lifecycle owner. + Start(context.Context) error + // Stop stops accepting work and drains active requests within the supplied deadline. + Stop(context.Context) error +} diff --git a/internal/cursor/codec.go b/internal/cursor/codec.go new file mode 100644 index 00000000..6f4cd94b --- /dev/null +++ b/internal/cursor/codec.go @@ -0,0 +1,119 @@ +// Package cursor signs and verifies resource-bound keyset positions. +package cursor + +import ( + "crypto/hmac" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "time" + + "github.com/google/uuid" +) + +const ( + cursorSigningKeyBytes = 32 + maxEncodedCursorBytes = 1024 +) + +// ErrInvalid means a cursor is malformed, tampered with or bound to another resource. +var ErrInvalid = errors.New("invalid cursor") + +// Position identifies the last record already returned by keyset pagination. +type Position struct { + // CreatedAt is the creation timestamp of the last returned record. + CreatedAt time.Time + // ID breaks ties between records sharing a timestamp. + ID uuid.UUID +} + +// Codec authenticates pagination positions with an immutable process-local key. +type Codec struct { + key [cursorSigningKeyBytes]byte +} + +type cursorPayload struct { + // Resource binds the position to a chat history or one user's chat list. + Resource string `json:"r"` + // Time is the creation timestamp of the last record in the previous page. + Time time.Time `json:"t"` + // ID breaks ties between records with the same creation timestamp. + ID uuid.UUID `json:"i"` +} + +// New creates a cursor codec with a random process-local signing key. +func New() (*Codec, error) { + codec := &Codec{} + if _, err := rand.Read(codec.key[:]); err != nil { + return nil, err + } + return codec, nil +} + +// Encode serializes and signs a pagination position bound to a resource. +func (codec *Codec) Encode(resource string, position Position) (string, error) { + payload, err := json.Marshal(cursorPayload{ + Resource: resource, + Time: position.CreatedAt, + ID: position.ID, + }) + if err != nil { + return "", fmt.Errorf("encode cursor: %w", err) + } + payload = append(payload, codec.signature(payload)...) + return base64.RawURLEncoding.EncodeToString(payload), nil +} + +// Decode verifies the cursor signature and extracts its resource-bound position. +func (codec *Codec) Decode(encoded, resource string) (Position, error) { + if encoded == "" { + return Position{}, nil + } + if len(encoded) > maxEncodedCursorBytes { + return Position{}, ErrInvalid + } + signed, err := base64.RawURLEncoding.DecodeString(encoded) + if err != nil || len(signed) <= sha256.Size { + return Position{}, ErrInvalid + } + boundary := len(signed) - sha256.Size + payload, signature := signed[:boundary], signed[boundary:] + if !hmac.Equal(signature, codec.signature(payload)) { + return Position{}, ErrInvalid + } + return decodeCursorPosition(payload, resource) +} + +// signature computes the HMAC-SHA256 authentication tag for a cursor payload. +func (codec *Codec) signature(payload []byte) []byte { + mac := hmac.New(sha256.New, codec.key[:]) + // hash.Hash.Write is documented to always return a nil error. + _, _ = mac.Write(payload) + return mac.Sum(nil) +} + +// decodeCursorPosition validates the decoded cursor resource and timestamp. +func decodeCursorPosition(payload []byte, resource string) (Position, error) { + var cursor cursorPayload + if err := json.Unmarshal(payload, &cursor); err != nil { + return Position{}, ErrInvalid + } + if cursor.Resource != resource || cursor.Time.IsZero() { + return Position{}, ErrInvalid + } + return Position{CreatedAt: cursor.Time, ID: cursor.ID}, nil +} + +// NewShared creates a codec from the common 256-bit key provisioned to every replica. +func NewShared(encoded string) (*Codec, error) { + key, err := base64.StdEncoding.DecodeString(encoded) + if err != nil || len(key) != cursorSigningKeyBytes { + return nil, fmt.Errorf("CURSOR_SIGNING_KEY must encode exactly 32 bytes as base64") + } + codec := &Codec{} + copy(codec.key[:], key) + return codec, nil +} diff --git a/internal/cursor/codec_test.go b/internal/cursor/codec_test.go new file mode 100644 index 00000000..441e5305 --- /dev/null +++ b/internal/cursor/codec_test.go @@ -0,0 +1,212 @@ +package cursor + +import ( + "encoding/base64" + "errors" + "strings" + "testing" + "time" + + "github.com/google/uuid" +) + +// TestCodec_EncodeDecode preserves the complete position through an authenticated round trip. +func TestCodec_EncodeDecode(t *testing.T) { + // Arrange. + codec := newTestCodec(t) + position := Position{CreatedAt: time.Unix(1700000000, 123456789).UTC(), ID: uuid.New()} + + // Act. + encoded, err := codec.Encode("chats:alice", position) + + // Assert. + if err != nil { + t.Fatal(err) + } + if encoded == "" { + t.Fatal("encoded position is empty") + } + decoded, err := codec.Decode(encoded, "chats:alice") + if err != nil || decoded != position { + t.Fatalf("decoded=%v, want=%v, error=%v", decoded, position, err) + } +} + +// TestCodec_Decode checks first-page behavior and independent rejection conditions. +func TestCodec_Decode(t *testing.T) { + t.Run("Positive: empty token starts first page", func(t *testing.T) { + // Arrange. + codec := newTestCodec(t) + + // Act. + got, err := codec.Decode("", "chats:alice") + + // Assert. + if err != nil || got != (Position{}) { + t.Fatalf("first-page position=%v, error=%v", got, err) + } + }) + + t.Run("Negative: another resource", func(t *testing.T) { + // Arrange. + codec := newTestCodec(t) + encoded := encodeFixture(t, codec, "chats:alice") + + // Act. + got, err := codec.Decode(encoded, "chats:bob") + + // Assert. + if !errors.Is(err, ErrInvalid) || got != (Position{}) { + t.Fatalf("position=%v, error=%v", got, err) + } + }) + + t.Run("Negative: another process key", func(t *testing.T) { + // Arrange. + codec := newTestCodec(t) + encoded := encodeFixture(t, codec, "chats:alice") + codec = newTestCodec(t) + + // Act. + got, err := codec.Decode(encoded, "chats:alice") + + // Assert. + if !errors.Is(err, ErrInvalid) || got != (Position{}) { + t.Fatalf("position=%v, error=%v", got, err) + } + }) + + t.Run("Negative: tampered payload", func(t *testing.T) { + // Arrange. + codec := newTestCodec(t) + encoded := encodeFixture(t, codec, "chats:alice") + signed, err := base64.RawURLEncoding.DecodeString(encoded) + if err != nil { + t.Fatal(err) + } + signed[0] ^= 1 + encoded = base64.RawURLEncoding.EncodeToString(signed) + + // Act. + got, err := codec.Decode(encoded, "chats:alice") + + // Assert. + if !errors.Is(err, ErrInvalid) || got != (Position{}) { + t.Fatalf("position=%v, error=%v", got, err) + } + }) + + t.Run("Negative: oversized token", func(t *testing.T) { + // Arrange. + codec := newTestCodec(t) + encoded := strings.Repeat("a", 1025) + + // Act. + got, err := codec.Decode(encoded, "chats:alice") + + // Assert. + if !errors.Is(err, ErrInvalid) || got != (Position{}) { + t.Fatalf("position=%v, error=%v", got, err) + } + }) + + t.Run("Negative: malformed base64", func(t *testing.T) { + // Arrange. + codec := newTestCodec(t) + encoded := "!invalid!" + + // Act. + got, err := codec.Decode(encoded, "chats:alice") + + // Assert. + if !errors.Is(err, ErrInvalid) || got != (Position{}) { + t.Fatalf("position=%v, error=%v", got, err) + } + }) + + t.Run("Negative: signed malformed JSON", func(t *testing.T) { + // Arrange. + codec := newTestCodec(t) + encoded := signedPayload(codec, []byte("not JSON")) + + // Act. + got, err := codec.Decode(encoded, "chats:alice") + + // Assert. + if !errors.Is(err, ErrInvalid) || got != (Position{}) { + t.Fatalf("position=%v, error=%v", got, err) + } + }) + + t.Run("Negative: signed zero timestamp", func(t *testing.T) { + // Arrange. + codec := newTestCodec(t) + encoded := signedPayload(codec, []byte(`{"r":"chats:alice","t":"0001-01-01T00:00:00Z","i":"11111111-1111-1111-1111-111111111111"}`)) + + // Act. + got, err := codec.Decode(encoded, "chats:alice") + + // Assert. + if !errors.Is(err, ErrInvalid) || got != (Position{}) { + t.Fatalf("position=%v, error=%v", got, err) + } + }) +} + +// signedPayload creates authenticated malformed fixtures to isolate payload validation. +func signedPayload(codec *Codec, payload []byte) string { + return base64.RawURLEncoding.EncodeToString(append(payload, codec.signature(payload)...)) +} + +// newTestCodec creates an independent signing key for one scenario. +func newTestCodec(t *testing.T) *Codec { + t.Helper() + codec, err := New() + if err != nil { + t.Fatal(err) + } + return codec +} + +// encodeFixture prepares a valid token before testing a separate decoding condition. +func encodeFixture(t *testing.T, codec *Codec, resource string) string { + t.Helper() + token, err := codec.Encode(resource, Position{ID: uuid.New(), CreatedAt: time.Unix(1700000000, 0).UTC()}) + if err != nil { + t.Fatal(err) + } + return token +} + +// TestSharedCodec verifies a second process can verify the first process's cursor. +func TestSharedCodec(t *testing.T) { + key := base64.StdEncoding.EncodeToString(make([]byte, 32)) + first, err := NewShared(key) + if err != nil { + t.Fatal(err) + } + second, err := NewShared(key) + if err != nil { + t.Fatal(err) + } + position := Position{CreatedAt: time.Now().UTC(), ID: uuid.New()} + encoded, err := first.Encode("chat", position) + if err != nil { + t.Fatal(err) + } + result, err := second.Decode(encoded, "chat") + if err != nil || result != position { + t.Fatalf("cross-replica cursor: %v", err) + } +} + +// TestSharedCodecRejectsInvalidKey requires a full 256-bit decoded secret. +func TestSharedCodecRejectsInvalidKey(t *testing.T) { + for _, key := range []string{"", "broken!", base64.StdEncoding.EncodeToString([]byte("short"))} { + t.Run(key, func(t *testing.T) { + if _, err := NewShared(key); err == nil { + t.Fatal("invalid key accepted") + } + }) + } +} diff --git a/internal/hashring/ring.go b/internal/hashring/ring.go new file mode 100644 index 00000000..f8c03623 --- /dev/null +++ b/internal/hashring/ring.go @@ -0,0 +1,62 @@ +// Package hashring implements immutable consistent hashing with virtual nodes. +package hashring + +import ( + "cmp" + "crypto/sha256" + "encoding/binary" + "fmt" + "slices" + "sort" + "strconv" +) + +type point struct { + hash uint64 + node string +} + +// Ring maps arbitrary keys to stable node identifiers. +type Ring struct { + points []point +} + +// New creates an order-independent ring and rejects ambiguous node identities. +func New(nodes []string, replicas int) (*Ring, error) { + if len(nodes) == 0 || replicas < 1 { + return nil, fmt.Errorf("nodes and positive virtual node count are required") + } + ring := &Ring{} + seen := make(map[string]bool) + for _, node := range nodes { + if node == "" || seen[node] { + return nil, fmt.Errorf("node identifiers must be unique and nonempty") + } + seen[node] = true + for index := range replicas { + ring.points = append(ring.points, point{hash: hash(node + ":" + strconv.Itoa(index)), node: node}) + } + } + slices.SortFunc(ring.points, func(a, b point) int { + if order := cmp.Compare(a.hash, b.hash); order != 0 { + return order + } + return cmp.Compare(a.node, b.node) + }) + return ring, nil +} + +// Owner selects the first virtual node clockwise from the key hash. +func (r *Ring) Owner(key string) string { + value := hash(key) + index := sort.Search(len(r.points), func(index int) bool { + return r.points[index].hash >= value + }) + return r.points[index%len(r.points)].node +} + +// hash maps a stable string into the ring's 64-bit coordinate space. +func hash(value string) uint64 { + sum := sha256.Sum256([]byte(value)) + return binary.BigEndian.Uint64(sum[:8]) +} diff --git a/internal/hashring/ring_test.go b/internal/hashring/ring_test.go new file mode 100644 index 00000000..56bd7625 --- /dev/null +++ b/internal/hashring/ring_test.go @@ -0,0 +1,73 @@ +package hashring + +import ( + "fmt" + "testing" +) + +// TestExpansionMovesOnlyKeysOwnedByNewNode verifies the consistent hashing invariant. +func TestExpansionMovesOnlyKeysOwnedByNewNode(t *testing.T) { + before, err := New([]string{"a", "b"}, 256) + if err != nil { + t.Fatal(err) + } + after, err := New([]string{"c", "b", "a"}, 256) + if err != nil { + t.Fatal(err) + } + moved := 0 + for index := range 100000 { + key := fmt.Sprint(index) + oldOwner, newOwner := before.Owner(key), after.Owner(key) + if oldOwner != newOwner { + moved++ + if newOwner != "c" { + t.Fatalf("existing nodes exchanged key %s", key) + } + } + } + fraction := float64(moved) / 100000 + if fraction < 0.2 || fraction > 0.45 { + t.Fatalf("unexpected moved fraction: %f", fraction) + } + t.Logf("100000 keys: moved=%d fraction=%.5f", moved, fraction) +} + +// TestRingRejectsAmbiguousConfiguration checks independent malformed rings. +func TestRingRejectsAmbiguousConfiguration(t *testing.T) { + cases := []struct { + name string + nodes []string + replicas int + }{ + {"empty", nil, 1}, + {"zero replicas", []string{"a"}, 0}, + {"empty node", []string{""}, 1}, + {"duplicate", []string{"a", "a"}, 1}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + if _, err := New(tc.nodes, tc.replicas); err == nil { + t.Fatal("invalid ring accepted") + } + }) + } +} + +// TestRingIgnoresInputOrder verifies that replicas agree despite configuration ordering. +func TestRingIgnoresInputOrder(t *testing.T) { + a, err := New([]string{"a", "b"}, 64) + if err != nil { + t.Fatal(err) + } + b, err := New([]string{"b", "a"}, 64) + if err != nil { + t.Fatal(err) + } + for index := range 1000 { + key := fmt.Sprint(index) + if a.Owner(key) != b.Owner(key) { + t.Fatal("node order changes ownership") + } + } +} diff --git a/internal/model/dto/models.go b/internal/model/dto/models.go new file mode 100644 index 00000000..53fa649f --- /dev/null +++ b/internal/model/dto/models.go @@ -0,0 +1,114 @@ +// Package dto defines the transport-independent data shared by service and store. +package dto + +import ( + "time" + + "github.com/google/uuid" +) + +// UserDTO is the public account profile without credentials. +type UserDTO struct { + // ID is the server-generated user identifier. + ID uuid.UUID + // Username is the unique lowercase ASCII account name. + Username string + // DisplayName is the display label, limited to 100 Unicode code points. + DisplayName string + // CreatedAt is the server-assigned UTC creation time. + CreatedAt time.Time +} + +// ChatDTO is a chat with immutable membership. +type ChatDTO struct { + // ID is the server-generated chat identifier. + ID uuid.UUID + // Title is the nonblank title, limited to 100 Unicode code points. + Title string + // MemberIDs contains the fixed set of users allowed to read and write the chat. + MemberIDs []uuid.UUID + // CreatedAt is the server-assigned UTC creation time. + CreatedAt time.Time +} + +// MessageDTO is an immutable message stored in a chat. +type MessageDTO struct { + // IdempotencyKey identifies a validated retry within the sender and chat scope. + IdempotencyKey string + // ID is the server-generated message identifier. + ID uuid.UUID + // ChatID identifies the owning chat. + ChatID uuid.UUID + // SenderID identifies the user resolved from the request identity. + SenderID uuid.UUID + // Text contains the original text, limited to 4000 Unicode code points. + Text string + // CreatedAt is the server-assigned UTC ordering timestamp. + CreatedAt time.Time +} + +// UsersCreateRequestDTO carries untrusted registration values into the service. +type UsersCreateRequestDTO struct { + // Username is the raw requested account name. + Username string + // DisplayName is the raw requested display label. + DisplayName string +} + +// ChatsCreateRequestDTO carries untrusted chat creation input. +type ChatsCreateRequestDTO struct { + // UserID is the caller identifier resolved from a validated session. + UserID string + // Title is the raw requested chat title. + Title string + // MemberIDs contains raw user UUIDs; the service checks uniqueness and membership. + MemberIDs []string +} + +// MessagesCreateRequestDTO carries untrusted message creation input. +type MessagesCreateRequestDTO struct { + // IdempotencyKey identifies a validated retry within the sender and chat scope. + IdempotencyKey string + // UserID is the authenticated caller identifier, never a supplied sender field. + UserID string + // ChatID is the raw chat UUID from the route. + ChatID string + // Text is the unmodified message text to validate. + Text string +} + +// PageRequestDTO carries raw pagination values for service-level validation. +type PageRequestDTO struct { + // UserID is the caller identifier resolved from a validated session. + UserID string + // ChatID is the requested chat UUID; it is unused when listing chats. + ChatID string + // Limit is the raw page size; empty selects the contract default. + Limit string + // Cursor is the opaque continuation token; empty starts at the beginning. + Cursor string +} + +// PositionDTO is a validated keyset boundary; its zero value starts a history. +type PositionDTO struct { + // CreatedAt is the timestamp of the last record already returned. + CreatedAt time.Time + // ID is the tie-breaking identifier of the last record already returned. + ID uuid.UUID +} + +// ChatPageDTO contains an ordered page of accessible chats. +type ChatPageDTO struct { + // Items contains at most the requested number of chats. + Items []ChatDTO + // NextCursor continues the same user-specific list; nil marks its current end. + NextCursor *string +} + +// MessagePageDTO contains an ordered page of chat history. +type MessagePageDTO struct { + // Items contains at most the requested number of messages. + Items []MessageDTO + // NextCursor continues the same chat history; nil marks its current end. + NextCursor *string +} diff --git a/internal/model/dto/session.go b/internal/model/dto/session.go new file mode 100644 index 00000000..9d1193cd --- /dev/null +++ b/internal/model/dto/session.go @@ -0,0 +1,13 @@ +package dto + +import "time" + +// SessionDTO is an issued session, exposing the raw token only at creation. +type SessionDTO struct { + // Token contains 256 random bits encoded for a Bearer header. + Token string + // ExpiresAt is an absolute UTC deadline which is not extended by reads. + ExpiresAt time.Time + // User is the authenticated account without credentials. + User UserDTO +} diff --git a/internal/model/http/models.go b/internal/model/http/models.go new file mode 100644 index 00000000..4ad10c8a --- /dev/null +++ b/internal/model/http/models.go @@ -0,0 +1,98 @@ +// Package http defines the public JSON boundary, separate from DTOs. +package http + +import "time" + +// UsersCreateRequest is the registration payload. +type UsersCreateRequest struct { + // Password is the unmodified Unicode registration secret. + Password string `json:"password"` + // Username is the unique lowercase ASCII username. + Username string `json:"username"` + // DisplayName is the user-visible name, limited to 100 Unicode code points. + DisplayName string `json:"display_name"` +} + +// ChatsCreateRequest is the chat payload. +type ChatsCreateRequest struct { + // Title is the nonblank chat title, limited to 100 Unicode code points. + Title string `json:"title"` + // MemberIDs contains unique user UUIDs, including the caller when creating a chat. + MemberIDs []string `json:"member_ids"` +} + +// MessagesCreateRequest is the message payload. +type MessagesCreateRequest struct { + // Text contains nonblank text, limited to 4000 Unicode code points. + Text string `json:"text"` +} + +// UserResponse is the public user model. +type UserResponse struct { + // ID is the canonical server-generated UUID. + ID string `json:"id"` + // Username is the unique lowercase ASCII username. + Username string `json:"username"` + // DisplayName is the user-visible name, limited to 100 Unicode code points. + DisplayName string `json:"display_name"` + // CreatedAt is the UTC creation time serialized as RFC 3339. + CreatedAt time.Time `json:"created_at"` +} + +// ChatResponse is the public chat model. +type ChatResponse struct { + // ID is the canonical server-generated UUID. + ID string `json:"id"` + // Title is the nonblank chat title, limited to 100 Unicode code points. + Title string `json:"title"` + // MemberIDs contains unique user UUIDs, including the caller when creating a chat. + MemberIDs []string `json:"member_ids"` + // CreatedAt is the UTC creation time serialized as RFC 3339. + CreatedAt time.Time `json:"created_at"` +} + +// MessageResponse is the public message model. +type MessageResponse struct { + // ID is the canonical server-generated UUID. + ID string `json:"id"` + // ChatID is the canonical UUID of the chat containing the message. + ChatID string `json:"chat_id"` + // SenderID is derived from the request identity, never from a client-supplied sender. + SenderID string `json:"sender_id"` + // Text contains nonblank text, limited to 4000 Unicode code points. + Text string `json:"text"` + // CreatedAt is the UTC creation time serialized as RFC 3339. + CreatedAt time.Time `json:"created_at"` +} + +// ChatPageResponse contains visible chats. +type ChatPageResponse struct { + // Items contains the ordered page records; an empty page is serialized as an empty array. + Items []ChatResponse `json:"items"` + // NextCursor is the opaque continuation token or null when the current page is last. + NextCursor *string `json:"next_cursor"` +} + +// MessagePageResponse contains the requested history page. +type MessagePageResponse struct { + // Items contains the ordered page records; an empty page is serialized as an empty array. + Items []MessageResponse `json:"items"` + // NextCursor is the opaque continuation token or null when the current page is last. + NextCursor *string `json:"next_cursor"` +} + +// ErrorResponse is the mandatory error envelope. +type ErrorResponse struct { + // Error contains the safe public error details. + Error ErrorDetail `json:"error"` +} + +// ErrorDetail never exposes internal errors or input contents. +type ErrorDetail struct { + // Code is one of the machine-readable error codes declared by the API contract. + Code string `json:"code"` + // Message is a safe public explanation without internal errors or input contents. + Message string `json:"message"` + // RequestID matches the X-Request-Id response header for log correlation. + RequestID string `json:"request_id"` +} diff --git a/internal/password/password.go b/internal/password/password.go new file mode 100644 index 00000000..630e1608 --- /dev/null +++ b/internal/password/password.go @@ -0,0 +1,54 @@ +// Package password implements a bounded Argon2id password KDF. +package password + +import ( + "crypto/rand" + "crypto/subtle" + "encoding/base64" + "strings" + + "golang.org/x/crypto/argon2" +) + +const ( + memoryKiB = 19 * 1024 + iterations = 2 + parallelism = 1 + saltBytes = 16 + hashBytes = 32 + prefix = "$argon2id$v=19$m=19456,t=2,p=1$" +) + +// Hasher implements password hashing without transport or storage dependencies. +type Hasher struct{} + +// Hash generates a salted Argon2id encoding using fixed resource bounds. +func (Hasher) Hash(password string) (string, error) { + salt := make([]byte, saltBytes) + if _, err := rand.Read(salt); err != nil { + return "", err + } + hash := argon2.IDKey([]byte(password), salt, iterations, memoryKiB, parallelism, hashBytes) + return prefix + base64.RawStdEncoding.EncodeToString(salt) + "$" + base64.RawStdEncoding.EncodeToString(hash), nil +} + +// Verify accepts only this application's bounded KDF encoding and compares in constant time. +func (Hasher) Verify(encoded, password string) bool { + if !strings.HasPrefix(encoded, prefix) { + return false + } + parts := strings.Split(strings.TrimPrefix(encoded, prefix), "$") + if len(parts) != 2 { + return false + } + salt, err := base64.RawStdEncoding.DecodeString(parts[0]) + if err != nil || len(salt) != saltBytes { + return false + } + expected, err := base64.RawStdEncoding.DecodeString(parts[1]) + if err != nil || len(expected) != hashBytes { + return false + } + actual := argon2.IDKey([]byte(password), salt, iterations, memoryKiB, parallelism, hashBytes) + return subtle.ConstantTimeCompare(actual, expected) == 1 +} diff --git a/internal/password/password_test.go b/internal/password/password_test.go new file mode 100644 index 00000000..565df62b --- /dev/null +++ b/internal/password/password_test.go @@ -0,0 +1,37 @@ +package password + +import ( + "strings" + "testing" +) + +// TestPasswordRoundTrip verifies long Unicode input without bcrypt-style truncation. +func TestPasswordRoundTrip(t *testing.T) { + password := strings.Repeat("🔐", 128) + hasher := Hasher{} + encoded, err := hasher.Hash(password) + if err != nil { + t.Fatal(err) + } + if !hasher.Verify(encoded, password) || hasher.Verify(encoded, password+"x") { + t.Fatal("password verification mismatch") + } + second, err := hasher.Hash(password) + if err != nil { + t.Fatal(err) + } + if encoded == second { + t.Fatal("salt reused") + } +} + +// TestPasswordRejectsInvalidEncoding checks corrupt or unbounded KDF descriptions. +func TestPasswordRejectsInvalidEncoding(t *testing.T) { + for _, encoded := range []string{"", "$argon2id$v=19$m=999999999,t=2,p=1$a$b", prefix + "x", prefix + "%%%$abc", prefix + "YWJj$abc", prefix + "AAAAAAAAAAAAAAAAAAAAAA$%%%", prefix + "AAAAAAAAAAAAAAAAAAAAAA$YWJj"} { + t.Run(encoded, func(t *testing.T) { + if (Hasher{}).Verify(encoded, "password") { + t.Fatal("invalid encoding accepted") + } + }) + } +} diff --git a/internal/service/auth.go b/internal/service/auth.go new file mode 100644 index 00000000..57a96c93 --- /dev/null +++ b/internal/service/auth.go @@ -0,0 +1,44 @@ +package service + +import ( + "context" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// Passwords is the password KDF boundary used by authentication. +type Passwords interface { + // Hash creates a salted password encoding. + Hash(password string) (string, error) + // Verify checks the supplied password against its encoding. + Verify(encoded, password string) bool +} + +// Accounts persists credentials and session validity independently of HTTP. +type Accounts interface { + // Register atomically stores a profile with credentials. + Register(context.Context, dto.UserDTO, string) (dto.UserDTO, error) + // Credentials looks up the password encoding and account profile. + Credentials(context.Context, string) (dto.UserDTO, string, error) + // SaveSession persists an opaque token digest and absolute expiry. + SaveSession(context.Context, string, uuid.UUID, time.Time) error + // SessionUser resolves an unexpired token digest. + SessionUser(context.Context, string) (uuid.UUID, error) + // RevokeSession invalidates a token digest. + RevokeSession(context.Context, string) error +} + +// Authentication defines registration and opaque session operations. +type Authentication interface { + // Register validates registration and persists a password-protected account. + Register(context.Context, dto.UsersCreateRequestDTO, string) (dto.UserDTO, error) + // Login verifies credentials and issues an opaque session. + Login(context.Context, string, string) (dto.SessionDTO, error) + // Authenticate resolves a valid token to its immutable owner. + Authenticate(context.Context, string) (string, error) + // Logout revokes the current token. + Logout(context.Context, string) error +} diff --git a/internal/service/authentication/service.go b/internal/service/authentication/service.go new file mode 100644 index 00000000..a1a76b99 --- /dev/null +++ b/internal/service/authentication/service.go @@ -0,0 +1,123 @@ +// Package authentication validates credentials and owns the session lifecycle. +package authentication + +import ( + "context" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/hex" + "errors" + "fmt" + "time" + "unicode/utf8" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service/production" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +const ( + minimumPasswordRunes = 12 + maximumPasswordRunes = 128 + tokenBytes = 32 +) + +// Service performs password and session operations through explicit boundaries. +type Service struct { + accounts service.Accounts + passwords service.Passwords + ttl time.Duration + dummyHash string +} + +// New validates dependencies and prepares the unknown-account verification hash. +func New(accounts service.Accounts, passwords service.Passwords, ttl time.Duration) (*Service, error) { + if accounts == nil || passwords == nil || ttl <= 0 { + return nil, fmt.Errorf("accounts, passwords and positive session TTL are required") + } + dummyHash, err := passwords.Hash("unknown-account-dummy-password") + if err != nil { + return nil, err + } + return &Service{accounts: accounts, passwords: passwords, ttl: ttl, dummyHash: dummyHash}, nil +} + +// Register checks profile and Unicode password bounds before hashing and persistence. +func (s *Service) Register(ctx context.Context, request dto.UsersCreateRequestDTO, password string) (dto.UserDTO, error) { + user, err := production.PrepareUser(request) + if err != nil || !validPassword(password) { + return dto.UserDTO{}, service.ErrInvalid + } + hash, err := s.passwords.Hash(password) + if err != nil { + return dto.UserDTO{}, err + } + user, err = s.accounts.Register(ctx, user, hash) + if errors.Is(err, store.ErrConflict) { + return dto.UserDTO{}, service.ErrConflict + } + return user, err +} + +// Login verifies credentials uniformly and persists a new session before returning its token. +func (s *Service) Login(ctx context.Context, username, password string) (dto.SessionDTO, error) { + if !validPassword(password) { + return dto.SessionDTO{}, service.ErrUnauthorized + } + user, hash, err := s.accounts.Credentials(ctx, username) + if err != nil && !errors.Is(err, store.ErrNotFound) { + return dto.SessionDTO{}, err + } + missing := errors.Is(err, store.ErrNotFound) + if missing { + hash = s.dummyHash + } + if !s.passwords.Verify(hash, password) || missing { + return dto.SessionDTO{}, service.ErrUnauthorized + } + random := make([]byte, tokenBytes) + if _, err := rand.Read(random); err != nil { + return dto.SessionDTO{}, err + } + token := base64.RawURLEncoding.EncodeToString(random) + expiry := time.Now().UTC().Add(s.ttl) + if err := s.accounts.SaveSession(ctx, digest(token), user.ID, expiry); err != nil { + return dto.SessionDTO{}, err + } + return dto.SessionDTO{Token: token, ExpiresAt: expiry, User: user}, nil +} + +// Authenticate checks absolute expiry in the source of truth on every request. +func (s *Service) Authenticate(ctx context.Context, token string) (string, error) { + decoded, err := base64.RawURLEncoding.DecodeString(token) + if err != nil || len(decoded) != tokenBytes { + return "", service.ErrUnauthorized + } + id, err := s.accounts.SessionUser(ctx, digest(token)) + if errors.Is(err, store.ErrNotFound) { + return "", service.ErrUnauthorized + } + if err != nil { + return "", err + } + return id.String(), nil +} + +// Logout removes the current session from the authoritative store. +func (s *Service) Logout(ctx context.Context, token string) error { + return s.accounts.RevokeSession(ctx, digest(token)) +} + +// digest produces the storage key without persisting the bearer secret. +func digest(token string) string { + hash := sha256.Sum256([]byte(token)) + return hex.EncodeToString(hash[:]) +} + +// validPassword enforces the contract in Unicode code points without truncation. +func validPassword(password string) bool { + count := utf8.RuneCountInString(password) + return utf8.ValidString(password) && count >= minimumPasswordRunes && count <= maximumPasswordRunes +} diff --git a/internal/service/authentication/service_test.go b/internal/service/authentication/service_test.go new file mode 100644 index 00000000..3a8d8ca7 --- /dev/null +++ b/internal/service/authentication/service_test.go @@ -0,0 +1,232 @@ +package authentication + +import ( + "context" + "errors" + "strings" + "testing" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +type accountFixture struct { + user dto.UserDTO + hash string + tokenHash string + expiry time.Time + failure error + registerFailure error + saveFailure error +} + +// Register captures one synthetic account or a prescribed persistence failure. +func (f *accountFixture) Register(_ context.Context, user dto.UserDTO, hash string) (dto.UserDTO, error) { + f.user = user + f.hash = hash + return user, f.registerFailure +} + +// Credentials returns the fixture account and its password encoding. +func (f *accountFixture) Credentials(context.Context, string) (dto.UserDTO, string, error) { + return f.user, f.hash, f.failure +} + +// SaveSession captures the digest and absolute expiry without storing the raw token. +func (f *accountFixture) SaveSession(_ context.Context, hash string, _ uuid.UUID, expiry time.Time) error { + f.tokenHash = hash + f.expiry = expiry + return f.saveFailure +} + +// SessionUser implements expiry and revocation for the service unit fixture. +func (f *accountFixture) SessionUser(_ context.Context, hash string) (uuid.UUID, error) { + if f.failure != nil { + return uuid.Nil, f.failure + } + if hash != f.tokenHash || !f.expiry.After(time.Now()) { + return uuid.Nil, store.ErrNotFound + } + return f.user.ID, nil +} + +// RevokeSession invalidates the fixture digest. +func (f *accountFixture) RevokeSession(context.Context, string) error { + f.tokenHash = "" + return f.failure +} + +type passwordFixture struct { + failure error +} + +// Hash creates an intentionally noncryptographic encoding for service-only unit tests. +func (f passwordFixture) Hash(password string) (string, error) { + return "fixture:" + password, f.failure +} + +// Verify compares only test fixture encodings; production uses Argon2id. +func (passwordFixture) Verify(encoded, password string) bool { + return encoded == "fixture:"+password +} + +// authFixture assembles deterministic service boundaries. +func authFixture(t *testing.T) (*Service, *accountFixture) { + t.Helper() + accounts := &accountFixture{user: dto.UserDTO{ID: uuid.New(), Username: "alice"}, hash: "fixture:synthetic-password"} + s, err := New(accounts, passwordFixture{}, time.Hour) + if err != nil { + t.Fatal(err) + } + return s, accounts +} + +// TestRegisterValidatesPassword checks contract boundaries without truncation. +func TestRegisterValidatesPassword(t *testing.T) { + cases := []struct { + name string + password string + valid bool + }{ + {"short", "short", false}, + {"minimum", strings.Repeat("a", 12), true}, + {"unicode maximum", strings.Repeat("🔐", 128), true}, + {"too long", strings.Repeat("a", 129), false}, + {"invalid UTF8", strings.Repeat("a", 12) + "\xff", false}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + s, _ := authFixture(t) + _, err := s.Register(t.Context(), dto.UsersCreateRequestDTO{Username: "alice", DisplayName: "Alice"}, tc.password) + if (err == nil) != tc.valid { + t.Fatalf("unexpected registration result: %v", err) + } + }) + } +} + +// TestRegisterConflictMapsToApplicationError verifies uniqueness error translation. +func TestRegisterConflictMapsToApplicationError(t *testing.T) { + s, accounts := authFixture(t) + accounts.registerFailure = store.ErrConflict + _, err := s.Register(t.Context(), dto.UsersCreateRequestDTO{Username: "alice", DisplayName: "Alice"}, "synthetic-password") + if !errors.Is(err, service.ErrConflict) { + t.Fatal(err) + } +} + +// TestRegisterHashFailurePreservesCause checks KDF failures before persistence. +func TestRegisterHashFailurePreservesCause(t *testing.T) { + s, _ := authFixture(t) + failure := errors.New("KDF unavailable") + s.passwords = passwordFixture{failure: failure} + _, err := s.Register(t.Context(), dto.UsersCreateRequestDTO{Username: "alice", DisplayName: "Alice"}, "synthetic-password") + if !errors.Is(err, failure) { + t.Fatal(err) + } +} + +// TestLoginPersistsOnlyTokenDigest checks issued entropy, owner and deadline together. +func TestLoginPersistsOnlyTokenDigest(t *testing.T) { + s, accounts := authFixture(t) + session, err := s.Login(t.Context(), "alice", "synthetic-password") + if err != nil { + t.Fatal(err) + } + if session.Token == accounts.tokenHash || len(accounts.tokenHash) != 64 || session.User.ID != accounts.user.ID || !session.ExpiresAt.Equal(accounts.expiry) { + t.Fatal("invalid issued session") + } + id, err := s.Authenticate(t.Context(), session.Token) + if err != nil || id != accounts.user.ID.String() { + t.Fatalf("session does not authenticate its owner: %v", err) + } +} + +// TestLoginRejectsCredentials checks independent authentication rejection scenarios. +func TestLoginRejectsCredentials(t *testing.T) { + cases := []struct { + name string + password string + failure error + expected error + }{ + {"short password", "short", nil, service.ErrUnauthorized}, + {"wrong password", "incorrect-password", nil, service.ErrUnauthorized}, + {"missing account", "synthetic-password", store.ErrNotFound, service.ErrUnauthorized}, + {"database unavailable", "synthetic-password", context.DeadlineExceeded, context.DeadlineExceeded}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + s, accounts := authFixture(t) + accounts.failure = tc.failure + _, err := s.Login(t.Context(), "alice", tc.password) + if !errors.Is(err, tc.expected) { + t.Fatalf("expected %v, got %v", tc.expected, err) + } + }) + } +} + +// TestLoginDoesNotReturnUnpersistedSession checks failure after successful password verification. +func TestLoginDoesNotReturnUnpersistedSession(t *testing.T) { + s, accounts := authFixture(t) + accounts.saveFailure = context.DeadlineExceeded + session, err := s.Login(t.Context(), "alice", "synthetic-password") + if !errors.Is(err, context.DeadlineExceeded) || session.Token != "" { + t.Fatal("unpersisted session escaped") + } +} + +// TestAuthenticateRejectsUnknownToken checks malformed and correctly encoded unknown tokens. +func TestAuthenticateRejectsUnknownToken(t *testing.T) { + for _, token := range []string{"", "%%%", strings.Repeat("A", 43)} { + t.Run(token, func(t *testing.T) { + s, _ := authFixture(t) + if _, err := s.Authenticate(t.Context(), token); !errors.Is(err, service.ErrUnauthorized) { + t.Fatal(err) + } + }) + } +} + +// TestAuthenticatePropagatesDatabaseFailure prevents trusting a token during an outage. +func TestAuthenticatePropagatesDatabaseFailure(t *testing.T) { + s, accounts := authFixture(t) + accounts.failure = context.DeadlineExceeded + if _, err := s.Authenticate(t.Context(), strings.Repeat("A", 43)); !errors.Is(err, context.DeadlineExceeded) { + t.Fatal(err) + } +} + +// TestLogoutRevokesIssuedToken checks that the same token cannot be reused. +func TestLogoutRevokesIssuedToken(t *testing.T) { + s, _ := authFixture(t) + session, err := s.Login(t.Context(), "alice", "synthetic-password") + if err != nil { + t.Fatal(err) + } + if err := s.Logout(t.Context(), session.Token); err != nil { + t.Fatal(err) + } + if _, err := s.Authenticate(t.Context(), session.Token); !errors.Is(err, service.ErrUnauthorized) { + t.Fatal("revoked token authenticated") + } +} + +// TestNewRejectsIncompleteDependencies checks constructor validation and KDF startup failure. +func TestNewRejectsIncompleteDependencies(t *testing.T) { + t.Run("missing accounts", func(t *testing.T) { + if _, err := New(nil, passwordFixture{}, time.Hour); err == nil { + t.Fatal("missing accounts accepted") + } + }) + t.Run("hash failure", func(t *testing.T) { + if _, err := New(&accountFixture{}, passwordFixture{failure: context.Canceled}, time.Hour); !errors.Is(err, context.Canceled) { + t.Fatal(err) + } + }) +} diff --git a/internal/service/cache.go b/internal/service/cache.go new file mode 100644 index 00000000..2eee452e --- /dev/null +++ b/internal/service/cache.go @@ -0,0 +1,17 @@ +package service + +import ( + "context" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// ProfileCache stores immutable public account profiles; misses fall back to PostgreSQL. +type ProfileCache interface { + // GetProfile returns a cached profile or a miss, including on backend failure. + GetProfile(context.Context, uuid.UUID) (dto.UserDTO, bool) + // PutProfile stores a bounded-lifetime profile on a best-effort basis. + PutProfile(context.Context, dto.UserDTO) +} diff --git a/internal/service/cursor.go b/internal/service/cursor.go new file mode 100644 index 00000000..17850d82 --- /dev/null +++ b/internal/service/cursor.go @@ -0,0 +1,12 @@ +package service + +import "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + +// CursorCodec defines the pagination operations required by application services. +type CursorCodec interface { + // Encode signs a position for the specified resource. + Encode(resource string, position cursor.Position) (string, error) + + // Decode verifies a token and returns its position; empty tokens start a page sequence. + Decode(encoded, resource string) (cursor.Position, error) +} diff --git a/internal/service/errors.go b/internal/service/errors.go new file mode 100644 index 00000000..d15e0af8 --- /dev/null +++ b/internal/service/errors.go @@ -0,0 +1,23 @@ +package service + +import ( + "errors" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +var ( + // ErrUnavailable preserves the dependency failure category across service boundaries. + ErrUnavailable = store.ErrUnavailable + + // ErrInvalid indicates invalid operation input. + ErrInvalid = errors.New("invalid request") + // ErrUnauthorized indicates an unresolved current user. + ErrUnauthorized = errors.New("unknown user identity") + // ErrNotFound hides both absent and inaccessible resources. + ErrNotFound = errors.New("resource not found") + // ErrConflict indicates a duplicate username. + ErrConflict = errors.New("username already exists") + // ErrCapacity indicates exhausted storage capacity without eviction. + ErrCapacity = errors.New("in-memory storage capacity reached") +) diff --git a/internal/service/interface.go b/internal/service/interface.go new file mode 100644 index 00000000..0baac14a --- /dev/null +++ b/internal/service/interface.go @@ -0,0 +1,36 @@ +// Package service defines the application operations consumed by HTTP controllers. +package service + +import ( + "context" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// Service validates raw input and enforces identity and membership requirements. +// Implementations must not expose transport-specific types or storage internals. +type Service interface { + // UsersCreate registers a user or reports invalid input, conflict or capacity exhaustion. + UsersCreate(ctx context.Context, request dto.UsersCreateRequestDTO) (dto.UserDTO, error) + + // UsersCheckIdentity verifies that an identity belongs to an existing user. + UsersCheckIdentity(ctx context.Context, userID string) error + + // UsersGetMe resolves the authenticated caller, rejecting malformed or unknown identifiers. + UsersGetMe(ctx context.Context, userID string) (dto.UserDTO, error) + + // ChatsCreate validates all members and creates one chat atomically. + ChatsCreate(ctx context.Context, request dto.ChatsCreateRequestDTO) (dto.ChatDTO, error) + + // ChatsGetByID hides missing and inaccessible chats behind the same not-found result. + ChatsGetByID(ctx context.Context, userID, chatID string) (dto.ChatDTO, error) + + // ChatsGetPage lists only chats visible to the caller, using resource-bound cursors. + ChatsGetPage(ctx context.Context, request dto.PageRequestDTO) (dto.ChatPageDTO, error) + + // MessagesCreate derives the sender from the identity and appends validated text. + MessagesCreate(ctx context.Context, request dto.MessagesCreateRequestDTO) (dto.MessageDTO, error) + + // MessagesGetPage authorizes the caller and returns history after a verified cursor. + MessagesGetPage(ctx context.Context, request dto.PageRequestDTO) (dto.MessagePageDTO, error) +} diff --git a/internal/service/production/access.go b/internal/service/production/access.go new file mode 100644 index 00000000..6510a335 --- /dev/null +++ b/internal/service/production/access.go @@ -0,0 +1,62 @@ +package production + +import ( + "context" + "slices" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// parseIdentity maps malformed identity values to the authentication error. +func parseIdentity(rawID string) (uuid.UUID, error) { + id, err := parseID(rawID) + if err != nil { + return uuid.Nil, service.ErrUnauthorized + } + return id, nil +} + +// requireUserID resolves an existing identity without loading a user profile. +func (s *Service) requireUserID(ctx context.Context, rawID string) (uuid.UUID, error) { + id, err := parseIdentity(rawID) + if err != nil { + return uuid.Nil, err + } + exists, err := s.repo.UsersExist(ctx, []uuid.UUID{id}) + if err != nil { + return uuid.Nil, normalizeStoreError(err) + } + if !exists { + return uuid.Nil, service.ErrUnauthorized + } + return id, nil +} + +// requireChatMember resolves an existing caller and a chat available to that caller. +func (s *Service) requireChatMember(ctx context.Context, userID, chatID string) (uuid.UUID, dto.ChatDTO, error) { + caller, err := s.requireUserID(ctx, userID) + if err != nil { + return uuid.Nil, dto.ChatDTO{}, err + } + chat, err := s.findChat(ctx, chatID) + if err != nil { + return uuid.Nil, dto.ChatDTO{}, err + } + if !slices.Contains(chat.MemberIDs, caller) { + return uuid.Nil, dto.ChatDTO{}, service.ErrNotFound + } + return caller, chat, nil +} + +// findChat parses a chat identifier and translates storage lookup errors. +func (s *Service) findChat(ctx context.Context, rawID string) (dto.ChatDTO, error) { + id, err := parseID(rawID) + if err != nil { + return dto.ChatDTO{}, err + } + chat, err := s.repo.Chat(ctx, id) + return chat, normalizeStoreError(err) +} diff --git a/internal/service/production/cache_test.go b/internal/service/production/cache_test.go new file mode 100644 index 00000000..fb6e97d5 --- /dev/null +++ b/internal/service/production/cache_test.go @@ -0,0 +1,84 @@ +package production + +import ( + "context" + "testing" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +type cacheFixture struct { + profile dto.UserDTO + hit bool + writes int +} + +// GetProfile returns the arranged optional-cache lookup outcome. +func (f *cacheFixture) GetProfile(context.Context, uuid.UUID) (dto.UserDTO, bool) { + return f.profile, f.hit +} + +// PutProfile records successful cache population from authoritative data. +func (f *cacheFixture) PutProfile(_ context.Context, user dto.UserDTO) { + f.profile = user + f.writes++ +} + +// TestProfileCacheHitAvoidsProfileQuery verifies that the cache has a concrete role. +func TestProfileCacheHitAvoidsProfileQuery(t *testing.T) { + codec, err := cursor.New() + if err != nil { + t.Fatal(err) + } + cache := &cacheFixture{profile: dto.UserDTO{ID: uuid.New()}, hit: true} + svc, err := NewCached(&storeStub{t: t}, codec, cache) + if err != nil { + t.Fatal(err) + } + got, err := svc.UsersGetMe(t.Context(), cache.profile.ID.String()) + if err != nil || got.ID != cache.profile.ID { + t.Fatalf("cache hit ignored: %v", err) + } +} + +// TestProfileCacheMissPopulatesAfterDatabaseRead checks the authoritative fallback. +func TestProfileCacheMissPopulatesAfterDatabaseRead(t *testing.T) { + codec, err := cursor.New() + if err != nil { + t.Fatal(err) + } + id := uuid.New() + repo := &storeStub{t: t, user: func(context.Context, uuid.UUID) (dto.UserDTO, error) { + return dto.UserDTO{ID: id}, nil + }} + cache := &cacheFixture{} + svc, err := NewCached(repo, codec, cache) + if err != nil { + t.Fatal(err) + } + got, err := svc.UsersGetMe(t.Context(), id.String()) + if err != nil || got.ID != id || cache.writes != 1 { + t.Fatalf("fallback failed: %v", err) + } +} + +// TestCachedServiceRejectsMissingDependencies checks explicit service boundaries. +func TestCachedServiceRejectsMissingDependencies(t *testing.T) { + t.Run("store", func(t *testing.T) { + if _, err := NewCached(nil, nil, &cacheFixture{}); err == nil { + t.Fatal("missing store accepted") + } + }) + t.Run("cache", func(t *testing.T) { + codec, err := cursor.New() + if err != nil { + t.Fatal(err) + } + if _, err := NewCached(&storeStub{t: t}, codec, nil); err == nil { + t.Fatal("missing cache accepted") + } + }) +} diff --git a/internal/service/production/chats.go b/internal/service/production/chats.go new file mode 100644 index 00000000..56ef0e52 --- /dev/null +++ b/internal/service/production/chats.go @@ -0,0 +1,47 @@ +package production + +import ( + "context" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// ChatsCreate resolves the caller, validates the proposed chat and persists it atomically. +func (s *Service) ChatsCreate(ctx context.Context, request dto.ChatsCreateRequestDTO) (dto.ChatDTO, error) { + caller, err := s.requireUserID(ctx, request.UserID) + if err != nil { + return dto.ChatDTO{}, err + } + chat, err := prepareChat(request, caller) + if err != nil { + return dto.ChatDTO{}, err + } + if err := s.requireExistingMembers(ctx, chat.MemberIDs); err != nil { + return dto.ChatDTO{}, err + } + created, err := s.repo.CreateChat(ctx, chat) + return created, normalizeStoreError(err) +} + +// ChatsGetByID returns a chat only to a current member, hiding its existence otherwise. +func (s *Service) ChatsGetByID(ctx context.Context, userID, chatID string) (dto.ChatDTO, error) { + _, chat, err := s.requireChatMember(ctx, userID, chatID) + return chat, err +} + +// ChatsGetPage authorizes the caller, loads a page and prepares its continuation. +func (s *Service) ChatsGetPage(ctx context.Context, request dto.PageRequestDTO) (dto.ChatPageDTO, error) { + caller, err := s.requireUserID(ctx, request.UserID) + if err != nil { + return dto.ChatPageDTO{}, err + } + page, err := s.parsePage(request, chatListResource(caller)) + if err != nil { + return dto.ChatPageDTO{}, err + } + items, err := s.repo.Chats(ctx, caller, page.position, page.fetchLimit()) + if err != nil { + return dto.ChatPageDTO{}, normalizeStoreError(err) + } + return s.chatPage(items, page) +} diff --git a/internal/service/production/chats_page_test.go b/internal/service/production/chats_page_test.go new file mode 100644 index 00000000..b325fd42 --- /dev/null +++ b/internal/service/production/chats_page_test.go @@ -0,0 +1,207 @@ +package production + +import ( + "context" + "errors" + "reflect" + "testing" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// TestService_ChatsGetPage validates access and pagination before issuing a typed store query. +func TestService_ChatsGetPage(t *testing.T) { + t.Run("Positive: continuation uses scope, position and lookahead", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + allowIdentity(repo, actor) + + previous := cursor.Position{ID: uuid.New(), CreatedAt: time.Unix(1700000000, 0).UTC()} + records := []dto.ChatDTO{ + {ID: uuid.New(), CreatedAt: time.Unix(1700000001, 0).UTC()}, + {ID: uuid.New(), CreatedAt: time.Unix(1700000002, 0).UTC()}, + {ID: uuid.New(), CreatedAt: time.Unix(1700000003, 0).UTC()}, + } + calls := 0 + repo.chats = func(_ context.Context, id uuid.UUID, position dto.PositionDTO, limit int) ([]dto.ChatDTO, error) { + calls++ + expected := dto.PositionDTO{ID: previous.ID, CreatedAt: previous.CreatedAt} + if id != actor || position != expected || limit != 3 { + t.Fatalf("wrong page query: id=%s, position=%v, limit=%d", id, position, limit) + } + return records, nil + } + svc := newStubService(t, repo) + resource := "chats:" + actor.String() + token, err := svc.cursors.Encode(resource, previous) + if err != nil { + t.Fatal(err) + } + input := dto.PageRequestDTO{UserID: actor.String(), Limit: "2", Cursor: token} + + // Act. + got, err := svc.ChatsGetPage(t.Context(), input) + + // Assert. + + if err != nil { + t.Fatal(err) + } + if calls != 1 || !reflect.DeepEqual(got.Items, records[:2]) || got.NextCursor == nil { + t.Fatalf("calls=%d, page=%+v", calls, got) + } + position, err := svc.cursors.Decode(*got.NextCursor, resource) + expected := cursor.Position{ID: records[1].ID, CreatedAt: records[1].CreatedAt} + if err != nil || position != expected { + t.Fatalf("next position=%v, want=%v, error=%v", position, expected, err) + } + + }) + + t.Run("Positive: empty history uses default limit and no continuation", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + allowIdentity(repo, actor) + + calls := 0 + repo.chats = func(_ context.Context, id uuid.UUID, position dto.PositionDTO, limit int) ([]dto.ChatDTO, error) { + calls++ + if id != actor || position != (dto.PositionDTO{}) || limit != 51 { + t.Fatalf("wrong initial page query: id=%s, position=%v, limit=%d", id, position, limit) + } + return []dto.ChatDTO{}, nil + } + svc := newStubService(t, repo) + input := dto.PageRequestDTO{UserID: actor.String()} + + // Act. + got, err := svc.ChatsGetPage(t.Context(), input) + + // Assert. + if err != nil { + t.Fatal(err) + } + if calls != 1 || got.Items == nil || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("calls=%d, page=%+v", calls, got) + } + }) + + t.Run("Negative: cursor for another resource skips page lookup", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + allowIdentity(repo, actor) + + svc := newStubService(t, repo) + token, err := svc.cursors.Encode("another-resource", cursor.Position{ID: uuid.New(), CreatedAt: time.Unix(1700000000, 0).UTC()}) + if err != nil { + t.Fatal(err) + } + input := dto.PageRequestDTO{UserID: actor.String(), Cursor: token} + + // Act. + got, err := svc.ChatsGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrInvalid) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: codec failure skips page lookup", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + allowIdentity(repo, actor) + + failure := errors.New("cursor unavailable") + svc := newStubService(t, repo) + svc.cursors = failingCursor{failure: failure} + input := dto.PageRequestDTO{UserID: actor.String(), Cursor: "token"} + + // Act. + got, err := svc.ChatsGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, failure) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: page storage fails", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + allowIdentity(repo, actor) + + failure := errors.New("page unavailable") + repo.chats = func(_ context.Context, _ uuid.UUID, _ dto.PositionDTO, _ int) ([]dto.ChatDTO, error) { + return nil, failure + } + svc := newStubService(t, repo) + input := dto.PageRequestDTO{UserID: actor.String()} + + // Act. + got, err := svc.ChatsGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, failure) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: malformed identity skips all storage", func(t *testing.T) { + // Arrange. + svc := newStubService(t, newStoreStub(t)) + input := dto.PageRequestDTO{UserID: "invalid", ChatID: uuid.NewString()} + + // Act. + got, err := svc.ChatsGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrUnauthorized) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) +} + +// TestService_ChatsGetPage_InvalidLimit rejects invalid limits before reading stored pages. +func TestService_ChatsGetPage_InvalidLimit(t *testing.T) { + cases := []struct { + name string + limit string + }{ + {"Negative: zero limit", "0"}, + {"Negative: negative limit", "-1"}, + {"Negative: limit above maximum", "101"}, + {"Negative: nonnumeric limit", "text"}, + {"Negative: fractional limit", "1.5"}, + {"Negative: integer overflow", "99999999999999999999999999"}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + allowIdentity(repo, actor) + + svc := newStubService(t, repo) + input := dto.PageRequestDTO{UserID: actor.String(), Limit: tc.limit} + + // Act. + got, err := svc.ChatsGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrInvalid) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) + } +} diff --git a/internal/service/production/chats_test.go b/internal/service/production/chats_test.go new file mode 100644 index 00000000..f2085395 --- /dev/null +++ b/internal/service/production/chats_test.go @@ -0,0 +1,261 @@ +package production + +import ( + "context" + "errors" + "reflect" + "slices" + "testing" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// TestService_ChatsCreate checks membership in one batch and persists only validated chats. +func TestService_ChatsCreate(t *testing.T) { + t.Run("Positive: one membership query and original chat fields", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor, other := uuid.New(), uuid.New() + var queries [][]uuid.UUID + repo.usersExist = func(_ context.Context, ids []uuid.UUID) (bool, error) { + queries = append(queries, slices.Clone(ids)) + return true, nil + } + var persisted dto.ChatDTO + repo.createChat = func(_ context.Context, input dto.ChatDTO) (dto.ChatDTO, error) { + persisted = input + input.CreatedAt = time.Unix(1700000000, 0).UTC() + return input, nil + } + svc := newStubService(t, repo) + input := dto.ChatsCreateRequestDTO{UserID: actor.String(), Title: " Team 👋 ", MemberIDs: []string{actor.String(), other.String()}} + + // Act. + got, err := svc.ChatsCreate(t.Context(), input) + + // Assert. + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(queries, [][]uuid.UUID{{actor}, {actor, other}}) { + t.Fatalf("existence queries=%v", queries) + } + if persisted.ID == uuid.Nil || persisted.Title != input.Title || !slices.Equal(persisted.MemberIDs, []uuid.UUID{actor, other}) { + t.Fatalf("wrong persistence input: %+v", persisted) + } + if got.ID != persisted.ID || got.CreatedAt.IsZero() || got.Title != input.Title || !slices.Equal(got.MemberIDs, persisted.MemberIDs) { + t.Fatalf("wrong returned chat: %+v", got) + } + }) + + t.Run("Negative: unknown member prevents persistence", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor, missing := uuid.New(), uuid.New() + repo.usersExist = func(_ context.Context, ids []uuid.UUID) (bool, error) { + return !slices.Contains(ids, missing), nil + } + svc := newStubService(t, repo) + input := dto.ChatsCreateRequestDTO{UserID: actor.String(), Title: "Team", MemberIDs: []string{actor.String(), missing.String()}} + + // Act. + got, err := svc.ChatsCreate(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrInvalid) || !reflect.DeepEqual(got, dto.ChatDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: membership lookup failure prevents persistence", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor, other := uuid.New(), uuid.New() + failure := errors.New("membership unavailable") + repo.usersExist = func(_ context.Context, ids []uuid.UUID) (bool, error) { + if len(ids) == 1 { + return true, nil + } + return false, failure + } + svc := newStubService(t, repo) + input := dto.ChatsCreateRequestDTO{UserID: actor.String(), Title: "Team", MemberIDs: []string{actor.String(), other.String()}} + + // Act. + got, err := svc.ChatsCreate(t.Context(), input) + + // Assert. + if !errors.Is(err, failure) || !reflect.DeepEqual(got, dto.ChatDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: unknown creator prevents membership and persistence calls", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + repo.usersExist = func(_ context.Context, _ []uuid.UUID) (bool, error) { + return false, nil + } + svc := newStubService(t, repo) + actor := uuid.New() + input := dto.ChatsCreateRequestDTO{UserID: actor.String(), Title: "Team", MemberIDs: []string{actor.String()}} + + // Act. + got, err := svc.ChatsCreate(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrUnauthorized) || !reflect.DeepEqual(got, dto.ChatDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + }) +} + +// TestService_ChatsCreate_InvalidInput rejects malformed chat fields before checking member existence. +func TestService_ChatsCreate_InvalidInput(t *testing.T) { + actor := uuid.New() + cases := []struct { + name string + title string + members []string + }{ + {"Negative: empty member set", "Team", nil}, + {"Negative: duplicate member", "Team", []string{actor.String(), actor.String()}}, + {"Negative: caller omitted", "Team", []string{uuid.NewString()}}, + {"Negative: malformed member ID", "Team", []string{actor.String(), "invalid"}}, + {"Negative: blank title", " ", []string{actor.String()}}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + calls := 0 + repo.usersExist = func(_ context.Context, ids []uuid.UUID) (bool, error) { + calls++ + if calls != 1 || !slices.Equal(ids, []uuid.UUID{actor}) { + t.Fatalf("unexpected membership check: %v", ids) + } + return true, nil + } + svc := newStubService(t, repo) + input := dto.ChatsCreateRequestDTO{UserID: actor.String(), Title: tc.title, MemberIDs: tc.members} + + // Act. + got, err := svc.ChatsCreate(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrInvalid) || !reflect.DeepEqual(got, dto.ChatDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + if calls != 1 { + t.Fatalf("identity checks=%d, want=1", calls) + } + }) + } +} + +// TestService_ChatsGetByID authorizes the requested chat and conceals inaccessible records. +func TestService_ChatsGetByID(t *testing.T) { + t.Run("Positive: member receives the complete chat", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + expected := dto.ChatDTO{ID: uuid.New(), Title: "Team", MemberIDs: []uuid.UUID{actor}, CreatedAt: time.Unix(1700000000, 0).UTC()} + allowChatAccess(repo, actor, expected) + svc := newStubService(t, repo) + + // Act. + got, err := svc.ChatsGetByID(t.Context(), actor.String(), expected.ID.String()) + + // Assert. + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(got, expected) { + t.Fatalf("chat=%+v, want=%+v", got, expected) + } + }) + + t.Run("Negative: outsider receives no chat details", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), Title: "Private", MemberIDs: []uuid.UUID{uuid.New()}} + allowChatAccess(repo, actor, chat) + svc := newStubService(t, repo) + + // Act. + got, err := svc.ChatsGetByID(t.Context(), actor.String(), chat.ID.String()) + + // Assert. + if !errors.Is(err, service.ErrNotFound) || !reflect.DeepEqual(got, dto.ChatDTO{}) { + t.Fatalf("private chat exposed: %+v, error=%v", got, err) + } + }) + + t.Run("Negative: malformed chat ID skips chat lookup", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + allowIdentity(repo, actor) + svc := newStubService(t, repo) + + // Act. + got, err := svc.ChatsGetByID(t.Context(), actor.String(), "invalid") + + // Assert. + if !errors.Is(err, service.ErrInvalid) || !reflect.DeepEqual(got, dto.ChatDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: malformed identity skips storage", func(t *testing.T) { + // Arrange. + svc := newStubService(t, newStoreStub(t)) + + // Act. + got, err := svc.ChatsGetByID(t.Context(), "invalid", uuid.NewString()) + + // Assert. + if !errors.Is(err, service.ErrUnauthorized) || !reflect.DeepEqual(got, dto.ChatDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + }) +} + +// TestService_ChatsGetByID_StoreErrors translates missing records and retains unexpected failures. +func TestService_ChatsGetByID_StoreErrors(t *testing.T) { + failure := errors.New("chat lookup unavailable") + cases := []struct { + name string + cause error + want error + }{ + {"Negative: absent chat", store.ErrNotFound, service.ErrNotFound}, + {"Negative: storage unavailable", failure, failure}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + allowIdentity(repo, actor) + repo.chat = func(_ context.Context, _ uuid.UUID) (dto.ChatDTO, error) { + return dto.ChatDTO{}, tc.cause + } + svc := newStubService(t, repo) + + // Act. + got, err := svc.ChatsGetByID(t.Context(), actor.String(), uuid.NewString()) + + // Assert. + if !errors.Is(err, tc.want) || !reflect.DeepEqual(got, dto.ChatDTO{}) { + t.Fatalf("result=%+v, error=%v, want=%v", got, err, tc.want) + } + }) + } +} diff --git a/internal/service/production/creation.go b/internal/service/production/creation.go new file mode 100644 index 00000000..0942d6cb --- /dev/null +++ b/internal/service/production/creation.go @@ -0,0 +1,64 @@ +package production + +import ( + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// PrepareUser validates registration fields and assigns the new user identifier. +func PrepareUser(request dto.UsersCreateRequestDTO) (dto.UserDTO, error) { + if !validUsername(request.Username) || !validText(request.DisplayName, maxDisplayNameRunes) { + return dto.UserDTO{}, service.ErrInvalid + } + return dto.UserDTO{ + ID: uuid.New(), + Username: request.Username, + DisplayName: request.DisplayName, + }, nil +} + +// prepareChat validates the title and member identifiers before storage access. +func prepareChat(request dto.ChatsCreateRequestDTO, caller uuid.UUID) (dto.ChatDTO, error) { + if !validText(request.Title, maxChatTitleRunes) { + return dto.ChatDTO{}, service.ErrInvalid + } + members, err := parseMembers(request.MemberIDs, caller) + if err != nil { + return dto.ChatDTO{}, err + } + return dto.ChatDTO{ + ID: uuid.New(), + Title: request.Title, + MemberIDs: members, + }, nil +} + +// prepareMessage validates text and creates a record for the authorized sender and chat. +func prepareMessage(request dto.MessagesCreateRequestDTO, sender, chatID uuid.UUID) (dto.MessageDTO, error) { + if !validText(request.Text, maxMessageRunes) || !validIdempotencyKey(request.IdempotencyKey) { + return dto.MessageDTO{}, service.ErrInvalid + } + return dto.MessageDTO{ + ID: uuid.New(), + ChatID: chatID, + SenderID: sender, + Text: request.Text, + IdempotencyKey: request.IdempotencyKey, + }, nil +} + +// validIdempotencyKey accepts only the bounded ASCII alphabet from the contract. +func validIdempotencyKey(key string) bool { + if len(key) < 1 || len(key) > 128 { + return false + } + for _, c := range key { + if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '.' || c == '_' || c == ':' || c == '-' { + continue + } + return false + } + return true +} diff --git a/internal/service/production/errors.go b/internal/service/production/errors.go new file mode 100644 index 00000000..15dc4035 --- /dev/null +++ b/internal/service/production/errors.go @@ -0,0 +1,23 @@ +package production + +import ( + "errors" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// normalizeStoreError maps expected storage failures to application errors. +// Unexpected failures retain their cause for the transport's safe fallback. +func normalizeStoreError(err error) error { + switch { + case errors.Is(err, store.ErrNotFound): + return service.ErrNotFound + case errors.Is(err, store.ErrConflict): + return service.ErrConflict + case errors.Is(err, store.ErrCapacity): + return service.ErrCapacity + default: + return err + } +} diff --git a/internal/service/production/fixture_test.go b/internal/service/production/fixture_test.go new file mode 100644 index 00000000..e067de6e --- /dev/null +++ b/internal/service/production/fixture_test.go @@ -0,0 +1,147 @@ +package production + +import ( + "context" + "testing" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// storeStub permits only the interactions explicitly arranged by each service scenario. +type storeStub struct { + t *testing.T + createUser func(ctx context.Context, user dto.UserDTO) (dto.UserDTO, error) + user func(ctx context.Context, id uuid.UUID) (dto.UserDTO, error) + usersExist func(ctx context.Context, ids []uuid.UUID) (bool, error) + createChat func(ctx context.Context, chat dto.ChatDTO) (dto.ChatDTO, error) + chat func(ctx context.Context, id uuid.UUID) (dto.ChatDTO, error) + chats func(ctx context.Context, id uuid.UUID, position dto.PositionDTO, limit int) ([]dto.ChatDTO, error) + createMessage func(ctx context.Context, message dto.MessageDTO) (dto.MessageDTO, error) + messages func(ctx context.Context, id uuid.UUID, position dto.PositionDTO, limit int) ([]dto.MessageDTO, error) +} + +// CreateUser delegates to the arranged behavior and rejects unexpected storage access. +func (repo *storeStub) CreateUser(ctx context.Context, user dto.UserDTO) (dto.UserDTO, error) { + repo.t.Helper() + if repo.createUser == nil { + repo.t.Fatalf("unexpected store.CreateUser call") + return dto.UserDTO{}, nil + } + return repo.createUser(ctx, user) +} + +// User delegates to the arranged behavior and rejects unexpected storage access. +func (repo *storeStub) User(ctx context.Context, id uuid.UUID) (dto.UserDTO, error) { + repo.t.Helper() + if repo.user == nil { + repo.t.Fatalf("unexpected store.User call") + return dto.UserDTO{}, nil + } + return repo.user(ctx, id) +} + +// UsersExist delegates to the arranged behavior and rejects unexpected storage access. +func (repo *storeStub) UsersExist(ctx context.Context, ids []uuid.UUID) (bool, error) { + repo.t.Helper() + if repo.usersExist == nil { + repo.t.Fatalf("unexpected store.UsersExist call") + return false, nil + } + return repo.usersExist(ctx, ids) +} + +// CreateChat delegates to the arranged behavior and rejects unexpected storage access. +func (repo *storeStub) CreateChat(ctx context.Context, chat dto.ChatDTO) (dto.ChatDTO, error) { + repo.t.Helper() + if repo.createChat == nil { + repo.t.Fatalf("unexpected store.CreateChat call") + return dto.ChatDTO{}, nil + } + return repo.createChat(ctx, chat) +} + +// Chat delegates to the arranged behavior and rejects unexpected storage access. +func (repo *storeStub) Chat(ctx context.Context, id uuid.UUID) (dto.ChatDTO, error) { + repo.t.Helper() + if repo.chat == nil { + repo.t.Fatalf("unexpected store.Chat call") + return dto.ChatDTO{}, nil + } + return repo.chat(ctx, id) +} + +// Chats delegates to the arranged behavior and rejects unexpected storage access. +func (repo *storeStub) Chats(ctx context.Context, id uuid.UUID, position dto.PositionDTO, limit int) ([]dto.ChatDTO, error) { + repo.t.Helper() + if repo.chats == nil { + repo.t.Fatalf("unexpected store.Chats call") + return nil, nil + } + return repo.chats(ctx, id, position, limit) +} + +// CreateMessage delegates to the arranged behavior and rejects unexpected storage access. +func (repo *storeStub) CreateMessage(ctx context.Context, message dto.MessageDTO) (dto.MessageDTO, error) { + repo.t.Helper() + if repo.createMessage == nil { + repo.t.Fatalf("unexpected store.CreateMessage call") + return dto.MessageDTO{}, nil + } + return repo.createMessage(ctx, message) +} + +// Messages delegates to the arranged behavior and rejects unexpected storage access. +func (repo *storeStub) Messages(ctx context.Context, id uuid.UUID, position dto.PositionDTO, limit int) ([]dto.MessageDTO, error) { + repo.t.Helper() + if repo.messages == nil { + repo.t.Fatalf("unexpected store.Messages call") + return nil, nil + } + return repo.messages(ctx, id, position, limit) +} + +// newStoreStub creates a repository that fails on every unarranged interaction. +func newStoreStub(t *testing.T) *storeStub { + t.Helper() + return &storeStub{t: t} +} + +// newStubService composes the service with controlled storage and a real cursor codec. +func newStubService(t *testing.T, repo *storeStub) *Service { + t.Helper() + codec, err := cursor.New() + if err != nil { + t.Fatal(err) + } + svc, err := New(repo, codec) + if err != nil { + t.Fatal(err) + } + return svc +} + +// allowIdentity permits exactly the arranged actor's existence lookup, never a profile read. +func allowIdentity(repo *storeStub, actor uuid.UUID) { + repo.t.Helper() + repo.usersExist = func(_ context.Context, ids []uuid.UUID) (bool, error) { + if len(ids) != 1 || ids[0] != actor { + repo.t.Fatalf("unexpected identity query: %v", ids) + } + return true, nil + } +} + +// allowChatAccess supplies a typed chat after checking the lookup key at the service boundary. +func allowChatAccess(repo *storeStub, actor uuid.UUID, chat dto.ChatDTO) { + repo.t.Helper() + allowIdentity(repo, actor) + repo.chat = func(_ context.Context, id uuid.UUID) (dto.ChatDTO, error) { + if id != chat.ID { + repo.t.Fatalf("chat queried for %s, want %s", id, chat.ID) + } + return chat, nil + } +} diff --git a/internal/service/production/members.go b/internal/service/production/members.go new file mode 100644 index 00000000..3c1437b9 --- /dev/null +++ b/internal/service/production/members.go @@ -0,0 +1,42 @@ +package production + +import ( + "context" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// parseMembers validates unique member identifiers and requires the caller to be included. +func parseMembers(rawIDs []string, caller uuid.UUID) ([]uuid.UUID, error) { + if len(rawIDs) == 0 || len(rawIDs) > maxChatMembers { + return nil, service.ErrInvalid + } + members := make([]uuid.UUID, 0, len(rawIDs)) + seen := make(map[uuid.UUID]bool, len(rawIDs)) + for _, rawID := range rawIDs { + id, err := parseID(rawID) + if err != nil || seen[id] { + return nil, service.ErrInvalid + } + seen[id] = true + members = append(members, id) + } + if !seen[caller] { + return nil, service.ErrInvalid + } + return members, nil +} + +// requireExistingMembers validates the complete membership set with one storage operation. +func (s *Service) requireExistingMembers(ctx context.Context, members []uuid.UUID) error { + exists, err := s.repo.UsersExist(ctx, members) + if err != nil { + return normalizeStoreError(err) + } + if !exists { + return service.ErrInvalid + } + return nil +} diff --git a/internal/service/production/messages.go b/internal/service/production/messages.go new file mode 100644 index 00000000..4885b04b --- /dev/null +++ b/internal/service/production/messages.go @@ -0,0 +1,38 @@ +package production + +import ( + "context" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// MessagesCreate authorizes the sender, validates the message and stores it atomically. +func (s *Service) MessagesCreate(ctx context.Context, request dto.MessagesCreateRequestDTO) (dto.MessageDTO, error) { + caller, chat, err := s.requireChatMember(ctx, request.UserID, request.ChatID) + if err != nil { + return dto.MessageDTO{}, err + } + message, err := prepareMessage(request, caller, chat.ID) + if err != nil { + return dto.MessageDTO{}, err + } + created, err := s.repo.CreateMessage(ctx, message) + return created, normalizeStoreError(err) +} + +// MessagesGetPage authorizes access, loads history and prepares its continuation. +func (s *Service) MessagesGetPage(ctx context.Context, request dto.PageRequestDTO) (dto.MessagePageDTO, error) { + _, chat, err := s.requireChatMember(ctx, request.UserID, request.ChatID) + if err != nil { + return dto.MessagePageDTO{}, err + } + page, err := s.parsePage(request, messageHistoryResource(chat.ID)) + if err != nil { + return dto.MessagePageDTO{}, err + } + items, err := s.repo.Messages(ctx, chat.ID, page.position, page.fetchLimit()) + if err != nil { + return dto.MessagePageDTO{}, normalizeStoreError(err) + } + return s.messagePage(items, page) +} diff --git a/internal/service/production/messages_page_test.go b/internal/service/production/messages_page_test.go new file mode 100644 index 00000000..e54fe8e8 --- /dev/null +++ b/internal/service/production/messages_page_test.go @@ -0,0 +1,231 @@ +package production + +import ( + "context" + "errors" + "reflect" + "testing" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// TestService_MessagesGetPage validates access and pagination before issuing a typed store query. +func TestService_MessagesGetPage(t *testing.T) { + t.Run("Positive: continuation uses scope, position and lookahead", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{actor}} + allowChatAccess(repo, actor, chat) + + previous := cursor.Position{ID: uuid.New(), CreatedAt: time.Unix(1700000000, 0).UTC()} + records := []dto.MessageDTO{ + {ID: uuid.New(), CreatedAt: time.Unix(1700000001, 0).UTC()}, + {ID: uuid.New(), CreatedAt: time.Unix(1700000002, 0).UTC()}, + {ID: uuid.New(), CreatedAt: time.Unix(1700000003, 0).UTC()}, + } + calls := 0 + repo.messages = func(_ context.Context, id uuid.UUID, position dto.PositionDTO, limit int) ([]dto.MessageDTO, error) { + calls++ + expected := dto.PositionDTO{ID: previous.ID, CreatedAt: previous.CreatedAt} + if id != chat.ID || position != expected || limit != 3 { + t.Fatalf("wrong page query: id=%s, position=%v, limit=%d", id, position, limit) + } + return records, nil + } + svc := newStubService(t, repo) + resource := "messages:" + chat.ID.String() + token, err := svc.cursors.Encode(resource, previous) + if err != nil { + t.Fatal(err) + } + input := dto.PageRequestDTO{UserID: actor.String(), ChatID: chat.ID.String(), Limit: "2", Cursor: token} + + // Act. + got, err := svc.MessagesGetPage(t.Context(), input) + + // Assert. + + if err != nil { + t.Fatal(err) + } + if calls != 1 || !reflect.DeepEqual(got.Items, records[:2]) || got.NextCursor == nil { + t.Fatalf("calls=%d, page=%+v", calls, got) + } + position, err := svc.cursors.Decode(*got.NextCursor, resource) + expected := cursor.Position{ID: records[1].ID, CreatedAt: records[1].CreatedAt} + if err != nil || position != expected { + t.Fatalf("next position=%v, want=%v, error=%v", position, expected, err) + } + + }) + + t.Run("Positive: empty history uses default limit and no continuation", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{actor}} + allowChatAccess(repo, actor, chat) + + calls := 0 + repo.messages = func(_ context.Context, id uuid.UUID, position dto.PositionDTO, limit int) ([]dto.MessageDTO, error) { + calls++ + if id != chat.ID || position != (dto.PositionDTO{}) || limit != 51 { + t.Fatalf("wrong initial page query: id=%s, position=%v, limit=%d", id, position, limit) + } + return []dto.MessageDTO{}, nil + } + svc := newStubService(t, repo) + input := dto.PageRequestDTO{UserID: actor.String(), ChatID: chat.ID.String()} + + // Act. + got, err := svc.MessagesGetPage(t.Context(), input) + + // Assert. + if err != nil { + t.Fatal(err) + } + if calls != 1 || got.Items == nil || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("calls=%d, page=%+v", calls, got) + } + }) + + t.Run("Negative: cursor for another resource skips page lookup", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{actor}} + allowChatAccess(repo, actor, chat) + + svc := newStubService(t, repo) + token, err := svc.cursors.Encode("another-resource", cursor.Position{ID: uuid.New(), CreatedAt: time.Unix(1700000000, 0).UTC()}) + if err != nil { + t.Fatal(err) + } + input := dto.PageRequestDTO{UserID: actor.String(), ChatID: chat.ID.String(), Cursor: token} + + // Act. + got, err := svc.MessagesGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrInvalid) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: codec failure skips page lookup", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{actor}} + allowChatAccess(repo, actor, chat) + + failure := errors.New("cursor unavailable") + svc := newStubService(t, repo) + svc.cursors = failingCursor{failure: failure} + input := dto.PageRequestDTO{UserID: actor.String(), ChatID: chat.ID.String(), Cursor: "token"} + + // Act. + got, err := svc.MessagesGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, failure) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: page storage fails", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{actor}} + allowChatAccess(repo, actor, chat) + + failure := errors.New("page unavailable") + repo.messages = func(_ context.Context, _ uuid.UUID, _ dto.PositionDTO, _ int) ([]dto.MessageDTO, error) { + return nil, failure + } + svc := newStubService(t, repo) + input := dto.PageRequestDTO{UserID: actor.String(), ChatID: chat.ID.String()} + + // Act. + got, err := svc.MessagesGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, failure) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: malformed identity skips all storage", func(t *testing.T) { + // Arrange. + svc := newStubService(t, newStoreStub(t)) + input := dto.PageRequestDTO{UserID: "invalid", ChatID: uuid.NewString()} + + // Act. + got, err := svc.MessagesGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrUnauthorized) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: outsider cannot read message history", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{uuid.New()}} + allowChatAccess(repo, actor, chat) + svc := newStubService(t, repo) + input := dto.PageRequestDTO{UserID: actor.String(), ChatID: chat.ID.String()} + + // Act. + got, err := svc.MessagesGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrNotFound) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) +} + +// TestService_MessagesGetPage_InvalidLimit rejects invalid limits before reading stored pages. +func TestService_MessagesGetPage_InvalidLimit(t *testing.T) { + cases := []struct { + name string + limit string + }{ + {"Negative: zero limit", "0"}, + {"Negative: negative limit", "-1"}, + {"Negative: limit above maximum", "101"}, + {"Negative: nonnumeric limit", "text"}, + {"Negative: fractional limit", "1.5"}, + {"Negative: integer overflow", "99999999999999999999999999"}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{actor}} + allowChatAccess(repo, actor, chat) + + svc := newStubService(t, repo) + input := dto.PageRequestDTO{UserID: actor.String(), ChatID: chat.ID.String(), Limit: tc.limit} + + // Act. + got, err := svc.MessagesGetPage(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrInvalid) || len(got.Items) != 0 || got.NextCursor != nil { + t.Fatalf("page=%+v, error=%v", got, err) + } + }) + } +} diff --git a/internal/service/production/messages_test.go b/internal/service/production/messages_test.go new file mode 100644 index 00000000..94f2dd2a --- /dev/null +++ b/internal/service/production/messages_test.go @@ -0,0 +1,169 @@ +package production + +import ( + "context" + "errors" + "strings" + "testing" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// TestService_MessagesCreate authorizes the sender before validating and persisting the message. +func TestService_MessagesCreate(t *testing.T) { + t.Run("Positive: authenticated sender and original text persisted", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{actor}} + allowChatAccess(repo, actor, chat) + var persisted dto.MessageDTO + repo.createMessage = func(_ context.Context, input dto.MessageDTO) (dto.MessageDTO, error) { + persisted = input + input.CreatedAt = time.Unix(1700000000, 0).UTC() + return input, nil + } + svc := newStubService(t, repo) + input := dto.MessagesCreateRequestDTO{IdempotencyKey: "fixture-key", UserID: actor.String(), ChatID: chat.ID.String(), Text: " Original 👋 "} + + // Act. + got, err := svc.MessagesCreate(t.Context(), input) + + // Assert. + if err != nil { + t.Fatal(err) + } + if persisted.ID == uuid.Nil || persisted.SenderID != actor || persisted.ChatID != chat.ID || persisted.Text != input.Text { + t.Fatalf("wrong persistence input: %+v", persisted) + } + if got.ID != persisted.ID || got.SenderID != actor || got.ChatID != chat.ID || got.Text != input.Text || got.CreatedAt.IsZero() { + t.Fatalf("wrong acknowledgement: %+v", got) + } + }) + + t.Run("Negative: outsider cannot persist messages", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{uuid.New()}} + allowChatAccess(repo, actor, chat) + svc := newStubService(t, repo) + input := dto.MessagesCreateRequestDTO{IdempotencyKey: "fixture-key", UserID: actor.String(), ChatID: chat.ID.String(), Text: "Valid text"} + + // Act. + got, err := svc.MessagesCreate(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrNotFound) || got != (dto.MessageDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + }) + + t.Run("Negative: malformed identity skips storage", func(t *testing.T) { + // Arrange. + svc := newStubService(t, newStoreStub(t)) + input := dto.MessagesCreateRequestDTO{IdempotencyKey: "fixture-key", UserID: "invalid", ChatID: uuid.NewString(), Text: "text"} + + // Act. + got, err := svc.MessagesCreate(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrUnauthorized) || got != (dto.MessageDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + }) +} + +// TestService_MessagesCreate_InvalidText refuses invalid text without attempting persistence. +func TestService_MessagesCreate_InvalidText(t *testing.T) { + cases := []struct { + name string + text string + }{ + {"Negative: empty text", ""}, + {"Negative: whitespace only", " \t"}, + {"Negative: rune limit exceeded", strings.Repeat("界", 4001)}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{actor}} + allowChatAccess(repo, actor, chat) + svc := newStubService(t, repo) + input := dto.MessagesCreateRequestDTO{IdempotencyKey: "fixture-key", UserID: actor.String(), ChatID: chat.ID.String(), Text: tc.text} + + // Act. + got, err := svc.MessagesCreate(t.Context(), input) + + // Assert. + if !errors.Is(err, service.ErrInvalid) || got != (dto.MessageDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + }) + } +} + +// TestService_MessagesCreate_StoreErrors propagates persistence failures without acknowledging a record. +func TestService_MessagesCreate_StoreErrors(t *testing.T) { + failure := errors.New("write unavailable") + cases := []struct { + name string + cause error + want error + }{ + {"Negative: capacity exhausted", store.ErrCapacity, service.ErrCapacity}, + {"Negative: chat disappeared", store.ErrNotFound, service.ErrNotFound}, + {"Negative: unexpected write failure", failure, failure}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + actor := uuid.New() + chat := dto.ChatDTO{ID: uuid.New(), MemberIDs: []uuid.UUID{actor}} + allowChatAccess(repo, actor, chat) + repo.createMessage = func(_ context.Context, _ dto.MessageDTO) (dto.MessageDTO, error) { + return dto.MessageDTO{}, tc.cause + } + svc := newStubService(t, repo) + input := dto.MessagesCreateRequestDTO{IdempotencyKey: "fixture-key", UserID: actor.String(), ChatID: chat.ID.String(), Text: "Valid text"} + + // Act. + got, err := svc.MessagesCreate(t.Context(), input) + + // Assert. + if !errors.Is(err, tc.want) || got != (dto.MessageDTO{}) { + t.Fatalf("result=%+v, error=%v, want=%v", got, err, tc.want) + } + }) + } +} + +// TestIdempotencyKeyValidation checks the exact contract alphabet and length independently. +func TestIdempotencyKeyValidation(t *testing.T) { + for _, test := range []struct { + name string + key string + want bool + }{ + {name: "missing", key: "", want: false}, + {name: "allowed alphabet", key: "aZ09._:-", want: true}, + {name: "space", key: "a b", want: false}, + {name: "unicode", key: "ключ", want: false}, + {name: "maximum", key: strings.Repeat("a", 128), want: true}, + {name: "too long", key: strings.Repeat("a", 129), want: false}, + } { + t.Run(test.name, func(t *testing.T) { + if got := validIdempotencyKey(test.key); got != test.want { + t.Fatalf("valid=%v want=%v", got, test.want) + } + }) + } +} diff --git a/internal/service/production/pages.go b/internal/service/production/pages.go new file mode 100644 index 00000000..4ff66f2c --- /dev/null +++ b/internal/service/production/pages.go @@ -0,0 +1,49 @@ +package production + +import ( + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// chatPage adapts the shared page result to the chat response DTO. +func (s *Service) chatPage(items []dto.ChatDTO, page pagination) (dto.ChatPageDTO, error) { + items, next, err := buildPage(items, page, s.cursors, chatPosition) + if err != nil { + return dto.ChatPageDTO{}, err + } + return dto.ChatPageDTO{Items: items, NextCursor: next}, nil +} + +// messagePage adapts the shared page result to the message response DTO. +func (s *Service) messagePage(items []dto.MessageDTO, page pagination) (dto.MessagePageDTO, error) { + items, next, err := buildPage(items, page, s.cursors, messagePosition) + if err != nil { + return dto.MessagePageDTO{}, err + } + return dto.MessagePageDTO{Items: items, NextCursor: next}, nil +} + +// buildPage trims lookahead and signs the last returned record when more data exists. +// The page limit must be validated before calling this helper. +func buildPage[T any](items []T, page pagination, codec service.CursorCodec, position func(T) cursor.Position) ([]T, *string, error) { + if len(items) <= page.limit { + return items, nil, nil + } + items = items[:page.limit] + next, err := codec.Encode(page.resource, position(items[len(items)-1])) + if err != nil { + return nil, nil, err + } + return items, new(next), nil +} + +// chatPosition extracts the stable pagination boundary from a stored chat. +func chatPosition(chat dto.ChatDTO) cursor.Position { + return cursor.Position{CreatedAt: chat.CreatedAt, ID: chat.ID} +} + +// messagePosition extracts the stable pagination boundary from a stored message. +func messagePosition(message dto.MessageDTO) cursor.Position { + return cursor.Position{CreatedAt: message.CreatedAt, ID: message.ID} +} diff --git a/internal/service/production/pages_test.go b/internal/service/production/pages_test.go new file mode 100644 index 00000000..0638f7ce --- /dev/null +++ b/internal/service/production/pages_test.go @@ -0,0 +1,53 @@ +package production + +import ( + "reflect" + "testing" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// TestService_messagePage checks boundaries and signs the last returned item, not lookahead. +func TestService_messagePage(t *testing.T) { + for _, count := range []int{0, 2, 3} { + names := map[int]string{0: "Positive: empty page", 2: "Positive: exact limit is final", 3: "Positive: lookahead creates continuation"} + t.Run(names[count], func(t *testing.T) { + // Arrange. + svc := newStubService(t, newStoreStub(t)) + items := make([]dto.MessageDTO, count) + for i := range items { + items[i] = dto.MessageDTO{ID: uuid.New(), Text: "message", CreatedAt: time.Unix(int64(i+1), 0).UTC()} + } + expected := items[:min(count, 2)] + + // Act. + page, err := svc.messagePage(items, pagination{limit: 2, resource: "messages:chat"}) + + // Assert. + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(page.Items, expected) { + t.Fatalf("page=%v, want=%v", page.Items, expected) + } + if count <= 2 { + if page.NextCursor != nil { + t.Fatal("final page has a continuation") + } + return + } + if page.NextCursor == nil { + t.Fatal("lookahead did not produce continuation") + } + decoded, err := svc.cursors.Decode(*page.NextCursor, "messages:chat") + want := cursor.Position{ID: items[1].ID, CreatedAt: items[1].CreatedAt} + if err != nil || decoded != want { + t.Fatalf("cursor=%v, want=%v, error=%v", decoded, want, err) + } + }) + } +} diff --git a/internal/service/production/pagination.go b/internal/service/production/pagination.go new file mode 100644 index 00000000..c5326b6e --- /dev/null +++ b/internal/service/production/pagination.go @@ -0,0 +1,78 @@ +package production + +import ( + "errors" + "strconv" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +const ( + defaultPageLimit = 50 + maxPageLimit = 100 + // Fetching one extra record determines whether to issue a next cursor. + pageLookahead = 1 +) + +type pagination struct { + position dto.PositionDTO + limit int + resource string +} + +// parsePage validates the page size and resource-bound cursor. +func (s *Service) parsePage(request dto.PageRequestDTO, resource string) (pagination, error) { + limit, err := parseLimit(request.Limit) + if err != nil { + return pagination{}, err + } + position, err := s.cursors.Decode(request.Cursor, resource) + if errors.Is(err, cursor.ErrInvalid) { + return pagination{}, service.ErrInvalid + } + if err != nil { + return pagination{}, err + } + return pagination{ + position: dto.PositionDTO{CreatedAt: position.CreatedAt, ID: position.ID}, + limit: limit, + resource: resource, + }, nil +} + +// parseLimit parses a bounded page size or supplies the default. +func parseLimit(raw string) (int, error) { + if raw == "" { + return defaultPageLimit, nil + } + for _, char := range raw { + if char < '0' || char > '9' { + return 0, service.ErrInvalid + } + } + limit, err := strconv.Atoi(raw) + if err != nil || limit < 1 || limit > maxPageLimit { + return 0, service.ErrInvalid + } + return limit, nil +} + +// fetchLimit includes one lookahead record to detect a following page. +func (page pagination) fetchLimit() int { + return page.limit + pageLookahead +} + +// chatListResource scopes a cursor to one user's visible chats. +func chatListResource(userID uuid.UUID) string { + return "chats:" + userID.String() +} + +// messageHistoryResource scopes a cursor to one chat's message history. +func messageHistoryResource(chatID uuid.UUID) string { + return "messages:" + chatID.String() +} diff --git a/internal/service/production/pagination_test.go b/internal/service/production/pagination_test.go new file mode 100644 index 00000000..6861ea45 --- /dev/null +++ b/internal/service/production/pagination_test.go @@ -0,0 +1,74 @@ +package production + +import ( + "errors" + "testing" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +type failingCursor struct { + failure error +} + +// Encode injects a signing failure at the service dependency boundary. +func (codec failingCursor) Encode(_ string, _ cursor.Position) (string, error) { + return "", codec.failure +} + +// Decode injects a verification failure at the service dependency boundary. +func (codec failingCursor) Decode(_, _ string) (cursor.Position, error) { + return cursor.Position{}, codec.failure +} + +// TestService_parsePage translates invalid tokens while retaining unexpected dependency failures. +func TestService_parsePage(t *testing.T) { + failure := errors.New("codec unavailable") + cases := []struct { + name string + cause error + want error + }{ + {"Negative: invalid token", cursor.ErrInvalid, service.ErrInvalid}, + {"Negative: unavailable codec", failure, failure}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + svc := &Service{cursors: failingCursor{failure: tc.cause}} + input := dto.PageRequestDTO{Cursor: "supplied-token"} + + // Act. + page, err := svc.parsePage(input, "messages:chat") + + // Assert. + if !errors.Is(err, tc.want) { + t.Fatalf("error=%v, want=%v", err, tc.want) + } + if page != (pagination{}) { + t.Fatalf("failed cursor produced a page: %+v", page) + } + }) + } +} + +// TestService_messagePage_EncodeFailure returns no partial page when signing fails. +func TestService_messagePage_EncodeFailure(t *testing.T) { + // Arrange. + failure := errors.New("signing unavailable") + svc := &Service{cursors: failingCursor{failure: failure}} + items := []dto.MessageDTO{{Text: "first"}, {Text: "lookahead"}} + + // Act. + page, err := svc.messagePage(items, pagination{limit: 1, resource: "messages:chat"}) + + // Assert. + if !errors.Is(err, failure) { + t.Fatalf("lost signing failure: %v", err) + } + if page.Items != nil || page.NextCursor != nil { + t.Fatalf("partial page escaped: %+v", page) + } +} diff --git a/internal/service/production/service.go b/internal/service/production/service.go new file mode 100644 index 00000000..c069823a --- /dev/null +++ b/internal/service/production/service.go @@ -0,0 +1,39 @@ +// Package production implements the messenger application operations. +package production + +import ( + "fmt" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// Service orchestrates operations through storage and cursor interfaces. +type Service struct { + repo store.Interface + cursors service.CursorCodec + cache service.ProfileCache +} + +var _ service.Service = (*Service)(nil) + +// New creates an application service using explicitly supplied dependencies. +func New(repo store.Interface, cursors service.CursorCodec) (*Service, error) { + if repo == nil || cursors == nil { + return nil, fmt.Errorf("store and cursor codec are required") + } + return &Service{repo: repo, cursors: cursors}, nil +} + +// NewCached builds the business service with optional immutable-profile caching. +func NewCached(repo store.Interface, cursors service.CursorCodec, cache service.ProfileCache) (*Service, error) { + instance, err := New(repo, cursors) + if err != nil { + return nil, err + } + if cache == nil { + return nil, fmt.Errorf("profile cache is required") + } + instance.cache = cache + return instance, nil +} diff --git a/internal/service/production/service_test.go b/internal/service/production/service_test.go new file mode 100644 index 00000000..461fc3cf --- /dev/null +++ b/internal/service/production/service_test.go @@ -0,0 +1,39 @@ +package production + +import ( + "testing" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/cursor" +) + +// TestService_New rejects each missing dependency separately. +func TestService_New(t *testing.T) { + t.Run("Negative: missing store", func(t *testing.T) { + // Arrange. + codec, err := cursor.New() + if err != nil { + t.Fatal(err) + } + + // Act. + svc, err := New(nil, codec) + + // Assert. + if err == nil || svc != nil { + t.Fatalf("service=%v, error=%v", svc, err) + } + }) + + t.Run("Negative: missing codec", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + + // Act. + svc, err := New(repo, nil) + + // Assert. + if err == nil || svc != nil { + t.Fatalf("service=%v, error=%v", svc, err) + } + }) +} diff --git a/internal/service/production/users.go b/internal/service/production/users.go new file mode 100644 index 00000000..9db4b1c0 --- /dev/null +++ b/internal/service/production/users.go @@ -0,0 +1,47 @@ +package production + +import ( + "context" + "errors" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// UsersCreate validates registration and atomically reserves the unique username. +func (s *Service) UsersCreate(ctx context.Context, request dto.UsersCreateRequestDTO) (dto.UserDTO, error) { + user, err := PrepareUser(request) + if err != nil { + return dto.UserDTO{}, err + } + created, err := s.repo.CreateUser(ctx, user) + return created, normalizeStoreError(err) +} + +// UsersGetMe loads the current user's profile; malformed and missing identities are unauthorized. +func (s *Service) UsersGetMe(ctx context.Context, rawID string) (dto.UserDTO, error) { + id, err := parseIdentity(rawID) + if err != nil { + return dto.UserDTO{}, err + } + if s.cache != nil { + if cached, ok := s.cache.GetProfile(ctx, id); ok { + return cached, nil + } + } + user, err := s.repo.User(ctx, id) + if errors.Is(err, store.ErrNotFound) { + return dto.UserDTO{}, service.ErrUnauthorized + } + if err == nil && s.cache != nil { + s.cache.PutProfile(ctx, user) + } + return user, normalizeStoreError(err) +} + +// UsersCheckIdentity validates the current identity without loading its profile. +func (s *Service) UsersCheckIdentity(ctx context.Context, rawID string) error { + _, err := s.requireUserID(ctx, rawID) + return err +} diff --git a/internal/service/production/users_test.go b/internal/service/production/users_test.go new file mode 100644 index 00000000..70f91a6f --- /dev/null +++ b/internal/service/production/users_test.go @@ -0,0 +1,289 @@ +package production + +import ( + "context" + "errors" + "slices" + "strings" + "testing" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// TestService_UsersCreate validates registration before persistence and preserves storage failures. +func TestService_UsersCreate(t *testing.T) { + t.Run("Positive: validates and persists the original profile", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + expected := dto.UserDTO{Username: "alice", DisplayName: "Алиса 👋", CreatedAt: time.Unix(1700000000, 0).UTC()} + calls := 0 + repo.createUser = func(_ context.Context, input dto.UserDTO) (dto.UserDTO, error) { + calls++ + if input.ID == uuid.Nil || input.Username != expected.Username || input.DisplayName != expected.DisplayName { + t.Fatalf("wrong persistence input: %+v", input) + } + expected.ID = input.ID + return expected, nil + } + svc := newStubService(t, repo) + input := dto.UsersCreateRequestDTO{Username: expected.Username, DisplayName: expected.DisplayName} + + // Act. + got, err := svc.UsersCreate(t.Context(), input) + + // Assert. + if err != nil { + t.Fatal(err) + } + if calls != 1 || got != expected { + t.Fatalf("calls=%d, got=%+v, want=%+v", calls, got, expected) + } + }) +} + +// TestService_UsersCreate_InvalidInput refuses malformed registrations without calling storage. +func TestService_UsersCreate_InvalidInput(t *testing.T) { + cases := []struct { + name string + input dto.UsersCreateRequestDTO + }{ + {"Negative: short username", dto.UsersCreateRequestDTO{Username: "a", DisplayName: "Alice"}}, + {"Negative: uppercase username", dto.UsersCreateRequestDTO{Username: "Alice", DisplayName: "Alice"}}, + {"Negative: blank display name", dto.UsersCreateRequestDTO{Username: "alice", DisplayName: " "}}, + {"Negative: display name exceeds rune limit", dto.UsersCreateRequestDTO{Username: "alice", DisplayName: strings.Repeat("界", 101)}}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange: every store method fails immediately if called. + svc := newStubService(t, newStoreStub(t)) + + // Act. + got, err := svc.UsersCreate(t.Context(), tc.input) + + // Assert. + if !errors.Is(err, service.ErrInvalid) || got != (dto.UserDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + }) + } +} + +// TestService_UsersCreate_StoreErrors preserves the application meaning of persistence failures. +func TestService_UsersCreate_StoreErrors(t *testing.T) { + unexpected := errors.New("storage unavailable") + cases := []struct { + name string + cause error + want error + }{ + {"Negative: duplicate username", store.ErrConflict, service.ErrConflict}, + {"Negative: capacity exhausted", store.ErrCapacity, service.ErrCapacity}, + {"Negative: unexpected failure", unexpected, unexpected}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + repo.createUser = func(_ context.Context, _ dto.UserDTO) (dto.UserDTO, error) { + return dto.UserDTO{}, tc.cause + } + svc := newStubService(t, repo) + + // Act. + got, err := svc.UsersCreate(t.Context(), dto.UsersCreateRequestDTO{Username: "alice", DisplayName: "Alice"}) + + // Assert. + if !errors.Is(err, tc.want) || got != (dto.UserDTO{}) { + t.Fatalf("result=%+v, error=%v, want=%v", got, err, tc.want) + } + }) + } +} + +// TestService_UsersGetMe loads only the requested profile and hides unknown identities. +func TestService_UsersGetMe(t *testing.T) { + t.Run("Positive: returns stored profile", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + expected := dto.UserDTO{ID: uuid.New(), Username: "alice", DisplayName: "Alice", CreatedAt: time.Unix(1700000000, 0).UTC()} + calls := 0 + repo.user = func(_ context.Context, id uuid.UUID) (dto.UserDTO, error) { + calls++ + if id != expected.ID { + t.Fatalf("profile queried for %s instead of %s", id, expected.ID) + } + return expected, nil + } + svc := newStubService(t, repo) + + // Act. + got, err := svc.UsersGetMe(t.Context(), expected.ID.String()) + + // Assert. + if err != nil { + t.Fatal(err) + } + if calls != 1 || got != expected { + t.Fatalf("calls=%d, got=%+v, want=%+v", calls, got, expected) + } + }) + + t.Run("Negative: unknown identity", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + repo.user = func(_ context.Context, _ uuid.UUID) (dto.UserDTO, error) { + return dto.UserDTO{}, store.ErrNotFound + } + svc := newStubService(t, repo) + wantErr := service.ErrUnauthorized + + // Act. + got, err := svc.UsersGetMe(t.Context(), uuid.NewString()) + + // Assert. + if !errors.Is(err, wantErr) { + t.Fatalf("error=%v, want=%v", err, wantErr) + } + if got != (dto.UserDTO{}) { + t.Fatalf("failed operation returned a profile: %+v", got) + } + }) + + t.Run("Negative: storage failure preserved", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + wantErr := errors.New("profile unavailable") + repo.user = func(_ context.Context, _ uuid.UUID) (dto.UserDTO, error) { + return dto.UserDTO{}, wantErr + } + svc := newStubService(t, repo) + + // Act. + got, err := svc.UsersGetMe(t.Context(), uuid.NewString()) + + // Assert. + if !errors.Is(err, wantErr) { + t.Fatalf("error=%v, want=%v", err, wantErr) + } + if got != (dto.UserDTO{}) { + t.Fatalf("failed operation returned a profile: %+v", got) + } + }) +} + +// TestService_UsersGetMe_InvalidIdentity rejects malformed identifiers before any store call. +func TestService_UsersGetMe_InvalidIdentity(t *testing.T) { + cases := []struct { + name string + raw string + }{ + {"Negative: missing header", ""}, + {"Negative: short ID", "invalid"}, + {"Negative: non-UUID characters", strings.Repeat("z", 36)}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + svc := newStubService(t, newStoreStub(t)) + + // Act. + got, err := svc.UsersGetMe(t.Context(), tc.raw) + + // Assert. + if !errors.Is(err, service.ErrUnauthorized) || got != (dto.UserDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + }) + } +} + +// TestService_UsersCheckIdentity uses the existence query and never loads a profile. +func TestService_UsersCheckIdentity(t *testing.T) { + t.Run("Positive: existence check without profile loading", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + id := uuid.New() + calls := 0 + repo.usersExist = func(_ context.Context, ids []uuid.UUID) (bool, error) { + calls++ + if !slices.Equal(ids, []uuid.UUID{id}) { + t.Fatalf("queried IDs=%v", ids) + } + return true, nil + } + svc := newStubService(t, repo) + + // Act. + err := svc.UsersCheckIdentity(t.Context(), id.String()) + + // Assert. + if !errors.Is(err, nil) || calls != 1 { + t.Fatalf("calls=%d, error=%v", calls, err) + } + }) + + t.Run("Negative: identity does not exist", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + id := uuid.New() + calls := 0 + repo.usersExist = func(_ context.Context, ids []uuid.UUID) (bool, error) { + calls++ + if !slices.Equal(ids, []uuid.UUID{id}) { + t.Fatalf("queried IDs=%v", ids) + } + return false, nil + } + svc := newStubService(t, repo) + + // Act. + err := svc.UsersCheckIdentity(t.Context(), id.String()) + + // Assert. + if !errors.Is(err, service.ErrUnauthorized) || calls != 1 { + t.Fatalf("calls=%d, error=%v", calls, err) + } + }) + + t.Run("Negative: existence lookup fails", func(t *testing.T) { + // Arrange. + repo := newStoreStub(t) + id := uuid.New() + calls := 0 + failure := errors.New("identity unavailable") + repo.usersExist = func(_ context.Context, ids []uuid.UUID) (bool, error) { + calls++ + if !slices.Equal(ids, []uuid.UUID{id}) { + t.Fatalf("queried IDs=%v", ids) + } + return false, failure + } + svc := newStubService(t, repo) + + // Act. + err := svc.UsersCheckIdentity(t.Context(), id.String()) + + // Assert. + if !errors.Is(err, failure) || calls != 1 { + t.Fatalf("calls=%d, error=%v", calls, err) + } + }) + + t.Run("Negative: malformed identity skips storage", func(t *testing.T) { + // Arrange. + svc := newStubService(t, newStoreStub(t)) + + // Act. + err := svc.UsersCheckIdentity(t.Context(), "invalid") + + // Assert. + if !errors.Is(err, service.ErrUnauthorized) { + t.Fatalf("error=%v", err) + } + }) +} diff --git a/internal/service/production/validation.go b/internal/service/production/validation.go new file mode 100644 index 00000000..84d12bd8 --- /dev/null +++ b/internal/service/production/validation.go @@ -0,0 +1,51 @@ +package production + +import ( + "strings" + "unicode/utf8" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" +) + +// These bounds come from the mandatory lab1 OpenAPI schema. +const ( + minUsernameLength = 3 + maxUsernameLength = 32 + maxDisplayNameRunes = 100 + maxChatTitleRunes = 100 + maxChatMembers = 100 + maxMessageRunes = 4000 + canonicalUUIDLength = len("00000000-0000-0000-0000-000000000000") +) + +// validText checks that text is nonblank and within its Unicode length limit. +func validText(value string, maxRunes int) bool { + return utf8.ValidString(value) && strings.TrimSpace(value) != "" && utf8.RuneCountInString(value) <= maxRunes +} + +// validUsername checks the username length and permitted ASCII characters. +func validUsername(value string) bool { + if len(value) < minUsernameLength || len(value) > maxUsernameLength { + return false + } + for _, char := range value { + if (char < 'a' || char > 'z') && (char < '0' || char > '9') && char != '_' { + return false + } + } + return true +} + +// parseID parses a canonical UUID or returns a validation error. +func parseID(value string) (uuid.UUID, error) { + if len(value) != canonicalUUIDLength { + return uuid.Nil, service.ErrInvalid + } + id, err := uuid.Parse(value) + if err != nil { + return uuid.Nil, service.ErrInvalid + } + return id, nil +} diff --git a/internal/store/interface.go b/internal/store/interface.go new file mode 100644 index 00000000..90ef47a1 --- /dev/null +++ b/internal/store/interface.go @@ -0,0 +1,54 @@ +// Package store defines typed persistence operations and storage errors. +package store + +import ( + "context" + "errors" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +var ( + // ErrUnavailable means a required storage dependency cannot serve the operation. + ErrUnavailable = errors.New("storage unavailable") + + // ErrNotFound means a record does not exist. + ErrNotFound = errors.New("record not found") + + // ErrConflict means a unique constraint failed. + ErrConflict = errors.New("record already exists") + + // ErrCapacity means the bounded store cannot accept more data. + ErrCapacity = errors.New("storage capacity reached") +) + +// Interface defines persistence operations on validated typed records. +// Implementations own atomicity, unique constraints and storage capacity, but not +// authorization. Callers must validate membership before accessing chat records. +type Interface interface { + // CreateUser atomically enforces username uniqueness and assigns CreatedAt. + CreateUser(ctx context.Context, user dto.UserDTO) (dto.UserDTO, error) + + // User returns a user by ID or ErrNotFound. + User(ctx context.Context, id uuid.UUID) (dto.UserDTO, error) + + // UsersExist reports whether every supplied ID exists; an empty set returns true. + UsersExist(ctx context.Context, ids []uuid.UUID) (bool, error) + + // CreateChat atomically stores a chat and its member indexes, assigning CreatedAt. + CreateChat(ctx context.Context, chat dto.ChatDTO) (dto.ChatDTO, error) + + // Chat returns a defensive copy of the stored chat or ErrNotFound. + Chat(ctx context.Context, id uuid.UUID) (dto.ChatDTO, error) + + // Chats reads up to limit records after position from the user's chat index. + Chats(ctx context.Context, userID uuid.UUID, position dto.PositionDTO, limit int) ([]dto.ChatDTO, error) + + // CreateMessage appends one message atomically and assigns its ordering timestamp. + CreateMessage(ctx context.Context, message dto.MessageDTO) (dto.MessageDTO, error) + + // Messages reads up to limit records strictly after position in one chat. + Messages(ctx context.Context, chatID uuid.UUID, position dto.PositionDTO, limit int) ([]dto.MessageDTO, error) +} diff --git a/internal/store/memory/capacity.go b/internal/store/memory/capacity.go new file mode 100644 index 00000000..715e266d --- /dev/null +++ b/internal/store/memory/capacity.go @@ -0,0 +1,38 @@ +package memory + +import "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + +// Conservative logical charges, not measurements of Go allocations or RSS. +// The budget includes record metadata and index entries; HTTP buffers are separate. +const ( + userRecordOverheadBytes = 256 + chatRecordOverheadBytes = 256 + messageRecordOverheadBytes = 256 + chatMemberIndexBytes = 128 + usernameIndexCopies = 2 +) + +// userCost calculates the logical storage charge for a user and its index entries. +func userCost(user dto.UserDTO) int { + return userRecordOverheadBytes + len(user.Username)*usernameIndexCopies + len(user.DisplayName) +} + +// chatCost calculates the logical storage charge for a chat and its membership index. +func chatCost(chat dto.ChatDTO) int { + return chatRecordOverheadBytes + len(chat.Title) + chatMemberIndexBytes*len(chat.MemberIDs) +} + +// messageCost calculates the logical storage charge for a message. +func messageCost(message dto.MessageDTO) int { + return messageRecordOverheadBytes + len(message.Text) +} + +// reserve checks and charges capacity while the caller holds the write lock. +// Callers must not perform a fallible operation after reserving this budget. +func (s *Store) reserve(bytes int) bool { + if bytes > s.limits.MaxStateBytes-s.usedBytes { + return false + } + s.usedBytes += bytes + return true +} diff --git a/internal/store/memory/chats.go b/internal/store/memory/chats.go new file mode 100644 index 00000000..b0a7501d --- /dev/null +++ b/internal/store/memory/chats.go @@ -0,0 +1,66 @@ +package memory + +import ( + "context" + "slices" + "sort" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// copyChat copies the membership slice to keep stored chat state private. +func copyChat(c dto.ChatDTO) dto.ChatDTO { + c.MemberIDs = slices.Clone(c.MemberIDs) + return c +} + +// CreateChat stores the chat and its member index atomically. +func (s *Store) CreateChat(_ context.Context, c dto.ChatDTO) (dto.ChatDTO, error) { + s.mu.Lock() + defer s.mu.Unlock() + for _, id := range c.MemberIDs { + if _, ok := s.users[id]; !ok { + return dto.ChatDTO{}, store.ErrNotFound + } + } + if len(s.chats) >= s.limits.MaxChats || !s.reserve(chatCost(c)) { + return dto.ChatDTO{}, store.ErrCapacity + } + c.CreatedAt = s.timestamp() + c = copyChat(c) + s.chats[c.ID] = c + for _, id := range c.MemberIDs { + s.userChats[id] = append(s.userChats[id], c) + } + return copyChat(c), nil +} + +// Chat retrieves a defensive copy. Authorization belongs to the service. +func (s *Store) Chat(_ context.Context, id uuid.UUID) (dto.ChatDTO, error) { + s.mu.RLock() + defer s.mu.RUnlock() + c, ok := s.chats[id] + if !ok { + return c, store.ErrNotFound + } + return copyChat(c), nil +} + +// Chats uses the per-member index and binary search, without scanning other chats. +func (s *Store) Chats(_ context.Context, user uuid.UUID, p dto.PositionDTO, limit int) ([]dto.ChatDTO, error) { + s.mu.RLock() + defer s.mu.RUnlock() + all := s.userChats[user] + i := sort.Search(len(all), func(i int) bool { + return after(all[i].CreatedAt, all[i].ID, p) + }) + end := min(len(all), i+limit) + out := make([]dto.ChatDTO, 0, end-i) + for _, c := range all[i:end] { + out = append(out, copyChat(c)) + } + return out, nil +} diff --git a/internal/store/memory/chats_test.go b/internal/store/memory/chats_test.go new file mode 100644 index 00000000..a433cb25 --- /dev/null +++ b/internal/store/memory/chats_test.go @@ -0,0 +1,148 @@ +package memory + +import ( + "errors" + "reflect" + "testing" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// TestStore_CreateChat_RejectsWithoutMutation checks atomic rejection of invalid or excess chats. +func TestStore_CreateChat_RejectsWithoutMutation(t *testing.T) { + t.Run("Negative: chat capacity reached", func(t *testing.T) { + // Arrange. + cfg := config.Default().Memory + cfg.MaxChats = 1 + repo := newTestStore(t, cfg) + member := seedUser(t, repo, "alice") + original := seedChat(t, repo, member.ID) + input := dto.ChatDTO{ID: uuid.New(), Title: "Rejected", MemberIDs: []uuid.UUID{member.ID}} + wantErr := store.ErrCapacity + + previousBytes := repo.usedBytes + + // Act. + got, err := repo.CreateChat(t.Context(), input) + + // Assert. + if !errors.Is(err, wantErr) || got.ID != uuid.Nil { + t.Fatalf("result=%+v, error=%v, want=%v", got, err, wantErr) + } + items, readErr := repo.Chats(t.Context(), member.ID, dto.PositionDTO{}, 10) + if readErr != nil { + t.Fatal(readErr) + } + if !reflect.DeepEqual(items, []dto.ChatDTO{original}) || len(repo.chats) != 1 || repo.usedBytes != previousBytes { + t.Fatalf("rejected chat changed stored state: %v", items) + } + }) + + t.Run("Negative: member does not exist", func(t *testing.T) { + // Arrange. + cfg := config.Default().Memory + cfg.MaxChats = 1 + repo := newTestStore(t, cfg) + member := seedUser(t, repo, "alice") + original := seedChat(t, repo, member.ID) + input := dto.ChatDTO{ID: uuid.New(), Title: "Rejected", MemberIDs: []uuid.UUID{member.ID}} + wantErr := store.ErrNotFound + input.MemberIDs = append(input.MemberIDs, uuid.New()) + + previousBytes := repo.usedBytes + + // Act. + got, err := repo.CreateChat(t.Context(), input) + + // Assert. + if !errors.Is(err, wantErr) || got.ID != uuid.Nil { + t.Fatalf("result=%+v, error=%v, want=%v", got, err, wantErr) + } + items, readErr := repo.Chats(t.Context(), member.ID, dto.PositionDTO{}, 10) + if readErr != nil { + t.Fatal(readErr) + } + if !reflect.DeepEqual(items, []dto.ChatDTO{original}) || len(repo.chats) != 1 || repo.usedBytes != previousBytes { + t.Fatalf("rejected chat changed stored state: %v", items) + } + }) +} + +// TestStore_CreateChat_DefensiveCopy ensures callers cannot mutate membership through write boundaries. +func TestStore_CreateChat_DefensiveCopy(t *testing.T) { + t.Run("Positive: isolated input membership", func(t *testing.T) { + // Arrange. + repo := newTestStore(t, config.Default().Memory) + member := seedUser(t, repo, "alice") + input := dto.ChatDTO{ID: uuid.New(), Title: "Team", MemberIDs: []uuid.UUID{member.ID}} + _, err := repo.CreateChat(t.Context(), input) + if err != nil { + t.Fatal(err) + } + + // Act: a caller modifies the slice it owns after CreateChat returns. + + input.MemberIDs[0] = uuid.New() + + // Assert. + stored, err := repo.Chat(t.Context(), input.ID) + if err != nil { + t.Fatal(err) + } + if len(stored.MemberIDs) != 1 || stored.MemberIDs[0] != member.ID { + t.Fatalf("caller mutated stored membership: %+v", stored) + } + }) + + t.Run("Positive: isolated result membership", func(t *testing.T) { + // Arrange. + repo := newTestStore(t, config.Default().Memory) + member := seedUser(t, repo, "alice") + input := dto.ChatDTO{ID: uuid.New(), Title: "Team", MemberIDs: []uuid.UUID{member.ID}} + created, err := repo.CreateChat(t.Context(), input) + if err != nil { + t.Fatal(err) + } + + // Act: a caller modifies the slice it owns after CreateChat returns. + + created.MemberIDs[0] = uuid.New() + + // Assert. + stored, err := repo.Chat(t.Context(), input.ID) + if err != nil { + t.Fatal(err) + } + if len(stored.MemberIDs) != 1 || stored.MemberIDs[0] != member.ID { + t.Fatalf("caller mutated stored membership: %+v", stored) + } + }) +} + +// TestStore_Chat_DefensiveCopy ensures a fetched detail cannot alter future reads. +func TestStore_Chat_DefensiveCopy(t *testing.T) { + // Arrange. + repo := newTestStore(t, config.Default().Memory) + member := seedUser(t, repo, "alice") + original := seedChat(t, repo, member.ID) + fetched, err := repo.Chat(t.Context(), original.ID) + if err != nil { + t.Fatal(err) + } + + // Act. + fetched.MemberIDs[0] = uuid.New() + + // Assert. + stored, err := repo.Chat(t.Context(), original.ID) + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(stored, original) { + t.Fatalf("read changed stored chat: %+v", stored) + } +} diff --git a/internal/store/memory/messages.go b/internal/store/memory/messages.go new file mode 100644 index 00000000..a56eb98c --- /dev/null +++ b/internal/store/memory/messages.go @@ -0,0 +1,41 @@ +package memory + +import ( + "context" + "sort" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// CreateMessage assigns ordering and publishes one complete message atomically. +func (s *Store) CreateMessage(_ context.Context, m dto.MessageDTO) (dto.MessageDTO, error) { + s.mu.Lock() + defer s.mu.Unlock() + if _, ok := s.chats[m.ChatID]; !ok { + return dto.MessageDTO{}, store.ErrNotFound + } + if s.messageCount >= s.limits.MaxMessages || !s.reserve(messageCost(m)) { + return dto.MessageDTO{}, store.ErrCapacity + } + m.CreatedAt = s.timestamp() + s.messages[m.ChatID] = append(s.messages[m.ChatID], m) + s.messageCount++ + return m, nil +} + +// Messages performs keyset pagination over an append-only ordered history. +func (s *Store) Messages(_ context.Context, chat uuid.UUID, p dto.PositionDTO, limit int) ([]dto.MessageDTO, error) { + s.mu.RLock() + defer s.mu.RUnlock() + all := s.messages[chat] + i := sort.Search(len(all), func(i int) bool { + return after(all[i].CreatedAt, all[i].ID, p) + }) + end := min(len(all), i+limit) + out := make([]dto.MessageDTO, end-i) + copy(out, all[i:end]) + return out, nil +} diff --git a/internal/store/memory/messages_test.go b/internal/store/memory/messages_test.go new file mode 100644 index 00000000..9550729e --- /dev/null +++ b/internal/store/memory/messages_test.go @@ -0,0 +1,72 @@ +package memory + +import ( + "errors" + "reflect" + "strings" + "testing" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// TestStore_CreateMessage_ByteCapacity preserves acknowledged history and accounting on rejection. +func TestStore_CreateMessage_ByteCapacity(t *testing.T) { + // Arrange. + cfg := config.Default().Memory + cfg.MaxStateBytes = 2048 + repo := newTestStore(t, cfg) + member := seedUser(t, repo, "alice") + chat := seedChat(t, repo, member.ID) + original := seedMessage(t, repo, chat, "kept") + input := dto.MessageDTO{ID: uuid.New(), ChatID: chat.ID, SenderID: member.ID, Text: strings.Repeat("x", 2000)} + previousBytes := repo.usedBytes + + // Act. + got, err := repo.CreateMessage(t.Context(), input) + + // Assert. + if !errors.Is(err, store.ErrCapacity) || got != (dto.MessageDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + items, readErr := repo.Messages(t.Context(), chat.ID, dto.PositionDTO{}, 10) + if readErr != nil { + t.Fatal(readErr) + } + if !reflect.DeepEqual(items, []dto.MessageDTO{original}) || repo.messageCount != 1 || repo.usedBytes != previousBytes { + t.Fatalf("overflow changed history or accounting: %v", items) + } +} + +// TestStore_CreateMessage_ClockRollback preserves chronological append order after a clock rollback. +func TestStore_CreateMessage_ClockRollback(t *testing.T) { + // Arrange. + repo := newTestStore(t, config.Default().Memory) + member := seedUser(t, repo, "alice") + chat := seedChat(t, repo, member.ID) + repo.lastTime = time.Now().UTC().Add(time.Hour) + first := seedMessage(t, repo, chat, "first") + input := dto.MessageDTO{ID: uuid.New(), ChatID: chat.ID, SenderID: member.ID, Text: "second"} + + // Act. + second, err := repo.CreateMessage(t.Context(), input) + + // Assert. + if err != nil { + t.Fatal(err) + } + if !second.CreatedAt.After(first.CreatedAt) { + t.Fatalf("second=%s must follow first=%s", second.CreatedAt, first.CreatedAt) + } + page, readErr := repo.Messages(t.Context(), chat.ID, dto.PositionDTO{CreatedAt: first.CreatedAt, ID: first.ID}, 10) + if readErr != nil { + t.Fatal(readErr) + } + if !reflect.DeepEqual(page, []dto.MessageDTO{second}) { + t.Fatalf("continuation lost the later message: %v", page) + } +} diff --git a/internal/store/memory/ordering.go b/internal/store/memory/ordering.go new file mode 100644 index 00000000..a3576b1d --- /dev/null +++ b/internal/store/memory/ordering.go @@ -0,0 +1,25 @@ +package memory + +import ( + "bytes" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// timestamp is called under the write lock, keeping append order during clock rollback. +func (s *Store) timestamp() time.Time { + now := time.Now().UTC() + if !now.After(s.lastTime) { + now = s.lastTime.Add(time.Nanosecond) + } + s.lastTime = now + return now +} + +// after compares a record with a keyset pagination position. +func after(t time.Time, id uuid.UUID, p dto.PositionDTO) bool { + return t.After(p.CreatedAt) || (t.Equal(p.CreatedAt) && bytes.Compare(id[:], p.ID[:]) > 0) +} diff --git a/internal/store/memory/store.go b/internal/store/memory/store.go new file mode 100644 index 00000000..9df013c6 --- /dev/null +++ b/internal/store/memory/store.go @@ -0,0 +1,47 @@ +// Package memory implements synchronized storage within one bounded process. +package memory + +import ( + "sync" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// Store owns all mutable state and its indexes under one lock. +// Records are immutable once published; membership slices are copied on both +// write and read boundaries. Its zero value is not usable; construct it with New. +type Store struct { + mu sync.RWMutex + limits config.Memory + users map[uuid.UUID]dto.UserDTO + usernames map[string]uuid.UUID + chats map[uuid.UUID]dto.ChatDTO + userChats map[uuid.UUID][]dto.ChatDTO + messages map[uuid.UUID][]dto.MessageDTO + messageCount int + usedBytes int + lastTime time.Time +} + +var _ store.Interface = (*Store)(nil) + +// New validates and copies capacity settings, then initializes an empty store. +// It creates no files, goroutines or external connections. +func New(cfg *config.Memory) (*Store, error) { + if err := cfg.Validate(); err != nil { + return nil, err + } + return &Store{ + limits: *cfg, + users: make(map[uuid.UUID]dto.UserDTO), + usernames: make(map[string]uuid.UUID), + chats: make(map[uuid.UUID]dto.ChatDTO), + userChats: make(map[uuid.UUID][]dto.ChatDTO), + messages: make(map[uuid.UUID][]dto.MessageDTO), + }, nil +} diff --git a/internal/store/memory/store_test.go b/internal/store/memory/store_test.go new file mode 100644 index 00000000..2d516760 --- /dev/null +++ b/internal/store/memory/store_test.go @@ -0,0 +1,64 @@ +package memory + +import ( + "testing" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// TestStore_New rejects missing capacity settings. +func TestStore_New(t *testing.T) { + // Arrange. + var cfg *config.Memory + + // Act. + repo, err := New(cfg) + + // Assert. + if err == nil || repo != nil { + t.Fatalf("missing configuration accepted: %v, %v", repo, err) + } +} + +// newTestStore creates independent storage for one scenario. +func newTestStore(t *testing.T, cfg *config.Memory) *Store { + t.Helper() + repo, err := New(cfg) + if err != nil { + t.Fatal(err) + } + return repo +} + +// seedUser creates a fixture user and checks preparation errors. +func seedUser(t *testing.T, repo *Store, username string) dto.UserDTO { + t.Helper() + user, err := repo.CreateUser(t.Context(), dto.UserDTO{ID: uuid.New(), Username: username}) + if err != nil { + t.Fatal(err) + } + return user +} + +// seedChat creates a fixture chat for an existing member. +func seedChat(t *testing.T, repo *Store, member uuid.UUID) dto.ChatDTO { + t.Helper() + chat, err := repo.CreateChat(t.Context(), dto.ChatDTO{ID: uuid.New(), Title: "Fixture", MemberIDs: []uuid.UUID{member}}) + if err != nil { + t.Fatal(err) + } + return chat +} + +// seedMessage creates an acknowledged fixture message. +func seedMessage(t *testing.T, repo *Store, chat dto.ChatDTO, text string) dto.MessageDTO { + t.Helper() + message, err := repo.CreateMessage(t.Context(), dto.MessageDTO{ID: uuid.New(), ChatID: chat.ID, SenderID: chat.MemberIDs[0], Text: text}) + if err != nil { + t.Fatal(err) + } + return message +} diff --git a/internal/store/memory/users.go b/internal/store/memory/users.go new file mode 100644 index 00000000..bae9971e --- /dev/null +++ b/internal/store/memory/users.go @@ -0,0 +1,50 @@ +package memory + +import ( + "context" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// CreateUser atomically enforces uniqueness and resource limits. +func (s *Store) CreateUser(_ context.Context, u dto.UserDTO) (dto.UserDTO, error) { + s.mu.Lock() + defer s.mu.Unlock() + if _, ok := s.usernames[u.Username]; ok { + return dto.UserDTO{}, store.ErrConflict + } + if len(s.users) >= s.limits.MaxUsers || !s.reserve(userCost(u)) { + return dto.UserDTO{}, store.ErrCapacity + } + u.CreatedAt = s.timestamp() + s.users[u.ID] = u + s.usernames[u.Username] = u.ID + return u, nil +} + +// User retrieves an immutable user. +func (s *Store) User(_ context.Context, id uuid.UUID) (dto.UserDTO, error) { + s.mu.RLock() + defer s.mu.RUnlock() + u, ok := s.users[id] + if !ok { + return u, store.ErrNotFound + } + return u, nil +} + +// UsersExist checks the complete set under one read lock without loading user records. +// Empty sets return true, and duplicate IDs do not affect the result. +func (s *Store) UsersExist(_ context.Context, ids []uuid.UUID) (bool, error) { + s.mu.RLock() + defer s.mu.RUnlock() + for _, id := range ids { + if _, exists := s.users[id]; !exists { + return false, nil + } + } + return true, nil +} diff --git a/internal/store/memory/users_test.go b/internal/store/memory/users_test.go new file mode 100644 index 00000000..a2dfaccc --- /dev/null +++ b/internal/store/memory/users_test.go @@ -0,0 +1,116 @@ +package memory + +import ( + "errors" + "testing" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// TestStore_UsersExist checks all-members semantics on an independent store per case. +func TestStore_UsersExist(t *testing.T) { + t.Run("Positive: existing user", func(t *testing.T) { + // Arrange. + repo := newTestStore(t, config.Default().Memory) + user := seedUser(t, repo, "alice") + ids := []uuid.UUID{user.ID} + want := true + + // Act. + got, err := repo.UsersExist(t.Context(), ids) + + // Assert. + if err != nil { + t.Fatal(err) + } + if got != want { + t.Fatalf("UsersExist(%v)=%v, want=%v", ids, got, want) + } + }) + + t.Run("Positive: duplicate IDs", func(t *testing.T) { + // Arrange. + repo := newTestStore(t, config.Default().Memory) + user := seedUser(t, repo, "alice") + ids := []uuid.UUID{user.ID} + want := true + + ids = append(ids, user.ID) + + // Act. + got, err := repo.UsersExist(t.Context(), ids) + + // Assert. + if err != nil { + t.Fatal(err) + } + if got != want { + t.Fatalf("UsersExist(%v)=%v, want=%v", ids, got, want) + } + }) + + t.Run("Positive: empty set", func(t *testing.T) { + // Arrange. + repo := newTestStore(t, config.Default().Memory) + var ids []uuid.UUID + want := true + + // Act. + got, err := repo.UsersExist(t.Context(), ids) + + // Assert. + if err != nil { + t.Fatal(err) + } + if got != want { + t.Fatalf("UsersExist(%v)=%v, want=%v", ids, got, want) + } + }) + + t.Run("Negative: missing member", func(t *testing.T) { + // Arrange. + repo := newTestStore(t, config.Default().Memory) + user := seedUser(t, repo, "alice") + ids := []uuid.UUID{user.ID} + want := false + + ids = append(ids, uuid.New()) + + // Act. + got, err := repo.UsersExist(t.Context(), ids) + + // Assert. + if err != nil { + t.Fatal(err) + } + if got != want { + t.Fatalf("UsersExist(%v)=%v, want=%v", ids, got, want) + } + }) +} + +// TestStore_CreateUser_Capacity checks that a refused user consumes no storage or username index. +func TestStore_CreateUser_Capacity(t *testing.T) { + // Arrange. + cfg := config.Default().Memory + cfg.MaxUsers = 1 + repo := newTestStore(t, cfg) + original := seedUser(t, repo, "alice") + rejected := dto.UserDTO{ID: uuid.New(), Username: "bob"} + previousBytes := repo.usedBytes + + // Act. + got, err := repo.CreateUser(t.Context(), rejected) + + // Assert. + if !errors.Is(err, store.ErrCapacity) || got != (dto.UserDTO{}) { + t.Fatalf("result=%+v, error=%v", got, err) + } + if len(repo.users) != 1 || repo.users[original.ID] != original || len(repo.usernames) != 1 || repo.usernames[original.Username] != original.ID || repo.usedBytes != previousBytes { + t.Fatal("refused registration changed storage or indexes") + } +} diff --git a/internal/store/postgres/chats.go b/internal/store/postgres/chats.go new file mode 100644 index 00000000..8946c12d --- /dev/null +++ b/internal/store/postgres/chats.go @@ -0,0 +1,58 @@ +package postgres + +import ( + "context" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// CreateChat commits the chat and every member together, rolling back on any failure. +func (s *Store) CreateChat(ctx context.Context, chat dto.ChatDTO) (dto.ChatDTO, error) { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + err := pgx.BeginFunc(ctx, s.pool, func(tx pgx.Tx) error { + if err := tx.QueryRow(ctx, `INSERT INTO chats(id,title) VALUES(@id,@title) RETURNING created_at`, pgx.StrictNamedArgs{"id": chat.ID, "title": chat.Title}).Scan(&chat.CreatedAt); err != nil { + return err + } + _, err := tx.Exec(ctx, `INSERT INTO chat_members(chat_id,user_id) SELECT @chat,id FROM unnest(@members::uuid[]) AS member(id)`, pgx.StrictNamedArgs{"chat": chat.ID, "members": chat.MemberIDs}) + return err + }) + return chat, normalize(err) +} + +// Chat reads a chat and its immutable membership in one snapshot. +func (s *Store) Chat(ctx context.Context, id uuid.UUID) (dto.ChatDTO, error) { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + var chat dto.ChatDTO + err := s.pool.QueryRow(ctx, `SELECT c.id,c.title,c.created_at,ARRAY(SELECT user_id FROM chat_members WHERE chat_id=c.id ORDER BY user_id) + FROM chats c WHERE c.id=@id`, pgx.StrictNamedArgs{"id": id}).Scan(&chat.ID, &chat.Title, &chat.CreatedAt, &chat.MemberIDs) + return chat, normalize(err) +} + +// Chats returns the requested keyset page of chats visible to a user. +func (s *Store) Chats(ctx context.Context, userID uuid.UUID, position dto.PositionDTO, limit int) ([]dto.ChatDTO, error) { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + rows, err := s.pool.Query(ctx, `SELECT c.id,c.title,c.created_at,ARRAY(SELECT user_id FROM chat_members WHERE chat_id=c.id ORDER BY user_id) + FROM chats c JOIN chat_members m ON m.chat_id=c.id + WHERE m.user_id=@user AND (c.created_at,c.id)>(@time,@id) ORDER BY c.created_at,c.id LIMIT @limit`, pgx.StrictNamedArgs{ + "user": userID, "time": position.CreatedAt, "id": position.ID, "limit": limit, + }) + if err != nil { + return nil, normalize(err) + } + defer rows.Close() + chats := make([]dto.ChatDTO, 0) + for rows.Next() { + var chat dto.ChatDTO + if err := rows.Scan(&chat.ID, &chat.Title, &chat.CreatedAt, &chat.MemberIDs); err != nil { + return nil, normalize(err) + } + chats = append(chats, chat) + } + return chats, normalize(rows.Err()) +} diff --git a/internal/store/postgres/errors_test.go b/internal/store/postgres/errors_test.go new file mode 100644 index 00000000..e326ee84 --- /dev/null +++ b/internal/store/postgres/errors_test.go @@ -0,0 +1,52 @@ +package postgres + +import ( + "context" + "errors" + "fmt" + "io" + "net" + "testing" + + "github.com/jackc/pgx/v5/pgconn" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// TestNormalizeUnavailable classifies dependency failures while retaining their causes. +func TestNormalizeUnavailable(t *testing.T) { + cases := []struct { + name string + err error + }{ + {"deadline", context.DeadlineExceeded}, + {"closed stream", io.EOF}, + {"truncated stream", io.ErrUnexpectedEOF}, + {"network", &net.OpError{Op: "dial", Net: "tcp", Err: errors.New("refused")}}, + {"connection exception", &pgconn.PgError{Code: "08006"}}, + {"connection limit", &pgconn.PgError{Code: "53300"}}, + {"shutdown", &pgconn.PgError{Code: "57P01"}}, + {"crash", &pgconn.PgError{Code: "57P02"}}, + {"starting", &pgconn.PgError{Code: "57P03"}}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + err := normalize(fmt.Errorf("operation failed: %w", tc.err)) + if !errors.Is(err, store.ErrUnavailable) || !errors.Is(err, tc.err) { + t.Fatalf("failure category or cause lost: %T", tc.err) + } + }) + } +} + +// TestNormalizeUnexpected preserves programming errors instead of misclassifying them as outages. +func TestNormalizeUnexpected(t *testing.T) { + for _, code := range []string{"42601", "23503", "42P01"} { + t.Run(code, func(t *testing.T) { + err := &pgconn.PgError{Code: code} + if normalize(err) != err { + t.Fatal("unexpected SQL error was reclassified") + } + }) + } +} diff --git a/internal/store/postgres/idempotency.go b/internal/store/postgres/idempotency.go new file mode 100644 index 00000000..eb2b2e5a --- /dev/null +++ b/internal/store/postgres/idempotency.go @@ -0,0 +1,51 @@ +package postgres + +import ( + "context" + "errors" + + "github.com/jackc/pgx/v5" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// replayMessage serializes one chat and returns an unexpired original response. +func replayMessage(ctx context.Context, tx pgx.Tx, message dto.MessageDTO) (dto.MessageDTO, bool, error) { + var locked string + if err := tx.QueryRow(ctx, "SELECT id FROM chats WHERE id=@chat FOR UPDATE", pgx.StrictNamedArgs{"chat": message.ChatID}).Scan(&locked); err != nil { + return dto.MessageDTO{}, false, err + } + if message.IdempotencyKey == "" { + return dto.MessageDTO{}, false, nil + } + args := pgx.StrictNamedArgs{"user": message.SenderID, "chat": message.ChatID, "key": message.IdempotencyKey} + if _, err := tx.Exec(ctx, `DELETE FROM message_idempotency WHERE user_id=@user AND chat_id=@chat AND key=@key AND expires_at<=clock_timestamp()`, args); err != nil { + return dto.MessageDTO{}, false, err + } + var original dto.MessageDTO + err := tx.QueryRow(ctx, `SELECT m.id,m.chat_id,m.sender_id,m.text,m.created_at FROM message_idempotency i JOIN messages m ON m.id=i.message_id + WHERE i.user_id=@user AND i.chat_id=@chat AND i.key=@key`, args).Scan(&original.ID, &original.ChatID, &original.SenderID, &original.Text, &original.CreatedAt) + if errors.Is(err, pgx.ErrNoRows) { + return dto.MessageDTO{}, false, nil + } + if err != nil { + return dto.MessageDTO{}, false, err + } + if original.Text != message.Text { + return dto.MessageDTO{}, false, store.ErrConflict + } + return original, true, nil +} + +// rememberMessage stores the result in the same transaction as the message insert. +func rememberMessage(ctx context.Context, tx pgx.Tx, message dto.MessageDTO) error { + if message.IdempotencyKey == "" { + return nil + } + _, err := tx.Exec(ctx, `INSERT INTO message_idempotency(user_id,chat_id,key,message_id,expires_at) + VALUES(@user,@chat,@key,@id,clock_timestamp()+interval '24 hours')`, pgx.StrictNamedArgs{ + "user": message.SenderID, "chat": message.ChatID, "key": message.IdempotencyKey, "id": message.ID, + }) + return err +} diff --git a/internal/store/postgres/idempotency_test.go b/internal/store/postgres/idempotency_test.go new file mode 100644 index 00000000..66871664 --- /dev/null +++ b/internal/store/postgres/idempotency_test.go @@ -0,0 +1,139 @@ +package postgres + +import ( + "errors" + "sync" + "testing" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// TestMessageRetryRace verifies concurrent attempts commit exactly one message and replay its response. +func TestMessageRetryRace(t *testing.T) { + s := testStore(t) + user := fixtureUser(t, s) + chat := fixtureChat(t, s, user) + var wg sync.WaitGroup + outcomes := make(chan dto.MessageDTO, 12) + failures := make(chan error, 12) + for range 12 { + wg.Go(func() { + message, err := s.CreateMessage(t.Context(), dto.MessageDTO{ID: uuid.New(), ChatID: chat.ID, SenderID: user.ID, Text: "same", IdempotencyKey: "retry"}) + if err != nil { + failures <- err + return + } + outcomes <- message + }) + } + wg.Wait() + close(failures) + close(outcomes) + for err := range failures { + t.Error(err) + } + var original dto.MessageDTO + for m := range outcomes { + if original.ID == uuid.Nil { + original = m + } + if m.ID != original.ID || m.Text != original.Text || !m.CreatedAt.Equal(original.CreatedAt) { + t.Fatal("retry returned a different result") + } + } + messages, err := s.Messages(t.Context(), chat.ID, dto.PositionDTO{}, 100) + if err != nil || len(messages) != 1 { + t.Fatalf("messages=%d error=%v", len(messages), err) + } +} + +// TestMessageRetryConflict rejects a different body without publishing a second message. +func TestMessageRetryConflict(t *testing.T) { + s := testStore(t) + user := fixtureUser(t, s) + chat := fixtureChat(t, s, user) + message := dto.MessageDTO{ID: uuid.New(), ChatID: chat.ID, SenderID: user.ID, Text: "first", IdempotencyKey: "retry"} + if _, err := s.CreateMessage(t.Context(), message); err != nil { + t.Fatal(err) + } + message.ID = uuid.New() + message.Text = "different" + if _, err := s.CreateMessage(t.Context(), message); !errors.Is(err, store.ErrConflict) { + t.Fatalf("expected conflict: %v", err) + } +} + +// TestMessageRetryExpiry permits reuse after the original retention window ends. +func TestMessageRetryExpiry(t *testing.T) { + s := testStore(t) + user := fixtureUser(t, s) + chat := fixtureChat(t, s, user) + message := dto.MessageDTO{ID: uuid.New(), ChatID: chat.ID, SenderID: user.ID, Text: "first", IdempotencyKey: "retry"} + if _, err := s.CreateMessage(t.Context(), message); err != nil { + t.Fatal(err) + } + if _, err := s.pool.Exec(t.Context(), "UPDATE message_idempotency SET expires_at=clock_timestamp()-interval '1 second'"); err != nil { + t.Fatal(err) + } + message.ID = uuid.New() + message.Text = "new" + if result, err := s.CreateMessage(t.Context(), message); err != nil || result.ID != message.ID { + t.Fatalf("expired result reused: %v", err) + } +} + +// TestMessageRetryRollback proves failed inserts leave no poisoned idempotency result. +func TestMessageRetryRollback(t *testing.T) { + s := testStore(t) + user := fixtureUser(t, s) + chat := fixtureChat(t, s, user) + message := dto.MessageDTO{ID: uuid.New(), ChatID: chat.ID, SenderID: uuid.New(), Text: "first", IdempotencyKey: "retry"} + if _, err := s.CreateMessage(t.Context(), message); err == nil { + t.Fatal("missing sender accepted") + } + var count int + if err := s.pool.QueryRow(t.Context(), "SELECT count(*) FROM message_idempotency").Scan(&count); err != nil || count != 0 { + t.Fatalf("failed write stored a result: %d %v", count, err) + } + message.SenderID = user.ID + if _, err := s.CreateMessage(t.Context(), message); err != nil { + t.Fatal(err) + } +} + +// TestSchemaCheck verifies API schema checks neither create nor upgrade tables. +func TestSchemaCheck(t *testing.T) { + s := testStore(t) + if err := s.CheckSchema(t.Context()); err != nil { + t.Fatal(err) + } + if _, err := s.pool.Exec(t.Context(), "DELETE FROM schema_migrations WHERE version=2"); err != nil { + t.Fatal(err) + } + if err := s.CheckSchema(t.Context()); err == nil { + t.Fatal("outdated schema accepted") + } + s.Close() + if err := s.CheckSchema(t.Context()); err == nil { + t.Fatal("closed connection accepted") + } +} + +// TestIdempotencyMigrationFailureRollsBackVersion keeps an unsuccessful DDL change out of migration history. +func TestIdempotencyMigrationFailureRollsBackVersion(t *testing.T) { + s := testStore(t) + if _, err := s.pool.Exec(t.Context(), "DELETE FROM schema_migrations WHERE version=2"); err != nil { + t.Fatal(err) + } + // The existing table deliberately conflicts with the pending migration. + if err := s.Start(t.Context()); err == nil { + t.Fatal("conflicting DDL reported success") + } + var applied bool + if err := s.pool.QueryRow(t.Context(), "SELECT EXISTS(SELECT 1 FROM schema_migrations WHERE version=2)").Scan(&applied); err != nil || applied { + t.Fatalf("failed migration marked applied: %v", err) + } +} diff --git a/internal/store/postgres/messages.go b/internal/store/postgres/messages.go new file mode 100644 index 00000000..88e03187 --- /dev/null +++ b/internal/store/postgres/messages.go @@ -0,0 +1,61 @@ +package postgres + +import ( + "context" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// CreateMessage serializes timestamps on the owning chat and atomically appends a message. +func (s *Store) CreateMessage(ctx context.Context, message dto.MessageDTO) (dto.MessageDTO, error) { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + err := pgx.BeginFunc(ctx, s.pool, func(tx pgx.Tx) error { + original, found, err := replayMessage(ctx, tx, message) + if err != nil { + return err + } + if found { + message = original + return nil + } + if err := tx.QueryRow(ctx, `UPDATE chats SET last_message_at=GREATEST(clock_timestamp(),last_message_at+interval '1 microsecond') + WHERE id=@chat RETURNING last_message_at`, pgx.StrictNamedArgs{"chat": message.ChatID}).Scan(&message.CreatedAt); err != nil { + return err + } + _, err = tx.Exec(ctx, `INSERT INTO messages(id,chat_id,sender_id,text,created_at) VALUES(@id,@chat,@sender,@text,@time)`, pgx.StrictNamedArgs{ + "id": message.ID, "chat": message.ChatID, "sender": message.SenderID, "text": message.Text, "time": message.CreatedAt, + }) + if err != nil { + return err + } + return rememberMessage(ctx, tx, message) + }) + return message, normalize(err) +} + +// Messages reads an indexed keyset page without scanning earlier history. +func (s *Store) Messages(ctx context.Context, chatID uuid.UUID, position dto.PositionDTO, limit int) ([]dto.MessageDTO, error) { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + rows, err := s.pool.Query(ctx, `SELECT id,chat_id,sender_id,text,created_at FROM messages + WHERE chat_id=@chat AND (created_at,id)>(@time,@id) ORDER BY created_at,id LIMIT @limit`, pgx.StrictNamedArgs{ + "chat": chatID, "time": position.CreatedAt, "id": position.ID, "limit": limit, + }) + if err != nil { + return nil, normalize(err) + } + defer rows.Close() + messages := make([]dto.MessageDTO, 0) + for rows.Next() { + var message dto.MessageDTO + if err := rows.Scan(&message.ID, &message.ChatID, &message.SenderID, &message.Text, &message.CreatedAt); err != nil { + return nil, normalize(err) + } + messages = append(messages, message) + } + return messages, normalize(rows.Err()) +} diff --git a/internal/store/postgres/migrations/001_initial.sql b/internal/store/postgres/migrations/001_initial.sql new file mode 100644 index 00000000..0a19d68d --- /dev/null +++ b/internal/store/postgres/migrations/001_initial.sql @@ -0,0 +1,34 @@ +CREATE TABLE users ( + id uuid PRIMARY KEY, + username text NOT NULL UNIQUE, + display_name text NOT NULL, + password_hash text NOT NULL DEFAULT '', + created_at timestamptz NOT NULL DEFAULT clock_timestamp() +); +CREATE TABLE chats ( + id uuid PRIMARY KEY, + title text NOT NULL, + created_at timestamptz NOT NULL DEFAULT clock_timestamp(), + last_message_at timestamptz NOT NULL DEFAULT '-infinity' +); +CREATE TABLE chat_members ( + chat_id uuid NOT NULL REFERENCES chats(id), + user_id uuid NOT NULL REFERENCES users(id), + PRIMARY KEY(chat_id,user_id) +); +CREATE INDEX chat_members_user ON chat_members(user_id,chat_id); +CREATE TABLE messages ( + id uuid PRIMARY KEY, + chat_id uuid NOT NULL REFERENCES chats(id), + sender_id uuid NOT NULL REFERENCES users(id), + text text NOT NULL, + created_at timestamptz NOT NULL, + FOREIGN KEY(chat_id,sender_id) REFERENCES chat_members(chat_id,user_id) +); +CREATE INDEX messages_history ON messages(chat_id,created_at,id); +CREATE TABLE sessions ( + token_hash text PRIMARY KEY, + user_id uuid NOT NULL REFERENCES users(id), + expires_at timestamptz NOT NULL +); +CREATE INDEX sessions_expiry ON sessions(expires_at); diff --git a/internal/store/postgres/migrations/002_idempotency.sql b/internal/store/postgres/migrations/002_idempotency.sql new file mode 100644 index 00000000..d34a519b --- /dev/null +++ b/internal/store/postgres/migrations/002_idempotency.sql @@ -0,0 +1,9 @@ +CREATE TABLE message_idempotency ( + user_id uuid NOT NULL REFERENCES users(id), + chat_id uuid NOT NULL REFERENCES chats(id), + key text NOT NULL, + message_id uuid NOT NULL REFERENCES messages(id), + expires_at timestamptz NOT NULL, + PRIMARY KEY (user_id,chat_id,key) +); +CREATE INDEX message_idempotency_expiry ON message_idempotency(expires_at); diff --git a/internal/store/postgres/sessions.go b/internal/store/postgres/sessions.go new file mode 100644 index 00000000..3e64d274 --- /dev/null +++ b/internal/store/postgres/sessions.go @@ -0,0 +1,36 @@ +package postgres + +import ( + "context" + "time" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5" +) + +// SaveSession persists an absolute expiry and a token digest in PostgreSQL. +func (s *Store) SaveSession(ctx context.Context, hash string, userID uuid.UUID, expiry time.Time) error { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + _, err := s.pool.Exec(ctx, `INSERT INTO sessions(token_hash,user_id,expires_at) VALUES(@hash,@user,@expiry)`, pgx.StrictNamedArgs{ + "hash": hash, "user": userID, "expiry": expiry, + }) + return normalize(err) +} + +// SessionUser rejects absent, revoked and expired sessions using database time. +func (s *Store) SessionUser(ctx context.Context, hash string) (uuid.UUID, error) { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + var id uuid.UUID + err := s.pool.QueryRow(ctx, `SELECT user_id FROM sessions WHERE token_hash=@hash AND expires_at>clock_timestamp()`, pgx.StrictNamedArgs{"hash": hash}).Scan(&id) + return id, normalize(err) +} + +// RevokeSession deletes the authoritative session before logout succeeds. +func (s *Store) RevokeSession(ctx context.Context, hash string) error { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + _, err := s.pool.Exec(ctx, `DELETE FROM sessions WHERE token_hash=@hash`, pgx.StrictNamedArgs{"hash": hash}) + return normalize(err) +} diff --git a/internal/store/postgres/store.go b/internal/store/postgres/store.go new file mode 100644 index 00000000..2db2ae15 --- /dev/null +++ b/internal/store/postgres/store.go @@ -0,0 +1,154 @@ +// Package postgres persists messenger records in PostgreSQL. +package postgres + +import ( + "context" + _ "embed" + "errors" + "fmt" + "io" + "net" + "strings" + "time" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" + "github.com/jackc/pgx/v5/pgtype" + "github.com/jackc/pgx/v5/pgxpool" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +//go:embed migrations/001_initial.sql +var initialMigration string + +//go:embed migrations/002_idempotency.sql +var idempotencyMigration string + +const migrationLockID = 202602 + +// Options bounds database resource use. +type Options struct { + // URL identifies the isolated application database. + URL string + // MaxConnections bounds concurrent database connections. + MaxConnections int32 + // Timeout bounds each persistence operation. + Timeout time.Duration +} + +// Store owns the PostgreSQL pool; Start and Close belong to application lifecycle. +type Store struct { + pool *pgxpool.Pool + timeout time.Duration +} + +var _ store.Interface = (*Store)(nil) + +// New validates options and builds a lazy pool without opening connections. +func New(options Options) (*Store, error) { + if options.URL == "" || options.MaxConnections < 1 || options.Timeout <= 0 { + return nil, fmt.Errorf("database URL, pool bound and timeout are required") + } + cfg, err := pgxpool.ParseConfig(options.URL) + if err != nil { + return nil, fmt.Errorf("invalid database configuration") + } + cfg.AfterConnect = func(_ context.Context, conn *pgx.Conn) error { + conn.TypeMap().RegisterType(&pgtype.Type{Name: "timestamptz", OID: pgtype.TimestamptzOID, Codec: &pgtype.TimestamptzCodec{ScanLocation: time.UTC}}) + return nil + } + cfg.MaxConns = options.MaxConnections + cfg.ConnConfig.ConnectTimeout = options.Timeout + pool, err := pgxpool.NewWithConfig(context.Background(), cfg) + if err != nil { + return nil, err + } + return &Store{pool: pool, timeout: options.Timeout}, nil +} + +// Start verifies connectivity and applies versioned migrations under a transaction lock. +func (s *Store) Start(ctx context.Context) error { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + return pgx.BeginFunc(ctx, s.pool, func(tx pgx.Tx) error { + if _, err := tx.Exec(ctx, "SELECT pg_advisory_xact_lock(@id)", pgx.StrictNamedArgs{"id": migrationLockID}); err != nil { + return err + } + if _, err := tx.Exec(ctx, "CREATE TABLE IF NOT EXISTS schema_migrations (version integer PRIMARY KEY)"); err != nil { + return err + } + var exists bool + if err := tx.QueryRow(ctx, "SELECT EXISTS(SELECT 1 FROM schema_migrations WHERE version=1)").Scan(&exists); err != nil { + return err + } + if !exists { + if _, err := tx.Exec(ctx, initialMigration); err != nil { + return err + } + if _, err := tx.Exec(ctx, "INSERT INTO schema_migrations(version) VALUES(1)"); err != nil { + return err + } + } + if err := tx.QueryRow(ctx, "SELECT EXISTS(SELECT 1 FROM schema_migrations WHERE version=2)").Scan(&exists); err != nil { + return err + } + if exists { + return nil + } + if _, err := tx.Exec(ctx, idempotencyMigration); err != nil { + return err + } + _, err := tx.Exec(ctx, "INSERT INTO schema_migrations(version) VALUES(2)") + return err + }) +} + +// Close releases owned pool resources after serving has stopped. +func (s *Store) Close() { + s.pool.Close() +} + +// Ping checks whether mandatory persistence can serve requests. +func (s *Store) Ping(ctx context.Context) error { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + return s.pool.Ping(ctx) +} + +// normalize translates expected database errors without exposing SQL to higher layers. +func normalize(err error) error { + if errors.Is(err, pgx.ErrNoRows) { + return store.ErrNotFound + } + if databaseError, ok := errors.AsType[*pgconn.PgError](err); ok { + if databaseError.Code == "23505" { + return store.ErrConflict + } + if strings.HasPrefix(databaseError.Code, "08") || strings.HasPrefix(databaseError.Code, "53") || + databaseError.Code == "57P01" || databaseError.Code == "57P02" || databaseError.Code == "57P03" { + return fmt.Errorf("%w: %w", store.ErrUnavailable, err) + } + } + var networkError net.Error + var connectError *pgconn.ConnectError + if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) || + errors.As(err, &networkError) || errors.As(err, &connectError) || pgconn.SafeToRetry(err) { + return fmt.Errorf("%w: %w", store.ErrUnavailable, err) + } + return err +} + +// CheckSchema verifies readiness without allowing API replicas to run DDL. +func (s *Store) CheckSchema(ctx context.Context) error { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + var version int + if err := s.pool.QueryRow(ctx, "SELECT COALESCE(max(version),0) FROM schema_migrations").Scan(&version); err != nil { + return err + } + if version != 2 { + return fmt.Errorf("database schema version %d; run server migrate", version) + } + return nil +} diff --git a/internal/store/postgres/store_test.go b/internal/store/postgres/store_test.go new file mode 100644 index 00000000..fdda0eef --- /dev/null +++ b/internal/store/postgres/store_test.go @@ -0,0 +1,336 @@ +package postgres + +import ( + "context" + "errors" + "os" + "sync" + "testing" + "time" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" +) + +// testStore creates an isolated schema inside the explicitly configured test database. +func testStore(t *testing.T) *Store { + t.Helper() + url := os.Getenv("TEST_DATABASE_URL") + if url == "" { + t.Skip("TEST_DATABASE_URL is required for PostgreSQL integration tests") + } + admin, err := pgx.Connect(t.Context(), url) + if err != nil { + t.Fatal(err) + } + schema := "test_" + uuid.New().String()[:8] + identifier := pgx.Identifier{schema}.Sanitize() + if _, err := admin.Exec(t.Context(), "CREATE SCHEMA "+identifier); err != nil { + t.Fatal(err) + } + separator := "?" + if containsQuery(url) { + separator = "&" + } + s, err := New(Options{URL: url + separator + "search_path=" + schema, MaxConnections: 4, Timeout: 3 * time.Second}) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { + s.Close() + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + if _, err := admin.Exec(ctx, "DROP SCHEMA "+identifier+" CASCADE"); err != nil { + t.Error(err) + } + if err := admin.Close(ctx); err != nil { + t.Error(err) + } + }) + if err := s.Start(t.Context()); err != nil { + t.Fatal(err) + } + return s +} + +// containsQuery identifies URL parameters without exposing credentials in test logs. +func containsQuery(value string) bool { + for _, char := range value { + if char == '?' { + return true + } + } + return false +} + +// fixtureUser creates an independent profile for a persistence scenario. +func fixtureUser(t *testing.T, s *Store) dto.UserDTO { + t.Helper() + user, err := s.Register(t.Context(), dto.UserDTO{ID: uuid.New(), Username: "u_" + uuid.NewString()[:8], DisplayName: "Test"}, "test-hash") + if err != nil { + t.Fatal(err) + } + return user +} + +// fixtureChat creates a chat containing an existing user. +func fixtureChat(t *testing.T, s *Store, user dto.UserDTO) dto.ChatDTO { + t.Helper() + chat, err := s.CreateChat(t.Context(), dto.ChatDTO{ID: uuid.New(), Title: "Test", MemberIDs: []uuid.UUID{user.ID}}) + if err != nil { + t.Fatal(err) + } + return chat +} + +// TestMigrationsRepeat verifies idempotent schema initialization. +func TestMigrationsRepeat(t *testing.T) { + s := testStore(t) + user := fixtureUser(t, s) + if err := s.Start(t.Context()); err != nil { + t.Fatal(err) + } + read, err := s.User(t.Context(), user.ID) + if err != nil || read.ID != user.ID || read.CreatedAt.Location() != time.UTC { + t.Fatalf("migration changed data or UTC: %v", err) + } + if err := s.Ping(t.Context()); err != nil { + t.Fatal(err) + } +} + +// TestRegistrationRace verifies database uniqueness under concurrent registration. +func TestRegistrationRace(t *testing.T) { + s := testStore(t) + outcomes := make(chan error, 12) + var wg sync.WaitGroup + for range 12 { + wg.Go(func() { + _, err := s.Register(t.Context(), dto.UserDTO{ID: uuid.New(), Username: "same", DisplayName: "Test"}, "hash") + outcomes <- err + }) + } + wg.Wait() + close(outcomes) + successes := 0 + for err := range outcomes { + if err == nil { + successes++ + } else if !errors.Is(err, store.ErrConflict) { + t.Fatal(err) + } + } + if successes != 1 { + t.Fatalf("got %d successful registrations", successes) + } +} + +// TestCreateChatRollsBack verifies failure of membership insertion leaves no chat. +func TestCreateChatRollsBack(t *testing.T) { + s := testStore(t) + id := uuid.New() + _, err := s.CreateChat(t.Context(), dto.ChatDTO{ID: id, Title: "Rollback", MemberIDs: []uuid.UUID{uuid.New()}}) + if err == nil { + t.Fatal("foreign key failure absent") + } + if _, err := s.Chat(t.Context(), id); !errors.Is(err, store.ErrNotFound) { + t.Fatalf("chat survived rollback: %v", err) + } +} + +// TestChatPageUsesMembershipAndCursor verifies one compound visibility/page invariant. +func TestChatPageUsesMembershipAndCursor(t *testing.T) { + s := testStore(t) + owner := fixtureUser(t, s) + outsider := fixtureUser(t, s) + first := fixtureChat(t, s, owner) + second := fixtureChat(t, s, owner) + fixtureChat(t, s, outsider) + page, err := s.Chats(t.Context(), owner.ID, dto.PositionDTO{CreatedAt: first.CreatedAt, ID: first.ID}, 10) + if err != nil || len(page) != 1 || page[0].ID != second.ID || len(page[0].MemberIDs) != 1 { + t.Fatalf("invalid membership page: %+v %v", page, err) + } +} + +// TestMessagePageOrdersConcurrentWrites verifies monotonic durable ordering and continuation. +func TestMessagePageOrdersConcurrentWrites(t *testing.T) { + s := testStore(t) + user := fixtureUser(t, s) + chat := fixtureChat(t, s, user) + var wg sync.WaitGroup + failures := make(chan error, 20) + for range 20 { + wg.Go(func() { + _, err := s.CreateMessage(t.Context(), dto.MessageDTO{ID: uuid.New(), ChatID: chat.ID, SenderID: user.ID, Text: "synthetic"}) + failures <- err + }) + } + wg.Wait() + close(failures) + for err := range failures { + if err != nil { + t.Fatal(err) + } + } + page, err := s.Messages(t.Context(), chat.ID, dto.PositionDTO{}, 10) + if err != nil || len(page) != 10 { + t.Fatalf("first page: %d %v", len(page), err) + } + for index := 1; index < len(page); index++ { + if !page[index].CreatedAt.After(page[index-1].CreatedAt) { + t.Fatal("timestamps are not monotonic") + } + } + last := page[len(page)-1] + next, err := s.Messages(t.Context(), chat.ID, dto.PositionDTO{CreatedAt: last.CreatedAt, ID: last.ID}, 20) + if err != nil || len(next) != 10 || !next[0].CreatedAt.After(last.CreatedAt) { + t.Fatalf("continuation: %d %v", len(next), err) + } +} + +// TestCredentialsReadsStoredHash checks credential lookup independently of public profiles. +func TestCredentialsReadsStoredHash(t *testing.T) { + s := testStore(t) + user := fixtureUser(t, s) + got, hash, err := s.Credentials(t.Context(), user.Username) + if err != nil || got.ID != user.ID || hash != "test-hash" { + t.Fatalf("credentials mismatch: %v", err) + } +} + +// TestUsersExistChecksAllIDs verifies the set membership contract. +func TestUsersExistChecksAllIDs(t *testing.T) { + for _, missing := range []bool{false, true} { + t.Run(map[bool]string{false: "all exist", true: "missing member"}[missing], func(t *testing.T) { + s := testStore(t) + ids := []uuid.UUID{fixtureUser(t, s).ID} + if missing { + ids = append(ids, uuid.New()) + } + exists, err := s.UsersExist(t.Context(), ids) + if err != nil || exists == missing { + t.Fatalf("exists=%v error=%v", exists, err) + } + }) + } +} + +// TestSessionExpiry rejects persisted sessions whose absolute deadline has passed. +func TestSessionExpiry(t *testing.T) { + s := testStore(t) + user := fixtureUser(t, s) + if err := s.SaveSession(t.Context(), "expired", user.ID, time.Now().Add(-time.Second)); err != nil { + t.Fatal(err) + } + if _, err := s.SessionUser(t.Context(), "expired"); !errors.Is(err, store.ErrNotFound) { + t.Fatalf("expired session accepted: %v", err) + } +} + +// TestSessionRevocation removes a still-valid session from the source of truth. +func TestSessionRevocation(t *testing.T) { + s := testStore(t) + user := fixtureUser(t, s) + if err := s.SaveSession(t.Context(), "live", user.ID, time.Now().Add(time.Hour)); err != nil { + t.Fatal(err) + } + if err := s.RevokeSession(t.Context(), "live"); err != nil { + t.Fatal(err) + } + if _, err := s.SessionUser(t.Context(), "live"); !errors.Is(err, store.ErrNotFound) { + t.Fatalf("revoked session accepted: %v", err) + } +} + +// TestSessionResolvesOwner verifies a live session's immutable identity. +func TestSessionResolvesOwner(t *testing.T) { + s := testStore(t) + user := fixtureUser(t, s) + if err := s.SaveSession(t.Context(), "live", user.ID, time.Now().Add(time.Hour)); err != nil { + t.Fatal(err) + } + id, err := s.SessionUser(t.Context(), "live") + if err != nil || id != user.ID { + t.Fatalf("invalid owner: %v", err) + } +} + +// TestNewRejectsInvalidOptions verifies pool construction errors without connecting. +func TestNewRejectsInvalidOptions(t *testing.T) { + for _, options := range []Options{{}, {URL: "://invalid", MaxConnections: 1, Timeout: time.Second}} { + if _, err := New(options); err == nil { + t.Fatal("invalid options accepted") + } + } +} + +// TestCreateMessageMissingChat reports a typed missing-record error. +func TestCreateMessageMissingChat(t *testing.T) { + s := testStore(t) + _, err := s.CreateMessage(t.Context(), dto.MessageDTO{ID: uuid.New(), ChatID: uuid.New(), SenderID: uuid.New(), Text: "test"}) + if !errors.Is(err, store.ErrNotFound) { + t.Fatal(err) + } +} + +// TestMessagesCanceledReturnsError verifies bounded cancellation before query execution. +func TestMessagesCanceledReturnsError(t *testing.T) { + s := testStore(t) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + if _, err := s.Messages(ctx, uuid.New(), dto.PositionDTO{}, 10); err == nil { + t.Fatal("canceled query succeeded") + } +} + +// TestChatsCanceledReturnsError verifies bounded cancellation of membership pages. +func TestChatsCanceledReturnsError(t *testing.T) { + s := testStore(t) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + if _, err := s.Chats(ctx, uuid.New(), dto.PositionDTO{}, 10); err == nil { + t.Fatal("canceled query succeeded") + } +} + +// TestMigrationCancellationReturnsError checks startup cancellation before migration work. +func TestMigrationCancellationReturnsError(t *testing.T) { + s := testStore(t) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + if err := s.Start(ctx); err == nil { + t.Fatal("canceled migration succeeded") + } +} + +// TestMigrationFailureRollsBackVersion verifies a failed migration is never marked applied. +func TestMigrationFailureRollsBackVersion(t *testing.T) { + s := testStore(t) + if _, err := s.pool.Exec(t.Context(), "DELETE FROM schema_migrations"); err != nil { + t.Fatal(err) + } + if err := s.Start(t.Context()); err == nil { + t.Fatal("conflicting unversioned schema accepted") + } + var count int + if err := s.pool.QueryRow(t.Context(), "SELECT count(*) FROM schema_migrations").Scan(&count); err != nil { + t.Fatal(err) + } + if count != 0 { + t.Fatal("failed migration version committed") + } +} + +// TestMigrationRejectsBrokenVersionLedger verifies corrupt migration metadata stops startup safely. +func TestMigrationRejectsBrokenVersionLedger(t *testing.T) { + s := testStore(t) + if _, err := s.pool.Exec(t.Context(), "ALTER TABLE schema_migrations RENAME COLUMN version TO broken_version"); err != nil { + t.Fatal(err) + } + if err := s.Start(t.Context()); err == nil { + t.Fatal("broken version ledger accepted") + } +} diff --git a/internal/store/postgres/users.go b/internal/store/postgres/users.go new file mode 100644 index 00000000..3cac3225 --- /dev/null +++ b/internal/store/postgres/users.go @@ -0,0 +1,58 @@ +package postgres + +import ( + "context" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// CreateUser inserts a profile and enforces uniqueness inside PostgreSQL. +func (s *Store) CreateUser(ctx context.Context, user dto.UserDTO) (dto.UserDTO, error) { + return s.Register(ctx, user, "") +} + +// Register atomically stores a profile and its password hash. +func (s *Store) Register(ctx context.Context, user dto.UserDTO, passwordHash string) (dto.UserDTO, error) { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + err := s.pool.QueryRow(ctx, `INSERT INTO users(id,username,display_name,password_hash) + VALUES(@id,@username,@display_name,@password_hash) RETURNING created_at`, pgx.StrictNamedArgs{ + "id": user.ID, + "username": user.Username, + "display_name": user.DisplayName, + "password_hash": passwordHash, + }).Scan(&user.CreatedAt) + return user, normalize(err) +} + +// User reads a profile without credentials. +func (s *Store) User(ctx context.Context, id uuid.UUID) (dto.UserDTO, error) { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + var user dto.UserDTO + err := s.pool.QueryRow(ctx, `SELECT id,username,display_name,created_at FROM users WHERE id=@id`, pgx.StrictNamedArgs{"id": id}).Scan(&user.ID, &user.Username, &user.DisplayName, &user.CreatedAt) + return user, normalize(err) +} + +// Credentials reads the account needed for password verification. +func (s *Store) Credentials(ctx context.Context, username string) (dto.UserDTO, string, error) { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + var user dto.UserDTO + var hash string + err := s.pool.QueryRow(ctx, `SELECT id,username,display_name,created_at,password_hash FROM users WHERE username=@username`, pgx.StrictNamedArgs{"username": username}).Scan(&user.ID, &user.Username, &user.DisplayName, &user.CreatedAt, &hash) + return user, hash, normalize(err) +} + +// UsersExist checks all distinct requested identifiers in one bounded query. +func (s *Store) UsersExist(ctx context.Context, ids []uuid.UUID) (bool, error) { + ctx, cancel := context.WithTimeout(ctx, s.timeout) + defer cancel() + var exists bool + err := s.pool.QueryRow(ctx, `SELECT NOT EXISTS (SELECT id FROM unnest(@ids::uuid[]) AS requested(id) + WHERE NOT EXISTS (SELECT 1 FROM users WHERE users.id=requested.id))`, pgx.StrictNamedArgs{"ids": ids}).Scan(&exists) + return exists, normalize(err) +} diff --git a/internal/strictjson/decode.go b/internal/strictjson/decode.go new file mode 100644 index 00000000..366b92d4 --- /dev/null +++ b/internal/strictjson/decode.go @@ -0,0 +1,79 @@ +// Package strictjson decodes objects with an exact set of required, non-null fields. +package strictjson + +import ( + "bytes" + "encoding/json" + "errors" + "io" + "slices" + "unicode/utf8" +) + +// ErrInvalid indicates invalid JSON, encoding, fields or destination field types. +var ErrInvalid = errors.New("invalid JSON object") + +// DecodeObject decodes one UTF-8 object with exactly the listed required fields. +// Duplicate, unknown, missing and null fields are rejected before unmarshaling. +// The destination must describe the supplied fields; this is not a general schema validator. +func DecodeObject(body []byte, target any, requiredFields ...string) error { + if !utf8.Valid(body) { + return ErrInvalid + } + if err := validateObject(body, requiredFields); err != nil { + return err + } + if err := json.Unmarshal(body, target); err != nil { + return ErrInvalid + } + return nil +} + +// validateObject enforces exact, unique, non-null required keys and one JSON value. +// All lab1 request properties are required; this is not a generic schema validator. +func validateObject(body []byte, requiredFields []string) error { + decoder := json.NewDecoder(bytes.NewReader(body)) + token, err := decoder.Token() + if err != nil || token != json.Delim('{') { + return ErrInvalid + } + seen := make(map[string]bool, len(requiredFields)) + for decoder.More() { + key, err := readObjectField(decoder, requiredFields, seen) + if err != nil { + return err + } + seen[key] = true + } + if token, err = decoder.Token(); err != nil || token != json.Delim('}') { + return ErrInvalid + } + if len(seen) != len(requiredFields) { + return ErrInvalid + } + var trailing any + if err := decoder.Decode(&trailing); err != io.EOF { + return ErrInvalid + } + return nil +} + +// readObjectField reads a known, unique, non-null JSON object field. +func readObjectField(decoder *json.Decoder, requiredFields []string, seen map[string]bool) (string, error) { + token, err := decoder.Token() + if err != nil { + return "", ErrInvalid + } + key, ok := token.(string) + if !ok || seen[key] || !slices.Contains(requiredFields, key) { + return "", ErrInvalid + } + var value json.RawMessage + if err := decoder.Decode(&value); err != nil { + return "", ErrInvalid + } + if bytes.Equal(bytes.TrimSpace(value), []byte("null")) { + return "", ErrInvalid + } + return key, nil +} diff --git a/internal/strictjson/decode_test.go b/internal/strictjson/decode_test.go new file mode 100644 index 00000000..5c3b4285 --- /dev/null +++ b/internal/strictjson/decode_test.go @@ -0,0 +1,52 @@ +package strictjson + +import ( + "errors" + "testing" +) + +type input struct { + // Name contains the only accepted field in these fixed-schema tests. + Name string `json:"name"` +} + +// TestDecodeObject checks each fixed-schema rule with a fresh destination. +func TestDecodeObject(t *testing.T) { + cases := []struct { + name string + body string + want string + wantErr error + }{ + {"Positive: Unicode preserved", `{"name":"Алиса 👋"}`, "Алиса 👋", nil}, + {"Negative: missing field", `{}`, "", ErrInvalid}, + {"Negative: unknown field", `{"name":"alice","extra":true}`, "", ErrInvalid}, + {"Negative: duplicate field", `{"name":"alice","name":"bob"}`, "", ErrInvalid}, + {"Negative: case mismatch", `{"Name":"alice"}`, "", ErrInvalid}, + {"Negative: null field", `{"name":null}`, "", ErrInvalid}, + {"Negative: wrong value type", `{"name":12}`, "", ErrInvalid}, + {"Negative: invalid UTF-8", "{\"name\":\"\xff\"}", "", ErrInvalid}, + {"Negative: array root", `[]`, "", ErrInvalid}, + {"Negative: unclosed object", `{"name":"alice"`, "", ErrInvalid}, + {"Negative: invalid value", `{"name":}`, "", ErrInvalid}, + {"Negative: invalid key", `{name:"alice"}`, "", ErrInvalid}, + {"Negative: trailing value", `{"name":"alice"} {}`, "", ErrInvalid}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + // Arrange. + var destination input + + // Act. + err := DecodeObject([]byte(tc.body), &destination, "name") + + // Assert. + if !errors.Is(err, tc.wantErr) { + t.Fatalf("error=%v, want=%v", err, tc.wantErr) + } + if destination.Name != tc.want { + t.Fatalf("decoded name=%q, want=%q", destination.Name, tc.want) + } + }) + } +} diff --git a/internal/valkey/admission.go b/internal/valkey/admission.go new file mode 100644 index 00000000..28cddc45 --- /dev/null +++ b/internal/valkey/admission.go @@ -0,0 +1,132 @@ +package valkey + +import ( + "context" + "fmt" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/admission" +) + +const ( + admissionWindow = time.Second + admissionLease = 30 * time.Second + releaseTimeout = time.Second +) + +// Budget defines a rate window and concurrent execution capacity. +type Budget struct { + // Rate is the maximum attempts per one-second window. + Rate int + // Slots is the maximum requests executing concurrently. + Slots int +} + +// Limits separates global, route-group and user budgets. +type Limits struct { + // Global covers every business request before authentication. + Global Budget + // Groups covers auth, read and write independently. + Groups map[string]Budget + // User covers all authenticated requests made by one account. + User Budget + // UserGroups limits each authenticated account within a route group. + UserGroups map[string]Budget +} + +// Limiter applies atomic local-shard decisions; global reservations precede user reservations. +type Limiter struct { + client *Client + limits Limits +} + +// NewLimiter validates independent rate and concurrency budgets. +func NewLimiter(client *Client, limits Limits) (*Limiter, error) { + if client == nil || limits.Global.Rate < 1 || limits.Global.Slots < 1 || limits.User.Rate < 1 || limits.User.Slots < 1 { + return nil, fmt.Errorf("client and positive budgets are required") + } + for _, group := range []string{"auth", "read", "write"} { + global := limits.Groups[group] + user := limits.UserGroups[group] + if global.Rate < 1 || global.Slots < 1 || user.Rate < 1 || user.Slots < 1 { + return nil, fmt.Errorf("positive budgets for every group are required") + } + } + groups := make(map[string]Budget, len(limits.Groups)) + userGroups := make(map[string]Budget, len(limits.UserGroups)) + for key, value := range limits.Groups { + groups[key] = value + } + for key, value := range limits.UserGroups { + userGroups[key] = value + } + limits.Groups = groups + limits.UserGroups = userGroups + return &Limiter{client: client, limits: limits}, nil +} + +// Enter atomically reserves two rate and slot budgets on one shard. +// Global admission precedes authentication; user admission follows verified identity. +func (l *Limiter) Enter(ctx context.Context, group, user string) (func(), error) { + groupBudget, ok := l.limits.Groups[group] + if !ok { + return nil, fmt.Errorf("unknown admission group") + } + totalBudget := l.limits.Global + node := l.client.coordinator + prefix := "admission:global" + if user != "" { + prefix = "admission:user:" + user + node = l.client.nodes[l.client.ring.Owner(prefix)] + totalBudget = l.limits.User + groupBudget = l.limits.UserGroups[group] + } + keys := []string{prefix + ":rate", prefix + ":slots", prefix + ":" + group + ":rate", prefix + ":" + group + ":slots"} + token := uuid.NewString() + ctx, cancel := context.WithTimeout(ctx, l.client.timeout) + defer cancel() + result, err := node.Eval(ctx, reserveScript, keys, token, admissionWindow.Milliseconds(), admissionLease.Milliseconds(), totalBudget.Rate, totalBudget.Slots, groupBudget.Rate, groupBudget.Slots).Int() + if err != nil { + return nil, err + } + if result == 1 { + return nil, admission.ErrRate + } + if result == 2 { + return nil, admission.ErrSlots + } + return func() { + releaseCtx, releaseCancel := context.WithTimeout(context.Background(), releaseTimeout) + defer releaseCancel() + // Failed release is bounded by the lease; tokens are never reused. + _ = node.Eval(releaseCtx, releaseScript, []string{keys[1], keys[3]}, token).Err() + }, nil +} + +// Redis TIME and one Lua operation make check-and-reserve indivisible within a shard. +const reserveScript = ` +local clock = redis.call('TIME') +local now = clock[1]*1000 + math.floor(clock[2]/1000) +for i=1,3,2 do + redis.call('ZREMRANGEBYSCORE',KEYS[i+1],'-inf',now) + local rate = tonumber(redis.call('GET',KEYS[i]) or '0') + local limitIndex = i==1 and 4 or 6 + if rate >= tonumber(ARGV[limitIndex]) then return 1 end + if redis.call('ZCARD',KEYS[i+1]) >= tonumber(ARGV[limitIndex+1]) then return 2 end +end +for i=1,3,2 do + local count = redis.call('INCR',KEYS[i]) + if count==1 then redis.call('PEXPIRE',KEYS[i],ARGV[2]) end + redis.call('ZADD',KEYS[i+1],now+tonumber(ARGV[3]),ARGV[1]) + redis.call('PEXPIRE',KEYS[i+1],ARGV[3]) +end +return 0 +` + +const releaseScript = ` +redis.call('ZREM',KEYS[1],ARGV[1]) +redis.call('ZREM',KEYS[2],ARGV[1]) +return 0 +` diff --git a/internal/valkey/cache.go b/internal/valkey/cache.go new file mode 100644 index 00000000..a3a407a9 --- /dev/null +++ b/internal/valkey/cache.go @@ -0,0 +1,42 @@ +package valkey + +import ( + "context" + "encoding/json" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +const profileTTL = 5 * time.Minute + +// GetProfile reads an immutable profile; corrupt values and outages are cache misses. +func (c *Client) GetProfile(ctx context.Context, id uuid.UUID) (dto.UserDTO, bool) { + ctx, cancel := context.WithTimeout(ctx, c.timeout) + defer cancel() + key := "profile:" + id.String() + value, err := c.nodes[c.ring.Owner(key)].Get(ctx, key).Bytes() + if err != nil { + return dto.UserDTO{}, false + } + var user dto.UserDTO + if json.Unmarshal(value, &user) != nil || user.ID != id { + return dto.UserDTO{}, false + } + return user, true +} + +// PutProfile populates the immutable profile cache with a bounded TTL. +func (c *Client) PutProfile(ctx context.Context, user dto.UserDTO) { + ctx, cancel := context.WithTimeout(ctx, c.timeout) + defer cancel() + value, err := json.Marshal(user) + if err != nil { + return + } + key := "profile:" + user.ID.String() + // Cache writes are best effort; PostgreSQL remains the source of truth. + _ = c.nodes[c.ring.Owner(key)].Set(ctx, key, value, profileTTL).Err() +} diff --git a/internal/valkey/client.go b/internal/valkey/client.go new file mode 100644 index 00000000..93eb629f --- /dev/null +++ b/internal/valkey/client.go @@ -0,0 +1,113 @@ +// Package valkey implements sharded cache and admission infrastructure. +package valkey + +import ( + "context" + "crypto/sha256" + "encoding/hex" + "errors" + "fmt" + "sort" + "strings" + "time" + + "github.com/redis/go-redis/v9" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/hashring" +) + +const virtualNodes = 256 + +// Options bounds each independent Valkey connection pool. +type Options struct { + // Nodes maps stable shard identities to network addresses. + Nodes map[string]string + // Coordinator identifies the stable global admission shard. + Coordinator string + // Timeout bounds operations and pool acquisition. + Timeout time.Duration + // PoolSize bounds connections to each shard. + PoolSize int +} + +// Client owns a fixed topology; callers must drain before changing it. +type Client struct { + nodes map[string]*redis.Client + ring *hashring.Ring + coordinator *redis.Client + timeout time.Duration + topology string +} + +// New prepares lazy clients without opening network connections. +func New(options Options) (*Client, error) { + if len(options.Nodes) < 1 || options.PoolSize < 1 || options.Timeout <= 0 { + return nil, fmt.Errorf("valkey nodes, pool bound and timeout are required") + } + ids := make([]string, 0, len(options.Nodes)) + for id, address := range options.Nodes { + if address == "" { + return nil, fmt.Errorf("valkey address is required") + } + ids = append(ids, id) + } + ring, err := hashring.New(ids, virtualNodes) + if err != nil { + return nil, err + } + if _, ok := options.Nodes[options.Coordinator]; !ok { + return nil, fmt.Errorf("coordinator must identify a configured node") + } + sort.Strings(ids) + topologyHash := sha256.Sum256([]byte(strings.Join(ids, ","))) + client := &Client{nodes: make(map[string]*redis.Client), ring: ring, timeout: options.Timeout} + for id, address := range options.Nodes { + client.nodes[id] = redis.NewClient(&redis.Options{ + Addr: address, + PoolSize: options.PoolSize, + MaxActiveConns: options.PoolSize, + PoolTimeout: options.Timeout, + DialTimeout: options.Timeout, + ReadTimeout: options.Timeout, + WriteTimeout: options.Timeout, + ContextTimeoutEnabled: true, + MaxRetries: -1, + }) + } + client.topology = hex.EncodeToString(topologyHash[:]) + client.coordinator = client.nodes[options.Coordinator] + return client, nil +} + +// Ping checks every shard required for safe admission. +func (c *Client) Ping(ctx context.Context) error { + ctx, cancel := context.WithTimeout(ctx, c.timeout) + defer cancel() + for _, node := range c.nodes { + if err := node.Ping(ctx).Err(); err != nil { + return err + } + } + stored, err := c.coordinator.Eval(ctx, topologyScript, []string{"admission:topology"}, c.topology).Text() + if err != nil { + return err + } + if stored != c.topology { + return fmt.Errorf("valkey topology differs: stop admission and drain before changing the ring") + } + return nil +} + +const topologyScript = ` +redis.call('SET',KEYS[1],ARGV[1],'NX') +return redis.call('GET',KEYS[1]) +` + +// Close releases every connection pool owned by the client. +func (c *Client) Close() error { + var result error + for _, node := range c.nodes { + result = errors.Join(result, node.Close()) + } + return result +} diff --git a/internal/valkey/client_test.go b/internal/valkey/client_test.go new file mode 100644 index 00000000..5abe3992 --- /dev/null +++ b/internal/valkey/client_test.go @@ -0,0 +1,247 @@ +package valkey + +import ( + "context" + "errors" + "os" + "sync" + "sync/atomic" + "testing" + "time" + + "github.com/google/uuid" + + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/admission" + "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/model/dto" +) + +// testClient connects only to explicitly configured disposable Valkey shards. +func testClient(t *testing.T) *Client { + t.Helper() + address := os.Getenv("TEST_VALKEY_ADDRESS") + if address == "" { + t.Skip("TEST_VALKEY_ADDRESS is required for Valkey integration tests") + } + client, err := New(Options{Nodes: map[string]string{"test": address}, Coordinator: "test", PoolSize: 16, Timeout: time.Second}) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { + if err := client.Close(); err != nil { + t.Error(err) + } + }) + if err := client.Ping(t.Context()); err != nil { + t.Fatal(err) + } + return client +} + +// testLimits builds independent small budgets for admission scenarios. +func testLimits() Limits { + return Limits{ + Global: Budget{Rate: 10000, Slots: 100}, + User: Budget{Rate: 1000, Slots: 3}, + Groups: map[string]Budget{ + "auth": {Rate: 100, Slots: 4}, + "read": {Rate: 1000, Slots: 50}, + "write": {Rate: 1000, Slots: 50}, + }, + UserGroups: map[string]Budget{ + "auth": {Rate: 10, Slots: 1}, + "read": {Rate: 100, Slots: 2}, + "write": {Rate: 100, Slots: 2}, + }, + } +} + +// TestPerUserSlotsAreAtomic verifies concurrent reservations cannot exceed the group budget. +func TestPerUserSlotsAreAtomic(t *testing.T) { + client := testClient(t) + limiter, err := NewLimiter(client, testLimits()) + if err != nil { + t.Fatal(err) + } + user := uuid.NewString() + var accepted atomic.Int32 + releases := make(chan func(), 30) + failures := make(chan error, 30) + var wg sync.WaitGroup + for range 30 { + wg.Go(func() { + release, err := limiter.Enter(t.Context(), "read", user) + if err == nil { + accepted.Add(1) + releases <- release + } else if !errors.Is(err, admission.ErrSlots) { + failures <- err + } + }) + } + wg.Wait() + close(releases) + close(failures) + for release := range releases { + release() + } + for err := range failures { + t.Error(err) + } + if accepted.Load() != 2 { + t.Fatalf("accepted %d, want exactly two", accepted.Load()) + } +} + +// TestUserGroupsHaveSeparateSlots verifies read saturation does not consume write-group capacity. +func TestUserGroupsHaveSeparateSlots(t *testing.T) { + client := testClient(t) + limiter, err := NewLimiter(client, testLimits()) + if err != nil { + t.Fatal(err) + } + user := uuid.NewString() + for range 2 { + release, err := limiter.Enter(t.Context(), "read", user) + if err != nil { + t.Fatal(err) + } + t.Cleanup(release) + } + release, err := limiter.Enter(t.Context(), "write", user) + if err != nil { + t.Fatal(err) + } + release() +} + +// TestUserRateSurvivesSlotRelease checks that release returns concurrency but not rate tokens. +func TestUserRateSurvivesSlotRelease(t *testing.T) { + client := testClient(t) + limits := testLimits() + limits.User.Rate = 1 + limiter, err := NewLimiter(client, limits) + if err != nil { + t.Fatal(err) + } + user := uuid.NewString() + release, err := limiter.Enter(t.Context(), "read", user) + if err != nil { + t.Fatal(err) + } + release() + if _, err := limiter.Enter(t.Context(), "read", user); !errors.Is(err, admission.ErrRate) { + t.Fatalf("rate budget reset after release: %v", err) + } +} + +// TestAdmissionRejectsUnavailableBackend verifies fail-closed behavior without network fallback. +func TestAdmissionRejectsUnavailableBackend(t *testing.T) { + client := testClient(t) + limiter, err := NewLimiter(client, testLimits()) + if err != nil { + t.Fatal(err) + } + ctx, cancel := context.WithCancel(t.Context()) + cancel() + if _, err := limiter.Enter(ctx, "read", ""); err == nil { + t.Fatal("canceled backend operation admitted request") + } +} + +// TestGlobalAdmissionReleasesSlots verifies the coordinator path and release semantics. +func TestGlobalAdmissionReleasesSlots(t *testing.T) { + client := testClient(t) + limiter, err := NewLimiter(client, testLimits()) + if err != nil { + t.Fatal(err) + } + release, err := limiter.Enter(t.Context(), "read", "") + if err != nil { + t.Fatal(err) + } + release() +} + +// TestProfileRoundTrip checks storage and ownership of immutable cached profiles. +func TestProfileRoundTrip(t *testing.T) { + client := testClient(t) + user := dto.UserDTO{ID: uuid.New(), Username: "synthetic", DisplayName: "Test", CreatedAt: time.Now().UTC()} + client.PutProfile(t.Context(), user) + got, ok := client.GetProfile(t.Context(), user.ID) + if !ok || got.ID != user.ID || got.Username != user.Username { + t.Fatal("profile cache did not preserve account") + } +} + +// TestProfileMissHandlesCorruption verifies corrupt cache entries cannot impersonate another account. +func TestProfileMissHandlesCorruption(t *testing.T) { + client := testClient(t) + id := uuid.New() + key := "profile:" + id.String() + if err := client.nodes[client.ring.Owner(key)].Set(t.Context(), key, `{"ID":"00000000-0000-0000-0000-000000000000"}`, time.Minute).Err(); err != nil { + t.Fatal(err) + } + if _, ok := client.GetProfile(t.Context(), id); ok { + t.Fatal("corrupt profile accepted") + } +} + +// TestProfileBackendFailureIsMiss checks optional-cache fallback semantics. +func TestProfileBackendFailureIsMiss(t *testing.T) { + client := testClient(t) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + if _, ok := client.GetProfile(ctx, uuid.New()); ok { + t.Fatal("failed cache read treated as hit") + } + client.PutProfile(ctx, dto.UserDTO{ID: uuid.New()}) + if err := client.Ping(ctx); err == nil { + t.Fatal("canceled readiness succeeded") + } +} + +// TestClientRejectsInvalidConfiguration covers configuration boundaries without opening sockets. +func TestClientRejectsInvalidConfiguration(t *testing.T) { + cases := []Options{ + {}, + {Nodes: map[string]string{"a": ""}, Coordinator: "a", PoolSize: 1, Timeout: time.Second}, + {Nodes: map[string]string{"": "localhost:6379"}, Coordinator: "", PoolSize: 1, Timeout: time.Second}, + {Nodes: map[string]string{"a": "localhost:6379"}, Coordinator: "b", PoolSize: 1, Timeout: time.Second}, + } + for index, options := range cases { + t.Run(string(rune('a'+index)), func(t *testing.T) { + if _, err := New(options); err == nil { + t.Fatal("invalid client options accepted") + } + }) + } +} + +// TestLimiterRejectsInvalidConfiguration verifies policy completeness. +func TestLimiterRejectsInvalidConfiguration(t *testing.T) { + if _, err := NewLimiter(nil, testLimits()); err == nil { + t.Fatal("nil client accepted") + } + client := testClient(t) + limits := testLimits() + delete(limits.Groups, "auth") + if _, err := NewLimiter(client, limits); err == nil { + t.Fatal("missing group accepted") + } + limiter, err := NewLimiter(client, testLimits()) + if err != nil { + t.Fatal(err) + } + if _, err := limiter.Enter(t.Context(), "unknown", ""); err == nil { + t.Fatal("unknown group accepted") + } +} + +// TestTopologyMismatchFailsClosed prevents replicas from silently splitting user budgets. +func TestTopologyMismatchFailsClosed(t *testing.T) { + client := testClient(t) + client.topology = "different-ring" + if err := client.Ping(t.Context()); err == nil { + t.Fatal("incompatible topology accepted") + } +} diff --git a/scripts/coverage.awk b/scripts/coverage.awk new file mode 100644 index 00000000..982f844f --- /dev/null +++ b/scripts/coverage.awk @@ -0,0 +1,35 @@ +# Aggregate covered statements once per merged block; keep files with no statements as N/A. +FNR == NR { + split($0, fields, "\t") + paths[fields[1]] = fields[2] + hashes[fields[1]] = fields[3] + executable[fields[1]] = fields[4] + next +} +/^mode:/ { next } +{ + file = $1 + sub(/:[^:]*$/, "", file) + if (!(file in paths)) { + print "unknown coverage source: " file > "/dev/stderr" + invalid = 1 + } + total[file] += $2 + if ($3 > 0) covered[file] += $2 +} +END { + print "{\"threshold_per_file\":90,\"files\":[" > summary + separator = "" + for (file in paths) { + percent = total[file] ? sprintf("%.8f", covered[file] * 100 / total[file]) : "null" + printf "%s{\"file\":\"%s\",\"statements\":%d,\"covered\":%d,\"percent\":%s,\"sha256\":\"%s\"}", separator, paths[file], total[file], covered[file], percent, hashes[file] > summary + separator = ",\n" + printf "%8s %s\n", (total[file] ? sprintf("%.2f%%", covered[file] * 100 / total[file]) : "N/A"), paths[file] + if (covered[file] * 100 < total[file] * 90 || (executable[file] && !total[file])) invalid = 1 + } + printf "\n],\"passed\":%s}\n", (invalid ? "false" : "true") > summary + if (invalid) { + print "FAIL: per-file coverage must reach 90%" > "/dev/stderr" + exit 1 + } +} diff --git a/scripts/coverage.sh b/scripts/coverage.sh new file mode 100755 index 00000000..cfc5cb9f --- /dev/null +++ b/scripts/coverage.sh @@ -0,0 +1,83 @@ +#!/bin/sh +# Measure unit and real-process coverage, enforcing 90% separately for each Go source file. +set -eu +cd "$(dirname "$0")/.." +GO=${GO:-go} +: "${DATABASE_URL:?Use an isolated test database}" "${VALKEY_SHARDS:?Use test shards}" +: "${TEST_DATABASE_URL:?Use an isolated test database}" "${TEST_VALKEY_ADDRESS:?Use a test shard}" +export APP_PORT=${COVERAGE_PORT:-18080} +export LOG_LEVEL=error +export CURSOR_SIGNING_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= +server_pid= +watchdog_pid= +mkdir -p coverage +run_dir=$(mktemp -d "$PWD/coverage/run.XXXXXX") +cleanup() { + if [ -n "$server_pid" ]; then kill "$server_pid" 2>/dev/null || true; wait "$server_pid" 2>/dev/null || true; fi + if [ -n "$watchdog_pid" ]; then kill "$watchdog_pid" 2>/dev/null || true; wait "$watchdog_pid" 2>/dev/null || true; fi + rm -rf "$run_dir" +} +trap cleanup EXIT +trap 'exit 129' HUP +trap 'exit 130' INT +trap 'exit 143' TERM +mkdir "$run_dir/process" +"$GO" build -race -cover -covermode=atomic -coverpkg=./... -o "$run_dir/server" ./cmd/server +"$run_dir/server" migrate +"$GO" test -race -coverpkg=./... -coverprofile="$run_dir/unit.out" ./... +export GOCOVERDIR="$run_dir/process" +if "$run_dir/server" unknown >"$run_dir/server-invalid.log" 2>&1; then + echo 'server accepted an unknown command' >&2 + exit 1 +else + test "$?" -eq 1 +fi +"$run_dir/server" >"$run_dir/server.log" 2>&1 & +server_pid=$! +ready=false +for attempt in $(seq 1 60); do + kill -0 "$server_pid" 2>/dev/null || { cat "$run_dir/server.log"; exit 1; } + if curl --fail --silent --max-time 1 "http://localhost:$APP_PORT/health/ready" >/dev/null; then ready=true; break; fi + sleep .25 +done +$ready || { cat "$run_dir/server.log"; exit 1; } +"$run_dir/server" healthcheck +"$run_dir/server" migrate +"${PYTHON:-python3}" tests/smoke.py --base-url "http://localhost:$APP_PORT" +kill -TERM "$server_pid" +# Bound the real-process shutdown check; a forced kill makes wait fail. +(sleep 12; kill -KILL "$server_pid" 2>/dev/null || true) & +watchdog_pid=$! +wait "$server_pid" +server_pid= +kill "$watchdog_pid" 2>/dev/null || true +wait "$watchdog_pid" 2>/dev/null || true +watchdog_pid= +unset GOCOVERDIR +"$GO" tool covdata textfmt -i="$run_dir/process" -o="$run_dir/process.out" +awk ' +/^mode:/ { if ($0 != "mode: atomic") exit 1; next } +{ + if (($1 in statements) && statements[$1] != $2) exit 1; + statements[$1] = $2; hits[$1] += $3 +} +END { + print "mode: atomic"; + for (block in statements) print block, statements[block], hits[block] +}' "$run_dir/unit.out" "$run_dir/process.out" > coverage/coverage.out +"$GO" list -f '{{.ImportPath}} {{.Dir}} {{join .GoFiles ","}}' ./... > "$run_dir/packages.txt" +: > "$run_dir/inventory.tsv" +while read -r import_path directory names; do + old_ifs=$IFS + IFS=, + for name in $names; do + checksum=$(shasum -a 256 "$directory/$name") + checksum=${checksum%% *} + relative=${directory#"$PWD/"}/$name + executable=$(awk '/^func[ (]/ {found=1} END {print found+0}' "$directory/$name") + printf '%s\t%s\t%s\t%s\n' "$import_path/$name" "$relative" "$checksum" "$executable" >> "$run_dir/inventory.tsv" + done + IFS=$old_ifs +done < "$run_dir/packages.txt" +awk -v summary=coverage/summary.json -f scripts/coverage.awk "$run_dir/inventory.tsv" coverage/coverage.out +"$GO" version > coverage/go-version.txt diff --git a/scripts/experiment.sh b/scripts/experiment.sh new file mode 100755 index 00000000..159ef282 --- /dev/null +++ b/scripts/experiment.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# Measure replica budgets, load saturation and a pool-size A/B using the same workload. +set -eu +cd "$(dirname "$0")/.." +: "${KUBE_CONTEXT:=dev}" "${NAMESPACE:=highload-applications}" "${RELEASE:=lab2}" +: "${DURATION:=30}" "${VUS:=32}" +: "${EVIDENCE_DIR:=evidence/research-$(date -u +%Y%m%d%H%M%S)}" +helm_apply_mode= +if helm upgrade --help | rg -q -- '--server-side'; then helm_apply_mode=--server-side=false; fi +export KUBE_CONTEXT NAMESPACE DURATION VUS EVIDENCE_DIR +mkdir -p "$EVIDENCE_DIR" +helm get values "$RELEASE" --kube-context "$KUBE_CONTEXT" -n "$NAMESPACE" -o yaml > "$EVIDENCE_DIR/restore-values.yaml" +restore() { + helm upgrade $helm_apply_mode "$RELEASE" charts/messenger --kube-context "$KUBE_CONTEXT" -n "$NAMESPACE" -f "$EVIDENCE_DIR/restore-values.yaml" --wait --wait-for-jobs --timeout 240s > "$EVIDENCE_DIR/restore.txt" 2>&1 +} +trap restore EXIT +trap 'exit 130' INT +trap 'exit 143' TERM +helm upgrade $helm_apply_mode "$RELEASE" charts/messenger --kube-context "$KUBE_CONTEXT" -n "$NAMESPACE" --reuse-values --set autoscaling.enabled=false --wait --wait-for-jobs --timeout 240s > "$EVIDENCE_DIR/disable-hpa.txt" +# Allow an already-running HPA reconciliation to finish before changing replicas. +sleep 16 +date -u '+%Y-%m-%dT%H:%M:%SZ' > "$EVIDENCE_DIR/date.txt" +git rev-parse HEAD > "$EVIDENCE_DIR/base-revision.txt" +shasum -a 256 student-tests/load/scaling.js charts/messenger/values.yaml internal/controller/http/fiber/errors.go > "$EVIDENCE_DIR/source.sha256" +kubectl --context "$KUBE_CONTEXT" get nodes -o wide > "$EVIDENCE_DIR/nodes.txt" +printf 'profile,run,replicas,cpu_millicores_per_replica,memory_mib_per_replica,pool,vus,duration\n' > "$EVIDENCE_DIR/profiles.csv" +for profile in ${PROFILES:-fixed1 fixed2 fixed4 growing1 growing2 growing4 saturation8 saturation64 single32a single8b single32b}; do + pool=8; vus=$VUS; probe_timeout=2; probe_failures=2 + case "$profile" in + fixed1) replicas=1; cpu=1000; memory=512 ;; + fixed2) replicas=2; cpu=500; memory=256 ;; + fixed4|growing4|pool8b) replicas=4; cpu=250; memory=128 ;; + growing1) replicas=1; cpu=250; memory=128 ;; + growing2) replicas=2; cpu=250; memory=128 ;; + saturation8) replicas=1; cpu=1000; memory=512; vus=8 ;; + saturation64) replicas=1; cpu=1000; memory=512; vus=64 ;; + resource-low-a|resource-low-b) replicas=2; cpu=250; memory=128 ;; + resource-high-a|resource-high-b) replicas=2; cpu=500; memory=256 ;; + probe2a|probe2b) replicas=1; cpu=1000; memory=512 ;; + probe5a|probe5b) replicas=1; cpu=1000; memory=512; probe_timeout=5; probe_failures=1 ;; + single8a|single8b) replicas=1; cpu=1000; memory=512 ;; + single32a|single32b) replicas=1; cpu=1000; memory=512; pool=32 ;; + pool32a|pool32b) replicas=4; cpu=250; memory=128; pool=32 ;; + *) echo "Unknown profile $profile" >&2; exit 2 ;; + esac + set -- + if [ -n "${BENCHMARK_NODE:-}" ]; then + set -- --set-json "api.nodeSelector={\"kubernetes.io/hostname\":\"$BENCHMARK_NODE\"}" + fi + run="$profile-$(date -u +%Y%m%d%H%M%S)" + helm upgrade $helm_apply_mode "$RELEASE" charts/messenger --kube-context "$KUBE_CONTEXT" -n "$NAMESPACE" --reuse-values --set autoscaling.enabled=false --set "api.replicas=$replicas" --set "api.resources.requests.cpu=${cpu}m,api.resources.limits.cpu=${cpu}m,api.resources.requests.memory=${memory}Mi,api.resources.limits.memory=${memory}Mi" --set-string api.env.GOMEMLIMIT=80MiB --set-string "api.env.DEPENDENCY_POOL_SIZE=$pool" --set "api.readiness.timeoutSeconds=$probe_timeout,api.readiness.failureThreshold=$probe_failures" "$@" --wait --wait-for-jobs --timeout 240s > "$EVIDENCE_DIR/rollout-$profile.txt" + # Let old admission leases expire after rolling replacement. + sleep 31 + printf '%s,%s,%s,%s,%s,%s,%s,%s\n' "$profile" "$run" "$replicas" "$cpu" "$memory" "$pool" "$vus" "$DURATION" >> "$EVIDENCE_DIR/profiles.csv" + RUN="$run" VUS="$vus" scripts/run-load.sh +done diff --git a/scripts/init-secrets.sh b/scripts/init-secrets.sh new file mode 100755 index 00000000..2fa990a2 --- /dev/null +++ b/scripts/init-secrets.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# Create lab credentials once, outside Helm values and release history. +set -eu +: "${KUBE_CONTEXT:=dev}" "${NAMESPACE:=highload-applications}" +: "${REGISTRY:=asisti.registry.twcstorage.ru}" "${REGISTRY_USER:=token}" +: "${REGISTRY_TOKEN_FILE:=$HOME/.secrets/twc-registry-token}" +test -s "$REGISTRY_TOKEN_FILE" || { echo 'Registry token file is missing or empty' >&2; exit 1; } +umask 077 +work=$(mktemp -d) +trap 'rm -rf "$work"' EXIT +kubectl --context "$KUBE_CONTEXT" create namespace "$NAMESPACE" --dry-run=client -o yaml | kubectl --context "$KUBE_CONTEXT" apply -f - +if ! kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get secret messenger-secrets >/dev/null 2>&1; then + openssl rand -hex 32 | tr -d '\n' > "$work/postgres-password" + printf 'postgres://messenger:%s@postgres:5432/messenger?sslmode=disable' "$(cat "$work/postgres-password")" > "$work/database-url" + openssl rand -base64 32 | tr -d '\n' > "$work/cursor-key" + kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" create secret generic messenger-secrets --from-file="$work/postgres-password" --from-file="$work/database-url" --from-file="$work/cursor-key" +fi +# Add the shared cursor key to an existing lab2 secret without replacing database credentials. +if ! kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get secret messenger-secrets -o json | jq -e '.data["cursor-key"] | length > 0' >/dev/null; then + openssl rand -base64 32 | tr -d '\n' > "$work/cursor-key" + jq -n --rawfile key "$work/cursor-key" '{stringData:{"cursor-key":$key}}' > "$work/patch.json" + kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" patch secret messenger-secrets --type merge --patch-file "$work/patch.json" +fi +# Build a portable Docker config; macOS credential-helper references cannot be used by kubelet. +jq -n --arg registry "$REGISTRY" --arg user "$REGISTRY_USER" --rawfile token "$REGISTRY_TOKEN_FILE" \ + '{auths:{($registry):{auth:(($user+":"+($token | sub("[\\r\\n]+$"; "")))|@base64)}}}' > "$work/config.json" +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" create secret generic registry-pull \ + --type=kubernetes.io/dockerconfigjson --from-file=".dockerconfigjson=$work/config.json" \ + --dry-run=client -o yaml | kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" apply -f - diff --git a/scripts/plot-research.py b/scripts/plot-research.py new file mode 100644 index 00000000..dffe83da --- /dev/null +++ b/scripts/plot-research.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +"""Summarize measured k6 counters and plot reproducible research figures.""" +import csv +import json +from pathlib import Path +import sys +import matplotlib +matplotlib.use("Agg") +import matplotlib.pyplot as plt + +roots = [Path(arg) for arg in sys.argv[1:]] +def resource_peaks(root, run): + """resource_peaks aggregates five-second samples, including setup and warmup.""" + path = root / ("resources-" + run + ".txt") + lines = path.read_text().splitlines() + pod_snapshot = root / ("pods-" + run + ".txt") + if pod_snapshot.exists(): + api_pods = {line.split()[0] for line in pod_snapshot.read_text().splitlines() if line.startswith("api-") and "Running" in line} + else: + api_pods = set() + block = set() + for line in lines + ["UTC END"]: + if line.startswith("UTC "): + if block: + api_pods = block + block = set() + elif line.startswith("api-"): + block.add(line.split()[0]) + peaks = dict(api_cpu_m=0, postgres_cpu_m=0, valkey_cpu_m=0, load_cpu_m=0, api_memory_mib=0, postgres_memory_mib=0, pg_active=0, pg_idle_transaction=0, pg_lock_waiters=0) + sample = dict.fromkeys(peaks, 0) + for line in lines + ["UTC END"]: + if line.startswith("UTC "): + for key in peaks: + peaks[key] = max(peaks[key], sample[key]) + sample = dict.fromkeys(peaks, 0) + continue + fields = line.split() + if len(fields) == 3 and fields[0].startswith(("api-", "postgres-", "valkey-", "load-")): + role = fields[0].split("-")[0] + if role == "api" and fields[0] not in api_pods: + continue + if role == "load" and not fields[0].startswith("load-" + run + "-"): + continue + cpu = float(fields[1][:-1]) if fields[1].endswith("m") else float(fields[1]) * 1000 + memory = float(fields[2][:-2]) * (1024 if fields[2].endswith("Gi") else 1) + sample[role + "_cpu_m"] += cpu + if role in ("api", "postgres"): + sample[role + "_memory_mib"] += memory + if line.startswith("active|"): + sample["pg_active"] += int(line.split("|")[-1]) + if line.startswith("idle in transaction|"): + sample["pg_idle_transaction"] += int(line.split("|")[-1]) + if "|Lock|" in line: + sample["pg_lock_waiters"] += int(line.split("|")[-1]) + return peaks + +rows = [] + +excluded = [] +for root in roots: + for profile in csv.DictReader((root / "profiles.csv").open()): + deployment = root / ("deployment-" + profile["run"] + ".json") + if deployment.exists() and json.loads(deployment.read_text())["spec"]["replicas"] != int(profile["replicas"]): + excluded.append(str(deployment) + " (replica mismatch)") + continue + source = root / ("load-" + profile["run"] + ".json") + if not source.exists(): + excluded.append(str(source)) + continue + result = json.loads(source.read_text()) + metrics = result["summary"]["metrics"] + if "message_latency_ms" not in metrics: + excluded.append(str(source)) + continue + def value(name, key="count"): + """value reads a measured metric, using zero for an absent error counter.""" + return metrics.get(name, {}).get("values", {}).get(key, 0) + latency = metrics["message_latency_ms"]["values"] + seconds = int(profile["duration"]) + operations = value("measured_operations") + rows.append(dict(profile, source=str(root), confirmed=value("confirmed_messages"), + rps=value("confirmed_messages") / seconds, + errors=value("application_errors"), + error_percent=100 * value("application_errors") / max(operations, 1), + p50_ms=latency["p(50)"], p95_ms=latency["p(95)"], + p99_ms=latency["p(99)"], + rejected_429=value("application_errors{status:429}"), + unavailable_503=value("application_errors{status:503}"), + network_errors=value("application_errors{status:0}"), **resource_peaks(root, profile["run"]))) +output = roots[0] +with (output / "summary.csv").open("w") as stream: + writer = csv.DictWriter(stream, fieldnames=list(rows[0])) + writer.writeheader() + writer.writerows(rows) +(output / "excluded.json").write_text(json.dumps(excluded, indent=2)+"\n") +fig, axes = plt.subplots(3, 1, figsize=(13, 11), constrained_layout=True) +names = [row["profile"] for row in rows] +for axis, field, label in zip(axes, ["rps", "p95_ms", "error_percent"], + ["Confirmed messages / second", "Write attempt p95, ms", "Failed operations, %"]): + axis.bar(names, [row[field] for row in rows], color="#267c75") + axis.set_ylabel(label) + axis.grid(axis="y", alpha=0.25) + axis.tick_params(axis="x", rotation=35) +fig.suptitle("Lab 3: measured replica budgets and pool-size experiment") +fig.savefig(output / "results.png", dpi=160) +fig.savefig(output / "results.svg") +plt.close(fig) +by_name = {row["profile"]: row for row in rows} +if all(f"{series}{n}" in by_name for series in ["fixed", "growing"] for n in [1, 2, 4]): + fig, axes = plt.subplots(1, 2, figsize=(11, 4), constrained_layout=True) + for series, label in [("fixed", "Fixed total CPU/RAM"), ("growing", "Growing total CPU/RAM")]: + for axis, field, ylabel in zip(axes, ["rps", "error_percent"], ["Confirmed messages / second", "Failed operations, %"]): + axis.plot([1, 2, 4], [by_name[f"{series}{n}"][field] for n in [1, 2, 4]], marker="o", label=label) + axis.set(xlabel="API replicas", ylabel=ylabel, xticks=[1, 2, 4]) + axis.grid(alpha=0.25) + axis.legend() + fig.savefig(output / "matrix.png", dpi=160) + fig.savefig(output / "matrix.svg") +print(json.dumps(rows, indent=2)) diff --git a/scripts/port-forward.sh b/scripts/port-forward.sh new file mode 100755 index 00000000..e8d7d132 --- /dev/null +++ b/scripts/port-forward.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Reconnect the loopback tunnel after the API pod is replaced during restart tests. +set -eu +: "${KUBE_CONTEXT:=dev}" "${NAMESPACE:=highload-applications}" +LOCAL_PORT=${LOCAL_PORT:-8083} +child= +cleanup() { + if [ -n "$child" ]; then + kill "$child" 2>/dev/null || true + wait "$child" 2>/dev/null || true + fi + exit 0 +} +trap cleanup INT TERM +while :; do + kubectl --context "$KUBE_CONTEXT" -n traefik port-forward service/traefik "$LOCAL_PORT:80" --address 127.0.0.1 & + child=$! + wait "$child" || true + child= + sleep 1 +done diff --git a/scripts/research.sh b/scripts/research.sh new file mode 100755 index 00000000..4728cc61 --- /dev/null +++ b/scripts/research.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# Run the SQL experiment in a fresh disposable container, never the deployed DB. +set -eu +cd "$(dirname "$0")/.." +mkdir -p evidence +work=$(mktemp -d) +container= +cleanup() { + if [ -n "$container" ]; then docker rm -f "$container" >/dev/null; fi + rm -rf "$work" +} +trap cleanup EXIT +container=$(docker run -d --label purpose=lab2-research --memory=512m --cpus=1 -e POSTGRES_HOST_AUTH_METHOD=trust postgres:17.6-alpine) +for attempt in $(seq 1 60); do + if docker exec "$container" pg_isready -U postgres >/dev/null 2>&1; then break; fi + sleep 1 +done +docker exec "$container" createdb -U postgres messenger +docker exec -i "$container" psql -X -v ON_ERROR_STOP=1 -U postgres -d messenger < internal/store/postgres/migrations/001_initial.sql > /dev/null +docker cp student-tests/plans.sql "$container:/tmp/plans.sql" >/dev/null +{ + date -u '+UTC: %Y-%m-%dT%H:%M:%SZ' + echo 'Hypothesis: composite index improves late-page reads, with additional write cost.' + echo '100000 rows, distribution 90/9/1%; three reads and 1000-row rollback writes per index.' + echo 'Limits: 1 CPU, 512MiB; single local Docker instance; no concurrent writes or PITR.' + docker inspect --format 'Image: {{.Image}}' "$container" + git ls-files --cached --others --exclude-standard cmd internal student-tests/research.sql student-tests/plans.sql scripts/research.sh | sort | while read -r file; do shasum -a 256 "$file"; done + docker exec -i "$container" psql -XAt -v ON_ERROR_STOP=1 -U postgres -d messenger < student-tests/research.sql +} > evidence/sql-research-helm.txt +# Use the actual schema, all table contents, and a fresh target database. +query="SELECT count(*),md5(string_agg(id||':'||chat_id||':'||sender_id||':'||text||':'||created_at,',' ORDER BY id)) FROM messages" +docker exec "$container" psql -XAt -U postgres -d messenger -c "$query" > "$work/before" +{ time docker exec "$container" pg_dump -U postgres -d messenger --no-owner --no-acl > "$work/dump.sql"; } 2>> evidence/sql-research-helm.txt +docker exec "$container" createdb -U postgres restored +{ time docker exec -i "$container" psql -X -v ON_ERROR_STOP=1 -U postgres -d restored < "$work/dump.sql" > /dev/null; } 2>> evidence/sql-research-helm.txt +docker exec "$container" psql -XAt -U postgres -d restored -c "$query" > "$work/after" +diff -u "$work/before" "$work/after" +{ + echo 'PASS: restore row count and checksum match' + cat "$work/after" + wc -c < "$work/dump.sql" + docker exec "$container" psql -X -U postgres -d restored -c "SELECT id,text FROM messages WHERE id IN(md5('1')::uuid,md5('50000')::uuid,md5('100000')::uuid) ORDER BY id" +} >> evidence/sql-research-helm.txt +echo 'PASS: evidence/sql-research-helm.txt' diff --git a/scripts/restart.sh b/scripts/restart.sh new file mode 100755 index 00000000..5b5a9a3b --- /dev/null +++ b/scripts/restart.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Restart only this lab's API and persistent stores, retaining every PVC. +set -eu +: "${KUBE_CONTEXT:=dev}" "${NAMESPACE:=highload-applications}" +replicas=$(kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get deployment api -o jsonpath='{.spec.replicas}') +mkdir -p evidence +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods -l 'app in (api,postgres,valkey)' -o custom-columns=NAME:.metadata.name,UID:.metadata.uid > evidence/restart-before.txt +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" scale deployment/api --replicas=0 +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" wait --for=delete pod -l app=api --timeout=60s +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" rollout restart statefulset/postgres statefulset/valkey +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" rollout status statefulset/postgres --timeout=120s +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" rollout status statefulset/valkey --timeout=120s +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" scale deployment/api --replicas="$replicas" +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" rollout status deployment/api --timeout=120s +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods -l 'app in (api,postgres,valkey)' -o custom-columns=NAME:.metadata.name,UID:.metadata.uid > evidence/restart-after.txt diff --git a/scripts/run-load.sh b/scripts/run-load.sh new file mode 100755 index 00000000..e494750f --- /dev/null +++ b/scripts/run-load.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# Run the pinned k6 workload inside the cluster and retain raw results and resource samples. +set -eu +cd "$(dirname "$0")/.." +: "${KUBE_CONTEXT:=dev}" "${NAMESPACE:=highload-applications}" +: "${RUN:=manual-$(date -u +%Y%m%d%H%M%S)}" "${DURATION:=30}" "${VUS:=32}" "${LOAD_SCRIPT:=scaling.js}" +case "$RUN" in *[!a-z0-9-]*|'') echo 'RUN must be a DNS label' >&2; exit 2 ;; esac +EVIDENCE_DIR=${EVIDENCE_DIR:-evidence} +mkdir -p "$EVIDENCE_DIR" +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get deployment api -o json > "$EVIDENCE_DIR/deployment-$RUN.json" +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods -l app=api -o wide > "$EVIDENCE_DIR/pods-$RUN.txt" +helm get values lab2 --kube-context "$KUBE_CONTEXT" -n "$NAMESPACE" -o json > "$EVIDENCE_DIR/values-$RUN.json" +if jq -e '.autoscaling.enabled == false' "$EVIDENCE_DIR/values-$RUN.json" >/dev/null; then + expected=$(jq -r .api.replicas "$EVIDENCE_DIR/values-$RUN.json") + actual=$(jq -r .spec.replicas "$EVIDENCE_DIR/deployment-$RUN.json") + test "$expected" = "$actual" || { echo "Replica mismatch: expected $expected, actual $actual" >&2; exit 1; } +fi +manifest=$(mktemp) +complete=false +created=false +sampler= +cleanup() { + if [ -n "$sampler" ]; then kill "$sampler" 2>/dev/null || true; wait "$sampler" 2>/dev/null || true; fi + if ! $complete && $created; then + kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" delete "job/load-$RUN" --ignore-not-found --wait=true --timeout=60s >/dev/null || true + fi + rm -f "$manifest" +} +trap cleanup EXIT +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" create configmap load-scripts --from-file=student-tests/load/ --dry-run=client -o yaml | kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" apply -f - +helm template lab2 charts/messenger -n "$NAMESPACE" -s templates/load.yaml --set load.enabled=true --set-string "load.run=$RUN" --set-string "load.script=$LOAD_SCRIPT" --set "load.duration=$DURATION" --set "load.vus=$VUS" --set-string "load.target=${TARGET_INSTANCE_ID:-}" > "$manifest" +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" apply -f "$manifest" +created=true +( + while :; do + date -u '+UTC %Y-%m-%dT%H:%M:%SZ' + kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" top pods -l 'app in (api,lb,postgres,valkey,load)' || true + kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" exec postgres-0 -- psql -U messenger -d messenger -Atc "SELECT state,wait_event_type,wait_event,count(*) FROM pg_stat_activity WHERE datname='messenger' GROUP BY state,wait_event_type,wait_event" || true + sleep 5 + done +) > "$EVIDENCE_DIR/resources-$RUN.txt" 2>&1 & +sampler=$! +complete=false +for attempt in $(seq 1 140); do + if ! state=$(kubectl --context "$KUBE_CONTEXT" --request-timeout=10s -n "$NAMESPACE" get "job/load-$RUN" -o json); then + sleep 2 + continue + fi + if printf '%s' "$state" | jq -e '.status.succeeded > 0' >/dev/null; then complete=true; break; fi + if printf '%s' "$state" | jq -e '.status.failed > 0' >/dev/null; then break; fi + sleep 2 +done +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" logs "job/load-$RUN" > "$EVIDENCE_DIR/load-$RUN.txt" +$complete || { echo "Load failed; inspect $EVIDENCE_DIR/load-$RUN.txt" >&2; exit 1; } +if [ "$LOAD_SCRIPT" = scaling.js ]; then + jq -R 'fromjson? | select(has("profile"))' "$EVIDENCE_DIR/load-$RUN.txt" > "$EVIDENCE_DIR/load-$RUN.json" + test -s "$EVIDENCE_DIR/load-$RUN.json" +fi diff --git a/scripts/sample-admission.sh b/scripts/sample-admission.sh new file mode 100755 index 00000000..458837f3 --- /dev/null +++ b/scripts/sample-admission.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -eu +trap 'exit 0' TERM INT +for sample in $(seq 1 180); do + date -u '+UTC %Y-%m-%dT%H:%M:%SZ' + kubectl --context dev --request-timeout=10s -n highload-applications exec valkey-0 -- valkey-cli EVAL "local t=redis.call('TIME'); local n=t[1]*1000+math.floor(t[2]/1000); return {redis.call('ZCOUNT',KEYS[1],n,'+inf'),redis.call('GET',KEYS[2]) or '0'}" 2 admission:global:slots admission:global:rate || true + sleep 5 +done diff --git a/scripts/scale-shards.sh b/scripts/scale-shards.sh new file mode 100755 index 00000000..7e62c1dc --- /dev/null +++ b/scripts/scale-shards.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Change the ring only after all API pods and their leases have drained. +set -eu +cd "$(dirname "$0")/.." +: "${KUBE_CONTEXT:=dev}" "${NAMESPACE:=highload-applications}" "${RELEASE:=lab2}" +: "${SHARDS:?Set SHARDS=2 or SHARDS=3}" +case "$SHARDS" in 2|3) ;; *) echo 'SHARDS must be 2 or 3' >&2; exit 2 ;; esac +# Keep the desired replica count explicit so an interrupted run can resume from zero. +: "${API_REPLICAS:=2}" +helm upgrade "$RELEASE" charts/messenger --kube-context "$KUBE_CONTEXT" -n "$NAMESPACE" --reuse-values --set autoscaling.enabled=false --set api.replicas=0 --wait --timeout 180s +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" wait --for=delete pod -l app=api --timeout=60s +# Maximum lease is 30 seconds; the rate window is one second. +sleep 31 +helm upgrade "$RELEASE" charts/messenger --kube-context "$KUBE_CONTEXT" -n "$NAMESPACE" --reuse-values --set autoscaling.enabled=false --set api.replicas=0 --set "valkey.shards=$SHARDS" --wait --timeout 180s +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" exec valkey-0 -- valkey-cli DEL admission:topology +helm upgrade "$RELEASE" charts/messenger --kube-context "$KUBE_CONTEXT" -n "$NAMESPACE" --reuse-values --set autoscaling.enabled=true --set "api.replicas=$API_REPLICAS" --wait --timeout 180s +printf 'Ring updated. Set valkey.shards=%s in your values file before the next make deploy.\n' "$SHARDS" diff --git a/scripts/stop-one.sh b/scripts/stop-one.sh new file mode 100755 index 00000000..b06f8230 --- /dev/null +++ b/scripts/stop-one.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Terminate the exact observed API pod; its replacement receives a different instance ID. +set -eu +: "${KUBE_CONTEXT:=dev}" "${NAMESPACE:=highload-applications}" "${TARGET_INSTANCE_ID:?Expected API pod name}" +case "$TARGET_INSTANCE_ID" in api-*) ;; *) echo 'Target is not a lab3 API pod' >&2; exit 2 ;; esac +label=$(kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pod "$TARGET_INSTANCE_ID" -o jsonpath='{.metadata.labels.app}') +test "$label" = api +mkdir -p evidence +printf '%s target=%s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$TARGET_INSTANCE_ID" >> evidence/failover-targets.txt +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" delete pod "$TARGET_INSTANCE_ID" --wait=false diff --git a/scripts/summarize-failover.rb b/scripts/summarize-failover.rb new file mode 100644 index 00000000..4e97b024 --- /dev/null +++ b/scripts/summarize-failover.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +# Verify recovery relative to the actual kubectl action, using only non-secret workload events. +require 'json' +directory, run = ARGV +result = File.readlines("#{directory}/load-#{run}.txt").map do |line| + match = line.match(/\bmsg=("(?:\\.|[^"])*")/) + next unless match + message = JSON.parse(match[1]) + next unless message.start_with?('{') + JSON.parse(message) +end.compact.find { |item| item['pass'] } +abort 'Missing successful failover report' unless result +stopped = Float(File.read("#{directory}/#{run}-stop-epoch.txt")) +relative_stop = stopped - result.fetch('started_epoch_ms') / 1000.0 +event = result.fetch('events').find { |item| item['seconds'] >= relative_stop && item['instance'] != result['target'] } +abort 'No recovered write' unless event +recovery = event['seconds'] - relative_stop +abort "Recovery exceeded 10 seconds: #{recovery}" unless recovery <= 10 +summary = result.reject { |key, _| key == 'events' }.merge('recovery_seconds' => recovery.round(3), 'confirmed_rps' => (result['confirmed'] - 1) / 25.0) +File.write("#{directory}/#{run}-summary.json", JSON.pretty_generate(summary)+"\n") +puts JSON.generate(summary) diff --git a/scripts/test-both-replicas.sh b/scripts/test-both-replicas.sh new file mode 100755 index 00000000..ccd9efac --- /dev/null +++ b/scripts/test-both-replicas.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# Stop each original pod explicitly and preserve request and Kubernetes evidence. +set -eu +cd "$(dirname "$0")/.." +: "${KUBE_CONTEXT:=dev}" "${NAMESPACE:=highload-applications}" +: "${EVIDENCE_DIR:=evidence/review-20261029}" +mkdir -p "$EVIDENCE_DIR" +if [ "${RESUME_FROM:-1}" = 1 ]; then +kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods -l app=api -o json | jq ' .items |= map(select(.metadata.deletionTimestamp == null)) ' > "$EVIDENCE_DIR/initial-api.json" +test "$(jq '.items|length' "$EVIDENCE_DIR/initial-api.json")" -eq 2 +jq -r '.items[].metadata.name' "$EVIDENCE_DIR/initial-api.json" > "$EVIDENCE_DIR/targets.txt" +fi +index=0 +while read -r target; do + index=$((index+1)) + [ "$index" -ge "${RESUME_FROM:-1}" ] || continue + run="failover-$index-$(date -u +%Y%m%d%H%M%S)" + TARGET_INSTANCE_ID="$target" RUN="$run" LOAD_SCRIPT=failover.js EVIDENCE_DIR="$EVIDENCE_DIR" scripts/run-load.sh > "$EVIDENCE_DIR/$run-run.txt" 2>&1 & + runner=$! + ready=false + for attempt in $(seq 1 90); do + if kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" logs "job/load-$run" 2>/dev/null | rg -q READY_TO_STOP; then ready=true; break; fi + kill -0 "$runner" 2>/dev/null || break + sleep 1 + done + if ! $ready; then wait "$runner" || true; echo 'Failover setup did not become ready' >&2; exit 1; fi + ruby -e 'puts Time.now.to_f' > "$EVIDENCE_DIR/$run-stop-epoch.txt" + kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pod "$target" -o json > "$EVIDENCE_DIR/$run-target.json" + kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" delete pod "$target" --wait=false > "$EVIDENCE_DIR/$run-delete.txt" + wait "$runner" + ruby scripts/summarize-failover.rb "$EVIDENCE_DIR" "$run" + kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" rollout status deployment/api --timeout=120s > "$EVIDENCE_DIR/$run-restored.txt" +done < "$EVIDENCE_DIR/targets.txt" diff --git a/scripts/test-faults.sh b/scripts/test-faults.sh new file mode 100755 index 00000000..868cf1d5 --- /dev/null +++ b/scripts/test-faults.sh @@ -0,0 +1,113 @@ +#!/bin/sh +# Exercise real dependency outages on disposable containers; never target the dev cluster. +set -eu +cd "$(dirname "$0")/.." +umask 077 +work=$(mktemp -d) +name="lab3-fault-$(basename "$work" | tr '[:upper:].' '[:lower:]-')" +containers= +cleanup() { + for container in $containers; do + docker unpause "$container" >/dev/null 2>&1 || true + docker rm -f "$container" >/dev/null 2>&1 || true + done + docker network rm "$name" >/dev/null 2>&1 || true + docker image rm "$name" >/dev/null 2>&1 || true + rm -rf "$work" +} +trap cleanup EXIT +trap 'exit 130' INT +trap 'exit 143' TERM +printf 'UTC %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" +git rev-parse HEAD +shasum -a 256 internal/store/postgres/*.go internal/service/errors.go internal/store/interface.go internal/controller/http/fiber/public_errors.go scripts/test-faults.sh +# Build the working tree, including uncommitted fixes, without publishing an image. +docker build -q -t "$name" . > "$work/build.txt" +docker network create "$name" >/dev/null +pg=$(docker run -d --network "$name" --network-alias postgres -e POSTGRES_PASSWORD=synthetic-fault-password -e POSTGRES_DB=messenger postgres:17.6-alpine) +containers="$pg" +cache=$(docker run -d --network "$name" --network-alias valkey valkey/valkey:8.1.3-alpine) +containers="$containers $cache" +for attempt in $(seq 1 60); do + if docker exec "$pg" pg_isready -U postgres >/dev/null 2>&1; then break; fi + sleep 1 + done +docker run --rm --network "$name" -e DATABASE_URL=postgres://postgres:synthetic-fault-password@postgres:5432/messenger?sslmode=disable -e VALKEY_SHARDS=shard0=valkey:6379 -e CURSOR_SIGNING_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= "$name" migrate +api=$(docker run -d --network "$name" -p 127.0.0.1::8080 \ + -e DATABASE_URL=postgres://postgres:synthetic-fault-password@postgres:5432/messenger?sslmode=disable \ + -e VALKEY_SHARDS=shard0=valkey:6379 -e VALKEY_COORDINATOR=shard0 \ + -e CURSOR_SIGNING_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= -e DEPENDENCY_TIMEOUT_MS=500 -e LOG_LEVEL=error "$name") +containers="$containers $api" +base="http://$(docker port "$api" 8080/tcp)" +: > "$work/anonymous" +wait_ready() { + for attempt in $(seq 1 60); do + if curl -fsS --max-time 2 "$base/health/ready" >/dev/null 2>&1; then return; fi + sleep 1 + done + echo 'FAIL: API did not recover within 60 seconds' >&2 + exit 1 +} +# Credentials remain in private temporary curl config files, never in evidence or argv. +request() { + method=$1; path=$2; expected=$3; auth=$4 + shift 4 + result=$(curl -sS --max-time 3 --config "$work/$auth" -X "$method" \ + -H 'Content-Type: application/json' -o "$work/response" \ + -w '%{http_code} %{time_total}' "$base$path" "$@") + status=${result%% *} + elapsed=${result#* } + if [ "$status" != "$expected" ]; then + printf 'FAIL: %s %s expected=%s actual=%s\n' "$method" "$path" "$expected" "$status" >&2 + exit 1 + fi +} +assert_error() { + jq -e --arg code "$1" '.error.code == $code and (.error.request_id | type == "string") and (has("items") | not)' "$work/response" >/dev/null + if rg -qi 'postgres|synthetic-fault-password|dial tcp|SELECT |SQLSTATE|redis|valkey|token_hash' "$work/response"; then + echo 'FAIL: internal dependency details exposed' >&2 + exit 1 + fi +} +wait_ready +request POST /api/v1/users 201 anonymous --data '{"username":"fault_actor","display_name":"Synthetic","password":"synthetic-user-password"}' +user=$(jq -er .id "$work/response") +printf 'header = "Authorization: Basic %s"\n' "$(printf 'fault_actor:synthetic-user-password' | openssl base64 -A)" > "$work/basic" +request POST /api/v1/auth/sessions 201 basic +jq -er '"header = \"Authorization: Bearer " + .token + "\""' "$work/response" > "$work/bearer" +printf 'header = "X-User-Id: %s"\n' "$user" > "$work/spoofed" +printf 'header = "Authorization: Bearer malformed"\n' > "$work/malformed" +printf 'header = "Authorization: Bearer AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"\n' > "$work/unknown" +request POST /api/v1/chats 201 bearer --data "{\"title\":\"Synthetic fault chat\",\"member_ids\":[\"$user\"]}" +chat=$(jq -er .id "$work/response") +history="/api/v1/chats/$chat/messages" +request POST "$history" 201 bearer -H "Idempotency-Key: fault-message" --data '{"text":"confirmed before outage"}' +cp "$work/response" "$work/message" +request GET "$history" 200 bearer +for dependency in "$pg" "$cache"; do + if [ "$dependency" = "$pg" ]; then label=postgres; else label=valkey; fi + for fault in stop pause; do + docker "$fault" "$dependency" >/dev/null + request GET "$history" 503 bearer + assert_error unavailable + printf 'PASS: %s %s authenticated history => 503 unavailable (%ss)\n' "$label" "$fault" "$elapsed" + request GET /health/ready 503 anonymous + assert_error unavailable + request GET /health/live 200 anonymous + for auth in anonymous spoofed malformed unknown; do + expected=503 + if [ "$label" = postgres ] && [ "$auth" != unknown ]; then expected=401; fi + request GET "$history" "$expected" "$auth" + if [ "$expected" = 401 ]; then assert_error unauthorized; else assert_error unavailable; fi + done + printf 'PASS: %s %s rejects anonymous/spoofed/malformed/unknown identity; liveness=200 readiness=503\n' "$label" "$fault" + if [ "$fault" = stop ]; then docker start "$dependency" >/dev/null; else docker unpause "$dependency" >/dev/null; fi + wait_ready + request GET "$history" 200 bearer + jq -e --slurpfile message "$work/message" '.items == $message' "$work/response" >/dev/null + request GET "$history" 401 anonymous + assert_error unauthorized + printf 'PASS: %s %s recovery preserves the original session and message\n' "$label" "$fault" + done + done +printf 'PASS: real dependency fault scenarios completed\n' diff --git a/student-tests/README.md b/student-tests/README.md new file mode 100644 index 00000000..7b120c86 --- /dev/null +++ b/student-tests/README.md @@ -0,0 +1,11 @@ +# Проверки лабораторной 3 + +Go-тесты рядом с кодом проверяют контракт, авторизацию, идемпотентность, SQL-транзакции, shared cursor, admission, lifecycle и метрики. PostgreSQL/Valkey integration требуют изолированных зависимостей; `make coverage` запускает race и настоящий процесс и проверяет 90% statements каждого исполняемого файла. + +`load/scaling.js` — одинаковый профиль k6 для сравнения реплик: 16 пользователей/чатов, 32 VU, запись + чтение, каждый десятый повтор возвращает прежний результат. Публикуются реальные success/error/latency metrics; bootstrap не содержит пользовательских данных. `load/idempotency.js` проверяет общий ключ через разные API, ровно одно сообщение и конфликт body. `load/hpa.js` нагружает Argon2id для проверки реальной реакции HPA по CPU. Все пользователи синтетические, токены не выводятся. + +`make research` сравнивает 1/2/4 реплики при фиксированном суммарном бюджете 1 CPU/512 MiB, затем при фиксированном бюджете одной реплики 250m/128 MiB. Во время измерений HPA выключен. Raw k6 summary и выборки CPU/RAM/PG wait events сохраняются в evidence. После эксперимента обычные Helm values восстанавливаются. + +`scripts/test-both-replicas.sh` фиксирует две исходные реплики, наблюдает обе через Traefik и последовательно удаляет их по имени. Между отказами Deployment восстанавливается. k6 проверяет чтение, подтверждённые записи и отсутствие дублей после неопределённого ответа; Ruby-агрегатор проверяет восстановление за 10 секунд относительно фактического kubectl action. Нужны Ruby 2.6+ и rg. При прерванной обработке отчёта `RESUME_FROM=2` продолжает по сохранённому targets.txt, не выбирая новую пару. + +`scripts/plot-research.py ` строит summary.csv, results.png и results.svg из реальных k6 JSON. Для графиков нужен Python 3 с matplotlib; управление стендом остаётся в shell/Helm. Не сравнивать прогоны с разными workload-настройками без явной оговорки. diff --git a/student-tests/load/failover.js b/student-tests/load/failover.js new file mode 100644 index 00000000..518ae1d3 --- /dev/null +++ b/student-tests/load/failover.js @@ -0,0 +1,61 @@ +import http from 'k6/http'; +import encoding from 'k6/encoding'; +import { sleep } from 'k6'; +export const options = { vus: 1, iterations: 1, setupTimeout: '120s' }; +const base = __ENV.BASE_URL; +const target = __ENV.TARGET_INSTANCE_ID; +export function setup() { + const username = 'fail_' + Date.now(); + const password = 'synthetic-failover-password'; + const user = http.post(base + '/api/v1/users', JSON.stringify({username, password, display_name:'Failover'}), {headers:{'Content-Type':'application/json'}}); + if (user.status !== 201) throw new Error('registration ' + user.status); + const session = http.post(base + '/api/v1/auth/sessions', null, {headers:{Authorization:'Basic ' + encoding.b64encode(username + ':' + password)}}); + if (session.status !== 201) throw new Error('login ' + session.status); + const headers = {Authorization:'Bearer ' + session.json().token, 'Content-Type':'application/json'}; + const chat = http.post(base + '/api/v1/chats', JSON.stringify({title:'Failover',member_ids:[user.json().id]}), {headers}); + if (chat.status !== 201) throw new Error('chat ' + chat.status); + const seen = new Set(); + for (let i=0; i<20; i++) { + const response = http.get(base + '/api/v1/users/me', {headers, timeout:'2s'}); + if (response.status !== 200) throw new Error('initial read ' + response.status); + seen.add(response.headers['X-Instance-Id']); + } + if (seen.size < 2 || !seen.has(target)) throw new Error('target not observed through LB'); + const path = base + '/api/v1/chats/' + chat.json().id + '/messages'; + const original = http.post(path, JSON.stringify({text:'before failure'}), {headers:{...headers,'Idempotency-Key':'before'}}); + if (original.status !== 201) throw new Error('initial message ' + original.status); + return {headers,path,original:original.json()}; +} +export default function(data) { + console.log('READY_TO_STOP ' + target); + const started = Date.now(); + const confirmed = new Set([data.original.id]); + let errors = 0, reads = 0, sequence = 0; + const events = []; + const lastInstances = []; + while (Date.now() - started < 25000) { + const response = http.post(data.path, JSON.stringify({text:'during-' + sequence}), {headers:{...data.headers,'Idempotency-Key':'during-' + sequence},timeout:'2s'}); + if (response.status === 201) { + confirmed.add(response.json().id); sequence++; + events.push({seconds:(Date.now()-started)/1000,instance:response.headers['X-Instance-Id']}); + lastInstances.push(response.headers['X-Instance-Id']); + } else errors++; + const read = http.get(data.path + '?limit=100', {headers:data.headers,timeout:'2s'}); + if (read.status === 200) reads++; else errors++; + sleep(0.1); + } + const items = []; + let path = data.path + '?limit=100'; + while (path) { + const response = http.get(path, {headers:data.headers,timeout:'5s'}); + if (response.status !== 200) throw new Error('final history ' + response.status); + items.push(...response.json().items); + const cursor = response.json().next_cursor; + path = cursor ? data.path + '?limit=100&cursor=' + encodeURIComponent(cursor) : null; + } + const ids = new Set(items.map(item=>item.id)); + if ([...confirmed].some(id=>!ids.has(id))) throw new Error('confirmed message lost'); + if (new Set(items.map(item=>item.text)).size !== items.length) throw new Error('uncertain retry duplicated'); + if (lastInstances.length < 5 || lastInstances.slice(-5).includes(target)) throw new Error('target still serves or insufficient writes'); + console.log(JSON.stringify({target,started_epoch_ms:started,confirmed:confirmed.size,reads,errors,events,pass:true})); +} diff --git a/student-tests/load/hpa.js b/student-tests/load/hpa.js new file mode 100644 index 00000000..97c915ce --- /dev/null +++ b/student-tests/load/hpa.js @@ -0,0 +1,18 @@ +import http from 'k6/http'; +import encoding from 'k6/encoding'; +import { check, sleep } from 'k6'; +export const options = { vus: 2, duration: '90s', thresholds: { checks: ['rate>0.95'] } }; +const base = __ENV.BASE_URL || 'https://hl.agapov.space'; +export function setup() { + const username = `hpa_${Date.now()}`; + const password = 'synthetic-autoscaling-password'; + const response = http.post(`${base}/api/v1/users`, JSON.stringify({ username, display_name: 'HPA CPU test', password }), { headers: { 'Content-Type': 'application/json' } }); + if (response.status !== 201) throw new Error(`registration: ${response.status}`); + return { authorization: `Basic ${encoding.b64encode(`${username}:${password}`)}` }; +} +export default function (data) { + const response = http.post(`${base}/api/v1/auth/sessions`, null, { headers: { Authorization: data.authorization } }); + check(response, { 'authenticated login': r => r.status === 201 }); + // Keep one account below its 20 requests/s auth budget. + sleep(0.1); +} diff --git a/student-tests/load/idempotency.js b/student-tests/load/idempotency.js new file mode 100644 index 00000000..6097e4c3 --- /dev/null +++ b/student-tests/load/idempotency.js @@ -0,0 +1,34 @@ +import http from 'k6/http'; +import encoding from 'k6/encoding'; +import { check, sleep } from 'k6'; +export const options = { vus: 8, iterations: 32, thresholds: { checks: ['rate==1'] } }; +const base = __ENV.BASE_URL || 'https://hl.agapov.space'; +export function setup() { + const username = `idem_${Date.now()}`; + const password = 'synthetic-idempotency-password'; + const registered = http.post(`${base}/api/v1/users`, JSON.stringify({ username, display_name: 'Idempotency', password }), { headers: { 'Content-Type': 'application/json' } }); + if (registered.status !== 201) throw new Error(`registration ${registered.status}`); + const session = http.post(`${base}/api/v1/auth/sessions`, null, { headers: { Authorization: `Basic ${encoding.b64encode(`${username}:${password}`)}` } }); + if (session.status !== 201) throw new Error(`login ${session.status}`); + const headers = { Authorization: `Bearer ${session.json().token}`, 'Content-Type': 'application/json', 'Idempotency-Key': 'shared-key' }; + const chat = http.post(`${base}/api/v1/chats`, JSON.stringify({ title: 'Retry race', member_ids: [registered.json().id] }), { headers }); + if (chat.status !== 201) throw new Error(`chat ${chat.status}`); + return { headers, path: `${base}/api/v1/chats/${chat.json().id}/messages` }; +} +export default function (data) { + // Eight writers share four user slots. Retry admission failures with the same key/body. + let response; + for (let attempt = 0; attempt < 20; attempt++) { + response = http.post(data.path, JSON.stringify({ text: 'one logical message' }), { headers: data.headers }); + if (response.status !== 503 && response.status !== 429) break; + sleep(0.1); + } + check(response, { 'concurrent retry succeeds': r => r.status === 201 }); + console.log(`instance=${response.headers['X-Instance-Id']}, status=${response.status}`); +} +export function teardown(data) { + const history = http.get(`${data.path}?limit=100`, { headers: data.headers }); + check(history, { 'exactly one stored message': r => r.status === 200 && r.json().items.length === 1 }); + const conflict = http.post(data.path, JSON.stringify({ text: 'different message' }), { headers: data.headers }); + check(conflict, { 'different body conflicts': r => r.status === 409 }); +} diff --git a/student-tests/load/scaling.js b/student-tests/load/scaling.js new file mode 100644 index 00000000..09ae8678 --- /dev/null +++ b/student-tests/load/scaling.js @@ -0,0 +1,77 @@ +import http from 'k6/http'; +import encoding from 'k6/encoding'; +import execution from 'k6/execution'; +import { check, sleep } from 'k6'; +import { Counter, Trend } from 'k6/metrics'; + +const base = __ENV.BASE_URL || 'https://hl.agapov.space'; +const seconds = Number(__ENV.DURATION || 30); +const users = Number(__ENV.USERS || 16); +const writes = new Counter('confirmed_messages'); +const attempts = new Counter('attempted_messages'); +const failures = new Counter('application_errors'); +const operations = new Counter('measured_operations'); +const failedWrites = new Counter('failed_writes'); +const latency = new Trend('message_latency_ms', true); +export const options = { + scenarios: { + warmup: { executor: 'constant-vus', vus: 4, duration: '5s', gracefulStop: '0s' }, + measured: { executor: 'constant-vus', vus: Number(__ENV.VUS || 32), duration: `${seconds}s`, startTime: '10s', gracefulStop: '0s' }, + }, + setupTimeout: '180s', + thresholds: { 'application_errors{status:429}': ['count>=0'], 'application_errors{status:503}': ['count>=0'], 'application_errors{status:0}': ['count>=0'] }, + summaryTrendStats: ['avg', 'p(50)', 'p(95)', 'p(99)', 'max'], +}; + +export function setup() { + const actors = []; + const prefix = `bench_${Date.now()}`; + for (let i = 0; i < users; i++) { + let prepared = false; + for (let attempt = 0; attempt < 5; attempt++) { + for (let ready = 0; ready < 30; ready++) { + if (http.get(base + '/health/ready', {timeout:'3s', tags:{phase:'setup'}}).status === 200) break; + sleep(1); + } + const username = `${prefix}_${i}_${attempt}`; + const password = 'synthetic-benchmark-password'; + let response = http.post(`${base}/api/v1/users`, JSON.stringify({ username, display_name: 'Synthetic', password }), { headers: { 'Content-Type': 'application/json' }, tags: { phase: 'setup' } }); + if (response.status !== 201) { console.warn(`setup registration: ${response.status}; abandoning synthetic actor`); sleep(1); continue; } + const user = response.json(); + response = http.post(`${base}/api/v1/auth/sessions`, null, { headers: { Authorization: `Basic ${encoding.b64encode(`${username}:${password}`)}` }, tags: { phase: 'setup' } }); + if (response.status !== 201) { console.warn(`setup login: ${response.status}; abandoning synthetic actor`); sleep(1); continue; } + const token = response.json().token; + response = http.post(`${base}/api/v1/chats`, JSON.stringify({ title: 'Synthetic benchmark', member_ids: [user.id] }), { headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, tags: { phase: 'setup' } }); + if (response.status !== 201) { console.warn(`setup chat: ${response.status}; abandoning synthetic actor`); sleep(1); continue; } + actors.push({ token, chat: response.json().id }); + prepared = true; + break; + } + if (!prepared) throw new Error("synthetic actor setup exhausted retries"); + } + return actors; +} + +export default function (actors) { + const measured = execution.scenario.name === 'measured'; + const actor = actors[(__VU - 1) % actors.length]; + const headers = { Authorization: `Bearer ${actor.token}`, 'Content-Type': 'application/json', 'Idempotency-Key': `${execution.scenario.name}:${__VU}:${__ITER}` }; + const path = `${base}/api/v1/chats/${actor.chat}/messages`; + const payload = JSON.stringify({ text: `synthetic message ${__VU}:${__ITER}` }); + const response = http.post(path, payload, { headers, tags: { phase: 'load' } }); + if (measured) { latency.add(response.timings.duration); attempts.add(1); operations.add(1); } + if (check(response, { 'message confirmed': r => r.status === 201 })) { if (measured) writes.add(1); } + else if (measured) { failures.add(1, { status: String(response.status) }); failedWrites.add(1); } + if (response.status === 201 && __ITER % 10 === 0) { + if (measured) operations.add(1); + const repeated = http.post(path, payload, { headers, tags: { phase: 'load' } }); + if (!check(repeated, { 'retry returns original': r => r.status === 201 && r.json().id === response.json().id })) { if (measured) failures.add(1, { status: String(repeated.status) }); } + } + if (measured) operations.add(1); + const read = http.get(`${path}?limit=10`, { headers, tags: { phase: 'load' } }); + if (!check(read, { 'history readable': r => r.status === 200 })) { if (measured) failures.add(1, { status: String(read.status) }); } +} + +export function handleSummary(data) { + return { stdout: JSON.stringify({ profile: { vus: Number(__ENV.VUS || 32), seconds, warmup_seconds: 5, drain_seconds: 5, users }, summary: data }) + '\n' }; +} diff --git a/student-tests/plans.sql b/student-tests/plans.sql new file mode 100644 index 00000000..9e1ea28f --- /dev/null +++ b/student-tests/plans.sql @@ -0,0 +1,16 @@ +-- Repeat the same read and rolled-back write three times for each index. +SELECT 'EXPLAIN (ANALYZE,BUFFERS,FORMAT JSON) +SELECT id,chat_id,sender_id,text,created_at FROM messages +WHERE chat_id=md5(''1'')::uuid +AND (created_at,id)>(''2026-01-01Z''::timestamptz+85000*interval ''1 microsecond'',md5(''85000'')::uuid) +ORDER BY created_at,id LIMIT 51; +BEGIN; +EXPLAIN (ANALYZE,BUFFERS,FORMAT JSON) +INSERT INTO messages +SELECT md5(n::text)::uuid,md5(''1'')::uuid, +''11111111-1111-4111-8111-111111111111'',''new-synthetic-''||n, +''2026-01-01Z''::timestamptz+n*interval ''1 microsecond'' +FROM generate_series(100001,101000) n; +ROLLBACK;' +FROM generate_series(1,3) +\gexec diff --git a/student-tests/quality_test.go b/student-tests/quality_test.go new file mode 100644 index 00000000..dcbfecc5 --- /dev/null +++ b/student-tests/quality_test.go @@ -0,0 +1,125 @@ +// Package quality checks source-level conventions required by the lab implementation. +package quality + +import ( + "go/ast" + "go/parser" + "go/token" + "io/fs" + "path/filepath" + "strconv" + "strings" + "testing" +) + +// TestExportedDocumentation checks functions, types, constants, fields and interface methods. +func TestExportedDocumentation(t *testing.T) { + visitProductionFiles(t, func(path string, file *ast.File) { + ast.Inspect(file, func(node ast.Node) bool { + switch declaration := node.(type) { + case *ast.FuncDecl: + if declaration.Doc == nil || !strings.HasPrefix(strings.TrimSpace(declaration.Doc.Text()), declaration.Name.Name+" ") { + t.Errorf("%s: function %s needs a prefixed doc comment", path, declaration.Name.Name) + } + case *ast.GenDecl: + for _, spec := range declaration.Specs { + switch spec := spec.(type) { + case *ast.TypeSpec: + doc := spec.Doc + if doc == nil { + doc = declaration.Doc + } + requireDoc(t, path, spec.Name, doc) + case *ast.ValueSpec: + doc := spec.Doc + if doc == nil { + doc = declaration.Doc + } + for _, name := range spec.Names { + requireDoc(t, path, name, doc) + } + } + } + case *ast.StructType: + for _, field := range declaration.Fields.List { + for _, name := range field.Names { + requireDoc(t, path, name, field.Doc) + } + } + case *ast.InterfaceType: + for _, method := range declaration.Methods.List { + for _, name := range method.Names { + requireDoc(t, path, name, method.Doc) + } + } + } + return true + }) + }) +} + +// requireDoc checks that an exported declaration has a correctly prefixed doc comment. +func requireDoc(t *testing.T, path string, name *ast.Ident, doc *ast.CommentGroup) { + t.Helper() + if !name.IsExported() { + return + } + if doc == nil || !strings.HasPrefix(strings.TrimSpace(doc.Text()), name.Name+" ") { + t.Errorf("%s: %s needs a Go doc comment starting with its name", path, name.Name) + } +} + +// TestDependencyDirection prevents concrete infrastructure leaking into higher layers. +func TestDependencyDirection(t *testing.T) { + visitProductionFiles(t, func(path string, file *ast.File) { + normalized := filepath.ToSlash(path) + for _, dependency := range file.Imports { + imported, err := strconv.Unquote(dependency.Path.Value) + if err != nil { + t.Fatal(err) + } + var forbidden []string + switch { + case strings.Contains(normalized, "internal/service/"): + forbidden = []string{"net/http", "github.com/gofiber/", "/internal/controller", "/internal/store/memory", "/internal/store/postgres", "/internal/valkey", "/internal/config", "go.lab260.ru/fielderr"} + case strings.Contains(normalized, "internal/admission/"), strings.Contains(normalized, "internal/strictjson/"): + forbidden = []string{"net/http", "github.com/gofiber/", "/internal/"} + case strings.Contains(normalized, "internal/cursor/"): + forbidden = []string{"net/http", "github.com/gofiber/", "/internal/service", "/internal/store", "/internal/controller", "/internal/model"} + case strings.Contains(normalized, "internal/store/"): + forbidden = []string{"net/http", "github.com/gofiber/", "/internal/controller", "/internal/service"} + case strings.Contains(normalized, "internal/controller/"): + forbidden = []string{"/internal/service/production", "/internal/store"} + } + for _, fragment := range forbidden { + if strings.Contains(imported, fragment) { + t.Errorf("%s: forbidden dependency %s", path, imported) + } + } + } + }) +} + +// visitProductionFiles parses application Go files and visits their syntax trees. +func visitProductionFiles(t *testing.T, visit func(string, *ast.File)) { + t.Helper() + for _, root := range []string{"../cmd", "../internal"} { + err := filepath.WalkDir(root, func(path string, entry fs.DirEntry, err error) error { + if err != nil { + return err + } + if entry.IsDir() || !strings.HasSuffix(path, ".go") || strings.HasSuffix(path, "_test.go") { + return nil + } + file, err := parser.ParseFile(token.NewFileSet(), path, nil, parser.ParseComments) + if err != nil { + return err + } + visit(path, file) + return nil + }) + if err != nil { + t.Fatal(err) + } + } +} diff --git a/student-tests/research.sql b/student-tests/research.sql new file mode 100644 index 00000000..c43c67b1 --- /dev/null +++ b/student-tests/research.sql @@ -0,0 +1,26 @@ +-- Isolated database: actual application schema and a deliberately skewed history. +\set ON_ERROR_STOP on +\timing on +SELECT version(); +INSERT INTO users(id,username,display_name,password_hash) +VALUES('11111111-1111-4111-8111-111111111111','research','Synthetic','not-a-login-hash'); +INSERT INTO chats(id,title) +SELECT md5(n::text)::uuid,'Synthetic '||n FROM generate_series(1,3) n; +INSERT INTO chat_members(chat_id,user_id) +SELECT id,'11111111-1111-4111-8111-111111111111' FROM chats; +INSERT INTO messages(id,chat_id,sender_id,text,created_at) +SELECT md5(n::text)::uuid, + md5((CASE WHEN n<=90000 THEN 1 WHEN n<=99000 THEN 2 ELSE 3 END)::text)::uuid, + '11111111-1111-4111-8111-111111111111','synthetic-'||n, + '2026-01-01Z'::timestamptz+n*interval '1 microsecond' +FROM generate_series(1,100000) AS n; +DROP INDEX messages_history; +CREATE INDEX candidate ON messages(chat_id); +\echo 'VARIANT: chat_only' +ANALYZE messages; +\i /tmp/plans.sql +DROP INDEX candidate; +CREATE INDEX candidate ON messages(chat_id,created_at,id); +\echo 'VARIANT: history_keyset' +ANALYZE messages; +\i /tmp/plans.sql