feat: plan the experiment

This commit is contained in:
TAskMAster339
2026-10-18 23:14:01 +03:00
parent d7e7ea93f1
commit 989280a763
20 changed files with 3074 additions and 0 deletions
+157
View File
@@ -0,0 +1,157 @@
services:
db:
image: ${DB_IMAGE}
pull_policy: never
cpus: 1
mem_limit: 512m
memswap_limit: 512m
networks: [data]
environment:
POSTGRES_DB: messenger_exp
POSTGRES_USER: messenger_exp
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
volumes:
- postgres_data:/var/lib/postgresql/data
- ${SECRET_DIR}/db_password:/run/secrets/db_password:ro
healthcheck:
test: [CMD-SHELL, pg_isready -U messenger_exp -d messenger_exp]
interval: 2s
timeout: 2s
retries: 30
redis:
image: ${REDIS_IMAGE}
pull_policy: never
cpus: 0.25
mem_limit: 128m
memswap_limit: 128m
networks: [data]
command: [redis-server, --appendonly, "yes", --appendfsync, everysec, --dir, /data]
volumes: [redis_data:/data]
healthcheck:
test: [CMD, redis-cli, ping]
interval: 2s
timeout: 2s
retries: 30
s3:
image: ${S3_IMAGE}
pull_policy: never
cpus: 1
mem_limit: 512m
memswap_limit: 512m
networks: [edge, data]
ports: ["127.0.0.1:${S3_PORT}:9000"]
environment:
MINIO_ROOT_USER_FILE: /run/secrets/root_access
MINIO_ROOT_PASSWORD_FILE: /run/secrets/root_secret
MINIO_BROWSER: "off"
MINIO_API_CORS_ALLOW_ORIGIN: http://127.0.0.1:5173,http://localhost:5173
volumes:
- s3_data:/data
- ${SECRET_DIR}/root_access:/run/secrets/root_access:ro
- ${SECRET_DIR}/root_secret:/run/secrets/root_secret:ro
healthcheck:
test: [CMD, curl, -f, http://127.0.0.1:9000/minio/health/ready]
interval: 2s
timeout: 2s
retries: 30
migrate:
image: ${APP_IMAGE}
pull_policy: never
cpus: 0.5
mem_limit: 128m
networks: [data]
environment:
DATABASE_URL_FILE: /run/secrets/database_url
volumes:
- ${SECRET_DIR}/database_url:/run/secrets/database_url:ro
command: [./messenger, migrate, up]
depends_on:
db: {condition: service_healthy}
s3-bootstrap:
image: ${APP_IMAGE}
pull_policy: never
cpus: 0.5
mem_limit: 128m
networks: [data]
environment:
<<: &s3
S3_ENDPOINT: http://s3:9000
S3_PUBLIC_ENDPOINT: http://127.0.0.1:${S3_PORT}
S3_REGION: us-east-1
S3_BUCKET: messenger-experiment
S3_ACCESS_KEY_ID_FILE: /run/secrets/api_access
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/api_secret
S3_ROOT_ACCESS_KEY_ID_FILE: /run/secrets/root_access
S3_ROOT_SECRET_ACCESS_KEY_FILE: /run/secrets/root_secret
volumes:
- ${SECRET_DIR}/api_access:/run/secrets/api_access:ro
- ${SECRET_DIR}/api_secret:/run/secrets/api_secret:ro
- ${SECRET_DIR}/root_access:/run/secrets/root_access:ro
- ${SECRET_DIR}/root_secret:/run/secrets/root_secret:ro
command: [./messenger, s3-bootstrap]
depends_on:
s3: {condition: service_healthy}
api:
image: ${APP_IMAGE}
pull_policy: never
cpus: 0.5
mem_limit: 512m
memswap_limit: 512m
deploy: {replicas: 2}
networks: [proxy, data]
stop_grace_period: 15s
environment:
<<: *s3
DATABASE_URL_FILE: /run/secrets/database_url
CACHE_URL_FILE: /run/secrets/cache_url
APP_HOST: 0.0.0.0
APP_PORT: "8080"
APP_ENV: experiment
GOMAXPROCS: "1"
GOMEMLIMIT: 384MiB
DATABASE_MAX_CONNS: "10"
SESSION_TTL_SECONDS: "3600"
IDEMPOTENCY_TTL_SECONDS: "86400"
UPLOAD_TMP_DIR: /tmp/uploads
UPLOAD_CLEANUP_GRACE_SECONDS: "600"
volumes:
- ${SECRET_DIR}/api_access:/run/secrets/api_access:ro
- ${SECRET_DIR}/api_secret:/run/secrets/api_secret:ro
- ${SECRET_DIR}/database_url:/run/secrets/database_url:ro
- ${SECRET_DIR}/cache_url:/run/secrets/cache_url:ro
tmpfs: ["/tmp/uploads:rw,noexec,nosuid,size=16m,mode=1777"]
depends_on:
migrate: {condition: service_completed_successfully}
s3-bootstrap: {condition: service_completed_successfully}
redis: {condition: service_healthy}
healthcheck:
test: [CMD, ./messenger, healthcheck]
interval: 2s
timeout: 3s
retries: 30
haproxy:
image: ${HAPROXY_IMAGE}
pull_policy: never
cpus: 0.5
mem_limit: 128m
memswap_limit: 128m
networks: [edge, proxy]
environment: {API_REPLICAS: "2", APP_PORT: "8080"}
ports: ["127.0.0.1:${API_PORT}:8080", "127.0.0.1:${STATS_PORT}:8404"]
volumes:
- ${REPO_ROOT}/infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
depends_on:
api: {condition: service_healthy}
healthcheck:
test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1:8080/health/ready]
interval: 2s
timeout: 3s
retries: 30
volumes:
postgres_data:
redis_data:
s3_data:
networks:
edge:
proxy: {internal: true}
data: {internal: true}
+53
View File
@@ -0,0 +1,53 @@
{
"version": 1,
"name": "proxy-versus-presigned-post",
"purpose": "confirmatory",
"hypothesis": "Presigned POST uses at most 65% of proxy API RX+TX bytes per ready, byte-verified attachment in each profile, without request errors, OOM or API restarts.",
"seed": 20261018,
"repetitions": 3,
"clients": 10,
"waves": 3,
"wave_pause_seconds": 1,
"warmup_clients": 4,
"settle_seconds": 2,
"idle_seconds": 5,
"sample_interval_seconds": 0.1,
"request_timeout_seconds": 35,
"flow_timeout_seconds": 90,
"ports": {"api": 18080, "s3": 19000, "stats": 18404},
"resources": {
"api_replicas": 2,
"api_cpus": 0.5,
"api_memory_bytes": 536870912,
"api_tmpfs_bytes": 16777216,
"api_go_memory_limit": "384MiB",
"api_gomaxprocs": 1,
"database_max_connections_per_replica": 10,
"db_cpus": 1,
"db_memory_bytes": 536870912,
"s3_cpus": 1,
"s3_memory_bytes": 536870912,
"redis_cpus": 0.25,
"redis_memory_bytes": 134217728,
"haproxy_cpus": 0.5,
"haproxy_memory_bytes": 134217728
},
"images": {"db": "postgres:16.10-bookworm", "redis": "redis:7.4.11-bookworm", "haproxy": "haproxy:3.2.25-alpine"},
"profiles": [
{"name": "small-moderate", "size_bytes": 1048576, "width": 1024, "height": 1024},
{"name": "large-moderate", "size_bytes": 10485760, "width": 1024, "height": 1024},
{"name": "small-pixels40m", "size_bytes": 1048576, "width": 8000, "height": 5000},
{"name": "large-pixels40m", "size_bytes": 10485760, "width": 8000, "height": 5000}
],
"criteria": {
"median_direct_proxy_traffic_ratio_max": 0.65,
"each_pair_traffic_ratio_max": 0.70,
"errors_allowed": 0,
"api_peak_strictly_below_bytes": 536870912,
"start_spread_seconds_max": 0.1,
"idle_background_payload_fraction_max": 0.05,
"sampler_coverage_fraction_min": 0.7,
"sampler_gap_seconds_max": 1.0,
"generator_cpu_cores_max": 0.8
}
}