scripts/scaling.py applies a replicas x CPU layout through compose variables: workers equal to the replica CPUs, a pool of 8 per worker, a balancer queue of 32 per worker so every layout of a series offers the same concurrency to the API, and the replicas pinned to CPUs 7 and up, next to PostgreSQL on 0-1, the balancer on 2, Valkey on 3 and k6 on 4-6 with 3 CPU and 1 GiB. For every offered rate it runs k6 three times and stops a config after two steps saturated in all repeats. Each step keeps its raw data: k6 summary, docker stats, HAProxy statistics and pg_stat_activity sampled every second, and the top of pg_stat_statements. The summary row carries CPU per component, PostgreSQL active, idle, idle in transaction and lock waiting backends, the balancer queue and the database size. Several variants alternate per repeat for before and after runs. host-snapshot.sh records every container on the host before a series. make track1-a and track1-b run the fixed budget and the growth series from an empty database. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
12 lines
506 B
Bash
Executable File
12 lines
506 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
out=${1:?usage: docker-stats.sh <csv>}
|
|
cd "$(dirname "$0")/.."
|
|
project=$(docker compose config | sed -n 's/^name: //p')
|
|
echo 'ts,name,cpu_pct,mem_usage,mem_pct,net_io,block_io,pids' > "$out"
|
|
while :; do
|
|
ids=$(docker ps -q --filter "label=com.docker.compose.project=$project")
|
|
[ -z "$ids" ] || docker stats --no-stream --format "$(date +%s),{{.Name}},{{.CPUPerc}},{{.MemUsage}},{{.MemPerc}},{{.NetIO}},{{.BlockIO}},{{.PIDs}}" $ids >> "$out" || true
|
|
sleep "${INTERVAL:-1}"
|
|
done
|