Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b299d8157 | ||
|
|
7ffebe65d0 | ||
|
|
95aed3c25b | ||
|
|
4918969c6b | ||
|
|
9d0080db10 |
@@ -18,3 +18,4 @@ __pycache__
|
||||
node_modules
|
||||
evidence
|
||||
.DS_Store
|
||||
!gradle-9.7.1-bin.zip
|
||||
@@ -0,0 +1,4 @@
|
||||
/gradlew text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.jar binary
|
||||
scripts/*.sh text eol=lf
|
||||
+104
-27
@@ -1,32 +1,109 @@
|
||||
# Local/private state
|
||||
### Git ###
|
||||
*.orig
|
||||
*.BACKUP.*
|
||||
*.BASE.*
|
||||
*.LOCAL.*
|
||||
*.REMOTE.*
|
||||
*_BACKUP_*.txt
|
||||
*_BASE_*.txt
|
||||
*_LOCAL_*.txt
|
||||
*_REMOTE_*.txt
|
||||
|
||||
### Java ###
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
.mtj.tmp/
|
||||
|
||||
# Package files
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# JVM crash logs
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
### Gradle ###
|
||||
.gradle/
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
### Maven ###
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse / STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings/
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Windows ###
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
[Dd]esktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
*.lnk
|
||||
|
||||
### macOS ###
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
### Miscellaneous ###
|
||||
*.sw?
|
||||
.#*
|
||||
*#
|
||||
*~
|
||||
bin/
|
||||
/scratch
|
||||
*.sublime-*
|
||||
|
||||
### Environment / Secrets ###
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
secrets/
|
||||
certs/private/
|
||||
*.key
|
||||
*.p12
|
||||
*.pfx
|
||||
*.jks
|
||||
*.pem
|
||||
*.tfstate*
|
||||
volumes/
|
||||
data/
|
||||
backups/
|
||||
# Runtime/build artifacts
|
||||
.venv/
|
||||
secrets/*.txt
|
||||
!secrets/.gitkeep
|
||||
|
||||
### Python / venv ###
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
node_modules/
|
||||
dist/
|
||||
build/
|
||||
target/
|
||||
bin/
|
||||
obj/
|
||||
coverage/
|
||||
*.log
|
||||
.DS_Store
|
||||
.idea/
|
||||
.vscode/
|
||||
# Keep small, sanitized evidence summaries in evidence/ under version control.
|
||||
# Inspect git diff --cached: ignore rules are not a secret scanner.
|
||||
*.pyc
|
||||
.venv/
|
||||
.venv
|
||||
venv/
|
||||
|
||||
### Lab evidence ###
|
||||
evidence/**/*.dump
|
||||
evidence/**/*.sql.gz
|
||||
evidence/**/raw/
|
||||
evidence/**/*.raw
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
FROM eclipse-temurin:21-jdk-jammy AS builder
|
||||
WORKDIR /build
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY gradle gradle
|
||||
COPY gradlew settings.gradle build.gradle ./
|
||||
COPY gradle-9.7.1-bin.zip /tmp/gradle.zip
|
||||
RUN unzip -q /tmp/gradle.zip -d /opt && rm /tmp/gradle.zip
|
||||
ENV PATH="/opt/gradle-9.7.1/bin:$PATH"
|
||||
RUN gradle dependencies --no-daemon
|
||||
COPY contracts contracts
|
||||
COPY src src
|
||||
RUN gradle bootJar -x test --no-daemon
|
||||
|
||||
FROM eclipse-temurin:21-jre-jammy AS runner
|
||||
WORKDIR /app
|
||||
RUN groupadd --system spring && useradd --system --gid spring --no-create-home spring
|
||||
COPY --from=builder /build/build/libs/*.jar app.jar
|
||||
RUN chown spring:spring app.jar
|
||||
USER spring
|
||||
EXPOSE 8080
|
||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=20s --retries=3 \
|
||||
CMD wget -qO- http://127.0.0.1:8080/actuator/health/readiness | grep -q UP || exit 1
|
||||
ENV JAVA_OPTS="-XX:MaxRAMPercentage=75 -Xss512k"
|
||||
ENTRYPOINT ["sh", "-c", "exec java -Dfile.encoding=UTF-8 $JAVA_OPTS -jar app.jar"]
|
||||
@@ -1,37 +1,161 @@
|
||||
# Отчёт — лабораторная 3
|
||||
|
||||
- Автор, группа: TODO
|
||||
- Целевая оценка; выбранный трек 5, если нужен: TODO
|
||||
- Commit/PR: TODO после публикации
|
||||
- Использованные источники, библиотеки и помощь ИИ: TODO
|
||||
- Автор, группа: Иванов Данил, БВТ2301
|
||||
- Целевая оценка: **5** трек 1
|
||||
- Commit/PR: https://gitea.privcloud.tech/mtusi2026/mtusi2026lab3/pulls/10
|
||||
- Источники: официальная документация Spring Boot 4.1, Docker Compose v2, nginx 1.27, PostgreSQL 16, HikariCP, MapStruct 1.6; помощь ИИ — консультации по архитектуре и отладке, все решения проверены экспериментально
|
||||
|
||||
## Запуск из чистого clone
|
||||
|
||||
TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных.
|
||||
**Prerequisites:** Docker Desktop 4.x, Python 3.11+, PowerShell 5.1+ (Windows) или bash (Linux/macOS).
|
||||
|
||||
**Создание секретов (один раз):**
|
||||
```powershell
|
||||
New-Item -ItemType Directory -Force -Path secrets
|
||||
"messenger" | Out-File -NoNewline secrets/postgres_db.txt
|
||||
"messenger" | Out-File -NoNewline secrets/postgres_user.txt
|
||||
"change-me-local" | Out-File -NoNewline secrets/postgres_password.txt
|
||||
```
|
||||
|
||||
**Сборка и запуск:**
|
||||
```powershell
|
||||
docker compose --env-file .env up -d --build
|
||||
Start-Sleep -Seconds 45
|
||||
docker compose ps
|
||||
```
|
||||
|
||||
Ожидаем: `lab3-migrate-1` → `Exited (0)`, `lab3-api-1/2` → `Up (healthy)`, `lab3-lb-1`, `lab3-db-1`, `lab3-redis-1` → `Up`.
|
||||
|
||||
**Публичный smoke:**
|
||||
```powershell
|
||||
.venv\Scripts\python.exe tests\smoke.py --base-url "http://127.0.0.1:8080"
|
||||
```
|
||||
|
||||
**Проверки уровня 3–4:**
|
||||
```powershell
|
||||
.venv\Scripts\python.exe tests\resilience.py --mode persistence --action-script "scripts/restart.cmd" --base-url "http://127.0.0.1:8080"
|
||||
.venv\Scripts\python.exe tests\resilience.py --mode failover --action-script "scripts/stop-one.cmd" --base-url "http://127.0.0.1:8080"
|
||||
```
|
||||
|
||||
## Архитектура и решения
|
||||
|
||||
TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab2, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации.
|
||||
**Топология:**
|
||||
```
|
||||
client → nginx (LB, 127.0.0.1:8080) → api-1 / api-2 (Spring Boot 4.1.1, Java 21)
|
||||
↓
|
||||
PostgreSQL 16 — общая БД (данные, сессии, idempotency_keys)
|
||||
Redis 7.4 — общий кэш
|
||||
```
|
||||
|
||||
**Ключевые решения:**
|
||||
|
||||
- **LB** — nginx 1.27.5, upstream с `zone api_backend 64k` + `resolve` + Docker DNS `127.0.0.11 valid=10s ipv6=off`. `max_fails=1 fail_timeout=5s`, `proxy_next_upstream` на 502/503/504 с флагом `non_idempotent` (позволяет перекидывать POST-запросы на живую реплику при отказе). `proxy_read_timeout=10s`. Это позволяет nginx видеть смену IP реплик без перезапуска.
|
||||
- **X-Instance-Id** — вычисляется из `/etc/hostname`, выставляется `InstanceIdFilter` с `@Order(HIGHEST_PRECEDENCE)` — раньше Spring Security, поэтому присутствует и на 401.
|
||||
- **Идемпотентность** — таблица `idempotency_keys`, PK `(user_id, method, chat_id, idempotency_key)`. Гонка решается atomic insert + read-after-conflict.
|
||||
- **Сессии** — в PostgreSQL. Токен переживает рестарт api и переключение между репликами.
|
||||
- **Graceful shutdown** — `server.shutdown: graceful` + `spring.lifecycle.timeout-per-shutdown-phase: 30s`.
|
||||
- **Readiness** — `HealthService` проверяет `active_connections >= max_pool_size` перед `SELECT 1` и возвращает 503 без ожидания таймаута БД.
|
||||
|
||||
**Соответствие контракту (исправленные замечания):**
|
||||
- **Пароль:** `@CodePointLength(min=12, max=128)` в `CreateUserDTO` (корректно обрабатывает суррогатные пары и кириллицу).
|
||||
- **Строгий Jackson:** `JacksonConfig` включает `FAIL_ON_UNKNOWN_PROPERTIES` и запрещает `CoercionConfig(Integer -> String)`. Лишние поля и типы отбрасываются с кодом 400.
|
||||
- **Cursor:** `MessageService` и `ChatService` используют `isEmpty()` вместо `isBlank()`. `?cursor=%20` возвращает 400.
|
||||
- **Basic challenge:** Добавлен `charset="UTF-8"`. Передача body при login отклоняется (`contentLength > 0` -> 400).
|
||||
|
||||
## Доказательства критериев
|
||||
|
||||
| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства |
|
||||
| --- | --- | --- | --- |
|
||||
| Публичный smoke | make test | TODO | TODO |
|
||||
| Остальные пункты уровня 3 | TODO | TODO | TODO |
|
||||
| Все пункты уровня 4, если заявлен | TODO | TODO | TODO |
|
||||
| Выбранный трек 5, если заявлен | TODO | TODO | TODO |
|
||||
|
||||
TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены.
|
||||
| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл |
|
||||
|-------------------------------------|------------------------------------|----------------------------------------------------------------|-------------------------------------------------|
|
||||
| Публичный smoke | `python tests/smoke.py` | `PASS: lab3 public API scenario` | `evidence/lab3/smoke.log` |
|
||||
| ≥2 реплики за LB | `curl -sD- /health/live` × 10 | Чередующиеся `X-Instance-Id` | `evidence/lab3/nginx-B2.log` |
|
||||
| Одна сессия, разные реплики | 20 запросов с одним Bearer | Ответы с обоих ID, без перелогина | `evidence/lab3/nginx-B1.log` |
|
||||
| X-Request-Id на всех ответах | `curl -sD- /api/v1/users/me` | Header присутствует на 401 | `evidence/lab3/nginx-C1.log` |
|
||||
| Idempotency-Key обязателен | POST /messages без header | HTTP 400, `code=invalid_request` | `evidence/lab3/idempotency-required.log` |
|
||||
| Idempotency-Key повтор | 3× POST с key=k1 | Один и тот же `id` | `evidence/lab3/idempotency-repeat.log` |
|
||||
| Idempotency-Key другой body | POST key=k1, body=DIFF | HTTP 409 | `evidence/lab3/idempotency-conflict.log` |
|
||||
| Failover (`make test-failover`) | `resilience.py --mode failover` | `failed_attempts=0`, `first_recovery_seconds=1.641` | `evidence/lab3/failover.log` |
|
||||
| Persistence | `resilience.py --mode persistence` | Данные и токен сохранены | `evidence/lab3/persistence.log` |
|
||||
| Graceful shutdown | `docker stop <api-id>` | `Graceful shutdown complete` | `evidence/lab3/api-<id>.log` |
|
||||
| CPU/RAM limits | `docker inspect lab3-api-1` | `2000000000 1073741824` (2 CPU / 1 GiB) | `evidence/lab3/seriesA-C1-limits.txt` |
|
||||
| Нет `container_name` | `docker compose ps` | Только `8080/tcp`, порты наружу не открыты | `evidence/lab3/ports.txt` |
|
||||
| **LB исключает нездоровый backend** | **`docker pause lab3-api-1`** | **POST-запрос ретраится на api-2 (201), зависшая исключается** | **`evidence/lab3/lb-exclusion-pause-test.log`** |
|
||||
|
||||
## Эксперименты и отказы
|
||||
|
||||
TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения.
|
||||
### Failover
|
||||
**Профиль:** `resilience.py --mode failover --action-script scripts/stop-one.cmd`.
|
||||
| Воздействие | Ожидали | Наблюдали |
|
||||
|---|---|---|
|
||||
| `docker stop <api-id>` под нагрузкой | Оставшаяся реплика обслуживает без 5xx | `observed_instances_before=2`, `successful_writes=106`, `failed_attempts=0`, восстановление **1.641 сек** |
|
||||
|
||||
| Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных |
|
||||
| --- | --- | --- | --- |
|
||||
| TODO | TODO | TODO | TODO |
|
||||
### LB exclusion (Зависший пул, Nginx)
|
||||
**Профиль:** `docker pause lab3-api-1` (имитация заполнения пула, TCP принимается, но ответа нет).
|
||||
- Первый POST-запрос повис на **10 секунд** (`proxy_read_timeout=10s`). Сработал `non_idempotent` -> запрос ушел на api-2 и вернул `201`.
|
||||
- Последующие запросы прошли мгновенно (~0.03s), так как Nginx исключил api-1 на `fail_timeout=5s`.
|
||||
- Доказательство: `evidence/lab3/lb-exclusion-pause-test.log`.
|
||||
|
||||
## Трек 1. Цена масштабирования (уровень 5)
|
||||
|
||||
**Гипотеза:** при фиксированном суммарном CPU добавление API-реплик даёт ускорение только до saturation point. После точки RPS не растёт, p95 деградирует.
|
||||
|
||||
**Методика:** `load.py`, профиль POST /messages, клиент в docker-сети, concurrency 8, duration 90s. Прогрев JVM 20с. Для чистоты замеров перед каждой серией выполняется `docker compose down -v` и `MAX_MESSAGES_PER_CHAT=500000`.
|
||||
|
||||
### Среда измерения
|
||||
- **Дата:** 2026-10-17
|
||||
- **Commit:** `7ffebe65d0e757d6c92863f9ef693437c5631923`
|
||||
- **Хост:** Физический ПК на Windows x64 (`Intel Core i5-11300H @ 3.10GHz`, 4 ядра / 8 потоков), 16 GiB RAM.
|
||||
- **Среда исполнения:** Docker Desktop (WSL2 backend). Выделено ресурсов: 8 vCPU, ~7.65 GiB RAM.
|
||||
- **Профиль нагрузки:** POST /messages, closed-loop, concurrency 8, duration 90s.
|
||||
- **Прогрев JVM:** 20s при concurrency 2 перед каждым замером.
|
||||
- **Сброс БД:** `docker compose down -v` перед каждой серией для чистоты замеров.
|
||||
- **Логирование Docker:** драйвер `local`, max-size=1k, max-file=1 (минимизация I/O).
|
||||
- **Сбор метрик:** `docker stats` (каждые 2с) и `pg_stat_activity` (каждые 5с).
|
||||
|
||||
### Серия A — фиксированный суммарный CPU (2 ядра)
|
||||
| Конфигурация | Replicas | CPU/rep | RPS | p50 | p95 | error |
|
||||
|---|---|---|---|---|---|---|
|
||||
| C1 | 1 | 2.0 | **136.6** | 59 | 106 | 0% |
|
||||
| C2 | 2 | 1.0 | **125.1** | 68 | 114 | 0% |
|
||||
| C3 | 4 | 0.5 | **51.4** | 52 | **288** | 1.09% |
|
||||
|
||||
**Вывод:** при фиксированных 2 CPU добавление реплик не ускоряет, а замедляет систему. Причина — **per-replica CPU throttle**. На 0.5 ядра (C3) Spring Boot не может эффективно разворачивать JIT и GC, что приводит к падению RPS в 2.6 раза и росту p95 в 2.7 раза. Это граница рабочей зоны (даже при `proxy_read_timeout=10s` начинаются таймауты).
|
||||
|
||||
### Серия B — рост ресурсов при 2 репликах
|
||||
| Конфигурация | Total CPU | RPS | p50 | p95 | error |
|
||||
|---|---|---|---|---|---|
|
||||
| B1 | 2.0 | **130.2** | 54 | 130 | 0% |
|
||||
| B2 | 4.0 | **146.9** | 49 | 98 | 0% |
|
||||
| B3 | 8.0 | **171.1** | 36 | 93 | 0% |
|
||||
|
||||
**Вывод:** при росте CPU пропускная способность монотонно растёт, а задержка падает.
|
||||
|
||||
### Графики (по результатам замеров)
|
||||

|
||||

|
||||

|
||||
|
||||
### Локализация узкого места (Saturation point)
|
||||
Согласно данным `docker stats` и `pg_stat_activity`:
|
||||
1. **БД (PostgreSQL):** `pg_stat_activity` показывает отсутствие блокировок и IO-wait. Пул Hikari заполнен не полностью (10-19 idle из 20). CPU БД ~100% в C1, но она справляется.
|
||||
2. **Сеть Docker:** не является узким местом, так как `docker stats` фиксирует загрузку CPU API на уровне 130-210% (то есть процесс упирается в процессор, а не ждет сеть).
|
||||
3. **Saturation point** находится на уровне **0.5 CPU на реплику**. Дробление ресурсов вредит JVM.
|
||||
|
||||
### Подтверждённое улучшение
|
||||
Добавление `non_idempotent` в `proxy_next_upstream` и сокращение `fail_timeout` с 15s до 5s дало сокращение времени восстановления после отказа реплики с **4.234s** до **1.641s** (в 2.5 раза). Подтверждено `resilience.py --mode failover`.
|
||||
|
||||
## Ограничения и следующие шаги
|
||||
|
||||
TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза.
|
||||
**Что доказано:**
|
||||
- Все критерии уровня 3 и 4 — PASS.
|
||||
- Saturation point локализован в CPU throttle.
|
||||
- Идемпотентность race-safe, graceful shutdown, failover, LB exclusion — работают.
|
||||
|
||||
**Учебные упрощения:**
|
||||
- Один узел Docker Desktop.
|
||||
- Closed-loop бенчмарк (координированное упущение не устранено).
|
||||
|
||||
**Следующие шаги в production-среде:**
|
||||
1. Переезд на Linux bare metal или Kubernetes.
|
||||
2. PgBouncer для высоконагруженных систем.
|
||||
3. Шардинг БД.
|
||||
```
|
||||
@@ -0,0 +1,69 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '4.1.1'
|
||||
id 'io.spring.dependency-management' version '1.1.7'}
|
||||
|
||||
group = 'ru.mtusi'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
|
||||
|
||||
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:3.1.0'
|
||||
implementation 'com.bucket4j:bucket4j-core:8.10.1'
|
||||
implementation 'org.mapstruct:mapstruct:1.6.3'
|
||||
// Source: https://mvnrepository.com/artifact/org.postgresql/postgresql
|
||||
implementation 'org.postgresql:postgresql:42.7.13'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-flyway'
|
||||
runtimeOnly 'org.flywaydb:flyway-database-postgresql'
|
||||
// Source: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:4.1.1'
|
||||
// Source: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-redis:4.1.1'
|
||||
implementation 'org.springframework.security:spring-security-crypto'
|
||||
implementation 'org.bouncycastle:bcprov-jdk18on:1.78.1'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-cache'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-aspectj'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-jackson'
|
||||
|
||||
runtimeOnly 'io.netty:netty-transport-native-epoll::linux-x86_64'
|
||||
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test:4.1.1'
|
||||
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-restclient-test'
|
||||
testImplementation 'org.springframework.boot:spring-boot-resttestclient'
|
||||
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.3'
|
||||
annotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
testCompileOnly 'org.projectlombok:lombok'
|
||||
testAnnotationProcessor 'org.projectlombok:lombok'
|
||||
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-actuator-test'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-validation-test'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.compilerArgs << '-parameters'
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
services:
|
||||
loadgen:
|
||||
image: python:3.12-slim
|
||||
working_dir: /app
|
||||
volumes:
|
||||
- .:/app
|
||||
networks:
|
||||
- messenger-net
|
||||
entrypoint: ["python", "tests/load.py"]
|
||||
command:
|
||||
- "--base-url"
|
||||
- "http://lb:80"
|
||||
- "--duration"
|
||||
- "90"
|
||||
- "--concurrency"
|
||||
- "8"
|
||||
- "--output"
|
||||
- "evidence/lab3/load-rolling.json"
|
||||
|
||||
networks:
|
||||
messenger-net:
|
||||
external: true
|
||||
name: lab3_messenger-net
|
||||
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
api:
|
||||
environment:
|
||||
MAX_MESSAGES_PER_CHAT: "500000"
|
||||
deploy:
|
||||
replicas: 2
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.0'
|
||||
memory: 2G
|
||||
@@ -0,0 +1,172 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB_FILE: /run/secrets/postgres_db
|
||||
POSTGRES_USER_FILE: /run/secrets/postgres_user
|
||||
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
secrets:
|
||||
- postgres_db
|
||||
- postgres_user
|
||||
- postgres_password
|
||||
networks:
|
||||
- messenger-net
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $$(cat /run/secrets/postgres_user) -d $$(cat /run/secrets/postgres_db)"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.0'
|
||||
memory: 1G
|
||||
reservations:
|
||||
cpus: '0.25'
|
||||
memory: 256M
|
||||
|
||||
redis:
|
||||
image: redis:7.4-alpine
|
||||
restart: unless-stopped
|
||||
command: >
|
||||
redis-server
|
||||
--appendonly yes
|
||||
--appendfsync everysec
|
||||
--save ""
|
||||
volumes:
|
||||
- redisdata:/data
|
||||
networks:
|
||||
- messenger-net
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
start_period: 5s
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.5'
|
||||
memory: 256M
|
||||
reservations:
|
||||
cpus: '0.1'
|
||||
memory: 64M
|
||||
|
||||
migrate:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
entrypoint: ["sh", "-c"]
|
||||
command:
|
||||
- "exec java -Dfile.encoding=UTF-8 -Dspring.main.web-application-type=none -jar app.jar"
|
||||
environment:
|
||||
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/messenger
|
||||
SPRING_DATASOURCE_USERNAME_FILE: /run/secrets/postgres_user
|
||||
SPRING_DATASOURCE_PASSWORD_FILE: /run/secrets/postgres_password
|
||||
SPRING_FLYWAY_ENABLED: "true"
|
||||
secrets:
|
||||
- postgres_user
|
||||
- postgres_password
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
restart: "no"
|
||||
networks:
|
||||
- messenger-net
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.5'
|
||||
memory: 512M
|
||||
reservations:
|
||||
cpus: '0.1'
|
||||
memory: 128M
|
||||
|
||||
api:
|
||||
stop_grace_period: 40s
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
redis:
|
||||
condition: service_healthy
|
||||
entrypoint:
|
||||
- "sh"
|
||||
- "-c"
|
||||
- "export INSTANCE_ID=\"$$(cat /etc/hostname)\"; exec java -Dfile.encoding=UTF-8 $$JAVA_OPTS -jar app.jar"
|
||||
environment:
|
||||
RATE_PER_MINUTE: ${RATE_PER_MINUTE:-100000}
|
||||
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/messenger
|
||||
SPRING_DATASOURCE_USERNAME_FILE: /run/secrets/postgres_user
|
||||
SPRING_DATASOURCE_PASSWORD_FILE: /run/secrets/postgres_password
|
||||
SPRING_PROFILES_ACTIVE: ${APP_ENV:-lab}
|
||||
SPRING_FLYWAY_ENABLED: "false"
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-400}
|
||||
SESSION_STORE: ${SESSION_STORE:-postgres}
|
||||
SPRING_DATA_REDIS_HOST: redis
|
||||
SPRING_DATA_REDIS_PORT: 6379
|
||||
MAX_MESSAGES_PER_CHAT: ${MAX_MESSAGES_PER_CHAT:-10000}
|
||||
secrets:
|
||||
- postgres_user
|
||||
- postgres_password
|
||||
networks:
|
||||
- messenger-net
|
||||
deploy:
|
||||
replicas: 2
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.0'
|
||||
memory: 512M
|
||||
reservations:
|
||||
cpus: '0.25'
|
||||
memory: 256M
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/health/ready | grep -q '\"status\":\"ok\"'"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
start_period: 40s
|
||||
|
||||
lb:
|
||||
image: nginx:1.27-alpine
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:8080:80"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
depends_on:
|
||||
api:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- messenger-net
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.5'
|
||||
memory: 128M
|
||||
reservations:
|
||||
cpus: '0.1'
|
||||
memory: 32M
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
redisdata:
|
||||
|
||||
networks:
|
||||
messenger-net:
|
||||
driver: bridge
|
||||
|
||||
secrets:
|
||||
postgres_db:
|
||||
file: ./secrets/postgres_db.txt
|
||||
postgres_user:
|
||||
file: ./secrets/postgres_user.txt
|
||||
postgres_password:
|
||||
file: ./secrets/postgres_password.txt
|
||||
@@ -0,0 +1,10 @@
|
||||
### Среда измерения
|
||||
- **Дата:** 2026-10-17
|
||||
- **Commit:** `7ffebe65d0e757d6c92863f9ef693437c5631923`
|
||||
- **Хост:** Физический ПК на Windows x64 (`Intel Core i5-11300H @ 3.10GHz`, 4 ядра / 8 потоков), 16 GiB RAM.
|
||||
- **Среда исполнения:** Docker Desktop (WSL2 backend). Выделено ресурсов: 8 vCPU, ~7.65 GiB RAM.
|
||||
- **Профиль нагрузки:** POST /messages, closed-loop, concurrency 8, duration 90s.
|
||||
- **Прогрев JVM:** 20s при concurrency 2 перед каждым замером.
|
||||
- **Сброс БД:** `docker compose down -v` перед каждой серией для чистоты замеров.
|
||||
- **Логирование Docker:** драйвер `local`, max-size=1k, max-file=1 (минимизация I/O).
|
||||
- **Сбор метрик:** `docker stats` (каждые 2с) и `pg_stat_activity` (каждые 5с).
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -0,0 +1,7 @@
|
||||
series,config,replicas,cpu_per_rep,ram_per_rep,total_cpu,successful_rps,error_ratio,p50_ms,p95_ms,p99_ms
|
||||
A,C1,1,2.0,1G,2.0,136.579,0.0,59.414,105.771,182.732
|
||||
A,C2,2,1.0,512M,2.0,125.085,0.0,68.275,114.484,198.429
|
||||
A,C3,4,0.5,256M,2.0,51.393,0.0109,52.345,288.565,391.365
|
||||
B,B1,2,1.0,512M,2.0,130.203,0.0,53.870,130.262,186.917
|
||||
B,B2,2,2.0,1G,4.0,146.914,0.0,48.778,97.924,121.514
|
||||
B,B3,2,4.0,2G,8.0,171.077,0.0,36.078,92.895,108.825
|
||||
|
Binary file not shown.
@@ -0,0 +1,121 @@
|
||||
timestamp,name,cpu_percent,mem_usage,mem_percent,net_io,block_io,pids
|
||||
2026-10-16T18:50:12.6059884+03:00,lab3-loadgen-run-22562303d7c3,10.89%,25.7MiB / 7.649GiB,0.33%,11.9kB / 12.1kB,0B / 0B,9
|
||||
2026-10-16T18:50:12.6059884+03:00,lab3-lb-1,0.20%,7.348MiB / 128MiB,5.74%,21.5kB / 22.8kB,0B / 12.3kB,9
|
||||
2026-10-16T18:50:12.6059884+03:00,lab3-api-2,94.57%,385.4MiB / 512MiB,75.28%,35.2kB / 36.6kB,0B / 274kB,36
|
||||
2026-10-16T18:50:12.6059884+03:00,lab3-api-1,9.98%,369.2MiB / 512MiB,72.12%,32.9kB / 33.2kB,32.8kB / 279kB,34
|
||||
2026-10-16T18:50:12.6059884+03:00,lab3-redis-1,0.56%,3.422MiB / 256MiB,1.34%,5.3kB / 1.85kB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:12.6059884+03:00,lab3-db-1,0.45%,39.93MiB / 1GiB,3.90%,87.5kB / 77kB,0B / 225kB,18
|
||||
2026-10-16T18:50:17.2370992+03:00,lab3-loadgen-run-22562303d7c3,10.02%,25.79MiB / 7.649GiB,0.33%,195kB / 157kB,0B / 0B,9
|
||||
2026-10-16T18:50:17.2370992+03:00,lab3-lb-1,3.65%,7.68MiB / 128MiB,6.00%,303kB / 328kB,0B / 12.3kB,9
|
||||
2026-10-16T18:50:17.2370992+03:00,lab3-api-2,97.33%,390.5MiB / 512MiB,76.27%,236kB / 285kB,0B / 274kB,36
|
||||
2026-10-16T18:50:17.2370992+03:00,lab3-api-1,98.09%,393.5MiB / 512MiB,76.86%,246kB / 309kB,32.8kB / 279kB,35
|
||||
2026-10-16T18:50:17.2370992+03:00,lab3-redis-1,1.02%,3.441MiB / 256MiB,1.34%,40.9kB / 39.5kB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:17.2370992+03:00,lab3-db-1,24.69%,62.34MiB / 1GiB,6.09%,333kB / 251kB,57.3kB / 1.55MB,24
|
||||
2026-10-16T18:50:21.9079887+03:00,lab3-loadgen-run-22562303d7c3,10.25%,25.79MiB / 7.649GiB,0.33%,581kB / 459kB,0B / 0B,9
|
||||
2026-10-16T18:50:21.9079887+03:00,lab3-lb-1,4.18%,8.004MiB / 128MiB,6.25%,785kB / 838kB,0B / 12.3kB,9
|
||||
2026-10-16T18:50:21.9079887+03:00,lab3-api-2,89.30%,397.8MiB / 512MiB,77.70%,615kB / 743kB,0B / 274kB,36
|
||||
2026-10-16T18:50:21.9079887+03:00,lab3-api-1,114.75%,411.2MiB / 512MiB,80.31%,624kB / 770kB,32.8kB / 279kB,34
|
||||
2026-10-16T18:50:21.9079887+03:00,lab3-redis-1,1.06%,3.438MiB / 256MiB,1.34%,108kB / 116kB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:21.9079887+03:00,lab3-db-1,26.00%,68.86MiB / 1GiB,6.72%,909kB / 702kB,57.3kB / 5.19MB,24
|
||||
2026-10-16T18:50:26.5621071+03:00,lab3-loadgen-run-22562303d7c3,17.03%,25.88MiB / 7.649GiB,0.33%,1.01MB / 797kB,0B / 2.36MB,9
|
||||
2026-10-16T18:50:26.5621071+03:00,lab3-lb-1,5.58%,7.809MiB / 128MiB,6.10%,1.54MB / 1.63MB,0B / 123kB,9
|
||||
2026-10-16T18:50:26.5621071+03:00,lab3-api-2,100.98%,405.2MiB / 512MiB,79.14%,1.04MB / 1.25MB,0B / 291kB,35
|
||||
2026-10-16T18:50:26.5621071+03:00,lab3-api-1,99.88%,412.2MiB / 512MiB,80.51%,1.04MB / 1.27MB,32.8kB / 295kB,34
|
||||
2026-10-16T18:50:26.5621071+03:00,lab3-redis-1,1.34%,3.445MiB / 256MiB,1.35%,183kB / 201kB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:26.5621071+03:00,lab3-db-1,28.62%,72.12MiB / 1GiB,7.04%,1.49MB / 1.16MB,65.5kB / 7.17MB,24
|
||||
2026-10-16T18:50:31.2251596+03:00,lab3-loadgen-run-22562303d7c3,17.15%,25.94MiB / 7.649GiB,0.33%,1.53MB / 1.2MB,0B / 2.36MB,9
|
||||
2026-10-16T18:50:31.2251596+03:00,lab3-lb-1,5.00%,7.766MiB / 128MiB,6.07%,2.32MB / 2.46MB,0B / 123kB,9
|
||||
2026-10-16T18:50:31.2251596+03:00,lab3-api-2,96.74%,412.8MiB / 512MiB,80.62%,1.54MB / 1.87MB,0B / 291kB,35
|
||||
2026-10-16T18:50:31.2251596+03:00,lab3-api-1,97.53%,429.2MiB / 512MiB,83.83%,1.54MB / 1.89MB,32.8kB / 295kB,34
|
||||
2026-10-16T18:50:31.2251596+03:00,lab3-redis-1,1.45%,3.445MiB / 256MiB,1.35%,254kB / 280kB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:31.2251596+03:00,lab3-db-1,40.05%,75.81MiB / 1GiB,7.40%,2.4MB / 1.88MB,65.5kB / 9.65MB,24
|
||||
2026-10-16T18:50:35.9084245+03:00,lab3-loadgen-run-22562303d7c3,21.79%,25.95MiB / 7.649GiB,0.33%,2.19MB / 1.71MB,0B / 2.36MB,9
|
||||
2026-10-16T18:50:35.9084245+03:00,lab3-lb-1,6.13%,7.828MiB / 128MiB,6.12%,3.04MB / 3.22MB,0B / 123kB,9
|
||||
2026-10-16T18:50:35.9084245+03:00,lab3-api-2,98.02%,416.6MiB / 512MiB,81.37%,2.18MB / 2.63MB,0B / 291kB,36
|
||||
2026-10-16T18:50:35.9084245+03:00,lab3-api-1,99.48%,428.6MiB / 512MiB,83.70%,2.17MB / 2.65MB,32.8kB / 295kB,34
|
||||
2026-10-16T18:50:35.9084245+03:00,lab3-redis-1,1.89%,3.441MiB / 256MiB,1.34%,385kB / 431kB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:35.9084245+03:00,lab3-db-1,51.87%,81.84MiB / 1GiB,7.99%,3.34MB / 2.63MB,65.5kB / 11.3MB,26
|
||||
2026-10-16T18:50:40.5615281+03:00,lab3-loadgen-run-22562303d7c3,25.01%,26.03MiB / 7.649GiB,0.33%,2.84MB / 2.22MB,0B / 2.36MB,9
|
||||
2026-10-16T18:50:40.5615281+03:00,lab3-lb-1,7.38%,7.895MiB / 128MiB,6.17%,4.27MB / 4.52MB,0B / 401kB,9
|
||||
2026-10-16T18:50:40.5615281+03:00,lab3-api-2,98.21%,418.4MiB / 512MiB,81.73%,2.81MB / 3.38MB,0B / 303kB,35
|
||||
2026-10-16T18:50:40.5615281+03:00,lab3-api-1,98.53%,432.5MiB / 512MiB,84.47%,2.79MB / 3.39MB,32.8kB / 307kB,34
|
||||
2026-10-16T18:50:40.5615281+03:00,lab3-redis-1,1.89%,3.441MiB / 256MiB,1.34%,493kB / 557kB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:40.5615281+03:00,lab3-db-1,59.48%,82.49MiB / 1GiB,8.06%,4.27MB / 3.38MB,65.5kB / 12.5MB,26
|
||||
2026-10-16T18:50:44.6128608+03:00,lab3-loadgen-run-22562303d7c3,26.53%,26.02MiB / 7.649GiB,0.33%,3.74MB / 2.93MB,0B / 2.36MB,9
|
||||
2026-10-16T18:50:44.6128608+03:00,lab3-lb-1,7.85%,7.848MiB / 128MiB,6.13%,5.62MB / 5.95MB,0B / 401kB,9
|
||||
2026-10-16T18:50:44.6128608+03:00,lab3-api-2,100.23%,419.1MiB / 512MiB,81.86%,3.48MB / 4.17MB,0B / 303kB,35
|
||||
2026-10-16T18:50:44.6128608+03:00,lab3-api-1,103.86%,434.4MiB / 512MiB,84.85%,3.66MB / 4.45MB,32.8kB / 307kB,34
|
||||
2026-10-16T18:50:44.6128608+03:00,lab3-redis-1,4.29%,3.688MiB / 256MiB,1.44%,608kB / 693kB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:44.6128608+03:00,lab3-db-1,73.21%,84.13MiB / 1GiB,8.22%,5.55MB / 4.42MB,65.5kB / 14.1MB,26
|
||||
2026-10-16T18:50:49.2680345+03:00,lab3-loadgen-run-22562303d7c3,25.70%,26.02MiB / 7.649GiB,0.33%,4.44MB / 3.48MB,0B / 2.36MB,9
|
||||
2026-10-16T18:50:49.2680345+03:00,lab3-lb-1,7.53%,7.867MiB / 128MiB,6.15%,6.66MB / 7.06MB,0B / 401kB,9
|
||||
2026-10-16T18:50:49.2680345+03:00,lab3-api-2,101.43%,421.2MiB / 512MiB,82.26%,4.52MB / 5.4MB,0B / 303kB,35
|
||||
2026-10-16T18:50:49.2680345+03:00,lab3-api-1,98.97%,444.6MiB / 512MiB,86.83%,4.34MB / 5.26MB,32.8kB / 307kB,34
|
||||
2026-10-16T18:50:49.2680345+03:00,lab3-redis-1,1.73%,3.441MiB / 256MiB,1.34%,757kB / 869kB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:49.2680345+03:00,lab3-db-1,74.98%,84.77MiB / 1GiB,8.28%,6.55MB / 5.22MB,65.5kB / 15.1MB,26
|
||||
2026-10-16T18:50:53.9842005+03:00,lab3-loadgen-run-22562303d7c3,16.90%,26MiB / 7.649GiB,0.33%,5.4MB / 4.22MB,0B / 2.36MB,9
|
||||
2026-10-16T18:50:53.9842005+03:00,lab3-lb-1,5.38%,7.871MiB / 128MiB,6.15%,8.08MB / 8.57MB,0B / 401kB,9
|
||||
2026-10-16T18:50:53.9842005+03:00,lab3-api-2,76.37%,427.1MiB / 512MiB,83.42%,5.27MB / 6.3MB,0B / 315kB,35
|
||||
2026-10-16T18:50:53.9842005+03:00,lab3-api-1,98.88%,439.7MiB / 512MiB,85.88%,5.13MB / 6.21MB,32.8kB / 307kB,34
|
||||
2026-10-16T18:50:53.9842005+03:00,lab3-redis-1,3.68%,3.441MiB / 256MiB,1.34%,914kB / 1.06MB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:53.9842005+03:00,lab3-db-1,62.16%,85.32MiB / 1GiB,8.33%,7.91MB / 6.32MB,65.5kB / 16.6MB,26
|
||||
2026-10-16T18:50:58.6405755+03:00,lab3-loadgen-run-22562303d7c3,28.14%,26.05MiB / 7.649GiB,0.33%,6.22MB / 4.87MB,0B / 2.36MB,9
|
||||
2026-10-16T18:50:58.6405755+03:00,lab3-lb-1,8.24%,7.867MiB / 128MiB,6.15%,9.32MB / 9.88MB,0B / 799kB,9
|
||||
2026-10-16T18:50:58.6405755+03:00,lab3-api-2,102.61%,428.6MiB / 512MiB,83.71%,6.07MB / 7.24MB,0B / 315kB,35
|
||||
2026-10-16T18:50:58.6405755+03:00,lab3-api-1,101.87%,447MiB / 512MiB,87.31%,6.05MB / 7.32MB,32.8kB / 319kB,34
|
||||
2026-10-16T18:50:58.6405755+03:00,lab3-redis-1,2.05%,3.445MiB / 256MiB,1.35%,1.05MB / 1.22MB,28.7kB / 0B,6
|
||||
2026-10-16T18:50:58.6405755+03:00,lab3-db-1,90.36%,86.14MiB / 1GiB,8.41%,9.09MB / 7.27MB,65.5kB / 17.8MB,26
|
||||
2026-10-16T18:51:02.9966052+03:00,lab3-loadgen-run-22562303d7c3,20.92%,26.07MiB / 7.649GiB,0.33%,7.11MB / 5.56MB,0B / 2.36MB,9
|
||||
2026-10-16T18:51:02.9966052+03:00,lab3-lb-1,6.46%,7.832MiB / 128MiB,6.12%,10.6MB / 11.3MB,0B / 799kB,9
|
||||
2026-10-16T18:51:02.9966052+03:00,lab3-api-2,103.29%,429.5MiB / 512MiB,83.88%,6.93MB / 8.26MB,0B / 315kB,36
|
||||
2026-10-16T18:51:02.9966052+03:00,lab3-api-1,86.60%,447.4MiB / 512MiB,87.38%,6.91MB / 8.34MB,32.8kB / 319kB,34
|
||||
2026-10-16T18:51:02.9966052+03:00,lab3-redis-1,1.64%,3.445MiB / 256MiB,1.35%,1.2MB / 1.39MB,28.7kB / 0B,6
|
||||
2026-10-16T18:51:02.9966052+03:00,lab3-db-1,94.41%,86.9MiB / 1GiB,8.49%,10.1MB / 8.11MB,65.5kB / 18.9MB,26
|
||||
2026-10-16T18:51:07.6918856+03:00,lab3-loadgen-run-22562303d7c3,25.29%,26.09MiB / 7.649GiB,0.33%,8MB / 6.26MB,0B / 2.36MB,9
|
||||
2026-10-16T18:51:07.6918856+03:00,lab3-lb-1,8.13%,7.867MiB / 128MiB,6.15%,12MB / 12.7MB,0B / 799kB,9
|
||||
2026-10-16T18:51:07.6918856+03:00,lab3-api-2,100.31%,426MiB / 512MiB,83.19%,7.78MB / 9.27MB,0B / 315kB,36
|
||||
2026-10-16T18:51:07.6918856+03:00,lab3-api-1,94.64%,448.1MiB / 512MiB,87.52%,7.57MB / 9.13MB,32.8kB / 319kB,34
|
||||
2026-10-16T18:51:07.6918856+03:00,lab3-redis-1,1.94%,3.445MiB / 256MiB,1.35%,1.34MB / 1.56MB,28.7kB / 0B,6
|
||||
2026-10-16T18:51:07.6918856+03:00,lab3-db-1,100.46%,87.82MiB / 1GiB,8.58%,11.6MB / 9.31MB,65.5kB / 20.5MB,26
|
||||
2026-10-16T18:51:12.3415939+03:00,lab3-loadgen-run-22562303d7c3,23.94%,26.11MiB / 7.649GiB,0.33%,8.81MB / 6.89MB,0B / 2.36MB,9
|
||||
2026-10-16T18:51:12.3415939+03:00,lab3-lb-1,7.17%,7.824MiB / 128MiB,6.11%,13.2MB / 14MB,0B / 1.21MB,9
|
||||
2026-10-16T18:51:12.3415939+03:00,lab3-api-2,87.40%,429.7MiB / 512MiB,83.93%,8.57MB / 10.2MB,0B / 328kB,35
|
||||
2026-10-16T18:51:12.3415939+03:00,lab3-api-1,93.53%,452.6MiB / 512MiB,88.39%,8.39MB / 10.1MB,32.8kB / 332kB,34
|
||||
2026-10-16T18:51:12.3415939+03:00,lab3-redis-1,2.00%,3.438MiB / 256MiB,1.34%,1.47MB / 1.73MB,28.7kB / 0B,6
|
||||
2026-10-16T18:51:12.3415939+03:00,lab3-db-1,100.20%,89.14MiB / 1GiB,8.71%,12.8MB / 10.3MB,65.5kB / 21.7MB,26
|
||||
2026-10-16T18:51:16.9891862+03:00,lab3-loadgen-run-22562303d7c3,22.32%,26.18MiB / 7.649GiB,0.33%,9.55MB / 7.47MB,0B / 2.36MB,9
|
||||
2026-10-16T18:51:16.9891862+03:00,lab3-lb-1,6.86%,7.848MiB / 128MiB,6.13%,14.3MB / 15.2MB,0B / 1.21MB,9
|
||||
2026-10-16T18:51:16.9891862+03:00,lab3-api-2,78.20%,434.4MiB / 512MiB,84.85%,9.31MB / 11.1MB,0B / 328kB,35
|
||||
2026-10-16T18:51:16.9891862+03:00,lab3-api-1,68.15%,444.1MiB / 512MiB,86.74%,9.31MB / 11.1MB,32.8kB / 332kB,34
|
||||
2026-10-16T18:51:16.9891862+03:00,lab3-redis-1,1.74%,3.445MiB / 256MiB,1.35%,1.59MB / 1.87MB,28.7kB / 0B,6
|
||||
2026-10-16T18:51:16.9891862+03:00,lab3-db-1,104.57%,90.16MiB / 1GiB,8.80%,13.6MB / 11MB,65.5kB / 21.8MB,26
|
||||
2026-10-16T18:51:21.6390114+03:00,lab3-loadgen-run-22562303d7c3,19.01%,26.16MiB / 7.649GiB,0.33%,10.3MB / 8.04MB,0B / 2.36MB,9
|
||||
2026-10-16T18:51:21.6390114+03:00,lab3-lb-1,6.22%,7.777MiB / 128MiB,6.08%,15.4MB / 16.3MB,0B / 1.21MB,9
|
||||
2026-10-16T18:51:21.6390114+03:00,lab3-api-2,61.71%,429.3MiB / 512MiB,83.85%,10MB / 11.9MB,0B / 328kB,35
|
||||
2026-10-16T18:51:21.6390114+03:00,lab3-api-1,46.04%,443.7MiB / 512MiB,86.67%,9.89MB / 11.8MB,32.8kB / 332kB,34
|
||||
2026-10-16T18:51:21.6390114+03:00,lab3-redis-1,2.33%,3.441MiB / 256MiB,1.34%,1.71MB / 2.02MB,28.7kB / 0B,6
|
||||
2026-10-16T18:51:21.6390114+03:00,lab3-db-1,101.80%,89.9MiB / 1GiB,8.78%,14.8MB / 12MB,65.5kB / 21.8MB,26
|
||||
2026-10-16T18:51:26.2942789+03:00,lab3-loadgen-run-22562303d7c3,22.44%,26.19MiB / 7.649GiB,0.33%,11MB / 8.58MB,0B / 2.36MB,9
|
||||
2026-10-16T18:51:26.2942789+03:00,lab3-lb-1,6.80%,7.746MiB / 128MiB,6.05%,16.5MB / 17.4MB,0B / 1.56MB,9
|
||||
2026-10-16T18:51:26.2942789+03:00,lab3-api-2,62.07%,429.2MiB / 512MiB,83.83%,10.7MB / 12.7MB,0B / 340kB,35
|
||||
2026-10-16T18:51:26.2942789+03:00,lab3-api-1,42.55%,444.1MiB / 512MiB,86.75%,10.7MB / 12.8MB,32.8kB / 344kB,34
|
||||
2026-10-16T18:51:26.2942789+03:00,lab3-redis-1,1.65%,3.445MiB / 256MiB,1.35%,1.83MB / 2.16MB,28.7kB / 0B,6
|
||||
2026-10-16T18:51:26.2942789+03:00,lab3-db-1,104.79%,90.93MiB / 1GiB,8.88%,15.6MB / 12.7MB,65.5kB / 21.8MB,26
|
||||
2026-10-16T18:51:30.9297160+03:00,lab3-loadgen-run-22562303d7c3,18.11%,26.16MiB / 7.649GiB,0.33%,11.5MB / 9.02MB,0B / 2.36MB,9
|
||||
2026-10-16T18:51:30.9297160+03:00,lab3-lb-1,5.13%,7.762MiB / 128MiB,6.06%,17.3MB / 18.3MB,0B / 1.56MB,9
|
||||
2026-10-16T18:51:30.9297160+03:00,lab3-api-2,38.57%,429.9MiB / 512MiB,83.96%,11.3MB / 13.4MB,0B / 340kB,35
|
||||
2026-10-16T18:51:30.9297160+03:00,lab3-api-1,41.89%,444MiB / 512MiB,86.72%,11.3MB / 13.4MB,32.8kB / 344kB,34
|
||||
2026-10-16T18:51:30.9297160+03:00,lab3-redis-1,1.48%,3.438MiB / 256MiB,1.34%,1.93MB / 2.27MB,28.7kB / 0B,6
|
||||
2026-10-16T18:51:30.9297160+03:00,lab3-db-1,100.84%,91.14MiB / 1GiB,8.90%,16.6MB / 13.6MB,65.5kB / 21.8MB,26
|
||||
2026-10-16T18:51:34.9843175+03:00,lab3-loadgen-run-22562303d7c3,18.53%,26.23MiB / 7.649GiB,0.33%,12.2MB / 9.54MB,0B / 2.36MB,9
|
||||
2026-10-16T18:51:34.9843175+03:00,lab3-lb-1,4.91%,7.777MiB / 128MiB,6.08%,18.3MB / 19.4MB,0B / 1.56MB,9
|
||||
2026-10-16T18:51:34.9843175+03:00,lab3-api-2,93.33%,432.7MiB / 512MiB,84.52%,12MB / 14.1MB,0B / 340kB,35
|
||||
2026-10-16T18:51:34.9843175+03:00,lab3-api-1,50.33%,444.5MiB / 512MiB,86.81%,11.8MB / 14MB,32.8kB / 344kB,34
|
||||
2026-10-16T18:51:34.9843175+03:00,lab3-redis-1,3.92%,3.445MiB / 256MiB,1.35%,2.04MB / 2.4MB,28.7kB / 0B,6
|
||||
2026-10-16T18:51:34.9843175+03:00,lab3-db-1,99.04%,91.94MiB / 1GiB,8.98%,17.5MB / 14.4MB,65.5kB / 21.8MB,26
|
||||
2026-10-16T18:51:39.6157679+03:00,lab3-loadgen-run-22562303d7c3,16.88%,26.17MiB / 7.649GiB,0.33%,12.8MB / 9.98MB,0B / 2.36MB,9
|
||||
2026-10-16T18:51:39.6157679+03:00,lab3-lb-1,4.75%,7.797MiB / 128MiB,6.09%,19.1MB / 20.3MB,0B / 1.56MB,9
|
||||
2026-10-16T18:51:39.6157679+03:00,lab3-api-2,80.65%,440MiB / 512MiB,85.95%,12.5MB / 14.8MB,0B / 352kB,35
|
||||
2026-10-16T18:51:39.6157679+03:00,lab3-api-1,67.44%,449.1MiB / 512MiB,87.71%,12.5MB / 14.8MB,32.8kB / 356kB,34
|
||||
2026-10-16T18:51:39.6157679+03:00,lab3-redis-1,1.58%,3.445MiB / 256MiB,1.35%,2.13MB / 2.51MB,28.7kB / 0B,6
|
||||
2026-10-16T18:51:39.6157679+03:00,lab3-db-1,100.77%,92.28MiB / 1GiB,9.01%,18.3MB / 15.1MB,65.5kB / 25.8MB,26
|
||||
|
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"lab": 3,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 90.0,
|
||||
"elapsed_seconds": 90.036,
|
||||
"concurrency": 8,
|
||||
"successful_requests": 12297,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 136.579,
|
||||
"successful_latency_ms": {
|
||||
"p50": 59.414,
|
||||
"p95": 105.771,
|
||||
"p99": 182.732
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,121 @@
|
||||
timestamp,name,cpu_percent,mem_usage,mem_percent,net_io,block_io,pids
|
||||
2026-10-16T19:34:05.7352982+03:00,lab3-loadgen-run-39d76031bdd7,0.57%,17.94MiB / 7.649GiB,0.23%,7.14kB / 5.09kB,0B / 0B,1
|
||||
2026-10-16T19:34:05.7352982+03:00,lab3-lb-1,0.35%,7.16MiB / 128MiB,5.59%,11.1kB / 11.1kB,0B / 12.3kB,9
|
||||
2026-10-16T19:34:05.7352982+03:00,lab3-api-1,25.87%,357.4MiB / 512MiB,69.80%,24.8kB / 25.3kB,0B / 242kB,33
|
||||
2026-10-16T19:34:05.7352982+03:00,lab3-api-2,94.75%,364.1MiB / 512MiB,71.11%,25.1kB / 26.5kB,0B / 246kB,36
|
||||
2026-10-16T19:34:05.7352982+03:00,lab3-db-1,1.06%,36.94MiB / 1GiB,3.61%,77.5kB / 69.3kB,0B / 225kB,16
|
||||
2026-10-16T19:34:05.7352982+03:00,lab3-redis-1,0.37%,3.375MiB / 256MiB,1.32%,2.71kB / 126B,36.9kB / 0B,6
|
||||
2026-10-16T19:34:09.8799201+03:00,lab3-loadgen-run-39d76031bdd7,0.00%,25.69MiB / 7.649GiB,0.33%,19.5kB / 18.1kB,0B / 0B,9
|
||||
2026-10-16T19:34:09.8799201+03:00,lab3-lb-1,2.60%,7.48MiB / 128MiB,5.84%,102kB / 111kB,0B / 12.3kB,9
|
||||
2026-10-16T19:34:09.8799201+03:00,lab3-api-1,90.73%,383.1MiB / 512MiB,74.83%,96.6kB / 117kB,0B / 242kB,35
|
||||
2026-10-16T19:34:09.8799201+03:00,lab3-api-2,98.76%,389.4MiB / 512MiB,76.06%,105kB / 129kB,0B / 246kB,35
|
||||
2026-10-16T19:34:09.8799201+03:00,lab3-db-1,26.09%,53.83MiB / 1GiB,5.26%,214kB / 165kB,8.19kB / 225kB,20
|
||||
2026-10-16T19:34:09.8799201+03:00,lab3-redis-1,2.69%,3.43MiB / 256MiB,1.34%,8.49kB / 5.22kB,41kB / 0B,6
|
||||
2026-10-16T19:34:14.5037374+03:00,lab3-loadgen-run-39d76031bdd7,10.08%,25.77MiB / 7.649GiB,0.33%,336kB / 269kB,0B / 0B,9
|
||||
2026-10-16T19:34:14.5037374+03:00,lab3-lb-1,3.51%,7.68MiB / 128MiB,6.00%,519kB / 555kB,0B / 12.3kB,9
|
||||
2026-10-16T19:34:14.5037374+03:00,lab3-api-1,98.47%,400.8MiB / 512MiB,78.28%,366kB / 444kB,0B / 242kB,35
|
||||
2026-10-16T19:34:14.5037374+03:00,lab3-api-2,99.08%,395.9MiB / 512MiB,77.31%,385kB / 478kB,0B / 246kB,34
|
||||
2026-10-16T19:34:14.5037374+03:00,lab3-db-1,24.60%,59.04MiB / 1GiB,5.77%,638kB / 488kB,8.19kB / 225kB,20
|
||||
2026-10-16T19:34:14.5037374+03:00,lab3-redis-1,3.06%,3.438MiB / 256MiB,1.34%,68.4kB / 68.1kB,41kB / 0B,6
|
||||
2026-10-16T19:34:18.9992427+03:00,lab3-loadgen-run-39d76031bdd7,12.78%,25.79MiB / 7.649GiB,0.33%,714kB / 566kB,0B / 2.36MB,9
|
||||
2026-10-16T19:34:18.9992427+03:00,lab3-lb-1,4.20%,7.691MiB / 128MiB,6.01%,1.09MB / 1.16MB,0B / 111kB,9
|
||||
2026-10-16T19:34:18.9992427+03:00,lab3-api-1,99.67%,407.1MiB / 512MiB,79.51%,737kB / 892kB,0B / 258kB,36
|
||||
2026-10-16T19:34:18.9992427+03:00,lab3-api-2,99.15%,400.7MiB / 512MiB,78.27%,753kB / 929kB,0B / 262kB,34
|
||||
2026-10-16T19:34:18.9992427+03:00,lab3-db-1,27.79%,65.34MiB / 1GiB,6.38%,1.2MB / 929kB,8.19kB / 225kB,21
|
||||
2026-10-16T19:34:18.9992427+03:00,lab3-redis-1,1.38%,3.434MiB / 256MiB,1.34%,120kB / 126kB,41kB / 0B,6
|
||||
2026-10-16T19:34:23.6236284+03:00,lab3-loadgen-run-39d76031bdd7,14.77%,25.84MiB / 7.649GiB,0.33%,1.04MB / 824kB,0B / 2.36MB,9
|
||||
2026-10-16T19:34:23.6236284+03:00,lab3-lb-1,3.97%,7.742MiB / 128MiB,6.05%,1.72MB / 1.82MB,0B / 111kB,9
|
||||
2026-10-16T19:34:23.6236284+03:00,lab3-api-1,104.41%,422MiB / 512MiB,82.42%,1.14MB / 1.39MB,0B / 258kB,35
|
||||
2026-10-16T19:34:23.6236284+03:00,lab3-api-2,104.30%,406.9MiB / 512MiB,79.47%,1.16MB / 1.43MB,0B / 262kB,34
|
||||
2026-10-16T19:34:23.6236284+03:00,lab3-db-1,25.44%,68.52MiB / 1GiB,6.69%,1.81MB / 1.41MB,8.19kB / 225kB,21
|
||||
2026-10-16T19:34:23.6236284+03:00,lab3-redis-1,1.18%,3.441MiB / 256MiB,1.34%,210kB / 226kB,41kB / 0B,6
|
||||
2026-10-16T19:34:28.2596080+03:00,lab3-loadgen-run-39d76031bdd7,15.88%,25.94MiB / 7.649GiB,0.33%,1.6MB / 1.26MB,0B / 2.36MB,9
|
||||
2026-10-16T19:34:28.2596080+03:00,lab3-lb-1,5.06%,7.723MiB / 128MiB,6.03%,2.44MB / 2.57MB,0B / 111kB,9
|
||||
2026-10-16T19:34:28.2596080+03:00,lab3-api-1,101.73%,446.2MiB / 512MiB,87.15%,1.6MB / 1.93MB,0B / 258kB,35
|
||||
2026-10-16T19:34:28.2596080+03:00,lab3-api-2,108.26%,409.8MiB / 512MiB,80.04%,1.62MB / 1.98MB,0B / 262kB,34
|
||||
2026-10-16T19:34:28.2596080+03:00,lab3-db-1,39.40%,70.98MiB / 1GiB,6.93%,2.49MB / 1.95MB,8.19kB / 225kB,21
|
||||
2026-10-16T19:34:28.2596080+03:00,lab3-redis-1,1.90%,3.441MiB / 256MiB,1.34%,274kB / 298kB,41kB / 0B,6
|
||||
2026-10-16T19:34:32.9828278+03:00,lab3-loadgen-run-39d76031bdd7,21.33%,25.93MiB / 7.649GiB,0.33%,2.17MB / 1.71MB,0B / 2.36MB,9
|
||||
2026-10-16T19:34:32.9828278+03:00,lab3-lb-1,6.91%,7.738MiB / 128MiB,6.05%,3.28MB / 3.46MB,0B / 111kB,9
|
||||
2026-10-16T19:34:32.9828278+03:00,lab3-api-1,98.78%,448.4MiB / 512MiB,87.59%,2.14MB / 2.59MB,0B / 258kB,35
|
||||
2026-10-16T19:34:32.9828278+03:00,lab3-api-2,99.68%,420.8MiB / 512MiB,82.19%,2.16MB / 2.64MB,0B / 262kB,34
|
||||
2026-10-16T19:34:32.9828278+03:00,lab3-db-1,45.91%,72.96MiB / 1GiB,7.13%,3.3MB / 2.6MB,8.19kB / 225kB,21
|
||||
2026-10-16T19:34:32.9828278+03:00,lab3-redis-1,1.55%,3.434MiB / 256MiB,1.34%,367kB / 404kB,41kB / 0B,6
|
||||
2026-10-16T19:34:37.6407023+03:00,lab3-loadgen-run-39d76031bdd7,20.26%,26.02MiB / 7.649GiB,0.33%,2.79MB / 2.19MB,0B / 2.36MB,9
|
||||
2026-10-16T19:34:37.6407023+03:00,lab3-lb-1,5.92%,8.004MiB / 128MiB,6.25%,3.99MB / 4.21MB,0B / 340kB,9
|
||||
2026-10-16T19:34:37.6407023+03:00,lab3-api-1,100.37%,431.3MiB / 512MiB,84.24%,2.74MB / 3.29MB,0B / 270kB,35
|
||||
2026-10-16T19:34:37.6407023+03:00,lab3-api-2,104.47%,415.4MiB / 512MiB,81.14%,2.76MB / 3.36MB,0B / 274kB,34
|
||||
2026-10-16T19:34:37.6407023+03:00,lab3-db-1,50.70%,74.22MiB / 1GiB,7.25%,4.18MB / 3.32MB,8.19kB / 225kB,21
|
||||
2026-10-16T19:34:37.6407023+03:00,lab3-redis-1,1.81%,3.441MiB / 256MiB,1.34%,495kB / 553kB,41kB / 0B,6
|
||||
2026-10-16T19:34:42.2790445+03:00,lab3-loadgen-run-39d76031bdd7,25.97%,26.01MiB / 7.649GiB,0.33%,3.47MB / 2.73MB,0B / 2.36MB,9
|
||||
2026-10-16T19:34:42.2790445+03:00,lab3-lb-1,8.38%,8.016MiB / 128MiB,6.26%,5.23MB / 5.53MB,0B / 340kB,9
|
||||
2026-10-16T19:34:42.2790445+03:00,lab3-api-1,101.24%,437MiB / 512MiB,85.36%,3.4MB / 4.07MB,0B / 270kB,35
|
||||
2026-10-16T19:34:42.2790445+03:00,lab3-api-2,102.77%,417MiB / 512MiB,81.45%,3.43MB / 4.16MB,0B / 274kB,35
|
||||
2026-10-16T19:34:42.2790445+03:00,lab3-db-1,67.07%,75.11MiB / 1GiB,7.33%,5.15MB / 4.1MB,8.19kB / 225kB,21
|
||||
2026-10-16T19:34:42.2790445+03:00,lab3-redis-1,1.95%,3.438MiB / 256MiB,1.34%,583kB / 657kB,41kB / 0B,6
|
||||
2026-10-16T19:34:46.9657484+03:00,lab3-loadgen-run-39d76031bdd7,24.39%,25.98MiB / 7.649GiB,0.33%,4.17MB / 3.27MB,0B / 2.36MB,9
|
||||
2026-10-16T19:34:46.9657484+03:00,lab3-lb-1,7.38%,7.777MiB / 128MiB,6.08%,6.28MB / 6.64MB,0B / 340kB,9
|
||||
2026-10-16T19:34:46.9657484+03:00,lab3-api-1,100.62%,437.9MiB / 512MiB,85.52%,4.08MB / 4.85MB,0B / 270kB,35
|
||||
2026-10-16T19:34:46.9657484+03:00,lab3-api-2,99.56%,419.9MiB / 512MiB,82.02%,4.1MB / 4.97MB,0B / 274kB,34
|
||||
2026-10-16T19:34:46.9657484+03:00,lab3-db-1,73.25%,76.01MiB / 1GiB,7.42%,6.13MB / 4.91MB,8.19kB / 225kB,21
|
||||
2026-10-16T19:34:46.9657484+03:00,lab3-redis-1,1.74%,3.441MiB / 256MiB,1.34%,724kB / 827kB,41kB / 0B,6
|
||||
2026-10-16T19:34:51.0112010+03:00,lab3-loadgen-run-39d76031bdd7,21.73%,25.99MiB / 7.649GiB,0.33%,4.86MB / 3.82MB,0B / 2.36MB,9
|
||||
2026-10-16T19:34:51.0112010+03:00,lab3-lb-1,6.72%,7.809MiB / 128MiB,6.10%,7.31MB / 7.73MB,0B / 668kB,9
|
||||
2026-10-16T19:34:51.0112010+03:00,lab3-api-1,101.92%,442.1MiB / 512MiB,86.34%,4.76MB / 5.67MB,0B / 283kB,36
|
||||
2026-10-16T19:34:51.0112010+03:00,lab3-api-2,100.48%,429.3MiB / 512MiB,83.85%,4.77MB / 5.76MB,0B / 287kB,34
|
||||
2026-10-16T19:34:51.0112010+03:00,lab3-db-1,68.37%,82.08MiB / 1GiB,8.02%,7.13MB / 5.71MB,8.19kB / 225kB,23
|
||||
2026-10-16T19:34:51.0112010+03:00,lab3-redis-1,4.48%,3.441MiB / 256MiB,1.34%,813kB / 932kB,41kB / 0B,6
|
||||
2026-10-16T19:34:55.6531428+03:00,lab3-loadgen-run-39d76031bdd7,21.59%,25.98MiB / 7.649GiB,0.33%,5.53MB / 4.34MB,0B / 2.36MB,9
|
||||
2026-10-16T19:34:55.6531428+03:00,lab3-lb-1,6.39%,7.832MiB / 128MiB,6.12%,8.31MB / 8.79MB,0B / 668kB,9
|
||||
2026-10-16T19:34:55.6531428+03:00,lab3-api-1,94.56%,443.5MiB / 512MiB,86.63%,5.4MB / 6.43MB,0B / 283kB,35
|
||||
2026-10-16T19:34:55.6531428+03:00,lab3-api-2,96.75%,426.4MiB / 512MiB,83.27%,5.42MB / 6.54MB,0B / 287kB,34
|
||||
2026-10-16T19:34:55.6531428+03:00,lab3-db-1,75.47%,82.57MiB / 1GiB,8.06%,8.08MB / 6.49MB,8.19kB / 225kB,23
|
||||
2026-10-16T19:34:55.6531428+03:00,lab3-redis-1,1.63%,3.434MiB / 256MiB,1.34%,951kB / 1.1MB,41kB / 0B,6
|
||||
2026-10-16T19:35:00.0714284+03:00,lab3-loadgen-run-39d76031bdd7,25.68%,26MiB / 7.649GiB,0.33%,6.37MB / 5MB,0B / 2.36MB,9
|
||||
2026-10-16T19:35:00.0714284+03:00,lab3-lb-1,8.71%,8.062MiB / 128MiB,6.30%,9.56MB / 10.1MB,0B / 668kB,9
|
||||
2026-10-16T19:35:00.0714284+03:00,lab3-api-1,64.35%,444.1MiB / 512MiB,86.75%,6.21MB / 7.37MB,0B / 283kB,35
|
||||
2026-10-16T19:35:00.0714284+03:00,lab3-api-2,100.11%,429.9MiB / 512MiB,83.97%,6.23MB / 7.51MB,0B / 287kB,35
|
||||
2026-10-16T19:35:00.0714284+03:00,lab3-db-1,92.50%,85.13MiB / 1GiB,8.31%,9.26MB / 7.45MB,8.19kB / 225kB,24
|
||||
2026-10-16T19:35:00.0714284+03:00,lab3-redis-1,2.06%,3.441MiB / 256MiB,1.34%,1.06MB / 1.22MB,41kB / 0B,6
|
||||
2026-10-16T19:35:04.7312116+03:00,lab3-loadgen-run-39d76031bdd7,26.79%,26.07MiB / 7.649GiB,0.33%,7.19MB / 5.64MB,0B / 2.36MB,9
|
||||
2026-10-16T19:35:04.7312116+03:00,lab3-lb-1,9.05%,7.832MiB / 128MiB,6.12%,10.8MB / 11.4MB,0B / 1.04MB,9
|
||||
2026-10-16T19:35:04.7312116+03:00,lab3-api-1,67.98%,444.7MiB / 512MiB,86.86%,7.01MB / 8.29MB,0B / 295kB,35
|
||||
2026-10-16T19:35:04.7312116+03:00,lab3-api-2,104.09%,430.2MiB / 512MiB,84.02%,7.03MB / 8.46MB,0B / 299kB,35
|
||||
2026-10-16T19:35:04.7312116+03:00,lab3-db-1,100.34%,87.04MiB / 1GiB,8.50%,10.4MB / 8.4MB,8.19kB / 430kB,25
|
||||
2026-10-16T19:35:04.7312116+03:00,lab3-redis-1,4.08%,3.445MiB / 256MiB,1.35%,1.22MB / 1.42MB,41kB / 0B,6
|
||||
2026-10-16T19:35:09.0793829+03:00,lab3-loadgen-run-39d76031bdd7,24.90%,26.07MiB / 7.649GiB,0.33%,8MB / 6.28MB,0B / 2.36MB,9
|
||||
2026-10-16T19:35:09.0793829+03:00,lab3-lb-1,9.44%,7.797MiB / 128MiB,6.09%,12MB / 12.7MB,0B / 1.04MB,9
|
||||
2026-10-16T19:35:09.0793829+03:00,lab3-api-1,102.32%,444.7MiB / 512MiB,86.86%,7.64MB / 9.02MB,0B / 295kB,35
|
||||
2026-10-16T19:35:09.0793829+03:00,lab3-api-2,101.18%,431.9MiB / 512MiB,84.36%,7.82MB / 9.38MB,0B / 299kB,34
|
||||
2026-10-16T19:35:09.0793829+03:00,lab3-db-1,100.67%,87.78MiB / 1GiB,8.57%,11.6MB / 9.35MB,8.19kB / 430kB,25
|
||||
2026-10-16T19:35:09.0793829+03:00,lab3-redis-1,2.08%,3.684MiB / 256MiB,1.44%,1.33MB / 1.55MB,41kB / 0B,6
|
||||
2026-10-16T19:35:13.7585814+03:00,lab3-loadgen-run-39d76031bdd7,23.23%,26.09MiB / 7.649GiB,0.33%,8.79MB / 6.89MB,0B / 2.36MB,9
|
||||
2026-10-16T19:35:13.7585814+03:00,lab3-lb-1,7.98%,7.754MiB / 128MiB,6.06%,13.2MB / 14MB,0B / 1.04MB,9
|
||||
2026-10-16T19:35:13.7585814+03:00,lab3-api-1,52.16%,445.1MiB / 512MiB,86.94%,8.58MB / 10.1MB,0B / 295kB,35
|
||||
2026-10-16T19:35:13.7585814+03:00,lab3-api-2,102.56%,437.7MiB / 512MiB,85.49%,8.43MB / 10.1MB,0B / 299kB,35
|
||||
2026-10-16T19:35:13.7585814+03:00,lab3-db-1,99.96%,88.76MiB / 1GiB,8.67%,12.7MB / 10.3MB,8.19kB / 430kB,25
|
||||
2026-10-16T19:35:13.7585814+03:00,lab3-redis-1,1.76%,3.691MiB / 256MiB,1.44%,1.46MB / 1.71MB,41kB / 0B,6
|
||||
2026-10-16T19:35:18.4303387+03:00,lab3-loadgen-run-39d76031bdd7,22.26%,26.16MiB / 7.649GiB,0.33%,9.57MB / 7.5MB,0B / 2.36MB,9
|
||||
2026-10-16T19:35:18.4303387+03:00,lab3-lb-1,7.27%,7.801MiB / 128MiB,6.09%,14.1MB / 15MB,0B / 1.04MB,9
|
||||
2026-10-16T19:35:18.4303387+03:00,lab3-api-1,46.70%,445.5MiB / 512MiB,87.02%,9.36MB / 11MB,0B / 307kB,35
|
||||
2026-10-16T19:35:18.4303387+03:00,lab3-api-2,66.69%,438MiB / 512MiB,85.54%,9.38MB / 11.2MB,0B / 311kB,35
|
||||
2026-10-16T19:35:18.4303387+03:00,lab3-db-1,99.05%,87.75MiB / 1GiB,8.57%,13.7MB / 11.2MB,8.19kB / 430kB,24
|
||||
2026-10-16T19:35:18.4303387+03:00,lab3-redis-1,1.79%,3.441MiB / 256MiB,1.34%,1.61MB / 1.89MB,41kB / 0B,6
|
||||
2026-10-16T19:35:23.0752357+03:00,lab3-loadgen-run-39d76031bdd7,18.30%,26.21MiB / 7.649GiB,0.33%,10.3MB / 8.04MB,0B / 2.36MB,9
|
||||
2026-10-16T19:35:23.0752357+03:00,lab3-lb-1,5.42%,7.797MiB / 128MiB,6.09%,15.4MB / 16.3MB,0B / 1.41MB,9
|
||||
2026-10-16T19:35:23.0752357+03:00,lab3-api-1,72.27%,445.9MiB / 512MiB,87.09%,10MB / 11.8MB,0B / 307kB,35
|
||||
2026-10-16T19:35:23.0752357+03:00,lab3-api-2,94.02%,438.6MiB / 512MiB,85.67%,10.1MB / 12MB,0B / 311kB,34
|
||||
2026-10-16T19:35:23.0752357+03:00,lab3-db-1,104.30%,105.8MiB / 1GiB,10.33%,14.7MB / 12.1MB,8.19kB / 430kB,25
|
||||
2026-10-16T19:35:23.0752357+03:00,lab3-redis-1,1.73%,3.434MiB / 256MiB,1.34%,1.71MB / 2.01MB,41kB / 0B,6
|
||||
2026-10-16T19:35:27.7584699+03:00,lab3-loadgen-run-39d76031bdd7,15.55%,26.15MiB / 7.649GiB,0.33%,10.9MB / 8.51MB,0B / 2.36MB,9
|
||||
2026-10-16T19:35:27.7584699+03:00,lab3-lb-1,4.53%,7.746MiB / 128MiB,6.05%,16.3MB / 17.3MB,0B / 1.41MB,9
|
||||
2026-10-16T19:35:27.7584699+03:00,lab3-api-1,31.90%,446MiB / 512MiB,87.10%,10.7MB / 12.5MB,0B / 307kB,35
|
||||
2026-10-16T19:35:27.7584699+03:00,lab3-api-2,43.86%,439MiB / 512MiB,85.74%,10.6MB / 12.5MB,0B / 311kB,34
|
||||
2026-10-16T19:35:27.7584699+03:00,lab3-db-1,99.46%,106.6MiB / 1GiB,10.41%,15.5MB / 12.8MB,8.19kB / 430kB,25
|
||||
2026-10-16T19:35:27.7584699+03:00,lab3-redis-1,1.35%,3.434MiB / 256MiB,1.34%,1.83MB / 2.15MB,41kB / 0B,6
|
||||
2026-10-16T19:35:32.4077828+03:00,lab3-loadgen-run-39d76031bdd7,23.75%,26.68MiB / 7.649GiB,0.34%,11.4MB / 8.96MB,0B / 2.36MB,9
|
||||
2026-10-16T19:35:32.4077828+03:00,lab3-lb-1,6.08%,7.758MiB / 128MiB,6.06%,17.2MB / 18.2MB,0B / 1.41MB,9
|
||||
2026-10-16T19:35:32.4077828+03:00,lab3-api-1,83.94%,446.5MiB / 512MiB,87.20%,11.2MB / 13.1MB,0B / 307kB,35
|
||||
2026-10-16T19:35:32.4077828+03:00,lab3-api-2,51.35%,439.7MiB / 512MiB,85.87%,11.3MB / 13.3MB,0B / 311kB,34
|
||||
2026-10-16T19:35:32.4077828+03:00,lab3-db-1,103.93%,90.05MiB / 1GiB,8.79%,16.3MB / 13.5MB,8.19kB / 430kB,24
|
||||
2026-10-16T19:35:32.4077828+03:00,lab3-redis-1,1.54%,3.441MiB / 256MiB,1.34%,1.91MB / 2.24MB,41kB / 0B,6
|
||||
|
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"lab": 3,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 90.0,
|
||||
"elapsed_seconds": 90.075,
|
||||
"concurrency": 8,
|
||||
"successful_requests": 11267,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 125.085,
|
||||
"successful_latency_ms": {
|
||||
"p50": 68.275,
|
||||
"p95": 114.484,
|
||||
"p99": 198.429
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
timestamp,name,cpu_percent,mem_usage,mem_percent,net_io,block_io,pids
|
||||
2026-10-16T19:24:51.2819767+03:00,lab3-loadgen-run-57a7191551e7,0.00%,17.88MiB / 7.649GiB,0.23%,2.89kB / 1.94kB,0B / 2.36MB,1
|
||||
2026-10-16T19:24:51.2819767+03:00,lab3-lb-1,0.16%,7.066MiB / 128MiB,5.52%,4.48kB / 3.92kB,0B / 16.4kB,9
|
||||
2026-10-16T19:24:51.2819767+03:00,lab3-api-4,0.24%,253.7MiB / 256MiB,99.10%,39.5kB / 48.5kB,46.7MB / 150MB,33
|
||||
2026-10-16T19:24:51.2819767+03:00,lab3-api-1,0.24%,253.2MiB / 256MiB,98.93%,40.2kB / 49.1kB,57.6MB / 169MB,33
|
||||
2026-10-16T19:24:51.2819767+03:00,lab3-api-3,0.22%,253.3MiB / 256MiB,98.93%,40.7kB / 49.9kB,49.3MB / 162MB,33
|
||||
2026-10-16T19:24:51.2819767+03:00,lab3-api-2,45.54%,255.9MiB / 256MiB,99.97%,40.7kB / 49.9kB,71.8MB / 173MB,33
|
||||
2026-10-16T19:24:51.2819767+03:00,lab3-redis-1,0.37%,3.254MiB / 256MiB,1.27%,3.08kB / 126B,32.8kB / 0B,6
|
||||
2026-10-16T19:24:51.2819767+03:00,lab3-db-1,2.80%,53.33MiB / 1GiB,5.21%,226kB / 179kB,4.1kB / 229kB,26
|
||||
2026-10-16T19:24:55.9191316+03:00,lab3-loadgen-run-57a7191551e7,0.00%,17.87MiB / 7.649GiB,0.23%,3.91kB / 2.62kB,0B / 2.36MB,1
|
||||
2026-10-16T19:24:55.9191316+03:00,lab3-lb-1,0.00%,7.098MiB / 128MiB,5.55%,6.18kB / 5.75kB,0B / 16.4kB,9
|
||||
2026-10-16T19:24:55.9191316+03:00,lab3-api-4,34.47%,256MiB / 256MiB,99.98%,41.4kB / 50.4kB,68.1MB / 198MB,33
|
||||
2026-10-16T19:24:55.9191316+03:00,lab3-api-1,0.23%,253.4MiB / 256MiB,98.98%,40.5kB / 49.4kB,57.6MB / 169MB,33
|
||||
2026-10-16T19:24:55.9191316+03:00,lab3-api-3,0.18%,253.3MiB / 256MiB,98.96%,41kB / 50.3kB,49.3MB / 162MB,33
|
||||
2026-10-16T19:24:55.9191316+03:00,lab3-api-2,0.18%,254.3MiB / 256MiB,99.34%,41.2kB / 51.1kB,72MB / 175MB,33
|
||||
2026-10-16T19:24:55.9191316+03:00,lab3-redis-1,2.19%,3.254MiB / 256MiB,1.27%,3.13kB / 126B,32.8kB / 0B,6
|
||||
2026-10-16T19:24:55.9191316+03:00,lab3-db-1,3.50%,54.01MiB / 1GiB,5.27%,230kB / 181kB,4.1kB / 229kB,26
|
||||
2026-10-16T19:24:59.5896023+03:00,lab3-loadgen-run-57a7191551e7,0.00%,17.87MiB / 7.649GiB,0.23%,6.06kB / 4.09kB,0B / 2.36MB,1
|
||||
2026-10-16T19:24:59.5896023+03:00,lab3-lb-1,0.00%,7.172MiB / 128MiB,5.60%,9.39kB / 9.38kB,0B / 24.6kB,9
|
||||
2026-10-16T19:24:59.5896023+03:00,lab3-api-4,0.27%,254.4MiB / 256MiB,99.38%,41.8kB / 51.7kB,69.6MB / 198MB,33
|
||||
2026-10-16T19:24:59.5896023+03:00,lab3-api-1,5.00%,254.1MiB / 256MiB,99.27%,41.9kB / 51.4kB,70.4MB / 196MB,33
|
||||
2026-10-16T19:24:59.5896023+03:00,lab3-api-3,35.63%,255.9MiB / 256MiB,99.98%,42.2kB / 51kB,61.3MB / 219MB,36
|
||||
2026-10-16T19:24:59.5896023+03:00,lab3-api-2,0.19%,253.7MiB / 256MiB,99.11%,41.4kB / 51.4kB,72MB / 176MB,33
|
||||
2026-10-16T19:24:59.5896023+03:00,lab3-redis-1,2.16%,3.293MiB / 256MiB,1.29%,3.13kB / 126B,32.8kB / 0B,6
|
||||
2026-10-16T19:24:59.5896023+03:00,lab3-db-1,0.23%,53.87MiB / 1GiB,5.26%,232kB / 183kB,4.1kB / 229kB,26
|
||||
2026-10-16T19:25:04.2238790+03:00,lab3-loadgen-run-57a7191551e7,9.78%,25.6MiB / 7.649GiB,0.33%,11.9kB / 12kB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:04.2238790+03:00,lab3-lb-1,0.17%,7.379MiB / 128MiB,5.76%,21.6kB / 22.9kB,0B / 24.6kB,9
|
||||
2026-10-16T19:25:04.2238790+03:00,lab3-api-4,9.76%,254.1MiB / 256MiB,99.24%,43.8kB / 54.2kB,70MB / 198MB,33
|
||||
2026-10-16T19:25:04.2238790+03:00,lab3-api-1,50.34%,256MiB / 256MiB,99.99%,47.8kB / 57.6kB,99.1MB / 239MB,35
|
||||
2026-10-16T19:25:04.2238790+03:00,lab3-api-3,18.73%,255.7MiB / 256MiB,99.89%,44.4kB / 53.3kB,70MB / 219MB,33
|
||||
2026-10-16T19:25:04.2238790+03:00,lab3-api-2,19.47%,255.8MiB / 256MiB,99.94%,44.2kB / 53.7kB,75.7MB / 192MB,33
|
||||
2026-10-16T19:25:04.2238790+03:00,lab3-redis-1,2.31%,3.434MiB / 256MiB,1.34%,5.72kB / 1.85kB,32.8kB / 0B,6
|
||||
2026-10-16T19:25:04.2238790+03:00,lab3-db-1,0.42%,54.36MiB / 1GiB,5.31%,239kB / 188kB,4.1kB / 229kB,26
|
||||
2026-10-16T19:25:08.8664204+03:00,lab3-loadgen-run-57a7191551e7,0.00%,25.61MiB / 7.649GiB,0.33%,14.2kB / 13.7kB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:08.8664204+03:00,lab3-lb-1,0.00%,7.398MiB / 128MiB,5.78%,25.2kB / 26.7kB,0B / 28.7kB,9
|
||||
2026-10-16T19:25:08.8664204+03:00,lab3-api-4,10.85%,255.8MiB / 256MiB,99.93%,47.8kB / 57.6kB,118MB / 252MB,39
|
||||
2026-10-16T19:25:08.8664204+03:00,lab3-api-1,6.48%,253.9MiB / 256MiB,99.20%,51.8kB / 65kB,109MB / 251MB,35
|
||||
2026-10-16T19:25:08.8664204+03:00,lab3-api-3,46.87%,255.6MiB / 256MiB,99.83%,47.7kB / 56.4kB,93.6MB / 244MB,36
|
||||
2026-10-16T19:25:08.8664204+03:00,lab3-api-2,42.16%,255.9MiB / 256MiB,99.98%,51.1kB / 60.7kB,114MB / 238MB,37
|
||||
2026-10-16T19:25:08.8664204+03:00,lab3-redis-1,0.44%,3.715MiB / 256MiB,1.45%,12.5kB / 7.05kB,36.9kB / 0B,6
|
||||
2026-10-16T19:25:08.8664204+03:00,lab3-db-1,0.95%,57.48MiB / 1GiB,5.61%,252kB / 197kB,45.1kB / 229kB,26
|
||||
2026-10-16T19:25:13.4891701+03:00,lab3-loadgen-run-57a7191551e7,0.00%,25.63MiB / 7.649GiB,0.33%,24.8kB / 25.9kB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:13.4891701+03:00,lab3-lb-1,0.00%,7.449MiB / 128MiB,5.82%,46.7kB / 48.6kB,0B / 32.8kB,9
|
||||
2026-10-16T19:25:13.4891701+03:00,lab3-api-4,8.23%,255.8MiB / 256MiB,99.91%,50.8kB / 58.3kB,191MB / 323MB,38
|
||||
2026-10-16T19:25:13.4891701+03:00,lab3-api-1,0.19%,255.3MiB / 256MiB,99.74%,63kB / 80.3kB,109MB / 251MB,35
|
||||
2026-10-16T19:25:13.4891701+03:00,lab3-api-3,9.58%,255.8MiB / 256MiB,99.93%,51.3kB / 58.4kB,165MB / 321MB,38
|
||||
2026-10-16T19:25:13.4891701+03:00,lab3-api-2,5.01%,254.1MiB / 256MiB,99.28%,61.4kB / 79kB,120MB / 256MB,37
|
||||
2026-10-16T19:25:13.4891701+03:00,lab3-redis-1,0.40%,3.484MiB / 256MiB,1.36%,15.4kB / 9.12kB,45.1kB / 0B,6
|
||||
2026-10-16T19:25:13.4891701+03:00,lab3-db-1,0.54%,60.1MiB / 1GiB,5.87%,275kB / 212kB,45.1kB / 233kB,26
|
||||
2026-10-16T19:25:18.1158423+03:00,lab3-loadgen-run-57a7191551e7,0.00%,25.65MiB / 7.649GiB,0.33%,35.6kB / 39.1kB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:18.1158423+03:00,lab3-lb-1,0.01%,7.488MiB / 128MiB,5.85%,67.4kB / 71.2kB,0B / 32.8kB,9
|
||||
2026-10-16T19:25:18.1158423+03:00,lab3-api-4,22.70%,255.3MiB / 256MiB,99.74%,55.7kB / 61kB,298MB / 435MB,40
|
||||
2026-10-16T19:25:18.1158423+03:00,lab3-api-1,0.20%,254.8MiB / 256MiB,99.54%,73.1kB / 92.8kB,110MB / 253MB,35
|
||||
2026-10-16T19:25:18.1158423+03:00,lab3-api-3,8.57%,255.3MiB / 256MiB,99.73%,54.3kB / 59.2kB,234MB / 420MB,41
|
||||
2026-10-16T19:25:18.1158423+03:00,lab3-api-2,0.17%,255.2MiB / 256MiB,99.67%,72kB / 93.1kB,120MB / 256MB,37
|
||||
2026-10-16T19:25:18.1158423+03:00,lab3-redis-1,0.39%,3.484MiB / 256MiB,1.36%,18.4kB / 12.3kB,45.1kB / 0B,6
|
||||
2026-10-16T19:25:18.1158423+03:00,lab3-db-1,0.15%,60.29MiB / 1GiB,5.89%,295kB / 226kB,45.1kB / 233kB,26
|
||||
2026-10-16T19:25:22.7509102+03:00,lab3-loadgen-run-57a7191551e7,0.00%,25.67MiB / 7.649GiB,0.33%,46.5kB / 52.2kB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:22.7509102+03:00,lab3-lb-1,0.00%,7.484MiB / 128MiB,5.85%,88.2kB / 93.8kB,0B / 45.1kB,9
|
||||
2026-10-16T19:25:22.7509102+03:00,lab3-api-4,50.42%,255.6MiB / 256MiB,99.84%,60kB / 63.7kB,384MB / 519MB,45
|
||||
2026-10-16T19:25:22.7509102+03:00,lab3-api-1,0.18%,254.9MiB / 256MiB,99.58%,82.1kB / 103kB,111MB / 253MB,35
|
||||
2026-10-16T19:25:22.7509102+03:00,lab3-api-3,51.28%,255.9MiB / 256MiB,99.95%,67.5kB / 73.6kB,346MB / 495MB,48
|
||||
2026-10-16T19:25:22.7509102+03:00,lab3-api-2,0.18%,255.2MiB / 256MiB,99.70%,82.1kB / 106kB,121MB / 256MB,37
|
||||
2026-10-16T19:25:22.7509102+03:00,lab3-redis-1,0.61%,3.488MiB / 256MiB,1.36%,27.5kB / 16.6kB,57.3kB / 0B,6
|
||||
2026-10-16T19:25:22.7509102+03:00,lab3-db-1,2.02%,63.2MiB / 1GiB,6.17%,319kB / 246kB,45.1kB / 233kB,27
|
||||
2026-10-16T19:25:27.3708828+03:00,lab3-loadgen-run-57a7191551e7,0.00%,25.68MiB / 7.649GiB,0.33%,57.4kB / 65.4kB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:27.3708828+03:00,lab3-lb-1,0.00%,7.508MiB / 128MiB,5.87%,109kB / 117kB,0B / 45.1kB,9
|
||||
2026-10-16T19:25:27.3708828+03:00,lab3-api-4,26.78%,254.5MiB / 256MiB,99.43%,99.9kB / 97.6kB,422MB / 552MB,47
|
||||
2026-10-16T19:25:27.3708828+03:00,lab3-api-1,0.19%,255.6MiB / 256MiB,99.84%,91.8kB / 115kB,113MB / 257MB,35
|
||||
2026-10-16T19:25:27.3708828+03:00,lab3-api-3,29.66%,255.8MiB / 256MiB,99.91%,110kB / 104kB,415MB / 600MB,54
|
||||
2026-10-16T19:25:27.3708828+03:00,lab3-api-2,0.19%,255.1MiB / 256MiB,99.65%,92.6kB / 119kB,122MB / 256MB,37
|
||||
2026-10-16T19:25:27.3708828+03:00,lab3-redis-1,0.33%,3.492MiB / 256MiB,1.36%,31.2kB / 20kB,57.3kB / 0B,6
|
||||
2026-10-16T19:25:27.3708828+03:00,lab3-db-1,6.94%,118MiB / 1GiB,11.52%,397kB / 333kB,45.1kB / 233kB,53
|
||||
2026-10-16T19:25:31.4440690+03:00,lab3-loadgen-run-57a7191551e7,3.35%,25.71MiB / 7.649GiB,0.33%,115kB / 114kB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:31.4440690+03:00,lab3-lb-1,1.48%,7.613MiB / 128MiB,5.95%,222kB / 219kB,0B / 45.1kB,9
|
||||
2026-10-16T19:25:31.4440690+03:00,lab3-api-4,0.23%,255.8MiB / 256MiB,99.94%,124kB / 156kB,446MB / 570MB,48
|
||||
2026-10-16T19:25:31.4440690+03:00,lab3-api-1,26.16%,256MiB / 256MiB,99.98%,129kB / 157kB,114MB / 257MB,35
|
||||
2026-10-16T19:25:31.4440690+03:00,lab3-api-3,51.06%,256MiB / 256MiB,99.99%,166kB / 212kB,470MB / 618MB,60
|
||||
2026-10-16T19:25:31.4440690+03:00,lab3-api-2,12.39%,255.8MiB / 256MiB,99.92%,114kB / 146kB,123MB / 256MB,37
|
||||
2026-10-16T19:25:31.4440690+03:00,lab3-redis-1,2.38%,3.492MiB / 256MiB,1.36%,37.9kB / 26.4kB,57.3kB / 0B,6
|
||||
2026-10-16T19:25:31.4440690+03:00,lab3-db-1,19.08%,135.6MiB / 1GiB,13.24%,575kB / 434kB,53.2kB / 233kB,54
|
||||
2026-10-16T19:25:36.0829524+03:00,lab3-loadgen-run-57a7191551e7,8.41%,25.71MiB / 7.649GiB,0.33%,366kB / 309kB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:36.0829524+03:00,lab3-lb-1,3.15%,8.094MiB / 128MiB,6.32%,600kB / 628kB,0B / 45.1kB,9
|
||||
2026-10-16T19:25:36.0829524+03:00,lab3-api-4,50.26%,255.9MiB / 256MiB,99.95%,168kB / 214kB,449MB / 574MB,47
|
||||
2026-10-16T19:25:36.0829524+03:00,lab3-api-1,40.57%,255.9MiB / 256MiB,99.96%,283kB / 346kB,118MB / 266MB,35
|
||||
2026-10-16T19:25:36.0829524+03:00,lab3-api-3,52.59%,256MiB / 256MiB,99.99%,348kB / 459kB,475MB / 625MB,59
|
||||
2026-10-16T19:25:36.0829524+03:00,lab3-api-2,49.05%,255.8MiB / 256MiB,99.94%,289kB / 366kB,139MB / 273MB,37
|
||||
2026-10-16T19:25:36.0829524+03:00,lab3-redis-1,1.05%,3.492MiB / 256MiB,1.36%,94.4kB / 81.1kB,57.3kB / 0B,6
|
||||
2026-10-16T19:25:36.0829524+03:00,lab3-db-1,24.82%,145.7MiB / 1GiB,14.22%,1.03MB / 762kB,53.2kB / 233kB,54
|
||||
2026-10-16T19:25:40.6439239+03:00,lab3-loadgen-run-57a7191551e7,8.22%,25.73MiB / 7.649GiB,0.33%,679kB / 556kB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:40.6439239+03:00,lab3-lb-1,2.99%,7.898MiB / 128MiB,6.17%,1.07MB / 1.13MB,0B / 127kB,9
|
||||
2026-10-16T19:25:40.6439239+03:00,lab3-api-4,49.33%,255.1MiB / 256MiB,99.67%,322kB / 420kB,452MB / 579MB,47
|
||||
2026-10-16T19:25:40.6439239+03:00,lab3-api-1,40.70%,255.6MiB / 256MiB,99.86%,430kB / 527kB,124MB / 274MB,35
|
||||
2026-10-16T19:25:40.6439239+03:00,lab3-api-3,49.26%,256MiB / 256MiB,99.99%,511kB / 667kB,480MB / 632MB,59
|
||||
2026-10-16T19:25:40.6439239+03:00,lab3-api-2,49.56%,255MiB / 256MiB,99.60%,441kB / 551kB,145MB / 279MB,37
|
||||
2026-10-16T19:25:40.6439239+03:00,lab3-redis-1,1.10%,3.746MiB / 256MiB,1.46%,158kB / 143kB,57.3kB / 0B,6
|
||||
2026-10-16T19:25:40.6439239+03:00,lab3-db-1,20.82%,156.6MiB / 1GiB,15.29%,1.58MB / 1.16MB,61.4kB / 233kB,54
|
||||
2026-10-16T19:25:45.3021058+03:00,lab3-loadgen-run-57a7191551e7,9.74%,25.78MiB / 7.649GiB,0.33%,999kB / 807kB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:45.3021058+03:00,lab3-lb-1,3.49%,7.926MiB / 128MiB,6.19%,1.54MB / 1.64MB,0B / 127kB,9
|
||||
2026-10-16T19:25:45.3021058+03:00,lab3-api-4,50.31%,255.4MiB / 256MiB,99.75%,521kB / 673kB,458MB / 587MB,47
|
||||
2026-10-16T19:25:45.3021058+03:00,lab3-api-1,51.60%,254.8MiB / 256MiB,99.53%,584kB / 714kB,126MB / 279MB,35
|
||||
2026-10-16T19:25:45.3021058+03:00,lab3-api-3,50.86%,255.8MiB / 256MiB,99.92%,669kB / 870kB,485MB / 640MB,59
|
||||
2026-10-16T19:25:45.3021058+03:00,lab3-api-2,45.40%,255.3MiB / 256MiB,99.72%,592kB / 736kB,148MB / 283MB,37
|
||||
2026-10-16T19:25:45.3021058+03:00,lab3-redis-1,3.05%,3.5MiB / 256MiB,1.37%,222kB / 206kB,57.3kB / 0B,6
|
||||
2026-10-16T19:25:45.3021058+03:00,lab3-db-1,24.55%,163.5MiB / 1GiB,15.96%,2.07MB / 1.54MB,61.4kB / 233kB,54
|
||||
2026-10-16T19:25:49.6902320+03:00,lab3-loadgen-run-57a7191551e7,8.69%,25.76MiB / 7.649GiB,0.33%,1.33MB / 1.06MB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:49.6902320+03:00,lab3-lb-1,3.65%,8.203MiB / 128MiB,6.41%,2.04MB / 2.17MB,0B / 127kB,9
|
||||
2026-10-16T19:25:49.6902320+03:00,lab3-api-4,50.05%,255.9MiB / 256MiB,99.95%,684kB / 880kB,460MB / 593MB,53
|
||||
2026-10-16T19:25:49.6902320+03:00,lab3-api-1,51.30%,254.2MiB / 256MiB,99.31%,742kB / 912kB,137MB / 317MB,35
|
||||
2026-10-16T19:25:49.6902320+03:00,lab3-api-3,48.70%,255.6MiB / 256MiB,99.84%,830kB / 1.07MB,488MB / 643MB,59
|
||||
2026-10-16T19:25:49.6902320+03:00,lab3-api-2,38.24%,254MiB / 256MiB,99.22%,751kB / 931kB,151MB / 291MB,37
|
||||
2026-10-16T19:25:49.6902320+03:00,lab3-redis-1,1.19%,3.496MiB / 256MiB,1.37%,275kB / 257kB,57.3kB / 0B,6
|
||||
2026-10-16T19:25:49.6902320+03:00,lab3-db-1,27.51%,169.8MiB / 1GiB,16.59%,2.57MB / 1.92MB,61.4kB / 233kB,54
|
||||
2026-10-16T19:25:54.3483994+03:00,lab3-loadgen-run-57a7191551e7,11.25%,25.86MiB / 7.649GiB,0.33%,1.71MB / 1.36MB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:54.3483994+03:00,lab3-lb-1,3.68%,7.938MiB / 128MiB,6.20%,2.47MB / 2.63MB,0B / 127kB,9
|
||||
2026-10-16T19:25:54.3483994+03:00,lab3-api-4,49.80%,256MiB / 256MiB,100.00%,877kB / 1.12MB,463MB / 595MB,47
|
||||
2026-10-16T19:25:54.3483994+03:00,lab3-api-1,49.32%,252.7MiB / 256MiB,98.71%,927kB / 1.14MB,142MB / 317MB,35
|
||||
2026-10-16T19:25:54.3483994+03:00,lab3-api-3,49.60%,255.4MiB / 256MiB,99.75%,1.02MB / 1.3MB,495MB / 672MB,59
|
||||
2026-10-16T19:25:54.3483994+03:00,lab3-api-2,45.92%,256MiB / 256MiB,99.99%,934kB / 1.15MB,153MB / 294MB,37
|
||||
2026-10-16T19:25:54.3483994+03:00,lab3-redis-1,1.36%,3.508MiB / 256MiB,1.37%,365kB / 345kB,57.3kB / 0B,6
|
||||
2026-10-16T19:25:54.3483994+03:00,lab3-db-1,25.97%,173.9MiB / 1GiB,16.98%,3.15MB / 2.37MB,61.4kB / 233kB,54
|
||||
2026-10-16T19:25:58.9912296+03:00,lab3-loadgen-run-57a7191551e7,11.01%,26.12MiB / 7.649GiB,0.33%,2.16MB / 1.72MB,0B / 2.36MB,9
|
||||
2026-10-16T19:25:58.9912296+03:00,lab3-lb-1,3.90%,7.957MiB / 128MiB,6.22%,3.27MB / 3.49MB,0B / 291kB,9
|
||||
2026-10-16T19:25:58.9912296+03:00,lab3-api-4,49.03%,255.9MiB / 256MiB,99.96%,1.1MB / 1.41MB,465MB / 602MB,47
|
||||
2026-10-16T19:25:58.9912296+03:00,lab3-api-1,45.30%,255.8MiB / 256MiB,99.94%,1.1MB / 1.36MB,144MB / 317MB,35
|
||||
2026-10-16T19:25:58.9912296+03:00,lab3-api-3,49.79%,248.5MiB / 256MiB,97.07%,1.24MB / 1.57MB,499MB / 674MB,64
|
||||
2026-10-16T19:25:58.9912296+03:00,lab3-api-2,38.99%,255.7MiB / 256MiB,99.87%,1.11MB / 1.36MB,154MB / 297MB,37
|
||||
2026-10-16T19:25:58.9912296+03:00,lab3-redis-1,1.30%,3.496MiB / 256MiB,1.37%,454kB / 435kB,57.3kB / 0B,6
|
||||
2026-10-16T19:25:58.9912296+03:00,lab3-db-1,32.75%,175.3MiB / 1GiB,17.11%,3.7MB / 2.79MB,61.4kB / 233kB,54
|
||||
2026-10-16T19:26:03.6353865+03:00,lab3-loadgen-run-57a7191551e7,13.09%,25.92MiB / 7.649GiB,0.33%,2.63MB / 2.09MB,0B / 2.36MB,9
|
||||
2026-10-16T19:26:03.6353865+03:00,lab3-lb-1,4.80%,7.988MiB / 128MiB,6.24%,3.96MB / 4.23MB,0B / 365kB,9
|
||||
2026-10-16T19:26:03.6353865+03:00,lab3-api-4,47.51%,255.9MiB / 256MiB,99.98%,1.33MB / 1.7MB,472MB / 608MB,47
|
||||
2026-10-16T19:26:03.6353865+03:00,lab3-api-1,47.19%,255.5MiB / 256MiB,99.80%,1.37MB / 1.68MB,147MB / 321MB,35
|
||||
2026-10-16T19:26:03.6353865+03:00,lab3-api-3,45.60%,251.4MiB / 256MiB,98.20%,1.47MB / 1.86MB,501MB / 674MB,59
|
||||
2026-10-16T19:26:03.6353865+03:00,lab3-api-2,35.95%,254.7MiB / 256MiB,99.51%,1.32MB / 1.62MB,156MB / 304MB,37
|
||||
2026-10-16T19:26:03.6353865+03:00,lab3-redis-1,1.45%,3.508MiB / 256MiB,1.37%,544kB / 527kB,57.3kB / 0B,6
|
||||
2026-10-16T19:26:03.6353865+03:00,lab3-db-1,40.84%,182.5MiB / 1GiB,17.82%,4.54MB / 3.44MB,61.4kB / 233kB,54
|
||||
2026-10-16T19:26:08.3344326+03:00,lab3-loadgen-run-57a7191551e7,13.69%,25.93MiB / 7.649GiB,0.33%,3.13MB / 2.47MB,0B / 2.36MB,9
|
||||
2026-10-16T19:26:08.3344326+03:00,lab3-lb-1,4.91%,7.977MiB / 128MiB,6.23%,4.7MB / 5.02MB,0B / 455kB,9
|
||||
2026-10-16T19:26:08.3344326+03:00,lab3-api-4,52.66%,255.5MiB / 256MiB,99.81%,1.59MB / 2.02MB,474MB / 612MB,47
|
||||
2026-10-16T19:26:08.3344326+03:00,lab3-api-1,40.16%,255.7MiB / 256MiB,99.90%,1.61MB / 1.97MB,150MB / 336MB,35
|
||||
2026-10-16T19:26:08.3344326+03:00,lab3-api-3,50.76%,255.1MiB / 256MiB,99.66%,1.71MB / 2.15MB,503MB / 674MB,59
|
||||
2026-10-16T19:26:08.3344326+03:00,lab3-api-2,43.26%,254.1MiB / 256MiB,99.26%,1.61MB / 1.97MB,158MB / 320MB,37
|
||||
2026-10-16T19:26:08.3344326+03:00,lab3-redis-1,1.52%,3.5MiB / 256MiB,1.37%,640kB / 625kB,57.3kB / 0B,6
|
||||
2026-10-16T19:26:08.3344326+03:00,lab3-db-1,48.54%,187.1MiB / 1GiB,18.27%,5.1MB / 3.88MB,61.4kB / 233kB,54
|
||||
2026-10-16T19:26:12.9748258+03:00,lab3-loadgen-run-57a7191551e7,15.38%,25.9MiB / 7.649GiB,0.33%,3.66MB / 2.89MB,0B / 2.36MB,9
|
||||
2026-10-16T19:26:12.9748258+03:00,lab3-lb-1,5.23%,7.988MiB / 128MiB,6.24%,5.48MB / 5.86MB,0B / 455kB,9
|
||||
2026-10-16T19:26:12.9748258+03:00,lab3-api-4,51.46%,255MiB / 256MiB,99.60%,1.85MB / 2.35MB,475MB / 615MB,47
|
||||
2026-10-16T19:26:12.9748258+03:00,lab3-api-1,39.09%,255.7MiB / 256MiB,99.89%,1.86MB / 2.28MB,153MB / 336MB,35
|
||||
2026-10-16T19:26:12.9748258+03:00,lab3-api-3,40.22%,255.9MiB / 256MiB,99.94%,1.91MB / 2.39MB,504MB / 676MB,59
|
||||
2026-10-16T19:26:12.9748258+03:00,lab3-api-2,38.39%,255.1MiB / 256MiB,99.63%,1.87MB / 2.27MB,159MB / 320MB,37
|
||||
2026-10-16T19:26:12.9748258+03:00,lab3-redis-1,1.59%,3.508MiB / 256MiB,1.37%,741kB / 729kB,57.3kB / 0B,6
|
||||
2026-10-16T19:26:12.9748258+03:00,lab3-db-1,47.93%,189.6MiB / 1GiB,18.52%,6.07MB / 4.64MB,61.4kB / 233kB,54
|
||||
2026-10-16T19:26:17.6310501+03:00,lab3-loadgen-run-57a7191551e7,13.11%,25.93MiB / 7.649GiB,0.33%,4.12MB / 3.26MB,0B / 2.36MB,9
|
||||
2026-10-16T19:26:17.6310501+03:00,lab3-lb-1,4.22%,8.266MiB / 128MiB,6.46%,6.17MB / 6.6MB,0B / 455kB,9
|
||||
2026-10-16T19:26:17.6310501+03:00,lab3-api-4,50.16%,255.9MiB / 256MiB,99.97%,2.09MB / 2.65MB,476MB / 619MB,53
|
||||
2026-10-16T19:26:17.6310501+03:00,lab3-api-1,50.25%,254.1MiB / 256MiB,99.26%,2.08MB / 2.55MB,155MB / 336MB,35
|
||||
2026-10-16T19:26:17.6310501+03:00,lab3-api-3,39.95%,255.3MiB / 256MiB,99.72%,2.2MB / 2.74MB,505MB / 682MB,59
|
||||
2026-10-16T19:26:17.6310501+03:00,lab3-api-2,48.85%,255.9MiB / 256MiB,99.96%,2.09MB / 2.54MB,161MB / 322MB,38
|
||||
2026-10-16T19:26:17.6310501+03:00,lab3-redis-1,1.66%,3.508MiB / 256MiB,1.37%,830kB / 821kB,57.3kB / 0B,6
|
||||
2026-10-16T19:26:17.6310501+03:00,lab3-db-1,42.44%,190.3MiB / 1GiB,18.58%,6.77MB / 5.18MB,61.4kB / 233kB,54
|
||||
|
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"lab": 3,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 90.0,
|
||||
"elapsed_seconds": 91.725,
|
||||
"concurrency": 8,
|
||||
"successful_requests": 4714,
|
||||
"failed_requests": 52,
|
||||
"error_ratio": 0.010911,
|
||||
"successful_rps": 51.393,
|
||||
"successful_latency_ms": {
|
||||
"p50": 52.345,
|
||||
"p95": 288.565,
|
||||
"p99": 391.365
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
timestamp,name,cpu_percent,mem_usage,mem_percent,net_io,block_io,pids
|
||||
2026-10-16T19:41:51.0275097+03:00,lab3-loadgen-run-6fdd9ec04e64,0.17%,17.89MiB / 7.649GiB,0.23%,3.7kB / 2.69kB,0B / 0B,1
|
||||
2026-10-16T19:41:51.0275097+03:00,lab3-lb-1,0.33%,7.27MiB / 128MiB,5.68%,14.3kB / 14.6kB,0B / 12.3kB,9
|
||||
2026-10-16T19:41:51.0275097+03:00,lab3-api-1,82.97%,375MiB / 512MiB,73.25%,27.2kB / 29.1kB,0B / 262kB,34
|
||||
2026-10-16T19:41:51.0275097+03:00,lab3-api-2,33.89%,355.2MiB / 512MiB,69.38%,28.6kB / 31kB,0B / 262kB,33
|
||||
2026-10-16T19:41:51.0275097+03:00,lab3-db-1,3.86%,37.12MiB / 1GiB,3.62%,84.7kB / 73.8kB,0B / 225kB,16
|
||||
2026-10-16T19:41:51.0275097+03:00,lab3-redis-1,4.09%,3.637MiB / 256MiB,1.42%,2.71kB / 126B,36.9kB / 0B,6
|
||||
2026-10-16T19:41:55.6578473+03:00,lab3-loadgen-run-6fdd9ec04e64,7.81%,25.71MiB / 7.649GiB,0.33%,84.3kB / 69kB,0B / 0B,9
|
||||
2026-10-16T19:41:55.6578473+03:00,lab3-lb-1,4.40%,7.59MiB / 128MiB,5.93%,133kB / 144kB,0B / 12.3kB,9
|
||||
2026-10-16T19:41:55.6578473+03:00,lab3-api-1,100.22%,385.7MiB / 512MiB,75.33%,116kB / 143kB,0B / 262kB,35
|
||||
2026-10-16T19:41:55.6578473+03:00,lab3-api-2,100.24%,382.7MiB / 512MiB,74.76%,133kB / 165kB,0B / 262kB,35
|
||||
2026-10-16T19:41:55.6578473+03:00,lab3-db-1,20.93%,53.14MiB / 1GiB,5.19%,146kB / 117kB,0B / 225kB,20
|
||||
2026-10-16T19:41:55.6578473+03:00,lab3-redis-1,0.61%,3.449MiB / 256MiB,1.35%,10.3kB / 7.35kB,41kB / 0B,6
|
||||
2026-10-16T19:42:00.3225797+03:00,lab3-loadgen-run-6fdd9ec04e64,9.89%,25.72MiB / 7.649GiB,0.33%,346kB / 274kB,0B / 0B,9
|
||||
2026-10-16T19:42:00.3225797+03:00,lab3-lb-1,3.45%,7.738MiB / 128MiB,6.05%,645kB / 691kB,0B / 12.3kB,9
|
||||
2026-10-16T19:42:00.3225797+03:00,lab3-api-1,101.43%,394.8MiB / 512MiB,77.12%,453kB / 548kB,0B / 262kB,36
|
||||
2026-10-16T19:42:00.3225797+03:00,lab3-api-2,108.10%,393.5MiB / 512MiB,76.86%,470kB / 580kB,0B / 262kB,34
|
||||
2026-10-16T19:42:00.3225797+03:00,lab3-db-1,25.83%,64.28MiB / 1GiB,6.28%,770kB / 592kB,0B / 225kB,22
|
||||
2026-10-16T19:42:00.3225797+03:00,lab3-redis-1,3.24%,3.453MiB / 256MiB,1.35%,80.1kB / 84.4kB,41kB / 0B,6
|
||||
2026-10-16T19:42:04.9982408+03:00,lab3-loadgen-run-6fdd9ec04e64,18.96%,26.04MiB / 7.649GiB,0.33%,894kB / 703kB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:04.9982408+03:00,lab3-lb-1,5.41%,7.777MiB / 128MiB,6.08%,1.35MB / 1.44MB,0B / 119kB,9
|
||||
2026-10-16T19:42:04.9982408+03:00,lab3-api-1,99.76%,416.2MiB / 512MiB,81.29%,909kB / 1.1MB,0B / 279kB,36
|
||||
2026-10-16T19:42:04.9982408+03:00,lab3-api-2,107.80%,399.1MiB / 512MiB,77.94%,830kB / 1.01MB,0B / 279kB,34
|
||||
2026-10-16T19:42:04.9982408+03:00,lab3-db-1,35.56%,71.46MiB / 1GiB,6.98%,1.45MB / 1.13MB,0B / 225kB,24
|
||||
2026-10-16T19:42:04.9982408+03:00,lab3-redis-1,1.12%,3.449MiB / 256MiB,1.35%,159kB / 177kB,41kB / 0B,6
|
||||
2026-10-16T19:42:09.6991409+03:00,lab3-loadgen-run-6fdd9ec04e64,18.60%,25.79MiB / 7.649GiB,0.33%,1.34MB / 1.05MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:09.6991409+03:00,lab3-lb-1,5.25%,7.84MiB / 128MiB,6.12%,2.21MB / 2.34MB,0B / 119kB,9
|
||||
2026-10-16T19:42:09.6991409+03:00,lab3-api-1,103.01%,425.8MiB / 512MiB,83.17%,1.46MB / 1.75MB,0B / 279kB,36
|
||||
2026-10-16T19:42:09.6991409+03:00,lab3-api-2,102.16%,408.8MiB / 512MiB,79.84%,1.47MB / 1.78MB,0B / 279kB,35
|
||||
2026-10-16T19:42:09.6991409+03:00,lab3-db-1,37.49%,78.05MiB / 1GiB,7.62%,2.25MB / 1.79MB,0B / 225kB,32
|
||||
2026-10-16T19:42:09.6991409+03:00,lab3-redis-1,1.39%,3.699MiB / 256MiB,1.45%,257kB / 288kB,41kB / 0B,6
|
||||
2026-10-16T19:42:14.3703512+03:00,lab3-loadgen-run-6fdd9ec04e64,22.39%,25.89MiB / 7.649GiB,0.33%,2.01MB / 1.57MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:14.3703512+03:00,lab3-lb-1,6.71%,7.867MiB / 128MiB,6.15%,3.02MB / 3.21MB,0B / 119kB,9
|
||||
2026-10-16T19:42:14.3703512+03:00,lab3-api-1,99.39%,428.9MiB / 512MiB,83.76%,1.99MB / 2.37MB,0B / 279kB,36
|
||||
2026-10-16T19:42:14.3703512+03:00,lab3-api-2,100.15%,413.1MiB / 512MiB,80.68%,2MB / 2.42MB,0B / 279kB,35
|
||||
2026-10-16T19:42:14.3703512+03:00,lab3-db-1,48.86%,81.49MiB / 1GiB,7.96%,3.03MB / 2.41MB,0B / 225kB,27
|
||||
2026-10-16T19:42:14.3703512+03:00,lab3-redis-1,1.87%,3.453MiB / 256MiB,1.35%,349kB / 395kB,41kB / 0B,6
|
||||
2026-10-16T19:42:18.4246413+03:00,lab3-loadgen-run-6fdd9ec04e64,21.92%,26.66MiB / 7.649GiB,0.34%,2.72MB / 2.13MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:18.4246413+03:00,lab3-lb-1,6.41%,7.875MiB / 128MiB,6.15%,3.84MB / 4.08MB,0B / 119kB,9
|
||||
2026-10-16T19:42:18.4246413+03:00,lab3-api-1,98.28%,426.2MiB / 512MiB,83.25%,2.67MB / 3.17MB,0B / 291kB,36
|
||||
2026-10-16T19:42:18.4246413+03:00,lab3-api-2,104.44%,429.7MiB / 512MiB,83.93%,2.7MB / 3.26MB,0B / 291kB,34
|
||||
2026-10-16T19:42:18.4246413+03:00,lab3-db-1,56.25%,83.75MiB / 1GiB,8.18%,4.04MB / 3.23MB,0B / 225kB,27
|
||||
2026-10-16T19:42:18.4246413+03:00,lab3-redis-1,1.70%,3.453MiB / 256MiB,1.35%,467kB / 534kB,41kB / 0B,6
|
||||
2026-10-16T19:42:23.0956013+03:00,lab3-loadgen-run-6fdd9ec04e64,26.56%,26.23MiB / 7.649GiB,0.33%,3.55MB / 2.78MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:23.0956013+03:00,lab3-lb-1,8.08%,7.836MiB / 128MiB,6.12%,5.03MB / 5.35MB,0B / 410kB,9
|
||||
2026-10-16T19:42:23.0956013+03:00,lab3-api-1,90.08%,427.2MiB / 512MiB,83.44%,3.29MB / 3.89MB,0B / 291kB,36
|
||||
2026-10-16T19:42:23.0956013+03:00,lab3-api-2,101.93%,423.7MiB / 512MiB,82.75%,3.3MB / 3.98MB,0B / 291kB,35
|
||||
2026-10-16T19:42:23.0956013+03:00,lab3-db-1,67.05%,85.5MiB / 1GiB,8.35%,4.94MB / 3.96MB,0B / 225kB,27
|
||||
2026-10-16T19:42:23.0956013+03:00,lab3-redis-1,2.10%,3.453MiB / 256MiB,1.35%,571kB / 659kB,41kB / 0B,6
|
||||
2026-10-16T19:42:27.8108063+03:00,lab3-loadgen-run-6fdd9ec04e64,27.95%,25.94MiB / 7.649GiB,0.33%,4.41MB / 3.46MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:27.8108063+03:00,lab3-lb-1,8.35%,7.91MiB / 128MiB,6.18%,6.6MB / 7.02MB,0B / 410kB,9
|
||||
2026-10-16T19:42:27.8108063+03:00,lab3-api-1,99.66%,428.4MiB / 512MiB,83.67%,4.3MB / 5.08MB,0B / 291kB,35
|
||||
2026-10-16T19:42:27.8108063+03:00,lab3-api-2,100.32%,424.3MiB / 512MiB,82.87%,4.32MB / 5.2MB,0B / 291kB,34
|
||||
2026-10-16T19:42:27.8108063+03:00,lab3-db-1,78.86%,87.97MiB / 1GiB,8.59%,6.43MB / 5.18MB,0B / 225kB,27
|
||||
2026-10-16T19:42:27.8108063+03:00,lab3-redis-1,2.22%,3.453MiB / 256MiB,1.35%,712kB / 829kB,41kB / 0B,6
|
||||
2026-10-16T19:42:32.5119847+03:00,lab3-loadgen-run-6fdd9ec04e64,21.06%,25.96MiB / 7.649GiB,0.33%,5.01MB / 3.92MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:32.5119847+03:00,lab3-lb-1,6.40%,7.879MiB / 128MiB,6.16%,7.47MB / 7.95MB,0B / 410kB,9
|
||||
2026-10-16T19:42:32.5119847+03:00,lab3-api-1,89.30%,432.9MiB / 512MiB,84.55%,4.87MB / 5.74MB,0B / 291kB,35
|
||||
2026-10-16T19:42:32.5119847+03:00,lab3-api-2,98.29%,427.3MiB / 512MiB,83.46%,4.89MB / 5.89MB,0B / 291kB,35
|
||||
2026-10-16T19:42:32.5119847+03:00,lab3-db-1,67.01%,88.6MiB / 1GiB,8.65%,7.28MB / 5.86MB,0B / 225kB,27
|
||||
2026-10-16T19:42:32.5119847+03:00,lab3-redis-1,1.54%,3.449MiB / 256MiB,1.35%,840kB / 979kB,41kB / 0B,6
|
||||
2026-10-16T19:42:36.7492891+03:00,lab3-loadgen-run-6fdd9ec04e64,21.99%,25.98MiB / 7.649GiB,0.33%,5.82MB / 4.55MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:36.7492891+03:00,lab3-lb-1,6.44%,7.91MiB / 128MiB,6.18%,8.68MB / 9.23MB,0B / 774kB,9
|
||||
2026-10-16T19:42:36.7492891+03:00,lab3-api-1,84.19%,440.9MiB / 512MiB,86.11%,5.66MB / 6.67MB,0B / 303kB,35
|
||||
2026-10-16T19:42:36.7492891+03:00,lab3-api-2,97.50%,431.1MiB / 512MiB,84.19%,5.67MB / 6.82MB,0B / 303kB,35
|
||||
2026-10-16T19:42:36.7492891+03:00,lab3-db-1,82.73%,91.99MiB / 1GiB,8.98%,8.43MB / 6.79MB,0B / 225kB,28
|
||||
2026-10-16T19:42:36.7492891+03:00,lab3-redis-1,1.87%,3.453MiB / 256MiB,1.35%,944kB / 1.1MB,41kB / 0B,6
|
||||
2026-10-16T19:42:41.4284870+03:00,lab3-loadgen-run-6fdd9ec04e64,25.76%,26.2MiB / 7.649GiB,0.33%,6.59MB / 5.16MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:41.4284870+03:00,lab3-lb-1,7.93%,7.914MiB / 128MiB,6.18%,9.83MB / 10.5MB,0B / 774kB,9
|
||||
2026-10-16T19:42:41.4284870+03:00,lab3-api-1,104.14%,433.6MiB / 512MiB,84.68%,6.24MB / 7.35MB,0B / 303kB,35
|
||||
2026-10-16T19:42:41.4284870+03:00,lab3-api-2,101.16%,431.8MiB / 512MiB,84.34%,6.42MB / 7.72MB,0B / 303kB,34
|
||||
2026-10-16T19:42:41.4284870+03:00,lab3-db-1,94.26%,92.98MiB / 1GiB,9.08%,9.53MB / 7.69MB,0B / 225kB,28
|
||||
2026-10-16T19:42:41.4284870+03:00,lab3-redis-1,4.73%,3.449MiB / 256MiB,1.35%,1.1MB / 1.29MB,41kB / 0B,6
|
||||
2026-10-16T19:42:46.0887960+03:00,lab3-loadgen-run-6fdd9ec04e64,27.38%,26.25MiB / 7.649GiB,0.34%,7.46MB / 5.84MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:46.0887960+03:00,lab3-lb-1,8.93%,7.906MiB / 128MiB,6.18%,11.1MB / 11.8MB,0B / 774kB,9
|
||||
2026-10-16T19:42:46.0887960+03:00,lab3-api-1,76.75%,433.6MiB / 512MiB,84.68%,7.05MB / 8.3MB,0B / 303kB,35
|
||||
2026-10-16T19:42:46.0887960+03:00,lab3-api-2,100.85%,435.2MiB / 512MiB,85.00%,7.26MB / 8.72MB,0B / 303kB,35
|
||||
2026-10-16T19:42:46.0887960+03:00,lab3-db-1,101.89%,93.49MiB / 1GiB,9.13%,10.8MB / 8.69MB,0B / 225kB,28
|
||||
2026-10-16T19:42:46.0887960+03:00,lab3-redis-1,4.46%,3.449MiB / 256MiB,1.35%,1.24MB / 1.46MB,41kB / 0B,6
|
||||
2026-10-16T19:42:50.7539590+03:00,lab3-loadgen-run-6fdd9ec04e64,26.53%,25.98MiB / 7.649GiB,0.33%,8.23MB / 6.44MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:50.7539590+03:00,lab3-lb-1,9.74%,7.895MiB / 128MiB,6.17%,12.3MB / 13.1MB,0B / 1.16MB,9
|
||||
2026-10-16T19:42:50.7539590+03:00,lab3-api-1,67.69%,435.4MiB / 512MiB,85.04%,7.98MB / 9.37MB,0B / 315kB,35
|
||||
2026-10-16T19:42:50.7539590+03:00,lab3-api-2,106.07%,437.1MiB / 512MiB,85.37%,8MB / 9.6MB,0B / 315kB,35
|
||||
2026-10-16T19:42:50.7539590+03:00,lab3-db-1,99.79%,94.43MiB / 1GiB,9.22%,11.6MB / 9.39MB,0B / 225kB,28
|
||||
2026-10-16T19:42:50.7539590+03:00,lab3-redis-1,1.82%,3.453MiB / 256MiB,1.35%,1.36MB / 1.61MB,41kB / 0B,6
|
||||
2026-10-16T19:42:55.4408559+03:00,lab3-loadgen-run-6fdd9ec04e64,22.40%,26.55MiB / 7.649GiB,0.34%,8.8MB / 6.89MB,0B / 2.36MB,9
|
||||
2026-10-16T19:42:55.4408559+03:00,lab3-lb-1,8.54%,7.848MiB / 128MiB,6.13%,13.4MB / 14.2MB,0B / 1.16MB,9
|
||||
2026-10-16T19:42:55.4408559+03:00,lab3-api-1,51.36%,435.6MiB / 512MiB,85.07%,8.7MB / 10.2MB,0B / 315kB,35
|
||||
2026-10-16T19:42:55.4408559+03:00,lab3-api-2,101.03%,437.8MiB / 512MiB,85.51%,8.72MB / 10.4MB,0B / 315kB,35
|
||||
2026-10-16T19:42:55.4408559+03:00,lab3-db-1,100.84%,94.78MiB / 1GiB,9.26%,12.9MB / 10.4MB,0B / 225kB,28
|
||||
2026-10-16T19:42:55.4408559+03:00,lab3-redis-1,1.92%,3.453MiB / 256MiB,1.35%,1.48MB / 1.75MB,41kB / 0B,6
|
||||
2026-10-16T19:43:00.1264119+03:00,lab3-loadgen-run-6fdd9ec04e64,24.83%,26.13MiB / 7.649GiB,0.33%,9.58MB / 7.5MB,0B / 2.36MB,9
|
||||
2026-10-16T19:43:00.1264119+03:00,lab3-lb-1,6.84%,7.883MiB / 128MiB,6.16%,14.5MB / 15.4MB,0B / 1.16MB,9
|
||||
2026-10-16T19:43:00.1264119+03:00,lab3-api-1,47.65%,435.9MiB / 512MiB,85.13%,9.29MB / 10.9MB,0B / 315kB,35
|
||||
2026-10-16T19:43:00.1264119+03:00,lab3-api-2,105.82%,438.9MiB / 512MiB,85.72%,9.44MB / 11.3MB,0B / 315kB,36
|
||||
2026-10-16T19:43:00.1264119+03:00,lab3-db-1,104.73%,96.29MiB / 1GiB,9.40%,13.9MB / 11.3MB,0B / 315kB,28
|
||||
2026-10-16T19:43:00.1264119+03:00,lab3-redis-1,1.92%,3.449MiB / 256MiB,1.35%,1.57MB / 1.87MB,41kB / 0B,6
|
||||
2026-10-16T19:43:04.7911250+03:00,lab3-loadgen-run-6fdd9ec04e64,22.97%,26.38MiB / 7.649GiB,0.34%,10.3MB / 8.07MB,0B / 2.36MB,9
|
||||
2026-10-16T19:43:04.7911250+03:00,lab3-lb-1,7.76%,7.855MiB / 128MiB,6.14%,15.4MB / 16.4MB,0B / 1.5MB,9
|
||||
2026-10-16T19:43:04.7911250+03:00,lab3-api-1,48.35%,435.7MiB / 512MiB,85.11%,10MB / 11.7MB,0B / 328kB,35
|
||||
2026-10-16T19:43:04.7911250+03:00,lab3-api-2,102.80%,440.2MiB / 512MiB,85.97%,10MB / 12MB,0B / 328kB,36
|
||||
2026-10-16T19:43:04.7911250+03:00,lab3-db-1,106.35%,99.13MiB / 1GiB,9.68%,14.8MB / 12MB,0B / 348kB,35
|
||||
2026-10-16T19:43:04.7911250+03:00,lab3-redis-1,2.00%,3.449MiB / 256MiB,1.35%,1.69MB / 2.02MB,41kB / 0B,6
|
||||
2026-10-16T19:43:08.8593748+03:00,lab3-loadgen-run-6fdd9ec04e64,22.77%,26.11MiB / 7.649GiB,0.33%,10.8MB / 8.45MB,0B / 2.36MB,9
|
||||
2026-10-16T19:43:08.8593748+03:00,lab3-lb-1,5.94%,7.84MiB / 128MiB,6.12%,16.3MB / 17.4MB,0B / 1.5MB,9
|
||||
2026-10-16T19:43:08.8593748+03:00,lab3-api-1,41.18%,435.8MiB / 512MiB,85.11%,10.6MB / 12.5MB,0B / 328kB,35
|
||||
2026-10-16T19:43:08.8593748+03:00,lab3-api-2,54.52%,440.7MiB / 512MiB,86.07%,10.7MB / 12.7MB,0B / 328kB,35
|
||||
2026-10-16T19:43:08.8593748+03:00,lab3-db-1,104.95%,99.57MiB / 1GiB,9.72%,15.7MB / 12.8MB,0B / 348kB,29
|
||||
2026-10-16T19:43:08.8593748+03:00,lab3-redis-1,1.56%,3.449MiB / 256MiB,1.35%,1.8MB / 2.14MB,41kB / 0B,6
|
||||
2026-10-16T19:43:13.5588148+03:00,lab3-loadgen-run-6fdd9ec04e64,19.61%,26.09MiB / 7.649GiB,0.33%,11.5MB / 8.99MB,0B / 2.36MB,9
|
||||
2026-10-16T19:43:13.5588148+03:00,lab3-lb-1,5.81%,7.809MiB / 128MiB,6.10%,17.1MB / 18.2MB,0B / 1.5MB,9
|
||||
2026-10-16T19:43:13.5588148+03:00,lab3-api-1,56.48%,435.9MiB / 512MiB,85.14%,11.2MB / 13.1MB,0B / 328kB,35
|
||||
2026-10-16T19:43:13.5588148+03:00,lab3-api-2,59.56%,441.1MiB / 512MiB,86.14%,11.2MB / 13.3MB,0B / 328kB,34
|
||||
2026-10-16T19:43:13.5588148+03:00,lab3-db-1,98.03%,98.54MiB / 1GiB,9.62%,16.4MB / 13.5MB,0B / 348kB,29
|
||||
2026-10-16T19:43:13.5588148+03:00,lab3-redis-1,1.56%,3.445MiB / 256MiB,1.35%,1.89MB / 2.25MB,41kB / 0B,6
|
||||
2026-10-16T19:43:17.8919488+03:00,lab3-loadgen-run-6fdd9ec04e64,19.33%,26.14MiB / 7.649GiB,0.33%,12.1MB / 9.47MB,0B / 2.36MB,9
|
||||
2026-10-16T19:43:17.8919488+03:00,lab3-lb-1,5.26%,7.824MiB / 128MiB,6.11%,18.1MB / 19.2MB,0B / 1.5MB,9
|
||||
2026-10-16T19:43:17.8919488+03:00,lab3-api-1,74.82%,447.3MiB / 512MiB,87.37%,11.8MB / 13.8MB,0B / 328kB,41
|
||||
2026-10-16T19:43:17.8919488+03:00,lab3-api-2,71.43%,444.6MiB / 512MiB,86.83%,11.9MB / 14MB,0B / 328kB,34
|
||||
2026-10-16T19:43:17.8919488+03:00,lab3-db-1,101.35%,99.32MiB / 1GiB,9.70%,17.3MB / 14.2MB,0B / 348kB,29
|
||||
2026-10-16T19:43:17.8919488+03:00,lab3-redis-1,4.12%,3.457MiB / 256MiB,1.35%,1.98MB / 2.35MB,41kB / 0B,6
|
||||
|
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"lab": 3,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 90.0,
|
||||
"elapsed_seconds": 90.106,
|
||||
"concurrency": 8,
|
||||
"successful_requests": 11732,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 130.203,
|
||||
"successful_latency_ms": {
|
||||
"p50": 53.87,
|
||||
"p95": 130.262,
|
||||
"p99": 186.917
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
timestamp,name,cpu_percent,mem_usage,mem_percent,net_io,block_io,pids
|
||||
2026-10-16T19:48:40.8570314+03:00,lab3-loadgen-run-dea587583317,1.00%,25.66MiB / 7.649GiB,0.33%,19.6kB / 18.1kB,0B / 0B,9
|
||||
2026-10-16T19:48:40.8570314+03:00,lab3-lb-1,0.30%,7.562MiB / 128MiB,5.91%,33.3kB / 35.6kB,0B / 12.3kB,9
|
||||
2026-10-16T19:48:40.8570314+03:00,lab3-api-1,189.48%,373.6MiB / 1GiB,36.49%,52kB / 51kB,0B / 324kB,35
|
||||
2026-10-16T19:48:40.8570314+03:00,lab3-api-2,113.37%,389.7MiB / 1GiB,38.06%,55.2kB / 66.4kB,0B / 324kB,36
|
||||
2026-10-16T19:48:40.8570314+03:00,lab3-db-1,17.42%,50.82MiB / 1GiB,4.96%,128kB / 109kB,0B / 225kB,20
|
||||
2026-10-16T19:48:40.8570314+03:00,lab3-redis-1,0.57%,3.672MiB / 256MiB,1.43%,5.42kB / 2.28kB,41kB / 0B,6
|
||||
2026-10-16T19:48:45.5147507+03:00,lab3-loadgen-run-dea587583317,22.51%,25.77MiB / 7.649GiB,0.33%,542kB / 431kB,0B / 0B,9
|
||||
2026-10-16T19:48:45.5147507+03:00,lab3-lb-1,7.58%,7.938MiB / 128MiB,6.20%,828kB / 877kB,0B / 12.3kB,9
|
||||
2026-10-16T19:48:45.5147507+03:00,lab3-api-1,215.00%,395.3MiB / 1GiB,38.60%,583kB / 699kB,0B / 324kB,42
|
||||
2026-10-16T19:48:45.5147507+03:00,lab3-api-2,214.72%,406.4MiB / 1GiB,39.69%,577kB / 678kB,0B / 324kB,42
|
||||
2026-10-16T19:48:45.5147507+03:00,lab3-db-1,54.71%,67.85MiB / 1GiB,6.63%,923kB / 740kB,0B / 225kB,23
|
||||
2026-10-16T19:48:45.5147507+03:00,lab3-redis-1,1.70%,3.441MiB / 256MiB,1.34%,73.3kB / 82.5kB,41kB / 0B,6
|
||||
2026-10-16T19:48:50.3373131+03:00,lab3-loadgen-run-dea587583317,28.65%,25.87MiB / 7.649GiB,0.33%,1.17MB / 930kB,0B / 0B,9
|
||||
2026-10-16T19:48:50.3373131+03:00,lab3-lb-1,8.55%,7.965MiB / 128MiB,6.22%,1.78MB / 1.88MB,0B / 12.3kB,9
|
||||
2026-10-16T19:48:50.3373131+03:00,lab3-api-1,203.90%,404.9MiB / 1GiB,39.55%,1.2MB / 1.41MB,0B / 324kB,34
|
||||
2026-10-16T19:48:50.3373131+03:00,lab3-api-2,202.92%,419.1MiB / 1GiB,40.93%,1.19MB / 1.4MB,0B / 324kB,35
|
||||
2026-10-16T19:48:50.3373131+03:00,lab3-db-1,58.17%,74.18MiB / 1GiB,7.24%,1.81MB / 1.47MB,0B / 225kB,23
|
||||
2026-10-16T19:48:50.3373131+03:00,lab3-redis-1,2.63%,3.449MiB / 256MiB,1.35%,194kB / 234kB,41kB / 0B,6
|
||||
2026-10-16T19:48:54.5353733+03:00,lab3-loadgen-run-dea587583317,34.50%,25.94MiB / 7.649GiB,0.33%,1.92MB / 1.52MB,0B / 2.36MB,9
|
||||
2026-10-16T19:48:54.5353733+03:00,lab3-lb-1,10.68%,7.953MiB / 128MiB,6.21%,3.21MB / 3.41MB,0B / 262kB,9
|
||||
2026-10-16T19:48:54.5353733+03:00,lab3-api-1,193.10%,412.1MiB / 1GiB,40.25%,2.12MB / 2.48MB,0B / 340kB,34
|
||||
2026-10-16T19:48:54.5353733+03:00,lab3-api-2,207.90%,449MiB / 1GiB,43.85%,2.13MB / 2.5MB,0B / 340kB,36
|
||||
2026-10-16T19:48:54.5353733+03:00,lab3-db-1,79.29%,80.2MiB / 1GiB,7.83%,3.15MB / 2.58MB,0B / 225kB,24
|
||||
2026-10-16T19:48:54.5353733+03:00,lab3-redis-1,2.57%,3.449MiB / 256MiB,1.35%,309kB / 381kB,41kB / 0B,6
|
||||
2026-10-16T19:48:59.3157464+03:00,lab3-loadgen-run-dea587583317,41.02%,26.28MiB / 7.649GiB,0.34%,3.17MB / 2.5MB,0B / 2.36MB,9
|
||||
2026-10-16T19:48:59.3157464+03:00,lab3-lb-1,12.37%,8.047MiB / 128MiB,6.29%,4.75MB / 5.06MB,0B / 262kB,9
|
||||
2026-10-16T19:48:59.3157464+03:00,lab3-api-1,185.63%,413.9MiB / 1GiB,40.42%,3.13MB / 3.64MB,0B / 340kB,34
|
||||
2026-10-16T19:48:59.3157464+03:00,lab3-api-2,201.87%,432.9MiB / 1GiB,42.28%,3.13MB / 3.65MB,0B / 340kB,35
|
||||
2026-10-16T19:48:59.3157464+03:00,lab3-db-1,100.09%,82.83MiB / 1GiB,8.09%,4.59MB / 3.77MB,0B / 225kB,24
|
||||
2026-10-16T19:48:59.3157464+03:00,lab3-redis-1,3.21%,3.449MiB / 256MiB,1.35%,501kB / 631kB,41kB / 0B,6
|
||||
2026-10-16T19:49:03.8798615+03:00,lab3-loadgen-run-dea587583317,34.17%,26MiB / 7.649GiB,0.33%,4.3MB / 3.38MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:03.8798615+03:00,lab3-lb-1,9.69%,8.242MiB / 128MiB,6.44%,6.03MB / 6.44MB,0B / 262kB,9
|
||||
2026-10-16T19:49:03.8798615+03:00,lab3-api-1,129.03%,414.5MiB / 1GiB,40.48%,4.21MB / 4.89MB,0B / 340kB,34
|
||||
2026-10-16T19:49:03.8798615+03:00,lab3-api-2,172.06%,434.7MiB / 1GiB,42.45%,4.21MB / 4.9MB,0B / 340kB,35
|
||||
2026-10-16T19:49:03.8798615+03:00,lab3-db-1,102.28%,84.26MiB / 1GiB,8.23%,6.14MB / 5.06MB,0B / 225kB,24
|
||||
2026-10-16T19:49:03.8798615+03:00,lab3-redis-1,2.93%,3.449MiB / 256MiB,1.35%,672kB / 854kB,41kB / 0B,6
|
||||
2026-10-16T19:49:08.6568965+03:00,lab3-loadgen-run-dea587583317,34.38%,26.02MiB / 7.649GiB,0.33%,5.1MB / 4.01MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:08.6568965+03:00,lab3-lb-1,10.74%,8.223MiB / 128MiB,6.42%,7.59MB / 8.1MB,0B / 741kB,9
|
||||
2026-10-16T19:49:08.6568965+03:00,lab3-api-1,154.44%,415.4MiB / 1GiB,40.57%,4.99MB / 5.8MB,0B / 352kB,34
|
||||
2026-10-16T19:49:08.6568965+03:00,lab3-api-2,159.74%,440.9MiB / 1GiB,43.05%,4.99MB / 5.8MB,0B / 352kB,35
|
||||
2026-10-16T19:49:08.6568965+03:00,lab3-db-1,102.96%,85.1MiB / 1GiB,8.31%,7.26MB / 6MB,0B / 225kB,24
|
||||
2026-10-16T19:49:08.6568965+03:00,lab3-redis-1,4.95%,3.449MiB / 256MiB,1.35%,796kB / 1.01MB,41kB / 0B,6
|
||||
2026-10-16T19:49:12.9763669+03:00,lab3-loadgen-run-dea587583317,36.43%,26.03MiB / 7.649GiB,0.33%,5.99MB / 4.71MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:12.9763669+03:00,lab3-lb-1,8.59%,7.984MiB / 128MiB,6.24%,8.93MB / 9.52MB,0B / 741kB,9
|
||||
2026-10-16T19:49:12.9763669+03:00,lab3-api-1,160.44%,416.8MiB / 1GiB,40.70%,5.87MB / 6.82MB,0B / 352kB,34
|
||||
2026-10-16T19:49:12.9763669+03:00,lab3-api-2,151.67%,444MiB / 1GiB,43.36%,5.87MB / 6.81MB,0B / 352kB,36
|
||||
2026-10-16T19:49:12.9763669+03:00,lab3-db-1,104.30%,87.56MiB / 1GiB,8.55%,8.5MB / 7.05MB,0B / 225kB,25
|
||||
2026-10-16T19:49:12.9763669+03:00,lab3-redis-1,2.19%,3.449MiB / 256MiB,1.35%,914kB / 1.16MB,41kB / 0B,6
|
||||
2026-10-16T19:49:17.7225206+03:00,lab3-loadgen-run-dea587583317,29.13%,26.02MiB / 7.649GiB,0.33%,6.81MB / 5.35MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:17.7225206+03:00,lab3-lb-1,8.51%,7.965MiB / 128MiB,6.22%,10.2MB / 10.8MB,0B / 741kB,9
|
||||
2026-10-16T19:49:17.7225206+03:00,lab3-api-1,85.28%,420.5MiB / 1GiB,41.06%,6.49MB / 7.53MB,0B / 352kB,34
|
||||
2026-10-16T19:49:17.7225206+03:00,lab3-api-2,118.57%,444.6MiB / 1GiB,43.42%,6.68MB / 7.74MB,0B / 352kB,35
|
||||
2026-10-16T19:49:17.7225206+03:00,lab3-db-1,99.01%,88.23MiB / 1GiB,8.62%,9.64MB / 8.02MB,0B / 229kB,25
|
||||
2026-10-16T19:49:17.7225206+03:00,lab3-redis-1,4.51%,3.449MiB / 256MiB,1.35%,1.07MB / 1.36MB,41kB / 0B,6
|
||||
2026-10-16T19:49:22.4866446+03:00,lab3-loadgen-run-dea587583317,25.56%,26.06MiB / 7.649GiB,0.33%,7.6MB / 5.97MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:22.4866446+03:00,lab3-lb-1,7.55%,7.93MiB / 128MiB,6.20%,11.3MB / 12.1MB,0B / 741kB,9
|
||||
2026-10-16T19:49:22.4866446+03:00,lab3-api-1,95.38%,424.3MiB / 1GiB,41.43%,7.47MB / 8.65MB,0B / 365kB,34
|
||||
2026-10-16T19:49:22.4866446+03:00,lab3-api-2,95.70%,444.9MiB / 1GiB,43.45%,7.31MB / 8.46MB,0B / 352kB,35
|
||||
2026-10-16T19:49:22.4866446+03:00,lab3-db-1,101.16%,88.98MiB / 1GiB,8.69%,10.7MB / 8.98MB,0B / 229kB,25
|
||||
2026-10-16T19:49:22.4866446+03:00,lab3-redis-1,2.47%,3.449MiB / 256MiB,1.35%,1.21MB / 1.51MB,41kB / 0B,6
|
||||
2026-10-16T19:49:27.1498264+03:00,lab3-loadgen-run-dea587583317,24.88%,26.13MiB / 7.649GiB,0.33%,8.37MB / 6.57MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:27.1498264+03:00,lab3-lb-1,7.57%,7.945MiB / 128MiB,6.21%,12.5MB / 13.3MB,0B / 1.13MB,9
|
||||
2026-10-16T19:49:27.1498264+03:00,lab3-api-1,74.03%,421.2MiB / 1GiB,41.13%,8.24MB / 9.54MB,0B / 365kB,34
|
||||
2026-10-16T19:49:27.1498264+03:00,lab3-api-2,66.17%,445.7MiB / 1GiB,43.53%,8.25MB / 9.52MB,0B / 365kB,36
|
||||
2026-10-16T19:49:27.1498264+03:00,lab3-db-1,103.14%,91.42MiB / 1GiB,8.93%,11.8MB / 9.92MB,0B / 229kB,26
|
||||
2026-10-16T19:49:27.1498264+03:00,lab3-redis-1,2.28%,3.441MiB / 256MiB,1.34%,1.3MB / 1.63MB,41kB / 0B,6
|
||||
2026-10-16T19:49:31.8330145+03:00,lab3-loadgen-run-dea587583317,25.33%,26.09MiB / 7.649GiB,0.33%,9.11MB / 7.15MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:31.8330145+03:00,lab3-lb-1,7.98%,7.895MiB / 128MiB,6.17%,13.6MB / 14.5MB,0B / 1.13MB,9
|
||||
2026-10-16T19:49:31.8330145+03:00,lab3-api-1,49.51%,421.4MiB / 1GiB,41.15%,8.99MB / 10.4MB,0B / 365kB,34
|
||||
2026-10-16T19:49:31.8330145+03:00,lab3-api-2,58.20%,446.1MiB / 1GiB,43.56%,9MB / 10.4MB,0B / 365kB,35
|
||||
2026-10-16T19:49:31.8330145+03:00,lab3-db-1,101.27%,91.64MiB / 1GiB,8.95%,12.8MB / 10.8MB,0B / 229kB,26
|
||||
2026-10-16T19:49:31.8330145+03:00,lab3-redis-1,2.31%,3.449MiB / 256MiB,1.35%,1.43MB / 1.79MB,41kB / 0B,6
|
||||
2026-10-16T19:49:36.4959165+03:00,lab3-loadgen-run-dea587583317,23.10%,26.16MiB / 7.649GiB,0.33%,9.79MB / 7.68MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:36.4959165+03:00,lab3-lb-1,7.55%,7.879MiB / 128MiB,6.16%,14.7MB / 15.6MB,0B / 1.13MB,9
|
||||
2026-10-16T19:49:36.4959165+03:00,lab3-api-1,54.14%,421.5MiB / 1GiB,41.16%,9.53MB / 11MB,0B / 365kB,34
|
||||
2026-10-16T19:49:36.4959165+03:00,lab3-api-2,43.16%,446.2MiB / 1GiB,43.58%,9.68MB / 11.1MB,0B / 365kB,36
|
||||
2026-10-16T19:49:36.4959165+03:00,lab3-db-1,100.83%,92.16MiB / 1GiB,9.00%,13.8MB / 11.7MB,0B / 229kB,26
|
||||
2026-10-16T19:49:36.4959165+03:00,lab3-redis-1,2.85%,3.449MiB / 256MiB,1.35%,1.57MB / 1.95MB,41kB / 0B,6
|
||||
2026-10-16T19:49:41.1829579+03:00,lab3-loadgen-run-dea587583317,21.53%,26.21MiB / 7.649GiB,0.33%,10.4MB / 8.19MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:41.1829579+03:00,lab3-lb-1,5.79%,7.941MiB / 128MiB,6.20%,15.6MB / 16.6MB,0B / 1.47MB,9
|
||||
2026-10-16T19:49:41.1829579+03:00,lab3-api-1,39.04%,421.7MiB / 1GiB,41.18%,10.3MB / 11.9MB,0B / 377kB,34
|
||||
2026-10-16T19:49:41.1829579+03:00,lab3-api-2,45.88%,446.5MiB / 1GiB,43.60%,10.3MB / 11.9MB,0B / 377kB,36
|
||||
2026-10-16T19:49:41.1829579+03:00,lab3-db-1,102.67%,93.44MiB / 1GiB,9.13%,14.7MB / 12.5MB,0B / 229kB,26
|
||||
2026-10-16T19:49:41.1829579+03:00,lab3-redis-1,2.33%,3.441MiB / 256MiB,1.34%,1.66MB / 2.05MB,41kB / 0B,6
|
||||
2026-10-16T19:49:45.8318419+03:00,lab3-loadgen-run-dea587583317,19.06%,26.16MiB / 7.649GiB,0.33%,11.1MB / 8.68MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:45.8318419+03:00,lab3-lb-1,4.96%,7.871MiB / 128MiB,6.15%,16.6MB / 17.6MB,0B / 1.47MB,9
|
||||
2026-10-16T19:49:45.8318419+03:00,lab3-api-1,37.82%,421.8MiB / 1GiB,41.19%,11MB / 12.6MB,0B / 377kB,34
|
||||
2026-10-16T19:49:45.8318419+03:00,lab3-api-2,40.52%,446.6MiB / 1GiB,43.61%,10.9MB / 12.5MB,0B / 377kB,36
|
||||
2026-10-16T19:49:45.8318419+03:00,lab3-db-1,100.39%,93.44MiB / 1GiB,9.12%,15.6MB / 13.2MB,0B / 229kB,26
|
||||
2026-10-16T19:49:45.8318419+03:00,lab3-redis-1,1.54%,3.449MiB / 256MiB,1.35%,1.79MB / 2.21MB,41kB / 0B,6
|
||||
2026-10-16T19:49:50.5066230+03:00,lab3-loadgen-run-dea587583317,19.82%,26.18MiB / 7.649GiB,0.33%,11.7MB / 9.14MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:50.5066230+03:00,lab3-lb-1,6.24%,7.941MiB / 128MiB,6.20%,17.5MB / 18.5MB,0B / 1.47MB,9
|
||||
2026-10-16T19:49:50.5066230+03:00,lab3-api-1,65.32%,430.7MiB / 1GiB,42.06%,11.6MB / 13.3MB,0B / 377kB,34
|
||||
2026-10-16T19:49:50.5066230+03:00,lab3-api-2,35.90%,448MiB / 1GiB,43.75%,11.6MB / 13.3MB,0B / 377kB,35
|
||||
2026-10-16T19:49:50.5066230+03:00,lab3-db-1,99.76%,93.99MiB / 1GiB,9.18%,16.4MB / 14MB,0B / 229kB,26
|
||||
2026-10-16T19:49:50.5066230+03:00,lab3-redis-1,1.85%,3.449MiB / 256MiB,1.35%,1.89MB / 2.33MB,41kB / 0B,6
|
||||
2026-10-16T19:49:54.5504899+03:00,lab3-loadgen-run-dea587583317,18.66%,26.14MiB / 7.649GiB,0.33%,12.3MB / 9.61MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:54.5504899+03:00,lab3-lb-1,5.47%,7.926MiB / 128MiB,6.19%,18.4MB / 19.5MB,0B / 1.77MB,9
|
||||
2026-10-16T19:49:54.5504899+03:00,lab3-api-1,89.93%,431.9MiB / 1GiB,42.18%,12.2MB / 14MB,0B / 389kB,34
|
||||
2026-10-16T19:49:54.5504899+03:00,lab3-api-2,113.47%,449.2MiB / 1GiB,43.87%,12.2MB / 14MB,0B / 389kB,35
|
||||
2026-10-16T19:49:54.5504899+03:00,lab3-db-1,100.06%,94.45MiB / 1GiB,9.22%,17.1MB / 14.5MB,0B / 229kB,26
|
||||
2026-10-16T19:49:54.5504899+03:00,lab3-redis-1,4.30%,3.445MiB / 256MiB,1.35%,1.97MB / 2.42MB,41kB / 0B,6
|
||||
2026-10-16T19:49:59.1882628+03:00,lab3-loadgen-run-dea587583317,19.59%,26.14MiB / 7.649GiB,0.33%,12.8MB / 10MB,0B / 2.36MB,9
|
||||
2026-10-16T19:49:59.1882628+03:00,lab3-lb-1,5.05%,8.219MiB / 128MiB,6.42%,19.2MB / 20.4MB,0B / 1.77MB,9
|
||||
2026-10-16T19:49:59.1882628+03:00,lab3-api-1,29.25%,427.5MiB / 1GiB,41.75%,12.7MB / 14.7MB,0B / 389kB,34
|
||||
2026-10-16T19:49:59.1882628+03:00,lab3-api-2,30.07%,449.5MiB / 1GiB,43.90%,12.7MB / 14.6MB,0B / 389kB,35
|
||||
2026-10-16T19:49:59.1882628+03:00,lab3-db-1,103.39%,95.5MiB / 1GiB,9.33%,18MB / 15.4MB,0B / 229kB,26
|
||||
2026-10-16T19:49:59.1882628+03:00,lab3-redis-1,3.89%,3.445MiB / 256MiB,1.35%,2.09MB / 2.56MB,41kB / 0B,6
|
||||
2026-10-16T19:50:03.7208763+03:00,lab3-loadgen-run-dea587583317,16.14%,26.18MiB / 7.649GiB,0.33%,13.3MB / 10.4MB,0B / 2.36MB,9
|
||||
2026-10-16T19:50:03.7208763+03:00,lab3-lb-1,4.25%,7.914MiB / 128MiB,6.18%,20.1MB / 21.3MB,0B / 1.77MB,9
|
||||
2026-10-16T19:50:03.7208763+03:00,lab3-api-1,32.14%,427.6MiB / 1GiB,41.76%,13.3MB / 15.3MB,0B / 389kB,34
|
||||
2026-10-16T19:50:03.7208763+03:00,lab3-api-2,28.01%,449.6MiB / 1GiB,43.91%,13.3MB / 15.3MB,0B / 389kB,35
|
||||
2026-10-16T19:50:03.7208763+03:00,lab3-db-1,100.50%,95.4MiB / 1GiB,9.32%,18.8MB / 16.1MB,0B / 229kB,26
|
||||
2026-10-16T19:50:03.7208763+03:00,lab3-redis-1,3.28%,3.445MiB / 256MiB,1.35%,2.19MB / 2.67MB,41kB / 0B,6
|
||||
2026-10-16T19:50:08.3584341+03:00,lab3-loadgen-run-dea587583317,17.71%,26.18MiB / 7.649GiB,0.33%,13.9MB / 10.9MB,0B / 2.36MB,9
|
||||
2026-10-16T19:50:08.3584341+03:00,lab3-lb-1,4.64%,7.93MiB / 128MiB,6.20%,20.8MB / 22MB,0B / 1.77MB,9
|
||||
2026-10-16T19:50:08.3584341+03:00,lab3-api-1,27.38%,429.5MiB / 1GiB,41.94%,13.8MB / 15.9MB,0B / 401kB,37
|
||||
2026-10-16T19:50:08.3584341+03:00,lab3-api-2,30.52%,449.8MiB / 1GiB,43.92%,13.8MB / 15.8MB,0B / 389kB,36
|
||||
2026-10-16T19:50:08.3584341+03:00,lab3-db-1,99.29%,94.27MiB / 1GiB,9.21%,19.5MB / 16.7MB,0B / 410kB,25
|
||||
2026-10-16T19:50:08.3584341+03:00,lab3-redis-1,1.67%,3.438MiB / 256MiB,1.34%,2.27MB / 2.77MB,41kB / 0B,6
|
||||
|
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"lab": 3,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 90.0,
|
||||
"elapsed_seconds": 90.073,
|
||||
"concurrency": 8,
|
||||
"successful_requests": 13233,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 146.914,
|
||||
"successful_latency_ms": {
|
||||
"p50": 48.778,
|
||||
"p95": 97.924,
|
||||
"p99": 121.514
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
timestamp,name,cpu_percent,mem_usage,mem_percent,net_io,block_io,pids
|
||||
2026-10-16T19:55:21.6355964+03:00,lab3-loadgen-run-a54434c38188,12.60%,25.65MiB / 7.649GiB,0.33%,19.5kB / 18.1kB,0B / 0B,9
|
||||
2026-10-16T19:55:21.6355964+03:00,lab3-lb-1,0.55%,7.461MiB / 128MiB,5.83%,33.3kB / 35.8kB,0B / 12.3kB,9
|
||||
2026-10-16T19:55:21.6355964+03:00,lab3-api-1,177.39%,475.2MiB / 2GiB,23.21%,34.6kB / 32.2kB,266kB / 246kB,43
|
||||
2026-10-16T19:55:21.6355964+03:00,lab3-api-2,243.15%,457.4MiB / 2GiB,22.33%,50.9kB / 59.9kB,0B / 254kB,45
|
||||
2026-10-16T19:55:21.6355964+03:00,lab3-db-1,0.84%,37.15MiB / 1GiB,3.63%,85.1kB / 74.7kB,0B / 225kB,16
|
||||
2026-10-16T19:55:21.6355964+03:00,lab3-redis-1,0.70%,3.422MiB / 256MiB,1.34%,6.17kB / 2.92kB,41kB / 0B,6
|
||||
2026-10-16T19:55:26.3066777+03:00,lab3-loadgen-run-a54434c38188,27.51%,25.98MiB / 7.649GiB,0.33%,556kB / 444kB,0B / 0B,9
|
||||
2026-10-16T19:55:26.3066777+03:00,lab3-lb-1,10.70%,7.785MiB / 128MiB,6.08%,857kB / 906kB,0B / 12.3kB,9
|
||||
2026-10-16T19:55:26.3066777+03:00,lab3-api-1,254.62%,495.5MiB / 2GiB,24.19%,595kB / 699kB,266kB / 246kB,44
|
||||
2026-10-16T19:55:26.3066777+03:00,lab3-api-2,304.43%,470MiB / 2GiB,22.95%,585kB / 679kB,0B / 254kB,45
|
||||
2026-10-16T19:55:26.3066777+03:00,lab3-db-1,55.20%,65.61MiB / 1GiB,6.41%,912kB / 744kB,0B / 225kB,22
|
||||
2026-10-16T19:55:26.3066777+03:00,lab3-redis-1,3.54%,3.445MiB / 256MiB,1.35%,68.2kB / 82.6kB,41kB / 0B,6
|
||||
2026-10-16T19:55:31.0493064+03:00,lab3-loadgen-run-a54434c38188,37.45%,26.08MiB / 7.649GiB,0.33%,1.4MB / 1.11MB,0B / 0B,9
|
||||
2026-10-16T19:55:31.0493064+03:00,lab3-lb-1,11.40%,7.781MiB / 128MiB,6.08%,2.12MB / 2.24MB,0B / 12.3kB,9
|
||||
2026-10-16T19:55:31.0493064+03:00,lab3-api-1,258.22%,536MiB / 2GiB,26.17%,1.22MB / 1.43MB,266kB / 246kB,43
|
||||
2026-10-16T19:55:31.0493064+03:00,lab3-api-2,237.51%,490.7MiB / 2GiB,23.96%,1.4MB / 1.61MB,0B / 254kB,44
|
||||
2026-10-16T19:55:31.0493064+03:00,lab3-db-1,70.38%,72.06MiB / 1GiB,7.04%,2.07MB / 1.71MB,0B / 225kB,22
|
||||
2026-10-16T19:55:31.0493064+03:00,lab3-redis-1,3.06%,3.449MiB / 256MiB,1.35%,217kB / 280kB,41kB / 0B,6
|
||||
2026-10-16T19:55:35.8383579+03:00,lab3-loadgen-run-a54434c38188,38.70%,25.99MiB / 7.649GiB,0.33%,2.64MB / 2.09MB,0B / 2.36MB,9
|
||||
2026-10-16T19:55:35.8383579+03:00,lab3-lb-1,11.71%,7.793MiB / 128MiB,6.09%,3.93MB / 4.2MB,0B / 328kB,9
|
||||
2026-10-16T19:55:35.8383579+03:00,lab3-api-1,201.14%,534.8MiB / 2GiB,26.11%,2.6MB / 3.02MB,266kB / 262kB,43
|
||||
2026-10-16T19:55:35.8383579+03:00,lab3-api-2,244.24%,496MiB / 2GiB,24.22%,2.59MB / 2.95MB,0B / 270kB,44
|
||||
2026-10-16T19:55:35.8383579+03:00,lab3-db-1,93.40%,77.03MiB / 1GiB,7.52%,3.76MB / 3.13MB,0B / 225kB,22
|
||||
2026-10-16T19:55:35.8383579+03:00,lab3-redis-1,3.25%,3.449MiB / 256MiB,1.35%,364kB / 474kB,41kB / 0B,6
|
||||
2026-10-16T19:55:40.5668501+03:00,lab3-loadgen-run-a54434c38188,37.33%,25.98MiB / 7.649GiB,0.33%,3.79MB / 2.99MB,0B / 2.36MB,9
|
||||
2026-10-16T19:55:40.5668501+03:00,lab3-lb-1,13.15%,7.84MiB / 128MiB,6.12%,5.62MB / 6.02MB,0B / 328kB,9
|
||||
2026-10-16T19:55:40.5668501+03:00,lab3-api-1,238.33%,551.4MiB / 2GiB,26.93%,3.71MB / 4.28MB,266kB / 262kB,43
|
||||
2026-10-16T19:55:40.5668501+03:00,lab3-api-2,269.10%,498.7MiB / 2GiB,24.35%,3.7MB / 4.22MB,0B / 270kB,44
|
||||
2026-10-16T19:55:40.5668501+03:00,lab3-db-1,108.31%,80.43MiB / 1GiB,7.85%,5.33MB / 4.45MB,0B / 225kB,22
|
||||
2026-10-16T19:55:40.5668501+03:00,lab3-redis-1,2.94%,3.449MiB / 256MiB,1.35%,544kB / 711kB,41kB / 0B,6
|
||||
2026-10-16T19:55:45.2942823+03:00,lab3-loadgen-run-a54434c38188,38.65%,25.98MiB / 7.649GiB,0.33%,4.55MB / 3.59MB,0B / 2.36MB,9
|
||||
2026-10-16T19:55:45.2942823+03:00,lab3-lb-1,10.49%,7.863MiB / 128MiB,6.14%,6.76MB / 7.22MB,0B / 328kB,9
|
||||
2026-10-16T19:55:45.2942823+03:00,lab3-api-1,121.29%,551.4MiB / 2GiB,26.92%,4.45MB / 5.14MB,266kB / 262kB,42
|
||||
2026-10-16T19:55:45.2942823+03:00,lab3-api-2,129.09%,498.8MiB / 2GiB,24.36%,4.44MB / 5.07MB,0B / 270kB,43
|
||||
2026-10-16T19:55:45.2942823+03:00,lab3-db-1,99.87%,80.95MiB / 1GiB,7.91%,6.38MB / 5.33MB,0B / 225kB,22
|
||||
2026-10-16T19:55:45.2942823+03:00,lab3-redis-1,2.36%,3.453MiB / 256MiB,1.35%,694kB / 905kB,41kB / 0B,6
|
||||
2026-10-16T19:55:49.3880913+03:00,lab3-loadgen-run-a54434c38188,31.47%,26.23MiB / 7.649GiB,0.33%,5.58MB / 4.4MB,0B / 2.36MB,9
|
||||
2026-10-16T19:55:49.3880913+03:00,lab3-lb-1,9.30%,7.84MiB / 128MiB,6.12%,8.29MB / 8.85MB,0B / 815kB,9
|
||||
2026-10-16T19:55:49.3880913+03:00,lab3-api-1,119.95%,542.2MiB / 2GiB,26.48%,5.45MB / 6.3MB,266kB / 279kB,43
|
||||
2026-10-16T19:55:49.3880913+03:00,lab3-api-2,144.66%,499.4MiB / 2GiB,24.39%,5.45MB / 6.22MB,0B / 287kB,45
|
||||
2026-10-16T19:55:49.3880913+03:00,lab3-db-1,99.74%,83.52MiB / 1GiB,8.16%,7.8MB / 6.54MB,0B / 225kB,23
|
||||
2026-10-16T19:55:49.3880913+03:00,lab3-redis-1,4.98%,3.453MiB / 256MiB,1.35%,821kB / 1.06MB,41kB / 0B,6
|
||||
2026-10-16T19:55:54.1140137+03:00,lab3-loadgen-run-a54434c38188,27.78%,25.99MiB / 7.649GiB,0.33%,6.41MB / 5.04MB,0B / 2.36MB,9
|
||||
2026-10-16T19:55:54.1140137+03:00,lab3-lb-1,9.17%,7.816MiB / 128MiB,6.11%,9.53MB / 10.2MB,0B / 815kB,9
|
||||
2026-10-16T19:55:54.1140137+03:00,lab3-api-1,108.11%,551MiB / 2GiB,26.90%,6.26MB / 7.23MB,266kB / 279kB,43
|
||||
2026-10-16T19:55:54.1140137+03:00,lab3-api-2,122.92%,520.2MiB / 2GiB,25.40%,6.25MB / 7.14MB,0B / 287kB,43
|
||||
2026-10-16T19:55:54.1140137+03:00,lab3-db-1,99.23%,84.32MiB / 1GiB,8.23%,8.94MB / 7.5MB,0B / 225kB,23
|
||||
2026-10-16T19:55:54.1140137+03:00,lab3-redis-1,4.70%,3.453MiB / 256MiB,1.35%,989kB / 1.27MB,41kB / 0B,6
|
||||
2026-10-16T19:55:58.4369070+03:00,lab3-loadgen-run-a54434c38188,25.63%,26.01MiB / 7.649GiB,0.33%,7.31MB / 5.75MB,0B / 2.36MB,9
|
||||
2026-10-16T19:55:58.4369070+03:00,lab3-lb-1,7.58%,8.285MiB / 128MiB,6.47%,10.9MB / 11.6MB,0B / 815kB,9
|
||||
2026-10-16T19:55:58.4369070+03:00,lab3-api-1,131.86%,540.5MiB / 2GiB,26.39%,7.17MB / 8.27MB,266kB / 279kB,43
|
||||
2026-10-16T19:55:58.4369070+03:00,lab3-api-2,103.01%,520.7MiB / 2GiB,25.42%,7.16MB / 8.16MB,0B / 287kB,44
|
||||
2026-10-16T19:55:58.4369070+03:00,lab3-db-1,97.34%,86.49MiB / 1GiB,8.45%,9.93MB / 8.38MB,0B / 225kB,24
|
||||
2026-10-16T19:55:58.4369070+03:00,lab3-redis-1,4.64%,3.445MiB / 256MiB,1.35%,1.14MB / 1.45MB,41kB / 0B,6
|
||||
2026-10-16T19:56:03.1048923+03:00,lab3-loadgen-run-a54434c38188,40.31%,26.29MiB / 7.649GiB,0.34%,8.3MB / 6.52MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:03.1048923+03:00,lab3-lb-1,11.12%,8.004MiB / 128MiB,6.25%,12.4MB / 13.2MB,0B / 815kB,9
|
||||
2026-10-16T19:56:03.1048923+03:00,lab3-api-1,105.77%,547.6MiB / 2GiB,26.74%,8.13MB / 9.37MB,266kB / 279kB,43
|
||||
2026-10-16T19:56:03.1048923+03:00,lab3-api-2,100.76%,525.4MiB / 2GiB,25.65%,8.13MB / 9.26MB,0B / 287kB,43
|
||||
2026-10-16T19:56:03.1048923+03:00,lab3-db-1,100.04%,90.21MiB / 1GiB,8.81%,11.5MB / 9.76MB,0B / 225kB,25
|
||||
2026-10-16T19:56:03.1048923+03:00,lab3-redis-1,2.77%,3.453MiB / 256MiB,1.35%,1.3MB / 1.65MB,41kB / 0B,6
|
||||
2026-10-16T19:56:07.3367896+03:00,lab3-loadgen-run-a54434c38188,29.99%,26.13MiB / 7.649GiB,0.33%,9.49MB / 7.45MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:07.3367896+03:00,lab3-lb-1,9.09%,7.789MiB / 128MiB,6.09%,13.8MB / 14.7MB,0B / 1.28MB,9
|
||||
2026-10-16T19:56:07.3367896+03:00,lab3-api-1,55.57%,547.7MiB / 2GiB,26.74%,9.31MB / 10.7MB,266kB / 295kB,43
|
||||
2026-10-16T19:56:07.3367896+03:00,lab3-api-2,53.65%,518.3MiB / 2GiB,25.31%,9.3MB / 10.6MB,0B / 303kB,43
|
||||
2026-10-16T19:56:07.3367896+03:00,lab3-db-1,99.59%,91.31MiB / 1GiB,8.92%,13.2MB / 11.2MB,0B / 225kB,25
|
||||
2026-10-16T19:56:07.3367896+03:00,lab3-redis-1,1.91%,3.445MiB / 256MiB,1.35%,1.49MB / 1.89MB,41kB / 0B,6
|
||||
2026-10-16T19:56:11.9847656+03:00,lab3-loadgen-run-a54434c38188,33.95%,26.18MiB / 7.649GiB,0.33%,10.2MB / 8.01MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:11.9847656+03:00,lab3-lb-1,10.16%,7.801MiB / 128MiB,6.09%,15.5MB / 16.6MB,0B / 1.28MB,9
|
||||
2026-10-16T19:56:11.9847656+03:00,lab3-api-1,68.03%,547.6MiB / 2GiB,26.74%,10.2MB / 11.8MB,266kB / 295kB,42
|
||||
2026-10-16T19:56:11.9847656+03:00,lab3-api-2,66.13%,518.3MiB / 2GiB,25.31%,10.2MB / 11.6MB,0B / 303kB,43
|
||||
2026-10-16T19:56:11.9847656+03:00,lab3-db-1,98.54%,94.52MiB / 1GiB,9.23%,14.5MB / 12.3MB,0B / 225kB,25
|
||||
2026-10-16T19:56:11.9847656+03:00,lab3-redis-1,2.46%,3.453MiB / 256MiB,1.35%,1.61MB / 2.03MB,41kB / 0B,6
|
||||
2026-10-16T19:56:16.6999024+03:00,lab3-loadgen-run-a54434c38188,29.92%,26.43MiB / 7.649GiB,0.34%,11.3MB / 8.85MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:16.6999024+03:00,lab3-lb-1,8.30%,7.82MiB / 128MiB,6.11%,16.5MB / 17.6MB,0B / 1.28MB,9
|
||||
2026-10-16T19:56:16.6999024+03:00,lab3-api-1,60.10%,547.6MiB / 2GiB,26.74%,11.1MB / 12.8MB,266kB / 295kB,42
|
||||
2026-10-16T19:56:16.6999024+03:00,lab3-api-2,105.17%,525.2MiB / 2GiB,25.65%,11.1MB / 12.6MB,0B / 303kB,43
|
||||
2026-10-16T19:56:16.6999024+03:00,lab3-db-1,98.47%,106.6MiB / 1GiB,10.41%,15.6MB / 13.3MB,0B / 225kB,24
|
||||
2026-10-16T19:56:16.6999024+03:00,lab3-redis-1,2.18%,3.453MiB / 256MiB,1.35%,1.78MB / 2.25MB,41kB / 0B,6
|
||||
2026-10-16T19:56:21.3702466+03:00,lab3-loadgen-run-a54434c38188,28.70%,26.2MiB / 7.649GiB,0.33%,12.1MB / 9.51MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:21.3702466+03:00,lab3-lb-1,11.35%,7.844MiB / 128MiB,6.13%,18.1MB / 19.3MB,0B / 1.72MB,9
|
||||
2026-10-16T19:56:21.3702466+03:00,lab3-api-1,123.73%,548.7MiB / 2GiB,26.79%,11.9MB / 13.7MB,266kB / 311kB,42
|
||||
2026-10-16T19:56:21.3702466+03:00,lab3-api-2,128.64%,529.5MiB / 2GiB,25.86%,11.9MB / 13.6MB,0B / 303kB,44
|
||||
2026-10-16T19:56:21.3702466+03:00,lab3-db-1,101.13%,116MiB / 1GiB,11.33%,16.8MB / 14.3MB,0B / 225kB,24
|
||||
2026-10-16T19:56:21.3702466+03:00,lab3-redis-1,2.03%,3.453MiB / 256MiB,1.35%,1.89MB / 2.38MB,41kB / 0B,6
|
||||
2026-10-16T19:56:26.1317268+03:00,lab3-loadgen-run-a54434c38188,24.06%,26.15MiB / 7.649GiB,0.33%,12.8MB / 10.1MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:26.1317268+03:00,lab3-lb-1,7.50%,7.797MiB / 128MiB,6.09%,19.1MB / 20.4MB,0B / 1.72MB,9
|
||||
2026-10-16T19:56:26.1317268+03:00,lab3-api-1,38.16%,549MiB / 2GiB,26.80%,12.6MB / 14.5MB,266kB / 311kB,42
|
||||
2026-10-16T19:56:26.1317268+03:00,lab3-api-2,46.23%,537.9MiB / 2GiB,26.26%,12.6MB / 14.4MB,0B / 303kB,43
|
||||
2026-10-16T19:56:26.1317268+03:00,lab3-db-1,99.24%,123.6MiB / 1GiB,12.07%,17.8MB / 15.2MB,0B / 250kB,24
|
||||
2026-10-16T19:56:26.1317268+03:00,lab3-redis-1,2.19%,3.445MiB / 256MiB,1.35%,2.04MB / 2.55MB,41kB / 0B,6
|
||||
2026-10-16T19:56:30.1981261+03:00,lab3-loadgen-run-a54434c38188,23.46%,26.18MiB / 7.649GiB,0.33%,13.6MB / 10.6MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:30.1981261+03:00,lab3-lb-1,7.00%,7.824MiB / 128MiB,6.11%,20.2MB / 21.5MB,0B / 1.72MB,9
|
||||
2026-10-16T19:56:30.1981261+03:00,lab3-api-1,49.59%,549MiB / 2GiB,26.81%,13.4MB / 15.3MB,266kB / 311kB,42
|
||||
2026-10-16T19:56:30.1981261+03:00,lab3-api-2,68.34%,530.9MiB / 2GiB,25.92%,13.4MB / 15.2MB,0B / 303kB,43
|
||||
2026-10-16T19:56:30.1981261+03:00,lab3-db-1,99.31%,124.2MiB / 1GiB,12.13%,18.8MB / 16.1MB,0B / 250kB,24
|
||||
2026-10-16T19:56:30.1981261+03:00,lab3-redis-1,5.14%,3.453MiB / 256MiB,1.35%,2.13MB / 2.67MB,41kB / 0B,6
|
||||
2026-10-16T19:56:34.8672656+03:00,lab3-loadgen-run-a54434c38188,24.67%,26.27MiB / 7.649GiB,0.34%,14.3MB / 11.2MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:34.8672656+03:00,lab3-lb-1,6.78%,7.816MiB / 128MiB,6.11%,21.3MB / 22.7MB,0B / 1.72MB,9
|
||||
2026-10-16T19:56:34.8672656+03:00,lab3-api-1,89.96%,549.5MiB / 2GiB,26.83%,14.1MB / 16.2MB,266kB / 328kB,42
|
||||
2026-10-16T19:56:34.8672656+03:00,lab3-api-2,98.56%,531.2MiB / 2GiB,25.94%,14.1MB / 16MB,0B / 319kB,43
|
||||
2026-10-16T19:56:34.8672656+03:00,lab3-db-1,100.58%,125.4MiB / 1GiB,12.25%,19.8MB / 16.9MB,0B / 266kB,24
|
||||
2026-10-16T19:56:34.8672656+03:00,lab3-redis-1,4.48%,3.453MiB / 256MiB,1.35%,2.28MB / 2.84MB,41kB / 0B,6
|
||||
2026-10-16T19:56:39.1314111+03:00,lab3-loadgen-run-a54434c38188,25.65%,26.22MiB / 7.649GiB,0.33%,14.8MB / 11.6MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:39.1314111+03:00,lab3-lb-1,8.60%,7.785MiB / 128MiB,6.08%,22.1MB / 23.5MB,0B / 2.08MB,9
|
||||
2026-10-16T19:56:39.1314111+03:00,lab3-api-1,33.55%,553.8MiB / 2GiB,27.04%,14.8MB / 17MB,266kB / 328kB,42
|
||||
2026-10-16T19:56:39.1314111+03:00,lab3-api-2,41.70%,533.5MiB / 2GiB,26.05%,14.8MB / 16.8MB,0B / 319kB,46
|
||||
2026-10-16T19:56:39.1314111+03:00,lab3-db-1,98.98%,125.5MiB / 1GiB,12.25%,20.8MB / 17.8MB,0B / 266kB,24
|
||||
2026-10-16T19:56:39.1314111+03:00,lab3-redis-1,4.57%,3.449MiB / 256MiB,1.35%,2.4MB / 2.98MB,41kB / 0B,6
|
||||
2026-10-16T19:56:43.7975511+03:00,lab3-loadgen-run-a54434c38188,20.75%,26.24MiB / 7.649GiB,0.34%,15.5MB / 12.2MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:43.7975511+03:00,lab3-lb-1,6.99%,7.797MiB / 128MiB,6.09%,23.2MB / 24.7MB,0B / 2.08MB,9
|
||||
2026-10-16T19:56:43.7975511+03:00,lab3-api-1,40.05%,546.3MiB / 2GiB,26.67%,15.4MB / 17.6MB,266kB / 328kB,42
|
||||
2026-10-16T19:56:43.7975511+03:00,lab3-api-2,30.00%,532.2MiB / 2GiB,25.99%,15.4MB / 17.5MB,0B / 319kB,43
|
||||
2026-10-16T19:56:43.7975511+03:00,lab3-db-1,106.16%,125.9MiB / 1GiB,12.29%,21.6MB / 18.5MB,0B / 266kB,24
|
||||
2026-10-16T19:56:43.7975511+03:00,lab3-redis-1,3.16%,3.445MiB / 256MiB,1.35%,2.49MB / 3.09MB,41kB / 0B,6
|
||||
2026-10-16T19:56:48.2171355+03:00,lab3-loadgen-run-a54434c38188,19.71%,26.24MiB / 7.649GiB,0.34%,16.1MB / 12.6MB,0B / 2.36MB,9
|
||||
2026-10-16T19:56:48.2171355+03:00,lab3-lb-1,5.55%,7.789MiB / 128MiB,6.09%,24.1MB / 25.6MB,0B / 2.08MB,9
|
||||
2026-10-16T19:56:48.2171355+03:00,lab3-api-1,24.51%,546.5MiB / 2GiB,26.68%,16MB / 18.3MB,266kB / 328kB,43
|
||||
2026-10-16T19:56:48.2171355+03:00,lab3-api-2,25.26%,532MiB / 2GiB,25.98%,15.8MB / 18MB,0B / 319kB,43
|
||||
2026-10-16T19:56:48.2171355+03:00,lab3-db-1,101.27%,124.9MiB / 1GiB,12.20%,22.4MB / 19.2MB,0B / 266kB,23
|
||||
2026-10-16T19:56:48.2171355+03:00,lab3-redis-1,1.32%,3.445MiB / 256MiB,1.35%,2.59MB / 3.21MB,41kB / 0B,6
|
||||
|
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"lab": 3,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 90.0,
|
||||
"elapsed_seconds": 90.065,
|
||||
"concurrency": 8,
|
||||
"successful_requests": 15408,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 171.077,
|
||||
"successful_latency_ms": {
|
||||
"p50": 36.078,
|
||||
"p95": 92.895,
|
||||
"p99": 108.825
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
+9
@@ -0,0 +1,9 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,248 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh gradlew
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+82
@@ -0,0 +1,82 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem gradlew startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
worker_processes auto;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
access_log /tmp/access.log;
|
||||
error_log /tmp/error.log warn;
|
||||
|
||||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||||
resolver_timeout 5s;
|
||||
|
||||
upstream api_backend {
|
||||
zone api_backend 64k;
|
||||
server api:8080 resolve max_fails=1 fail_timeout=5s;
|
||||
keepalive 32;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
client_max_body_size 1m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://api_backend;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_next_upstream error timeout http_502 http_503 http_504 non_idempotent;
|
||||
proxy_next_upstream_tries 3;
|
||||
|
||||
proxy_connect_timeout 1s;
|
||||
proxy_send_timeout 10s;
|
||||
proxy_read_timeout 10s;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
param(
|
||||
[int]$DurationSeconds = 90,
|
||||
[string]$Output = "evidence/lab3/pg-stat-activity.log"
|
||||
)
|
||||
|
||||
$end = (Get-Date).AddSeconds($DurationSeconds)
|
||||
"=== pg_stat_activity collection started at $(Get-Date -Format o) ===" | Out-File $Output
|
||||
|
||||
while ((Get-Date) -lt $end) {
|
||||
"--- $(Get-Date -Format o) ---" | Add-Content $Output
|
||||
docker compose exec -T db psql -U messenger -d messenger -c "SELECT state, wait_event_type, wait_event, count(*) FROM pg_stat_activity WHERE datname='messenger' GROUP BY 1,2,3 ORDER BY 4 DESC;" 2>&1 | Add-Content $Output
|
||||
Start-Sleep -Seconds 5
|
||||
}
|
||||
|
||||
"=== collection finished at $(Get-Date -Format o) ===" | Add-Content $Output
|
||||
@@ -0,0 +1,21 @@
|
||||
param(
|
||||
[int]$DurationSeconds = 90,
|
||||
[string]$Output = "evidence/lab3/docker-stats.csv"
|
||||
)
|
||||
|
||||
$header = "timestamp,name,cpu_percent,mem_usage,mem_percent,net_io,block_io,pids"
|
||||
Set-Content -Path $Output -Value $header
|
||||
|
||||
$end = (Get-Date).AddSeconds($DurationSeconds)
|
||||
Write-Host "Collecting stats for $DurationSeconds seconds..."
|
||||
|
||||
while ((Get-Date) -lt $end) {
|
||||
$timestamp = (Get-Date).ToString("o")
|
||||
$stats = docker stats --no-stream --format "{{.Name}},{{.CPUPerc}},{{.MemUsage}},{{.MemPerc}},{{.NetIO}},{{.BlockIO}},{{.PIDs}}"
|
||||
foreach ($line in $stats) {
|
||||
Add-Content -Path $Output -Value "$timestamp,$line"
|
||||
}
|
||||
Start-Sleep -Seconds 2
|
||||
}
|
||||
|
||||
Write-Host "Done. Rows: $((Get-Content $Output | Measure-Object -Line).Lines)"
|
||||
@@ -0,0 +1,53 @@
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
import os
|
||||
|
||||
# Создаем папку, если ее нет
|
||||
os.makedirs('evidence/lab3/charts', exist_ok=True)
|
||||
|
||||
# Загружаем данные из CSV
|
||||
csv_path = 'evidence/lab3/series-summary.csv'
|
||||
if not os.path.exists(csv_path):
|
||||
print(f"ОШИБКА: Файл {csv_path} не найден! Сначала создайте его.")
|
||||
exit(1)
|
||||
|
||||
df = pd.read_csv(csv_path)
|
||||
|
||||
# --- ГРАФИК 1: RPS от числа реплик (Серия A) ---
|
||||
df_a = df[df['series'] == 'A'].sort_values('replicas')
|
||||
plt.figure(figsize=(8, 5))
|
||||
plt.plot(df_a['replicas'], df_a['successful_rps'], marker='o', linestyle='-', color='red', linewidth=2, markersize=8)
|
||||
plt.title('Series A: RPS vs Replicas (Fixed 2 CPU)', fontsize=14)
|
||||
plt.xlabel('Number of Replicas', fontsize=12)
|
||||
plt.ylabel('Successful RPS', fontsize=12)
|
||||
plt.xticks(df_a['replicas'])
|
||||
plt.grid(True, linestyle='--', alpha=0.7)
|
||||
plt.savefig('evidence/lab3/charts/seriesA-rps-vs-replicas.png', bbox_inches='tight')
|
||||
plt.close()
|
||||
|
||||
# --- ГРАФИК 2: RPS от суммарного CPU (Серия B) ---
|
||||
df_b = df[df['series'] == 'B'].sort_values('total_cpu')
|
||||
plt.figure(figsize=(8, 5))
|
||||
plt.plot(df_b['total_cpu'], df_b['successful_rps'], marker='s', linestyle='-', color='blue', linewidth=2, markersize=8)
|
||||
plt.title('Series B: RPS vs Total CPU (2 Replicas)', fontsize=14)
|
||||
plt.xlabel('Total CPU Cores', fontsize=12)
|
||||
plt.ylabel('Successful RPS', fontsize=12)
|
||||
plt.xticks(df_b['total_cpu'])
|
||||
plt.grid(True, linestyle='--', alpha=0.7)
|
||||
plt.savefig('evidence/lab3/charts/seriesB-rps-vs-cpu.png', bbox_inches='tight')
|
||||
plt.close()
|
||||
|
||||
# --- ГРАФИК 3: Сравнение p95 ---
|
||||
plt.figure(figsize=(10, 5))
|
||||
# Красим столбцы: серия А - красные, серия B - синие
|
||||
colors = ['red' if s == 'A' else 'blue' for s in df['series']]
|
||||
|
||||
plt.bar(df['config'], df['p95_ms'], color=colors)
|
||||
plt.title('p95 Latency by Configuration', fontsize=14)
|
||||
plt.xlabel('Configuration', fontsize=12)
|
||||
plt.ylabel('p95 Latency (ms)', fontsize=12)
|
||||
plt.grid(axis='y', linestyle='--', alpha=0.7)
|
||||
plt.savefig('evidence/lab3/charts/comparison-p95.png', bbox_inches='tight')
|
||||
plt.close()
|
||||
|
||||
print("✅ Графики успешно созданы из series-summary.csv в evidence/lab3/charts/")
|
||||
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0restart.ps1"
|
||||
exit /b %ERRORLEVEL%
|
||||
@@ -0,0 +1,3 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
docker compose --env-file .env restart db redis api lb
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# Restart API and state stores. Volumes are untouched -> data, sessions
|
||||
# and idempotency keys survive.
|
||||
# migrate is one-shot (exited 0) and is intentionally not restarted here.
|
||||
docker compose --env-file .env restart db redis api lb
|
||||
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0stop-one.ps1"
|
||||
exit /b %ERRORLEVEL%
|
||||
@@ -0,0 +1,14 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if (-not $env:TARGET_INSTANCE_ID) {
|
||||
Write-Error "TARGET_INSTANCE_ID is not set"
|
||||
exit 2
|
||||
}
|
||||
|
||||
$id = $env:TARGET_INSTANCE_ID
|
||||
$logDir = "evidence\lab3"
|
||||
New-Item -ItemType Directory -Force -Path $logDir | Out-Null
|
||||
|
||||
docker stop $id | Out-Null
|
||||
docker logs $id 2>&1 | Out-File -Encoding utf8 "$logDir\api-$id.log"
|
||||
Write-Host "saved $logDir\api-$id.log"
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
|
||||
|
||||
# X-Instance-Id = short container ID (lab3 implementation detail).
|
||||
# docker stop resolves short IDs natively.
|
||||
docker stop "$TARGET_INSTANCE_ID"
|
||||
@@ -0,0 +1,52 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$logDir = "evidence\lab3"
|
||||
New-Item -ItemType Directory -Force -Path $logDir | Out-Null
|
||||
|
||||
# 1. Создаем тестового юзера (на случай чистого volume)
|
||||
curl.exe -s -o NUL -X POST http://127.0.0.1:8080/api/v1/users -H "Content-Type: application/json" -d '{\"username\":\"lbtest\",\"display_name\":\"L\",\"password\":\"validpassword123\"}'
|
||||
|
||||
# 2. Получаем токен и создаем чат
|
||||
$TOKEN = (curl.exe -s -X POST http://127.0.0.1:8080/api/v1/auth/sessions -u "lbtest:validpassword123" | ConvertFrom-Json).token
|
||||
$USER_ID = (curl.exe -s http://127.0.0.1:8080/api/v1/users/me -H "Authorization: Bearer $TOKEN" | ConvertFrom-Json).id
|
||||
$CHAT_ID = (curl.exe -s -X POST http://127.0.0.1:8080/api/v1/chats -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d ('{\"title\":\"lb-test\",\"member_ids\":[\"' + $USER_ID + '\"]}') | ConvertFrom-Json).id
|
||||
|
||||
$out = "$logDir\lb-exclusion-pause-test.log"
|
||||
"=== LB exclusion test (docker pause) at $(Get-Date -Format o) ===" | Out-File $out
|
||||
"CHAT_ID=$CHAT_ID" | Add-Content $out
|
||||
|
||||
# 3. Замеры ДО паузы
|
||||
"`n--- ДО ПАУЗЫ (трафик идет на обе реплики) ---" | Add-Content $out
|
||||
for ($i = 1; $i -le 4; $i++) {
|
||||
$r = curl.exe -s -o NUL -w "HTTP=%{http_code} time=%{time_total}s" -X POST "http://127.0.0.1:8080/api/v1/chats/$CHAT_ID/messages" -H "Authorization: Bearer $TOKEN" -H "Idempotency-Key: pre-$i-$(New-Guid)" -H "Content-Type: application/json" -d '{\"text\":\"pre\"}'
|
||||
Write-Host "Pre: $r"
|
||||
"${i}: ${r}" | Add-Content $out
|
||||
}
|
||||
|
||||
# 4. Замораживаем api-1
|
||||
"`n---> docker pause lab3-api-1 (имитация зависшего пула)" | Add-Content $out
|
||||
docker pause lab3-api-1
|
||||
Write-Host "api-1 PAUSED"
|
||||
|
||||
# 5. Замеры ВО ВРЕМЯ паузы (проверяем non_idempotent)
|
||||
"`n--- ВО ВРЕМЯ ПАУЗЫ (Nginx должен перекинуть на api-2) ---" | Add-Content $out
|
||||
for ($i = 1; $i -le 6; $i++) {
|
||||
# Ставим таймаут curl 15s, чтобы он не оборвался раньше Nginx (у nginx read_timeout 10s)
|
||||
$r = curl.exe -s -o NUL -w "HTTP=%{http_code} time=%{time_total}s" -m 15 -X POST "http://127.0.0.1:8080/api/v1/chats/$CHAT_ID/messages" -H "Authorization: Bearer $TOKEN" -H "Idempotency-Key: during-$i-$(New-Guid)" -H "Content-Type: application/json" -d '{\"text\":\"during\"}'
|
||||
Write-Host "During: $r"
|
||||
"${i}: ${r}" | Add-Content $out
|
||||
}
|
||||
|
||||
# 6. Размораживаем api-1
|
||||
"`n---> docker unpause lab3-api-1" | Add-Content $out
|
||||
docker unpause lab3-api-1
|
||||
Write-Host "api-1 UNPAUSED"
|
||||
|
||||
# 7. Замеры ПОСЛЕ паузы
|
||||
"`n--- ПОСЛЕ ПАУЗЫ ---" | Add-Content $out
|
||||
for ($i = 1; $i -le 4; $i++) {
|
||||
$r = curl.exe -s -o NUL -w "HTTP=%{http_code} time=%{time_total}s" -X POST "http://127.0.0.1:8080/api/v1/chats/$CHAT_ID/messages" -H "Authorization: Bearer $TOKEN" -H "Idempotency-Key: post-$i-$(New-Guid)" -H "Content-Type: application/json" -d '{\"text\":\"post\"}'
|
||||
Write-Host "Post: $r"
|
||||
"${i}: ${r}" | Add-Content $out
|
||||
}
|
||||
|
||||
Write-Host "`n✅ Готово! Лог сохранен в $out"
|
||||
@@ -0,0 +1 @@
|
||||
rootProject.name = 'messenger-lab1'
|
||||
@@ -0,0 +1,16 @@
|
||||
package ru.mtusi.messenger;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
import org.springframework.boot.security.autoconfigure.UserDetailsServiceAutoConfiguration;
|
||||
|
||||
@ConfigurationPropertiesScan
|
||||
@SpringBootApplication(exclude = UserDetailsServiceAutoConfiguration.class)
|
||||
public class MessengerLab1Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MessengerLab1Application.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package ru.mtusi.messenger.cache;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@Component
|
||||
public class CacheHealthTracker {
|
||||
|
||||
private final AtomicBoolean stale = new AtomicBoolean(false);
|
||||
|
||||
public void markStale() {
|
||||
stale.set(true);
|
||||
}
|
||||
|
||||
public boolean consumeStale() {
|
||||
return stale.getAndSet(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package ru.mtusi.messenger.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.jackson.autoconfigure.JsonMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import tools.jackson.databind.DeserializationFeature;
|
||||
import tools.jackson.databind.cfg.CoercionAction;
|
||||
import tools.jackson.databind.cfg.CoercionInputShape;
|
||||
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class JacksonConfig {
|
||||
|
||||
@Bean
|
||||
public JsonMapperBuilderCustomizer strictJacksonCustomizer() {
|
||||
log.warn(">>> Strict JsonMapper customizer applied");
|
||||
return builder -> builder
|
||||
.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||
.withCoercionConfigDefaults(config -> {
|
||||
config.setCoercion(CoercionInputShape.Integer, CoercionAction.Fail);
|
||||
config.setCoercion(CoercionInputShape.Float, CoercionAction.Fail);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package ru.mtusi.messenger.config;
|
||||
|
||||
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityScheme;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@SecurityScheme(
|
||||
name = "basicAuth",
|
||||
type = SecuritySchemeType.HTTP,
|
||||
scheme = "basic"
|
||||
)
|
||||
@SecurityScheme(
|
||||
name = "bearerAuth",
|
||||
type = SecuritySchemeType.HTTP,
|
||||
scheme = "bearer",
|
||||
bearerFormat = "opaque session token"
|
||||
)
|
||||
public class OpenApiConfig {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package ru.mtusi.messenger.config;
|
||||
|
||||
import io.github.bucket4j.Bandwidth;
|
||||
import io.github.bucket4j.Bucket;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import ru.mtusi.messenger.config.properties.RateLimitProperties;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class RateLimitConfig {
|
||||
private final RateLimitProperties props;
|
||||
|
||||
@Bean
|
||||
public Bucket rateLimitBucket() {
|
||||
Bandwidth limit = Bandwidth.builder()
|
||||
.capacity(props.ratePerMinute())
|
||||
.refillGreedy(props.ratePerMinute(), Duration.ofMinutes(1))
|
||||
.build();
|
||||
return Bucket.builder().addLimit(limit).build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package ru.mtusi.messenger.config;
|
||||
|
||||
import io.lettuce.core.ClientOptions;
|
||||
import io.lettuce.core.SocketOptions;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.annotation.CachingConfigurer;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cache.interceptor.CacheErrorHandler;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||
import org.springframework.data.redis.cache.RedisCacheManager;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.serializer.JacksonJsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||
import ru.mtusi.messenger.cache.CacheHealthTracker;
|
||||
import ru.mtusi.messenger.config.properties.RedisProperties;
|
||||
import ru.mtusi.messenger.config.properties.SessionProperties;
|
||||
import ru.mtusi.messenger.service.SessionService;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
@EnableConfigurationProperties(RedisProperties.class)
|
||||
@RequiredArgsConstructor
|
||||
public class RedisConfig implements CachingConfigurer {
|
||||
private final SessionProperties sessionProperties;
|
||||
private final RedisProperties redisProperties;
|
||||
private final CacheHealthTracker cacheHealthTracker;
|
||||
|
||||
@Bean
|
||||
public RedisConnectionFactory redisConnectionFactory() {
|
||||
RedisStandaloneConfiguration server =
|
||||
new RedisStandaloneConfiguration(redisProperties.host(), redisProperties.port());
|
||||
|
||||
SocketOptions socketOptions = SocketOptions.builder()
|
||||
.connectTimeout(redisProperties.connectTimeout())
|
||||
.keepAlive(SocketOptions.KeepAliveOptions.builder()
|
||||
.enable()
|
||||
.idle(redisProperties.keepAliveIdle())
|
||||
.interval(redisProperties.keepAliveInterval())
|
||||
.count(3)
|
||||
.build())
|
||||
.tcpUserTimeout(SocketOptions.TcpUserTimeoutOptions.builder()
|
||||
.tcpUserTimeout(redisProperties.tcpUserTimeout())
|
||||
.enable()
|
||||
.build())
|
||||
.build();
|
||||
|
||||
ClientOptions clientOptions = ClientOptions.builder()
|
||||
.socketOptions(socketOptions)
|
||||
.autoReconnect(true)
|
||||
.build();
|
||||
|
||||
LettuceClientConfiguration client = LettuceClientConfiguration.builder()
|
||||
.commandTimeout(redisProperties.commandTimeout())
|
||||
.shutdownTimeout(redisProperties.shutdownTimeout())
|
||||
.clientOptions(clientOptions)
|
||||
.build();
|
||||
|
||||
return new LettuceConnectionFactory(server, client);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RedisCacheManager cacheManager(RedisConnectionFactory cf) {
|
||||
RedisCacheConfiguration cfg = RedisCacheConfiguration.defaultCacheConfig()
|
||||
.entryTtl(sessionProperties.ttl())
|
||||
.disableCachingNullValues()
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair
|
||||
.fromSerializer(new JacksonJsonRedisSerializer<>(SessionService.SessionRecord.class)));
|
||||
return RedisCacheManager.builder(cf).cacheDefaults(cfg).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CacheErrorHandler errorHandler() {
|
||||
return new CacheErrorHandler() {
|
||||
@Override
|
||||
public void handleCacheGetError(RuntimeException e, Cache cache, Object key) {
|
||||
cacheHealthTracker.markStale();
|
||||
log.warn("Cache GET failed ({}): {}", cache.getName(), e.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void handleCachePutError(RuntimeException e, Cache cache, Object key, Object value) {
|
||||
cacheHealthTracker.markStale();
|
||||
log.warn("Cache PUT failed ({}): {}", cache.getName(), e.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void handleCacheEvictError(RuntimeException e, Cache cache, Object key) {
|
||||
cacheHealthTracker.markStale();
|
||||
log.warn("Cache EVICT failed ({}): {}", cache.getName(), e.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void handleCacheClearError(RuntimeException e, Cache cache) {
|
||||
cacheHealthTracker.markStale();
|
||||
log.warn("Cache CLEAR failed ({}): {}", cache.getName(), e.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package ru.mtusi.messenger.config;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.ProviderManager;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.crypto.argon2.Argon2PasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import ru.mtusi.messenger.security.ApiAuthenticationEntryPoint;
|
||||
import ru.mtusi.messenger.security.SessionAuthenticationFilter;
|
||||
import ru.mtusi.messenger.security.SessionAuthenticationProvider;
|
||||
import org.springframework.security.oauth2.server.resource.web.BearerTokenResolver;
|
||||
import org.springframework.security.oauth2.server.resource.web.DefaultBearerTokenResolver;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@RequiredArgsConstructor
|
||||
public class SecurityConfig {
|
||||
private final SessionAuthenticationProvider sessionAuthenticationProvider;
|
||||
private final ApiAuthenticationEntryPoint entryPoint;
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return Argon2PasswordEncoder.defaultsForSpringSecurity_v5_8();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManager() {
|
||||
return new ProviderManager(sessionAuthenticationProvider);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http,
|
||||
AuthenticationManager authenticationManager,
|
||||
BearerTokenResolver bearerTokenResolver) throws Exception {
|
||||
SessionAuthenticationFilter sessionFilter =
|
||||
new SessionAuthenticationFilter(bearerTokenResolver, authenticationManager);
|
||||
|
||||
http
|
||||
.csrf(AbstractHttpConfigurer::disable)
|
||||
.httpBasic(AbstractHttpConfigurer::disable)
|
||||
.formLogin(AbstractHttpConfigurer::disable)
|
||||
.logout(AbstractHttpConfigurer::disable)
|
||||
.sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||
.authorizeHttpRequests(auth -> auth
|
||||
.requestMatchers("/health/**").permitAll()
|
||||
.requestMatchers(
|
||||
"/swagger-ui.html",
|
||||
"/swagger-ui/**",
|
||||
"/v3/api-docs",
|
||||
"/v3/api-docs/**"
|
||||
).permitAll()
|
||||
.requestMatchers(HttpMethod.POST, "/api/v1/users").permitAll()
|
||||
.requestMatchers(HttpMethod.POST, "/api/v1/auth/sessions").permitAll()
|
||||
.requestMatchers("/actuator/health", "/actuator/health/**").permitAll()
|
||||
.anyRequest().authenticated())
|
||||
.addFilterBefore(sessionFilter, UsernamePasswordAuthenticationFilter.class)
|
||||
.exceptionHandling(eh -> eh.authenticationEntryPoint(entryPoint));
|
||||
|
||||
return http.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public BearerTokenResolver bearerTokenResolver() {
|
||||
return new DefaultBearerTokenResolver();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package ru.mtusi.messenger.config.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "app.limits")
|
||||
public record AppProperties(
|
||||
int maxMessagesPerChat
|
||||
) {}
|
||||
@@ -0,0 +1,10 @@
|
||||
package ru.mtusi.messenger.config.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "app.idempotency")
|
||||
public record IdempotencyProperties(
|
||||
int keyMaxLength,
|
||||
String keyPattern,
|
||||
int retentionHours
|
||||
) {}
|
||||
@@ -0,0 +1,7 @@
|
||||
package ru.mtusi.messenger.config.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "app.instance")
|
||||
public record InstanceProperties(String id) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ru.mtusi.messenger.config.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "app.rate")
|
||||
public record RateLimitProperties(int ratePerMinute, int retryAfterSeconds) {}
|
||||
@@ -0,0 +1,16 @@
|
||||
package ru.mtusi.messenger.config.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import java.time.Duration;
|
||||
|
||||
@ConfigurationProperties(prefix = "app.redis")
|
||||
public record RedisProperties(
|
||||
String host,
|
||||
int port,
|
||||
Duration commandTimeout,
|
||||
Duration connectTimeout,
|
||||
Duration shutdownTimeout,
|
||||
Duration keepAliveIdle,
|
||||
Duration keepAliveInterval,
|
||||
Duration tcpUserTimeout
|
||||
) {}
|
||||
@@ -0,0 +1,10 @@
|
||||
package ru.mtusi.messenger.config.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@ConfigurationProperties(prefix = "app.session")
|
||||
public record SessionProperties(
|
||||
Duration ttl
|
||||
) {}
|
||||
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.10.0).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import ru.mtusi.messenger.dto.SessionDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Generated;
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.10.0")
|
||||
@Validated
|
||||
@Tag(name = "Auth", description = "Аутентификация: вход по Basic и выдача/отзыв сессионного Bearer-токена.")
|
||||
@RequestMapping("${openapi.mTUSIMessenger2.base-path:}")
|
||||
public interface AuthApi {
|
||||
|
||||
/**
|
||||
* POST /api/v1/auth/sessions : Вход: Basic username:password; выдаёт сессию
|
||||
*
|
||||
* @return Успех (status code 201)
|
||||
* or Неверный запрос (status code 400)
|
||||
* or Нет действительной аутентификации (status code 401)
|
||||
* or Ограничение частоты запросов (status code 429)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "createSession",
|
||||
summary = "Вход: Basic username:password; выдаёт сессию",
|
||||
tags = { "Auth" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "201", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = SessionDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "basicAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.POST,
|
||||
value = "/api/v1/auth/sessions",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<SessionDTO> createSession(
|
||||
HttpServletRequest request
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* DELETE /api/v1/auth/sessions/current : Отозвать текущую сессию
|
||||
*
|
||||
* @return Успех (status code 204)
|
||||
* or Нет действительной аутентификации (status code 401)
|
||||
* or Ограничение частоты запросов (status code 429)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "revokeSession",
|
||||
summary = "Отозвать текущую сессию",
|
||||
tags = { "Auth" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "204", description = "Успех"),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "bearerAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.DELETE,
|
||||
value = "/api/v1/auth/sessions/current",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<Void> revokeSession(
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.mtusi.messenger.dto.SessionDTO;
|
||||
import ru.mtusi.messenger.service.AuthService;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class AuthController implements AuthApi {
|
||||
private final AuthService authService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<SessionDTO> createSession(HttpServletRequest request) {
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(authService.login(request.getHeader(HttpHeaders.AUTHORIZATION), request.getContentLengthLong()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> revokeSession() {
|
||||
authService.logout();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.mtusi.messenger.dto.ChatDTO;
|
||||
import ru.mtusi.messenger.dto.ChatPageDTO;
|
||||
import ru.mtusi.messenger.dto.CreateChatDTO;
|
||||
import ru.mtusi.messenger.security.SessionPrincipal;
|
||||
import ru.mtusi.messenger.service.ChatService;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class ChatController implements ChatsApi {
|
||||
private final ChatService chatService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<ChatDTO> createChat(CreateChatDTO createChatDTO, @AuthenticationPrincipal SessionPrincipal principal) {
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(chatService.createChat(principal.userId(), createChatDTO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<ChatDTO> getChat(UUID chatId , @AuthenticationPrincipal SessionPrincipal principal) {
|
||||
return ResponseEntity.ok(chatService.getChatDTO(principal.userId(), chatId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<ChatPageDTO> listChats(Integer limit, String cursor , @AuthenticationPrincipal SessionPrincipal principal) {
|
||||
return ResponseEntity.ok(chatService.listChats(principal.userId(), limit, cursor));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.10.0).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import ru.mtusi.messenger.dto.ChatDTO;
|
||||
import ru.mtusi.messenger.dto.ChatPageDTO;
|
||||
import ru.mtusi.messenger.dto.CreateChatDTO;
|
||||
import ru.mtusi.messenger.dto.ErrorDTO;
|
||||
import java.util.UUID;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.annotation.Generated;
|
||||
import ru.mtusi.messenger.security.SessionPrincipal;
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.10.0")
|
||||
@Validated
|
||||
@Tag(name = "Chats", description = "Управление чатами и доступ к чатам текущего пользователя.")
|
||||
@RequestMapping("${openapi.mTUSIMessenger2.base-path:}")
|
||||
public interface ChatsApi {
|
||||
|
||||
/**
|
||||
* POST /api/v1/chats : Создать чат; вызывающий должен входить в member_ids
|
||||
*
|
||||
* @param createChatDTO (required)
|
||||
* @return Успех (status code 201)
|
||||
* or Неверный запрос (status code 400)
|
||||
* or Нет действительной аутентификации (status code 401)
|
||||
* or Объект отсутствует или недоступен (status code 404)
|
||||
* or Конфликт (status code 409)
|
||||
* or Ограничение частоты запросов (status code 429)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "createChat",
|
||||
summary = "Создать чат; вызывающий должен входить в member_ids",
|
||||
tags = { "Chats" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "201", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ChatDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "404", description = "Объект отсутствует или недоступен", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "409", description = "Конфликт", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "bearerAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.POST,
|
||||
value = "/api/v1/chats",
|
||||
produces = { "application/json" },
|
||||
consumes = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<ChatDTO> createChat(
|
||||
@Parameter(name = "CreateChatDTO", description = "", required = true) @Valid @RequestBody CreateChatDTO createChatDTO, @AuthenticationPrincipal SessionPrincipal principal
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* GET /api/v1/chats/{chat_id} : Получить доступный чат
|
||||
*
|
||||
* @param chatId (required)
|
||||
* @return Успех (status code 200)
|
||||
* or Неверный запрос (status code 400)
|
||||
* or Нет действительной аутентификации (status code 401)
|
||||
* or Объект отсутствует или недоступен (status code 404)
|
||||
* or Конфликт (status code 409)
|
||||
* or Ограничение частоты запросов (status code 429)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "getChatDTO",
|
||||
summary = "Получить доступный чат",
|
||||
tags = { "Chats" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ChatDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "404", description = "Объект отсутствует или недоступен", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "409", description = "Конфликт", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "bearerAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.GET,
|
||||
value = "/api/v1/chats/{chat_id}",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<ChatDTO> getChat(
|
||||
@Parameter(name = "chat_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("chat_id") UUID chatId,
|
||||
@AuthenticationPrincipal SessionPrincipal principal
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* GET /api/v1/chats : Чаты текущего пользователя
|
||||
*
|
||||
* @param limit (optional, default to 50)
|
||||
* @param cursor (optional)
|
||||
* @return Успех (status code 200)
|
||||
* or Неверный запрос (status code 400)
|
||||
* or Нет действительной аутентификации (status code 401)
|
||||
* or Объект отсутствует или недоступен (status code 404)
|
||||
* or Конфликт (status code 409)
|
||||
* or Ограничение частоты запросов (status code 429)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "listChats",
|
||||
summary = "Чаты текущего пользователя",
|
||||
tags = { "Chats" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ChatPageDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "404", description = "Объект отсутствует или недоступен", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "409", description = "Конфликт", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "bearerAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.GET,
|
||||
value = "/api/v1/chats",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<ChatPageDTO> listChats(
|
||||
@Min(1) @Max(100) @Parameter(name = "limit", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false, defaultValue = "50") Integer limit,
|
||||
@Size(min = 1) @Parameter(name = "cursor", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "cursor", required = false) String cursor,
|
||||
@AuthenticationPrincipal SessionPrincipal principal
|
||||
);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.10.0).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Generated;
|
||||
import ru.mtusi.messenger.dto.HealthDTO;
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.10.0")
|
||||
@Validated
|
||||
@Tag(name = "Health", description = "Проверки живости и готовности процесса. Публичные, без аутентификации.")
|
||||
@RequestMapping("${openapi.mTUSIMessenger2.base-path:}")
|
||||
public interface HealthApi {
|
||||
|
||||
/**
|
||||
* GET /health/live : Процесс жив
|
||||
*
|
||||
* @return Успех (status code 200)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "liveness",
|
||||
summary = "Процесс жив",
|
||||
tags = { "Health" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = HealthDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
})
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.GET,
|
||||
value = "/health/live",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<HealthDTO> liveness(
|
||||
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* GET /health/ready : Готов принимать трафик
|
||||
*
|
||||
* @return Успех (status code 200)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "readiness",
|
||||
summary = "Готов принимать трафик",
|
||||
tags = { "Health" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = HealthDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = Error.class))
|
||||
})
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.GET,
|
||||
value = "/health/ready",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<HealthDTO> readiness(
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.mtusi.messenger.dto.HealthDTO;
|
||||
import ru.mtusi.messenger.service.HealthService;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class HealthController implements HealthApi {
|
||||
private final HealthService healthService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<HealthDTO> liveness() {
|
||||
return ResponseEntity.ok(healthService.liveness());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<HealthDTO> readiness() {
|
||||
return ResponseEntity.ok(healthService.readiness());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.mtusi.messenger.dto.CreateMessageDTO;
|
||||
import ru.mtusi.messenger.dto.MessageDTO;
|
||||
import ru.mtusi.messenger.dto.MessagePageDTO;
|
||||
import ru.mtusi.messenger.security.SessionPrincipal;
|
||||
import ru.mtusi.messenger.service.MessageService;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class MessageController implements MessagesApi {
|
||||
private final MessageService messageService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MessageDTO> createMessage(UUID chatId, String idempotencyKey, CreateMessageDTO createMessageDTO, @AuthenticationPrincipal SessionPrincipal principal) {
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(messageService.createMessage(principal.userId(), chatId, createMessageDTO, idempotencyKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MessagePageDTO> listMessages(UUID chatId, Integer limit, String cursor, @AuthenticationPrincipal SessionPrincipal principal) {
|
||||
return ResponseEntity.ok(messageService.listMessages(principal.userId(), chatId, limit, cursor));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.10.0).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import ru.mtusi.messenger.dto.CreateMessageDTO;
|
||||
import ru.mtusi.messenger.dto.MessageDTO;
|
||||
import ru.mtusi.messenger.dto.ErrorDTO;
|
||||
import ru.mtusi.messenger.dto.MessagePageDTO;
|
||||
import ru.mtusi.messenger.security.SessionPrincipal;
|
||||
import java.util.UUID;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.annotation.Generated;
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.10.0")
|
||||
@Validated
|
||||
@Tag(name = "Messages", description = "Отправка и чтение сообщений внутри доступного чата.")
|
||||
@RequestMapping("${openapi.mTUSIMessenger2.base-path:}")
|
||||
public interface MessagesApi {
|
||||
|
||||
@Operation(
|
||||
operationId = "createMessage",
|
||||
summary = "Отправить сообщение",
|
||||
tags = { "Messages" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "201", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = MessageDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "404", description = "Объект отсутствует или недоступен", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "409", description = "Конфликт", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "bearerAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.POST,
|
||||
value = "/api/v1/chats/{chat_id}/messages",
|
||||
produces = { "application/json" },
|
||||
consumes = { "application/json" }
|
||||
)
|
||||
ResponseEntity<MessageDTO> createMessage(
|
||||
@Parameter(name = "chat_id", description = "", required = true, in = ParameterIn.PATH)
|
||||
@PathVariable("chat_id") UUID chatId,
|
||||
@Parameter(name = "Idempotency-Key", required = true, in = ParameterIn.HEADER)
|
||||
@RequestHeader(value = "Idempotency-Key", required = true) String idempotencyKey,
|
||||
@Parameter(name = "CreateMessageDTO", description = "", required = true)
|
||||
@Valid @RequestBody CreateMessageDTO createMessageDTO,
|
||||
@AuthenticationPrincipal SessionPrincipal principal
|
||||
);
|
||||
|
||||
@Operation(
|
||||
operationId = "listMessages",
|
||||
summary = "Сообщения по (created_at, id) по возрастанию",
|
||||
tags = { "Messages" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = MessagePageDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "404", description = "Объект отсутствует или недоступен", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "409", description = "Конфликт", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "bearerAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.GET,
|
||||
value = "/api/v1/chats/{chat_id}/messages",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
ResponseEntity<MessagePageDTO> listMessages(
|
||||
@Parameter(name = "chat_id", description = "", required = true, in = ParameterIn.PATH)
|
||||
@PathVariable("chat_id") UUID chatId,
|
||||
@Min(1) @Max(100)
|
||||
@Parameter(name = "limit", description = "", in = ParameterIn.QUERY)
|
||||
@Valid @RequestParam(value = "limit", required = false, defaultValue = "50") Integer limit,
|
||||
@Size(min = 1)
|
||||
@Parameter(name = "cursor", description = "", in = ParameterIn.QUERY)
|
||||
@Valid @RequestParam(value = "cursor", required = false) String cursor,
|
||||
@AuthenticationPrincipal SessionPrincipal principal
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.mtusi.messenger.dto.CreateUserDTO;
|
||||
import ru.mtusi.messenger.dto.UserDTO;
|
||||
import ru.mtusi.messenger.security.SessionPrincipal;
|
||||
import ru.mtusi.messenger.service.UserService;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class UserController implements UsersApi {
|
||||
private final UserService userService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<UserDTO> currentUser(@AuthenticationPrincipal SessionPrincipal principal) {
|
||||
return ResponseEntity.ok(userService.currentUser(principal.userId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<UserDTO> registerUser(CreateUserDTO createUserDTO) {
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(userService.registerUser(createUserDTO));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.10.0).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import ru.mtusi.messenger.dto.CreateUserDTO;
|
||||
import ru.mtusi.messenger.dto.ErrorDTO;
|
||||
import ru.mtusi.messenger.dto.UserDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.annotation.Generated;
|
||||
import ru.mtusi.messenger.security.SessionPrincipal;
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.10.0")
|
||||
@Validated
|
||||
@Tag(name = "Users", description = "Регистрация пользователей и доступ к профилю текущего пользователя.")
|
||||
@RequestMapping("${openapi.mTUSIMessenger2.base-path:}")
|
||||
public interface UsersApi {
|
||||
|
||||
/**
|
||||
* GET /api/v1/users/me : Текущий пользователь
|
||||
*
|
||||
* @return Успех (status code 200)
|
||||
* or Неверный запрос (status code 400)
|
||||
* or Нет действительной аутентификации (status code 401)
|
||||
* or Объект отсутствует или недоступен (status code 404)
|
||||
* or Конфликт (status code 409)
|
||||
* or Ограничение частоты запросов (status code 429)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "currentUser",
|
||||
summary = "Текущий пользователь",
|
||||
tags = { "Users" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = UserDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "404", description = "Объект отсутствует или недоступен", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "409", description = "Конфликт", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "bearerAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.GET,
|
||||
value = "/api/v1/users/me",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<UserDTO> currentUser(
|
||||
@AuthenticationPrincipal SessionPrincipal principal
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* POST /api/v1/users : Создать пользователя
|
||||
*
|
||||
* @param createUserDTO (required)
|
||||
* @return Успех (status code 201)
|
||||
* or Неверный запрос (status code 400)
|
||||
* or Конфликт (status code 409)
|
||||
* or Ограничение частоты запросов (status code 429)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "registerUser",
|
||||
summary = "Создать пользователя",
|
||||
tags = { "Users" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "201", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = UserDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "409", description = "Конфликт", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
})
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.POST,
|
||||
value = "/api/v1/users",
|
||||
produces = { "application/json" },
|
||||
consumes = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<UserDTO> registerUser(
|
||||
@Parameter(name = "CreateUserDTO", description = "", required = true) @Valid @RequestBody CreateUserDTO createUserDTO
|
||||
);
|
||||
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
package ru.mtusi.messenger.controller.controllerAdvice;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.transaction.CannotCreateTransactionException;
|
||||
import org.springframework.web.HttpMediaTypeNotSupportedException;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.MissingRequestHeaderException;
|
||||
import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.method.annotation.HandlerMethodValidationException;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
import ru.mtusi.messenger.config.properties.RateLimitProperties;
|
||||
import ru.mtusi.messenger.dto.ErrorDTO;
|
||||
import ru.mtusi.messenger.dto.ErrorErrorDTO;
|
||||
import ru.mtusi.messenger.exception.*;
|
||||
|
||||
@RestControllerAdvice
|
||||
@RequiredArgsConstructor
|
||||
public class GlobalExceptionHandler {
|
||||
private final RateLimitProperties limitProperties;
|
||||
private final ApiErrorFactory errors;
|
||||
|
||||
@ExceptionHandler(InvalidRequestException.class)
|
||||
public ResponseEntity<ErrorDTO> invalidRequest(InvalidRequestException e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.BAD_REQUEST, ErrorErrorDTO.CodeEnum.INVALID_REQUEST, e.getMessage(), req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(UnauthorizedException.class)
|
||||
public ResponseEntity<ErrorDTO> unauthorized(UnauthorizedException e, HttpServletRequest req) {
|
||||
boolean isLogin = "/api/v1/auth/sessions".equals(req.getRequestURI());
|
||||
String challenge = isLogin
|
||||
? "Basic realm=\"messenger\", charset=\"UTF-8\""
|
||||
: "Bearer realm=\"messenger\"";
|
||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED)
|
||||
.header("WWW-Authenticate", challenge)
|
||||
.body(errors.error(ErrorErrorDTO.CodeEnum.UNAUTHORIZED, e.getMessage(), req));
|
||||
}
|
||||
|
||||
@ExceptionHandler(NotFoundException.class)
|
||||
public ResponseEntity<ErrorDTO> notFound(NotFoundException e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.NOT_FOUND, ErrorErrorDTO.CodeEnum.NOT_FOUND, e.getMessage(), req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(ConflictException.class)
|
||||
public ResponseEntity<ErrorDTO> conflict(ConflictException e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.CONFLICT, ErrorErrorDTO.CodeEnum.CONFLICT, e.getMessage(), req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(PayloadTooLargeException.class)
|
||||
public ResponseEntity<ErrorDTO> payloadTooLarge(PayloadTooLargeException e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.PAYLOAD_TOO_LARGE, ErrorErrorDTO.CodeEnum.PAYLOAD_TOO_LARGE, e.getMessage(), req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
public ResponseEntity<ErrorDTO> validation(MethodArgumentNotValidException e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.BAD_REQUEST, ErrorErrorDTO.CodeEnum.INVALID_REQUEST, "Validation failed", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||
public ResponseEntity<ErrorDTO> unreadable(Exception e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.BAD_REQUEST, ErrorErrorDTO.CodeEnum.INVALID_REQUEST, "Malformed request body", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(MissingServletRequestParameterException.class)
|
||||
public ResponseEntity<ErrorDTO> missingParam(Exception e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.BAD_REQUEST, ErrorErrorDTO.CodeEnum.INVALID_REQUEST, "Missing parameter", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
|
||||
public ResponseEntity<ErrorDTO> typeMismatch(Exception e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.BAD_REQUEST, ErrorErrorDTO.CodeEnum.INVALID_REQUEST, "Invalid parameter type", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(HttpMediaTypeNotSupportedException.class)
|
||||
public ResponseEntity<ErrorDTO> mediaType(Exception e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.UNSUPPORTED_MEDIA_TYPE, ErrorErrorDTO.CodeEnum.UNSUPPORTED_MEDIA_TYPE,
|
||||
"Unsupported media type", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(HandlerMethodValidationException.class)
|
||||
public ResponseEntity<ErrorDTO> methodValidation(Exception e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.BAD_REQUEST, ErrorErrorDTO.CodeEnum.INVALID_REQUEST,
|
||||
"Validation failed", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
public ResponseEntity<ErrorDTO> methodNotAllowed(Exception e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.METHOD_NOT_ALLOWED, ErrorErrorDTO.CodeEnum.INVALID_REQUEST,
|
||||
"Method not allowed", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(RateLimitedException.class)
|
||||
public ResponseEntity<ErrorDTO> rateLimited(RateLimitedException e, HttpServletRequest req) {
|
||||
return ResponseEntity.status(HttpStatus.TOO_MANY_REQUESTS)
|
||||
.header("Retry-After", String.valueOf(limitProperties.retryAfterSeconds()))
|
||||
.body(errors.error(ErrorErrorDTO.CodeEnum.RATE_LIMITED, e.getMessage(), req));
|
||||
}
|
||||
|
||||
@ExceptionHandler(ConstraintViolationException.class)
|
||||
public ResponseEntity<ErrorDTO> constraint(ConstraintViolationException e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.BAD_REQUEST, ErrorErrorDTO.CodeEnum.INVALID_REQUEST,
|
||||
"Validation failed", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<ErrorDTO> fallback(Exception e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.INTERNAL_SERVER_ERROR, ErrorErrorDTO.CodeEnum.INTERNAL_ERROR,
|
||||
"Internal error", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(ServiceUnavailableException.class)
|
||||
public ResponseEntity<ErrorDTO> serviceUnavailable(ServiceUnavailableException e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.SERVICE_UNAVAILABLE,
|
||||
ErrorErrorDTO.CodeEnum.UNAVAILABLE,
|
||||
e.getMessage(), req);
|
||||
}
|
||||
|
||||
@ExceptionHandler({
|
||||
CannotCreateTransactionException.class,
|
||||
DataAccessResourceFailureException.class
|
||||
})
|
||||
public ResponseEntity<ErrorDTO> dependencyUnavailable(Exception e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.SERVICE_UNAVAILABLE,
|
||||
ErrorErrorDTO.CodeEnum.UNAVAILABLE,
|
||||
"Dependency unavailable", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(DataAccessException.class)
|
||||
public ResponseEntity<ErrorDTO> dataAccess(DataAccessException e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
ErrorErrorDTO.CodeEnum.INTERNAL_ERROR,
|
||||
"Database error", req);
|
||||
}
|
||||
|
||||
@ExceptionHandler(MissingRequestHeaderException.class)
|
||||
public ResponseEntity<ErrorDTO> missingHeader(MissingRequestHeaderException e, HttpServletRequest req) {
|
||||
return respond(HttpStatus.BAD_REQUEST, ErrorErrorDTO.CodeEnum.INVALID_REQUEST,
|
||||
"Missing header: " + e.getHeaderName(), req);
|
||||
}
|
||||
|
||||
private ResponseEntity<ErrorDTO> respond(HttpStatus status,
|
||||
ErrorErrorDTO.CodeEnum code,
|
||||
String message,
|
||||
HttpServletRequest req) {
|
||||
return ResponseEntity.status(status).body(errors.error(code, message, req));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.time.Instant;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.UUID;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.annotation.Generated;
|
||||
import org.hibernate.validator.constraints.CodePointLength;
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.10.0")
|
||||
public class ChatDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String title;
|
||||
|
||||
@Valid
|
||||
private List<UUID> memberIds = new ArrayList<>();
|
||||
|
||||
private Instant createdAt;
|
||||
|
||||
public ChatDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public ChatDTO(String title, List<UUID> memberIds) {
|
||||
this.title = title;
|
||||
this.memberIds = memberIds;
|
||||
}
|
||||
|
||||
public ChatDTO id(UUID id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Valid
|
||||
@Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("id")
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ChatDTO title(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@CodePointLength(min = 1, max = 100)
|
||||
@Schema(name = "title", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("title")
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public ChatDTO memberIds(List<UUID> memberIds) {
|
||||
this.memberIds = memberIds;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChatDTO addMemberIdsItem(UUID memberIdsItem) {
|
||||
if (this.memberIds == null) {
|
||||
this.memberIds = new ArrayList<>();
|
||||
}
|
||||
this.memberIds.add(memberIdsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull @Valid @Size(min = 1, max = 100)
|
||||
@Schema(name = "member_ids", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("member_ids")
|
||||
public List<UUID> getMemberIds() {
|
||||
return memberIds;
|
||||
}
|
||||
|
||||
public void setMemberIds(List<UUID> memberIds) {
|
||||
this.memberIds = memberIds;
|
||||
}
|
||||
|
||||
public ChatDTO createdAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Schema(name = "created_at", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("created_at")
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ChatDTO createChat = (ChatDTO) o;
|
||||
return Objects.equals(this.id, createChat.id) &&
|
||||
Objects.equals(this.title, createChat.title) &&
|
||||
Objects.equals(this.memberIds, createChat.memberIds) &&
|
||||
Objects.equals(this.createdAt, createChat.createdAt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, title, memberIds, createdAt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ChatDTO {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" title: ").append(toIndentedString(title)).append("\n");
|
||||
sb.append(" memberIds: ").append(toIndentedString(memberIds)).append("\n");
|
||||
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* ChatPageDTO
|
||||
*/
|
||||
|
||||
public class ChatPageDTO {
|
||||
|
||||
@Valid
|
||||
private List<@Valid ChatDTO> items = new ArrayList<>();
|
||||
|
||||
private String nextCursor = null;
|
||||
|
||||
public ChatPageDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public ChatPageDTO(List<@Valid ChatDTO> items, String nextCursor) {
|
||||
this.items = items;
|
||||
this.nextCursor = nextCursor;
|
||||
}
|
||||
|
||||
public ChatPageDTO items(List<@Valid ChatDTO> items) {
|
||||
this.items = items;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChatPageDTO addItemsItem(ChatDTO itemsItem) {
|
||||
if (this.items == null) {
|
||||
this.items = new ArrayList<>();
|
||||
}
|
||||
this.items.add(itemsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get items
|
||||
* @return items
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "items", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("items")
|
||||
public List<@Valid ChatDTO> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<@Valid ChatDTO> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public ChatPageDTO nextCursor(String nextCursor) {
|
||||
this.nextCursor = nextCursor;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nextCursor
|
||||
* @return nextCursor
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.ALWAYS)
|
||||
@Schema(name = "next_cursor", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("next_cursor")
|
||||
public String getNextCursor() {
|
||||
return nextCursor;
|
||||
}
|
||||
|
||||
public void setNextCursor(String nextCursor) {
|
||||
this.nextCursor = nextCursor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ChatPageDTO chatPageDTO = (ChatPageDTO) o;
|
||||
return Objects.equals(this.items, chatPageDTO.items) &&
|
||||
Objects.equals(this.nextCursor, chatPageDTO.nextCursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(items, nextCursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ChatPageDTO {\n");
|
||||
sb.append(" items: ").append(toIndentedString(items)).append("\n");
|
||||
sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Generated;
|
||||
import org.hibernate.validator.constraints.CodePointLength;
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.10.0")
|
||||
public class CreateChatDTO {
|
||||
|
||||
private String title;
|
||||
|
||||
@Valid
|
||||
private List<UUID> memberIds = new ArrayList<>();
|
||||
|
||||
public CreateChatDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CreateChatDTO(String title, List<UUID> memberIds) {
|
||||
this.title = title;
|
||||
this.memberIds = memberIds;
|
||||
}
|
||||
|
||||
public CreateChatDTO title(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@CodePointLength(min = 1, max = 100)
|
||||
@Schema(name = "title", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("title")
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public CreateChatDTO memberIds(List<UUID> memberIds) {
|
||||
this.memberIds = memberIds;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CreateChatDTO addMemberIdsItem(UUID memberIdsItem) {
|
||||
if (this.memberIds == null) {
|
||||
this.memberIds = new ArrayList<>();
|
||||
}
|
||||
this.memberIds.add(memberIdsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Valid
|
||||
@Size(min = 1, max = 100)
|
||||
@Schema(name = "member_ids", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("member_ids")
|
||||
public List<UUID> getMemberIds() {
|
||||
return memberIds;
|
||||
}
|
||||
|
||||
public void setMemberIds(List<UUID> memberIds) {
|
||||
this.memberIds = memberIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
CreateChatDTO that = (CreateChatDTO) o;
|
||||
return Objects.equals(title, that.title) && Objects.equals(memberIds, that.memberIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(title, memberIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class CreateChatDTO {\n");
|
||||
sb.append(" title: ").append(toIndentedString(title)).append("\n");
|
||||
sb.append(" memberIds: ").append(toIndentedString(memberIds)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) return "null";
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import org.hibernate.validator.constraints.CodePointLength;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Schema(name = "CreateMessage")
|
||||
public class CreateMessageDTO {
|
||||
|
||||
private String text;
|
||||
|
||||
public CreateMessageDTO() {}
|
||||
|
||||
public CreateMessageDTO text(String text) {
|
||||
this.text = text;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@CodePointLength(min = 1, max = 4000)
|
||||
@Schema(name = "text", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("text")
|
||||
public String getText() { return text; }
|
||||
|
||||
public void setText(String text) { this.text = text; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof CreateMessageDTO d)) return false;
|
||||
return Objects.equals(text, d.text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() { return Objects.hash(text); }
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Generated;
|
||||
import org.hibernate.validator.constraints.CodePointLength;
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.10.0")
|
||||
public class CreateUserDTO {
|
||||
|
||||
private String username;
|
||||
|
||||
private String displayName;
|
||||
|
||||
private String password;
|
||||
|
||||
public CreateUserDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CreateUserDTO(String username, String displayName, String password) {
|
||||
this.username = username;
|
||||
this.displayName = displayName;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public CreateUserDTO username(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Pattern(regexp = "^[a-z0-9_]{3,32}$")
|
||||
@Schema(name = "username", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("username")
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public CreateUserDTO displayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@CodePointLength(min = 1, max = 100)
|
||||
@Schema(name = "display_name", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("display_name")
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public CreateUserDTO password(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@CodePointLength(min = 12, max = 128)
|
||||
@Schema(name = "password", requiredMode = Schema.RequiredMode.REQUIRED, accessMode = Schema.AccessMode.WRITE_ONLY)
|
||||
@JsonProperty(value = "password", access = JsonProperty.Access.WRITE_ONLY)
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
CreateUserDTO createUser = (CreateUserDTO) o;
|
||||
return Objects.equals(this.username, createUser.username) &&
|
||||
Objects.equals(this.displayName, createUser.displayName) &&
|
||||
Objects.equals(this.password, createUser.password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(username, displayName, password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class CreateUserDTO {\n");
|
||||
sb.append(" username: ").append(toIndentedString(username)).append("\n");
|
||||
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
|
||||
sb.append(" password: ").append(password != null ? "***" : "null").append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) return "null";
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import ru.mtusi.messenger.dto.ErrorErrorDTO;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* ErrorDTO
|
||||
*/
|
||||
|
||||
public class ErrorDTO {
|
||||
|
||||
private ErrorErrorDTO error;
|
||||
|
||||
public ErrorDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public ErrorDTO(ErrorErrorDTO error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public ErrorDTO error(ErrorErrorDTO error) {
|
||||
this.error = error;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get error
|
||||
* @return error
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "error", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("error")
|
||||
public ErrorErrorDTO getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(ErrorErrorDTO error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ErrorDTO errorDTO = (ErrorDTO) o;
|
||||
return Objects.equals(this.error, errorDTO.error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ErrorDTO {\n");
|
||||
sb.append(" error: ").append(toIndentedString(error)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* ErrorErrorDTO
|
||||
*/
|
||||
|
||||
public class ErrorErrorDTO {
|
||||
|
||||
/**
|
||||
* Gets or Sets code
|
||||
*/
|
||||
public enum CodeEnum {
|
||||
INVALID_REQUEST("invalid_request"),
|
||||
UNAUTHORIZED("unauthorized"),
|
||||
NOT_FOUND("not_found"),
|
||||
CONFLICT("conflict"),
|
||||
PAYLOAD_TOO_LARGE("payload_too_large"),
|
||||
UNSUPPORTED_MEDIA_TYPE("unsupported_media_type"),
|
||||
RATE_LIMITED("rate_limited"),
|
||||
UNAVAILABLE("unavailable"),
|
||||
INTERNAL_ERROR("internal_error");
|
||||
|
||||
private String value;
|
||||
|
||||
CodeEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static CodeEnum fromValue(String value) {
|
||||
for (CodeEnum b : CodeEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
private CodeEnum code;
|
||||
|
||||
private String message;
|
||||
|
||||
private String requestId;
|
||||
|
||||
public ErrorErrorDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public ErrorErrorDTO(CodeEnum code, String message, String requestId) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
public ErrorErrorDTO code(CodeEnum code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get code
|
||||
* @return code
|
||||
*/
|
||||
@NotNull
|
||||
@Schema(name = "code", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("code")
|
||||
public CodeEnum getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(CodeEnum code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public ErrorErrorDTO message(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get message
|
||||
* @return message
|
||||
*/
|
||||
@NotNull @Size(min = 1)
|
||||
@Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("message")
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ErrorErrorDTO requestId(String requestId) {
|
||||
this.requestId = requestId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get requestId
|
||||
* @return requestId
|
||||
*/
|
||||
@NotNull @Size(min = 1)
|
||||
@Schema(name = "request_id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("request_id")
|
||||
public String getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
|
||||
public void setRequestId(String requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ErrorErrorDTO errorErrorDTO = (ErrorErrorDTO) o;
|
||||
return Objects.equals(this.code, errorErrorDTO.code) &&
|
||||
Objects.equals(this.message, errorErrorDTO.message) &&
|
||||
Objects.equals(this.requestId, errorErrorDTO.requestId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(code, message, requestId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ErrorErrorDTO {\n");
|
||||
sb.append(" code: ").append(toIndentedString(code)).append("\n");
|
||||
sb.append(" message: ").append(toIndentedString(message)).append("\n");
|
||||
sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* HealthDTO
|
||||
*/
|
||||
|
||||
public class HealthDTO {
|
||||
|
||||
/**
|
||||
* Gets or Sets status
|
||||
*/
|
||||
public enum StatusEnum {
|
||||
OK("ok");
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static StatusEnum fromValue(String value) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status;
|
||||
|
||||
public HealthDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public HealthDTO(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public HealthDTO status(StatusEnum status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status
|
||||
* @return status
|
||||
*/
|
||||
@NotNull
|
||||
@Schema(name = "status", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("status")
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
HealthDTO healthDTO = (HealthDTO) o;
|
||||
return Objects.equals(this.status, healthDTO.status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class HealthDTO {\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.hibernate.validator.constraints.CodePointLength;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* MessageDTO
|
||||
*/
|
||||
|
||||
public class MessageDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private UUID chatId;
|
||||
|
||||
private UUID senderId;
|
||||
|
||||
private String text;
|
||||
|
||||
private Instant createdAt;
|
||||
|
||||
public MessageDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public MessageDTO(UUID id, UUID chatId, UUID senderId, String text, Instant createdAt) {
|
||||
this.id = id;
|
||||
this.chatId = chatId;
|
||||
this.senderId = senderId;
|
||||
this.text = text;
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public MessageDTO id(UUID id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("id")
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public MessageDTO chatId(UUID chatId) {
|
||||
this.chatId = chatId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get chatId
|
||||
* @return chatId
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "chat_id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("chat_id")
|
||||
public UUID getChatId() {
|
||||
return chatId;
|
||||
}
|
||||
|
||||
public void setChatId(UUID chatId) {
|
||||
this.chatId = chatId;
|
||||
}
|
||||
|
||||
public MessageDTO senderId(UUID senderId) {
|
||||
this.senderId = senderId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get senderId
|
||||
* @return senderId
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "sender_id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("sender_id")
|
||||
public UUID getSenderId() {
|
||||
return senderId;
|
||||
}
|
||||
|
||||
public void setSenderId(UUID senderId) {
|
||||
this.senderId = senderId;
|
||||
}
|
||||
|
||||
public MessageDTO text(String text) {
|
||||
this.text = text;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
* @return text
|
||||
*/
|
||||
@NotNull
|
||||
@CodePointLength(min = 1, max = 4000)
|
||||
@Schema(name = "text", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("text")
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public MessageDTO createdAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
* @return createdAt
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "created_at", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("created_at")
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
MessageDTO messageDTO = (MessageDTO) o;
|
||||
return Objects.equals(this.id, messageDTO.id) &&
|
||||
Objects.equals(this.chatId, messageDTO.chatId) &&
|
||||
Objects.equals(this.senderId, messageDTO.senderId) &&
|
||||
Objects.equals(this.text, messageDTO.text) &&
|
||||
Objects.equals(this.createdAt, messageDTO.createdAt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, chatId, senderId, text, createdAt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class MessageDTO {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" chatId: ").append(toIndentedString(chatId)).append("\n");
|
||||
sb.append(" senderId: ").append(toIndentedString(senderId)).append("\n");
|
||||
sb.append(" text: ").append(toIndentedString(text)).append("\n");
|
||||
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import ru.mtusi.messenger.dto.MessageDTO;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* MessagePageDTO
|
||||
*/
|
||||
|
||||
public class MessagePageDTO {
|
||||
|
||||
@Valid
|
||||
private List<@Valid MessageDTO> items = new ArrayList<>();
|
||||
|
||||
private String nextCursor = null;
|
||||
|
||||
public MessagePageDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public MessagePageDTO(List<@Valid MessageDTO> items, String nextCursor) {
|
||||
this.items = items;
|
||||
this.nextCursor = nextCursor;
|
||||
}
|
||||
|
||||
public MessagePageDTO items(List<@Valid MessageDTO> items) {
|
||||
this.items = items;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MessagePageDTO addItemsItem(MessageDTO itemsItem) {
|
||||
if (this.items == null) {
|
||||
this.items = new ArrayList<>();
|
||||
}
|
||||
this.items.add(itemsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get items
|
||||
* @return items
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "items", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("items")
|
||||
public List<@Valid MessageDTO> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<@Valid MessageDTO> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public MessagePageDTO nextCursor(String nextCursor) {
|
||||
this.nextCursor = nextCursor;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nextCursor
|
||||
* @return nextCursor
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.ALWAYS)
|
||||
@Schema(name = "next_cursor", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("next_cursor")
|
||||
public String getNextCursor() {
|
||||
return nextCursor;
|
||||
}
|
||||
|
||||
public void setNextCursor(String nextCursor) {
|
||||
this.nextCursor = nextCursor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
MessagePageDTO messagePageDTO = (MessagePageDTO) o;
|
||||
return Objects.equals(this.items, messagePageDTO.items) &&
|
||||
Objects.equals(this.nextCursor, messagePageDTO.nextCursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(items, nextCursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class MessagePageDTO {\n");
|
||||
sb.append(" items: ").append(toIndentedString(items)).append("\n");
|
||||
sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.time.Instant;
|
||||
import ru.mtusi.messenger.dto.UserDTO;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* SessionDTO
|
||||
*/
|
||||
|
||||
public class SessionDTO {
|
||||
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* Gets or Sets tokenType
|
||||
*/
|
||||
public enum TokenTypeEnum {
|
||||
BEARER("Bearer");
|
||||
|
||||
private String value;
|
||||
|
||||
TokenTypeEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static TokenTypeEnum fromValue(String value) {
|
||||
for (TokenTypeEnum b : TokenTypeEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
private TokenTypeEnum tokenType;
|
||||
|
||||
private Instant expiresAt;
|
||||
|
||||
private UserDTO user;
|
||||
|
||||
public SessionDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public SessionDTO(String token, TokenTypeEnum tokenType, Instant expiresAt, UserDTO user) {
|
||||
this.token = token;
|
||||
this.tokenType = tokenType;
|
||||
this.expiresAt = expiresAt;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public SessionDTO token(String token) {
|
||||
this.token = token;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get token
|
||||
* @return token
|
||||
*/
|
||||
@NotNull @Size(min = 32)
|
||||
@Schema(name = "token", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("token")
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public SessionDTO tokenType(TokenTypeEnum tokenType) {
|
||||
this.tokenType = tokenType;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tokenType
|
||||
* @return tokenType
|
||||
*/
|
||||
@NotNull
|
||||
@Schema(name = "token_type", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("token_type")
|
||||
public TokenTypeEnum getTokenType() {
|
||||
return tokenType;
|
||||
}
|
||||
|
||||
public void setTokenType(TokenTypeEnum tokenType) {
|
||||
this.tokenType = tokenType;
|
||||
}
|
||||
|
||||
public SessionDTO expiresAt(Instant expiresAt) {
|
||||
this.expiresAt = expiresAt;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get expiresAt
|
||||
* @return expiresAt
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "expires_at", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("expires_at")
|
||||
public Instant getExpiresAt() {
|
||||
return expiresAt;
|
||||
}
|
||||
|
||||
public void setExpiresAt(Instant expiresAt) {
|
||||
this.expiresAt = expiresAt;
|
||||
}
|
||||
|
||||
public SessionDTO user(UserDTO user) {
|
||||
this.user = user;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user
|
||||
* @return user
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "user", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("user")
|
||||
public UserDTO getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(UserDTO user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
SessionDTO sessionDTO = (SessionDTO) o;
|
||||
return Objects.equals(this.token, sessionDTO.token) &&
|
||||
Objects.equals(this.tokenType, sessionDTO.tokenType) &&
|
||||
Objects.equals(this.expiresAt, sessionDTO.expiresAt) &&
|
||||
Objects.equals(this.user, sessionDTO.user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(token, tokenType, expiresAt, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class SessionDTO {\n");
|
||||
sb.append(" token: ").append(toIndentedString(token)).append("\n");
|
||||
sb.append(" tokenType: ").append(toIndentedString(tokenType)).append("\n");
|
||||
sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n");
|
||||
sb.append(" user: ").append(toIndentedString(user)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.hibernate.validator.constraints.CodePointLength;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* UserDTO
|
||||
*/
|
||||
|
||||
public class UserDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String username;
|
||||
|
||||
private String displayName;
|
||||
|
||||
private Instant createdAt;
|
||||
|
||||
public UserDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public UserDTO(String username, String displayName, String password) {
|
||||
this.username = username;
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public UserDTO username(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Valid
|
||||
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("id")
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UserDTO id(UUID id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get username
|
||||
* @return username
|
||||
*/
|
||||
@NotNull @Pattern(regexp = "^[a-z0-9_]{3,32}$")
|
||||
@Schema(name = "username", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("username")
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public UserDTO displayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get displayName
|
||||
* @return displayName
|
||||
*/
|
||||
@NotNull
|
||||
@CodePointLength(min = 1, max = 100)
|
||||
@Schema(name = "display_name", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("display_name")
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password
|
||||
* @return password
|
||||
*/
|
||||
|
||||
public UserDTO createdAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
* @return createdAt
|
||||
*/
|
||||
@Schema(name = "created_at", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("created_at")
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
UserDTO userDTO = (UserDTO) o;
|
||||
return Objects.equals(this.id, userDTO.id) &&
|
||||
Objects.equals(this.username, userDTO.username) &&
|
||||
Objects.equals(this.displayName, userDTO.displayName) &&
|
||||
Objects.equals(this.createdAt, userDTO.createdAt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, username, displayName, createdAt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class UserDTO {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" username: ").append(toIndentedString(username)).append("\n");
|
||||
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
|
||||
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package ru.mtusi.messenger.exception;
|
||||
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.mtusi.messenger.dto.ErrorDTO;
|
||||
import ru.mtusi.messenger.dto.ErrorErrorDTO;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class ApiErrorFactory {
|
||||
private static final String DEFAULT_MESSAGE = "Error";
|
||||
private static final String REQUEST_ID_ATTR = "requestId";
|
||||
private static final String REQUEST_ID_MDC = "requestId";
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public ErrorDTO error(ErrorErrorDTO.CodeEnum code, String message, HttpServletRequest request) {
|
||||
ErrorErrorDTO inner = new ErrorErrorDTO();
|
||||
inner.setCode(code);
|
||||
inner.setMessage(normalizeMessage(message));
|
||||
inner.setRequestId(resolveRequestId(request));
|
||||
|
||||
ErrorDTO outer = new ErrorDTO();
|
||||
outer.setError(inner);
|
||||
return outer;
|
||||
}
|
||||
|
||||
public void writeError(HttpServletResponse response,
|
||||
HttpServletRequest request,
|
||||
HttpStatus status,
|
||||
String wwwAuthenticate,
|
||||
ErrorErrorDTO.CodeEnum code,
|
||||
String message) throws IOException {
|
||||
String requestId = resolveRequestId(request);
|
||||
response.setStatus(status.value());
|
||||
response.setHeader("X-Request-Id", requestId);
|
||||
if (wwwAuthenticate != null) {
|
||||
response.setHeader(HttpHeaders.WWW_AUTHENTICATE, wwwAuthenticate);
|
||||
}
|
||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||
objectMapper.writeValue(response.getWriter(), error(code, message, request));
|
||||
}
|
||||
|
||||
public String resolveRequestId(HttpServletRequest request) {
|
||||
Object attr = request.getAttribute(REQUEST_ID_ATTR);
|
||||
if (attr instanceof String s && !s.isBlank()) {
|
||||
return s;
|
||||
}
|
||||
String mdc = MDC.get(REQUEST_ID_MDC);
|
||||
if (mdc != null && !mdc.isBlank()) {
|
||||
request.setAttribute(REQUEST_ID_ATTR, mdc);
|
||||
return mdc;
|
||||
}
|
||||
String generated = UUID.randomUUID().toString();
|
||||
request.setAttribute(REQUEST_ID_ATTR, generated);
|
||||
return generated;
|
||||
}
|
||||
|
||||
private String normalizeMessage(String message) {
|
||||
return (message == null || message.isBlank()) ? DEFAULT_MESSAGE : message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package ru.mtusi.messenger.exception;
|
||||
|
||||
public class ConflictException extends RuntimeException {
|
||||
public ConflictException(String message) { super(message); }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package ru.mtusi.messenger.exception;
|
||||
|
||||
public class InvalidRequestException extends RuntimeException {
|
||||
public InvalidRequestException(String message) { super(message); }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package ru.mtusi.messenger.exception;
|
||||
|
||||
public class NotFoundException extends RuntimeException {
|
||||
public NotFoundException(String message) { super(message); }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package ru.mtusi.messenger.exception;
|
||||
|
||||
public class PayloadTooLargeException extends RuntimeException {
|
||||
public PayloadTooLargeException(String message) { super(message); }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package ru.mtusi.messenger.exception;
|
||||
|
||||
public class RateLimitedException extends RuntimeException {
|
||||
public RateLimitedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package ru.mtusi.messenger.exception;
|
||||
|
||||
public class ServiceUnavailableException extends RuntimeException {
|
||||
public ServiceUnavailableException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package ru.mtusi.messenger.exception;
|
||||
|
||||
public class UnauthorizedException extends RuntimeException {
|
||||
public UnauthorizedException(String message) { super(message); }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package ru.mtusi.messenger.filter;
|
||||
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
import ru.mtusi.messenger.config.properties.InstanceProperties;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@RequiredArgsConstructor
|
||||
public class InstanceIdFilter extends OncePerRequestFilter {
|
||||
|
||||
private final InstanceProperties props;
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
FilterChain chain) throws ServletException, IOException {
|
||||
response.setHeader("X-Instance-Id", props.id());
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package ru.mtusi.messenger.filter;
|
||||
|
||||
import io.github.bucket4j.Bucket;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
import ru.mtusi.messenger.config.properties.RateLimitProperties;
|
||||
import ru.mtusi.messenger.dto.ErrorErrorDTO;
|
||||
import ru.mtusi.messenger.exception.ApiErrorFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
@Order(2)
|
||||
@RequiredArgsConstructor
|
||||
public class RateLimitFilter extends OncePerRequestFilter {
|
||||
private final RateLimitProperties limitProperties;
|
||||
private final Bucket bucket;
|
||||
private final ApiErrorFactory errors;
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest req, HttpServletResponse res,
|
||||
FilterChain chain) throws ServletException, IOException {
|
||||
if (!req.getRequestURI().startsWith("/api/")) {
|
||||
chain.doFilter(req, res);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bucket.tryConsume(1)) {
|
||||
chain.doFilter(req, res);
|
||||
return;
|
||||
}
|
||||
|
||||
res.setHeader("Retry-After", String.valueOf(limitProperties.retryAfterSeconds()));
|
||||
errors.writeError(
|
||||
res,
|
||||
req,
|
||||
HttpStatus.TOO_MANY_REQUESTS,
|
||||
null,
|
||||
ErrorErrorDTO.CodeEnum.RATE_LIMITED,
|
||||
"Rate limit exceeded. Try again later.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package ru.mtusi.messenger.filter;
|
||||
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE + 1)
|
||||
public class RequestIdFilter extends OncePerRequestFilter {
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest req, HttpServletResponse res,
|
||||
FilterChain chain) throws ServletException, IOException {
|
||||
String rid = UUID.randomUUID().toString();
|
||||
res.setHeader("X-Request-Id", rid);
|
||||
req.setAttribute("requestId", rid);
|
||||
MDC.put("requestId", rid);
|
||||
try {
|
||||
chain.doFilter(req, res);
|
||||
} finally {
|
||||
MDC.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package ru.mtusi.messenger.mapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Named;
|
||||
import ru.mtusi.messenger.dto.ChatDTO;
|
||||
import ru.mtusi.messenger.dto.CreateChatDTO;
|
||||
import ru.mtusi.messenger.model.Chat;
|
||||
import ru.mtusi.messenger.model.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface ChatMapper {
|
||||
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "createdAt", ignore = true)
|
||||
@Mapping(target = "members", ignore = true)
|
||||
@Mapping(target = "messages", ignore = true)
|
||||
Chat toChat(CreateChatDTO dto);
|
||||
|
||||
@Mapping(target = "memberIds", source = "members", qualifiedByName = "usersToIds")
|
||||
ChatDTO toChatDto(Chat chat);
|
||||
|
||||
@Named("usersToIds")
|
||||
default List<UUID> usersToIds(Set<User> users) {
|
||||
if (users == null) return new ArrayList<>();
|
||||
List<UUID> ids = new ArrayList<>(users.size());
|
||||
for (User u : users) ids.add(u.getId());
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package ru.mtusi.messenger.mapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import ru.mtusi.messenger.dto.CreateMessageDTO;
|
||||
import ru.mtusi.messenger.dto.MessageDTO;
|
||||
import ru.mtusi.messenger.model.Message;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface MessageMapper {
|
||||
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "chat", ignore = true)
|
||||
@Mapping(target = "sender", ignore = true)
|
||||
@Mapping(target = "createdAt", ignore = true)
|
||||
Message toMessage(MessageDTO dto);
|
||||
|
||||
@Mapping(target = "chatId", source = "chat.id")
|
||||
@Mapping(target = "senderId", source = "sender.id")
|
||||
MessageDTO toMessageDTO(Message entity);
|
||||
|
||||
Message toMessage(CreateMessageDTO dto);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package ru.mtusi.messenger.mapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import ru.mtusi.messenger.dto.SessionDTO;
|
||||
import ru.mtusi.messenger.dto.UserDTO;
|
||||
import ru.mtusi.messenger.model.Session;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SessionMapper {
|
||||
|
||||
@Mapping(target = "token", source = "tokenRaw")
|
||||
@Mapping(target = "tokenType", expression = "java(ru.mtusi.messenger.dto.SessionDTO.TokenTypeEnum.BEARER)")
|
||||
@Mapping(target = "expiresAt", source = "session.expiresAt")
|
||||
@Mapping(target = "user", source = "userDTO")
|
||||
SessionDTO toSessionDTO(Session session, String tokenRaw, UserDTO userDTO);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package ru.mtusi.messenger.mapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import ru.mtusi.messenger.dto.CreateUserDTO;
|
||||
import ru.mtusi.messenger.dto.UserDTO;
|
||||
import ru.mtusi.messenger.model.User;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface UserMapper {
|
||||
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "createdAt", ignore = true)
|
||||
@Mapping(target = "passwordHash", ignore = true)
|
||||
@Mapping(target = "chats", ignore = true)
|
||||
@Mapping(target = "messages", ignore = true)
|
||||
User toUser(CreateUserDTO dto);
|
||||
|
||||
UserDTO toUserDto(User user);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package ru.mtusi.messenger.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "chats")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class Chat {
|
||||
|
||||
@Id
|
||||
@Column(nullable = false, updatable = false)
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
@Column(nullable = false, length = 100)
|
||||
private String title;
|
||||
|
||||
@Column(name = "created_at", nullable = false, updatable = false)
|
||||
private Instant createdAt;
|
||||
|
||||
@ManyToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(
|
||||
name = "chat_members",
|
||||
joinColumns = @JoinColumn(name = "chat_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "user_id")
|
||||
)
|
||||
private Set<User> members = new HashSet<>();
|
||||
|
||||
@OneToMany(
|
||||
mappedBy = "chat",
|
||||
fetch = FetchType.LAZY,
|
||||
cascade = CascadeType.ALL,
|
||||
orphanRemoval = true
|
||||
)
|
||||
@OrderBy("createdAt ASC, id ASC")
|
||||
private List<Message> messages = new ArrayList<>();
|
||||
|
||||
@PrePersist
|
||||
private void onCreate() {
|
||||
this.createdAt = Instant.now().truncatedTo(ChronoUnit.MILLIS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package ru.mtusi.messenger.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "idempotency_keys")
|
||||
@Getter
|
||||
@Setter
|
||||
public class IdempotencyKey {
|
||||
|
||||
@Id
|
||||
@Column(nullable = false, updatable = false)
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "user_id", nullable = false)
|
||||
private UUID userId;
|
||||
|
||||
@Column(nullable = false, length = 16)
|
||||
private String method;
|
||||
|
||||
@Column(name = "chat_id", nullable = false)
|
||||
private UUID chatId;
|
||||
|
||||
@Column(name = "idempotency_key", nullable = false, length = 128)
|
||||
private String idempotencyKey;
|
||||
|
||||
@Column(name = "request_hash", nullable = false, length = 64)
|
||||
private String requestHash;
|
||||
|
||||
@Column(name = "status_code")
|
||||
private Short statusCode;
|
||||
|
||||
@JdbcTypeCode(SqlTypes.JSON)
|
||||
@Column(name = "response_body", columnDefinition = "jsonb")
|
||||
private String responseBody;
|
||||
|
||||
@Column(name = "created_at", nullable = false)
|
||||
private Instant createdAt;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package ru.mtusi.messenger.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "messages")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class Message {
|
||||
|
||||
@Id
|
||||
@Column(nullable = false, updatable = false)
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "chat_id", nullable = false)
|
||||
private Chat chat;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "sender_id", nullable = false)
|
||||
private User sender;
|
||||
|
||||
@Column(nullable = false, length = 4000)
|
||||
private String text;
|
||||
|
||||
@Column(name = "created_at", nullable = false, updatable = false)
|
||||
private Instant createdAt;
|
||||
|
||||
@PrePersist
|
||||
private void onCreate() {
|
||||
this.createdAt = Instant.now().truncatedTo(ChronoUnit.MILLIS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package ru.mtusi.messenger.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "sessions")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class Session {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "user_id", nullable = false)
|
||||
private UUID userId;
|
||||
|
||||
@Column(name = "token_hash", nullable = false, unique = true)
|
||||
private byte[] tokenHash;
|
||||
|
||||
@Column(name = "created_at", nullable = false)
|
||||
private Instant createdAt;
|
||||
|
||||
@Column(name = "expires_at", nullable = false)
|
||||
private Instant expiresAt;
|
||||
|
||||
@Column(name = "revoked_at")
|
||||
private Instant revokedAt;
|
||||
|
||||
@PrePersist
|
||||
private void onCreate() {
|
||||
this.createdAt = Instant.now().truncatedTo(ChronoUnit.MILLIS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package ru.mtusi.messenger.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class User{
|
||||
|
||||
@Id()
|
||||
@Column(nullable = false, updatable = false)
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
@Column(nullable = false, unique = true, length = 32)
|
||||
private String username;
|
||||
|
||||
@Column(name = "display_name", nullable = false, length = 100)
|
||||
private String displayName;
|
||||
|
||||
@Column(name = "password_hash", nullable = false, length = 255)
|
||||
private String passwordHash;
|
||||
|
||||
@Column(name = "created_at", nullable = false, updatable = false)
|
||||
private Instant createdAt;
|
||||
|
||||
@ManyToMany(mappedBy = "members", fetch = FetchType.LAZY)
|
||||
private Set<Chat> chats = new HashSet<>();
|
||||
|
||||
@OneToMany(mappedBy = "sender", fetch = FetchType.LAZY)
|
||||
private Set<Message> messages = new HashSet<>();
|
||||
|
||||
@PrePersist
|
||||
private void onCreate() {
|
||||
this.createdAt = Instant.now().truncatedTo(ChronoUnit.MILLIS);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user