Repository navigation
Expand file tree
/
Copy pathdocker-compose.load.yml
More file actions
134 lines (128 loc) · 3.27 KB
/
Copy pathdocker-compose.load.yml
File metadata and controls
134 lines (128 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
services:
postgres:
image: postgres:14-alpine
container_name: synapse-load-postgres
environment:
POSTGRES_USER: synapse
POSTGRES_PASSWORD: synapse
POSTGRES_DB: synapse
ports:
- "5433:5432"
volumes:
- load_postgres_data:/var/lib/postgresql/data
- ./scripts/db-init:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U synapse"]
interval: 5s
timeout: 5s
retries: 5
# Optimize for load testing
command:
- "postgres"
- "-c"
- "max_connections=200"
- "-c"
- "shared_buffers=256MB"
- "-c"
- "effective_cache_size=1GB"
- "-c"
- "maintenance_work_mem=64MB"
- "-c"
- "checkpoint_completion_target=0.9"
- "-c"
- "wal_buffers=16MB"
- "-c"
- "default_statistics_target=100"
- "-c"
- "random_page_cost=1.1"
- "-c"
- "effective_io_concurrency=200"
redis:
image: redis:7-alpine
container_name: synapse-load-redis
ports:
- "6380:6379"
volumes:
- load_redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
# Optimize for load testing
command:
- "redis-server"
- "--maxmemory"
- "512mb"
- "--maxmemory-policy"
- "allkeys-lru"
- "--save"
- "" # Disable persistence for performance
vault:
image: hashicorp/vault:latest
container_name: synapse-load-vault
ports:
- "8201:8200"
environment:
VAULT_DEV_ROOT_TOKEN_ID: "root"
VAULT_DEV_LISTEN_ADDRESS: "0.0.0.0:8200"
cap_add:
- IPC_LOCK
command: server -dev
app:
build: .
container_name: synapse-load-app
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
vault:
condition: service_started
environment:
SERVER_PORT: 3000
# Restricted, non-superuser role — see scripts/db-init/01-create-app-role.sql.
DATABASE_URL: postgres://synapse_app:synapse_app@postgres:5432/synapse
DATABASE_URL_TEMPLATE: postgres://synapse_app:{password}@postgres:5432/synapse
BACKUP_DATABASE_URL: postgres://synapse:synapse@postgres:5432/synapse
STELLAR_HORIZON_URL: https://horizon-testnet.stellar.org
VAULT_ADDR: http://vault:8200
VAULT_ROLE_ID: ""
VAULT_SECRET_ID: ""
REDIS_URL: redis://redis:6379
RUST_LOG: info
DB_MIN_CONNECTIONS: "2"
DB_MAX_CONNECTIONS: "10"
DB_IDLE_TIMEOUT_SECS: "30"
DB_STATEMENT_TIMEOUT_MS: "30000"
DB_LONG_RUNNING_STATEMENT_TIMEOUT_MS: "120000"
ports:
- "3001:3000"
deploy:
resources:
limits:
cpus: '2'
memory: 1G
command: ["/app/synapse-core"]
k6:
image: grafana/k6:latest
container_name: synapse-k6
depends_on:
- app
environment:
BASE_URL: http://app:3000
volumes:
- ./tests/load:/scripts
- ./docs:/results
networks:
- default
profiles:
- load-test
# Run specific test by overriding command
# docker-compose -f docker-compose.load.yml run k6 run /scripts/callback_load.js
volumes:
load_postgres_data:
load_redis_data:
networks:
default:
driver: bridge