forked from mtusi2026/mtusi2026lab3
feat: add new experiment to test GOMAXPROCS and DB CPU limit
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:16.10-bookworm
|
||||
cpus: ${BENCH_DB_CPU:-1}
|
||||
mem_limit: 512m
|
||||
command: [postgres, -c, track_io_timing=on, -c, track_wal_io_timing=on]
|
||||
environment:
|
||||
POSTGRES_DB: benchmark
|
||||
POSTGRES_USER: benchmark
|
||||
POSTGRES_PASSWORD: ${BENCH_PASSWORD:?private environment required}
|
||||
volumes: [bench_db:/var/lib/postgresql/data]
|
||||
networks: [data]
|
||||
healthcheck:
|
||||
test: [CMD-SHELL, 'pg_isready -U benchmark -d benchmark']
|
||||
interval: 1s
|
||||
timeout: 3s
|
||||
retries: 60
|
||||
redis:
|
||||
image: redis:7.4.11-bookworm
|
||||
cpus: 0.25
|
||||
mem_limit: 128m
|
||||
command: [redis-server, --appendonly, 'yes', --appendfsync, everysec, --dir, /data]
|
||||
volumes: [bench_redis:/data]
|
||||
networks: [data]
|
||||
healthcheck:
|
||||
test: [CMD, redis-cli, ping]
|
||||
interval: 1s
|
||||
timeout: 3s
|
||||
retries: 60
|
||||
migrate:
|
||||
image: ${BENCH_IMAGE:?prepared image required}
|
||||
cpus: 0.5
|
||||
mem_limit: 128m
|
||||
networks: [data]
|
||||
environment:
|
||||
DATABASE_URL: postgres://benchmark:${BENCH_PASSWORD}@db:5432/benchmark?sslmode=disable
|
||||
command: [./messenger, migrate, up]
|
||||
depends_on:
|
||||
db: {condition: service_healthy}
|
||||
api:
|
||||
image: ${BENCH_IMAGE:?prepared image required}
|
||||
cpus: ${BENCH_CPU:-0.5}
|
||||
mem_limit: ${BENCH_MEMORY:-128m}
|
||||
deploy:
|
||||
replicas: ${BENCH_REPLICAS:-2}
|
||||
stop_grace_period: 15s
|
||||
networks: [proxy, data]
|
||||
environment:
|
||||
DATABASE_URL: postgres://benchmark:${BENCH_PASSWORD}@db:5432/benchmark?sslmode=disable
|
||||
DATABASE_MAX_CONNS: ${BENCH_POOL:-6}
|
||||
BENCH_POOL_STATS: '1'
|
||||
GOMAXPROCS: ${BENCH_GOMAXPROCS:-16}
|
||||
REDIS_ADDR: redis:6379
|
||||
SESSION_TTL_SECONDS: 86400
|
||||
APP_PORT: 8080
|
||||
APP_HOST: 0.0.0.0
|
||||
healthcheck:
|
||||
test: [CMD, ./messenger, healthcheck]
|
||||
interval: 1s
|
||||
timeout: 3s
|
||||
retries: 60
|
||||
depends_on:
|
||||
migrate: {condition: service_completed_successfully}
|
||||
redis: {condition: service_healthy}
|
||||
haproxy:
|
||||
image: haproxy:3.2.25-alpine
|
||||
cpus: 0.5
|
||||
mem_limit: 128m
|
||||
ports: ['127.0.0.1:18082:8080', '127.0.0.1:18406:8404']
|
||||
networks: [edge, proxy]
|
||||
volumes:
|
||||
- ./experiments/lab3-scale/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||
depends_on:
|
||||
api: {condition: service_healthy}
|
||||
volumes:
|
||||
bench_db:
|
||||
bench_redis:
|
||||
networks:
|
||||
edge:
|
||||
proxy: {internal: true}
|
||||
data: {internal: true}
|
||||
Reference in New Issue
Block a user