lab3: complete lab with scaling track 1 and failover evidence
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# Функция теста
|
||||
function Test-Scale($replicas, $cpu_limit) {
|
||||
Write-Host "`n--- Тестируем $replicas реплик (CPU лимит: $cpu_limit) ---" -ForegroundColor Cyan
|
||||
docker compose down -v
|
||||
# Меняем лимит в compose (через sed или параметр, но проще поправить руками или использовать переменные окружения)
|
||||
# Для простоты: остановим всё и запустим с нужным количеством
|
||||
docker compose up -d --build --scale api=$replicas
|
||||
Start-Sleep -Seconds 8
|
||||
|
||||
# Прогрев
|
||||
python tests/load.py --base-url http://localhost:8080 --duration 5 --concurrency 10 > $null
|
||||
|
||||
# Замер
|
||||
$result = python tests/load.py --base-url http://localhost:8080 --duration 15 --concurrency 20 | ConvertFrom-Json
|
||||
Write-Host "Результат: RPS = $($result.successful_rps), p95 = $($result.successful_latency_ms.p95) ms" -ForegroundColor Green
|
||||
|
||||
# Собираем загрузку БД (опционально)
|
||||
docker stats --no-stream --format "DB CPU: {{.CPUPerc}}" mtusi2026lab3-db-1
|
||||
}
|
||||
|
||||
# Запускаем серию
|
||||
Test-Scale -replicas 1 -cpu_limit 2.0
|
||||
Test-Scale -replicas 2 -cpu_limit 1.0
|
||||
Test-Scale -replicas 4 -cpu_limit 0.5
|
||||
Reference in New Issue
Block a user