forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
81 lines (76 loc) · 2.3 KB
/
docker-compose.yaml
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
version: "3.5"
services:
db:
image: postgres:16.2-bullseye
hostname: db
volumes:
- ./DbSchema/create_db.sql:/docker-entrypoint-initdb.d/create_db.sql
# removing these got me 300 KOs again, leaving it got me 1 KO. I could make tables UNLOGGED to avoid writing to WAL too, but didn't need to
command: "postgres -c checkpoint_timeout=600 -c max_wal_size=4096 -c synchronous_commit=0 -c fsync=0 -c full_page_writes=0"
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=mystrongpassword
- POSTGRES_USER=admin
- POSTGRES_DB=rinha
deploy:
resources:
limits:
cpus: "1.05" # got up to 50ish %
memory: "300MB" # got up to 100ish MB
api01: &api
image: marcelocferraz/rinha2024q1-marcelo-python:latest
hostname: api01
depends_on:
- db
ports:
- "8081:8081"
environment:
- API_HOSTNAME=api01
- API_PORT=8081
- DB_PORT=5432
- DB_HOSTNAME=db
- DB_NAME=rinha
- DB_USER=admin
- DB_PASS=mystrongpassword
- MAX_CONNECTIONS=10
- MAX_DB_CONNECTIONS=10
deploy:
resources:
limits:
cpus: "0.15" # got up to 20%
memory: "100MB" # got up to 50ish MB
api02:
<<: *api
hostname: api02
ports:
- "8082:8082"
environment:
- API_HOSTNAME=api02
- API_PORT=8082
- DB_PORT=5432
- DB_HOSTNAME=db
- DB_NAME=rinha
- DB_USER=admin
- DB_PASS=mystrongpassword
- MAX_CONNECTIONS=10
- MAX_DB_CONNECTIONS=10
depends_on:
- api01
load_balancer:
image: nginx:latest
volumes:
- ./NginxConf/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api01
- api02
ports:
- "9999:9999"
deploy:
resources:
limits:
cpus: "0.15" # got up to 10%
memory: "50MB" # got to 14 MB
networks:
default:
name: rinha-nginx-2024q1