-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.benchmark.yml
More file actions
215 lines (206 loc) · 5.46 KB
/
docker-compose.benchmark.yml
File metadata and controls
215 lines (206 loc) · 5.46 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
version: '3.8'
services:
# Express PHP Benchmark Application
app:
build:
context: .
dockerfile: Dockerfile.benchmark
container_name: express-php-benchmark
volumes:
- ./benchmarks:/app/benchmarks
- ./src:/app/src
- benchmark-results:/app/benchmarks/results
environment:
- DB_HOST=mysql
- DB_PORT=3306
- DB_DATABASE=express_benchmark
- DB_USERNAME=benchmark_user
- DB_PASSWORD=benchmark_pass
- REDIS_HOST=redis
- REDIS_PORT=6379
- BENCHMARK_ENV=docker
depends_on:
mysql:
condition: service_healthy
postgres:
condition: service_healthy
mariadb:
condition: service_healthy
redis:
condition: service_healthy
networks:
- benchmark-network
command: >
sh -c "
echo 'Waiting for services to be ready...';
sleep 5;
echo 'Running benchmarks...';
php benchmarks/run_all_benchmarks.php
"
# MySQL Database for benchmarks
mysql:
image: mysql:8.0
container_name: express-php-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: express_benchmark
MYSQL_USER: benchmark_user
MYSQL_PASSWORD: benchmark_pass
ports:
- "3307:3306"
volumes:
- mysql-data:/var/lib/mysql
- ./benchmarks/sql/init-mysql.sql:/docker-entrypoint-initdb.d/01-init.sql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot_password"]
interval: 10s
timeout: 5s
retries: 5
networks:
- benchmark-network
command: >
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
--max_connections=1000
--innodb_buffer_pool_size=1G
--innodb_log_file_size=256M
--innodb_flush_log_at_trx_commit=2
--innodb_flush_method=O_DIRECT
# PostgreSQL Database for benchmarks
postgres:
image: postgres:15-alpine
container_name: express-php-postgres
restart: unless-stopped
environment:
POSTGRES_USER: benchmark_user
POSTGRES_PASSWORD: benchmark_pass
POSTGRES_DB: express_benchmark
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
ports:
- "5433:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
- ./benchmarks/sql/init-postgres.sql:/docker-entrypoint-initdb.d/01-init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U benchmark_user -d express_benchmark"]
interval: 10s
timeout: 5s
retries: 5
networks:
- benchmark-network
command: >
postgres
-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
-c work_mem=4MB
-c min_wal_size=1GB
-c max_wal_size=4GB
-c max_connections=200
# MariaDB Database for benchmarks
mariadb:
image: mariadb:11
container_name: express-php-mariadb
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: root_password
MARIADB_DATABASE: express_benchmark
MARIADB_USER: benchmark_user
MARIADB_PASSWORD: benchmark_pass
ports:
- "3308:3306"
volumes:
- mariadb-data:/var/lib/mysql
- ./benchmarks/sql/init-mariadb.sql:/docker-entrypoint-initdb.d/01-init.sql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
networks:
- benchmark-network
command: >
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
--max_connections=1000
--innodb_buffer_pool_size=1G
--innodb_log_file_size=256M
--innodb_flush_log_at_trx_commit=2
--innodb_flush_method=O_DIRECT
--innodb_io_capacity=2000
--innodb_io_capacity_max=4000
# Redis for caching benchmarks
redis:
image: redis:7-alpine
container_name: express-php-redis
restart: unless-stopped
ports:
- "6380:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- benchmark-network
command: >
redis-server
--maxmemory 512mb
--maxmemory-policy allkeys-lru
--save ""
--appendonly no
# PHPMyAdmin for database inspection (optional)
phpmyadmin:
image: phpmyadmin:latest
container_name: express-php-phpmyadmin
restart: unless-stopped
environment:
PMA_HOST: mysql
PMA_USER: benchmark_user
PMA_PASSWORD: benchmark_pass
ports:
- "8080:80"
depends_on:
- mysql
networks:
- benchmark-network
profiles:
- debug
# Redis Commander for Redis inspection (optional)
redis-commander:
image: rediscommander/redis-commander:latest
container_name: express-php-redis-commander
restart: unless-stopped
environment:
REDIS_HOSTS: local:redis:6379
ports:
- "8081:8081"
depends_on:
- redis
networks:
- benchmark-network
profiles:
- debug
volumes:
mysql-data:
driver: local
postgres-data:
driver: local
mariadb-data:
driver: local
redis-data:
driver: local
benchmark-results:
driver: local
networks:
benchmark-network:
driver: bridge