Adjust container resource limits for 6 CPU / 30 GB RAM server

Resource allocation (limits / reservations):
- php x2:        1.5 CPU / 1G    |  0.5 CPU / 256M
- db-master:     2.0 CPU / 4G    |  0.5 CPU / 1G    (shared_buffers=1GB, effective_cache_size=3GB)
- db-slave:      1.5 CPU / 2G    |  0.25 CPU / 512M
- pgbouncer:     0.5 CPU / 128M  |  0.1 CPU / 32M
- messenger x2:  1.0 CPU / 512M  |  0.25 CPU / 128M
- redis:         1.0 CPU / 1G    |  0.25 CPU / 128M  (maxmemory 768mb)
- meilisearch:   1.0 CPU / 1G    |  0.25 CPU / 256M

Total max with replicas: ~12 CPU / ~13G RAM (overcommit OK, reservations fit)
Total reservations: ~3.6 CPU / ~4G RAM (guaranteed minimum)
Added PostgreSQL tuning: shared_buffers, effective_cache_size, work_mem.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-26 11:25:35 +01:00
parent 04c9df7638
commit 3bb676bfda

View File

@@ -9,11 +9,11 @@ services:
replicas: 2
resources:
limits:
cpus: "1.0"
memory: 512M
cpus: "1.5"
memory: 1G
reservations:
cpus: "0.25"
memory: 128M
cpus: "0.5"
memory: 256M
restart: unless-stopped
group_add:
- "{{ docker_gid }}"
@@ -36,11 +36,11 @@ services:
deploy:
resources:
limits:
cpus: "1.5"
memory: 2G
cpus: "2.0"
memory: 4G
reservations:
cpus: "0.5"
memory: 512M
memory: 1G
environment:
POSTGRES_USER: e-ticket
POSTGRES_PASSWORD: {{ db_password }}
@@ -55,6 +55,12 @@ services:
- wal_keep_size=64MB
- -c
- hot_standby=on
- -c
- shared_buffers=1GB
- -c
- effective_cache_size=3GB
- -c
- work_mem=16MB
volumes:
- db-master-data:/var/lib/postgresql/data
- ./docker/pgsql/init-master.sh:/docker-entrypoint-initdb.d/init-master.sh
@@ -72,11 +78,11 @@ services:
deploy:
resources:
limits:
cpus: "1.0"
memory: 1G
cpus: "1.5"
memory: 2G
reservations:
cpus: "0.25"
memory: 256M
memory: 512M
environment:
POSTGRES_USER: e-ticket
POSTGRES_PASSWORD: {{ db_password }}
@@ -104,11 +110,11 @@ services:
deploy:
resources:
limits:
cpus: "0.25"
memory: 64M
cpus: "0.5"
memory: 128M
reservations:
cpus: "0.05"
memory: 16M
cpus: "0.1"
memory: 32M
volumes:
- ./docker/pgsql/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro
- ./docker/pgsql/userlist.txt:/etc/pgbouncer/userlist.txt:ro
@@ -134,11 +140,11 @@ services:
replicas: 2
resources:
limits:
cpus: "0.5"
memory: 384M
cpus: "1.0"
memory: 512M
reservations:
cpus: "0.1"
memory: 64M
cpus: "0.25"
memory: 128M
restart: unless-stopped
volumes:
- .:/app
@@ -158,12 +164,12 @@ services:
deploy:
resources:
limits:
cpus: "0.5"
memory: 256M
cpus: "1.0"
memory: 1G
reservations:
cpus: "0.1"
memory: 64M
command: redis-server --requirepass {{ redis_password }} --maxmemory 200mb --maxmemory-policy allkeys-lru
cpus: "0.25"
memory: 128M
command: redis-server --requirepass {{ redis_password }} --maxmemory 768mb --maxmemory-policy allkeys-lru
volumes:
- redis-data:/data
networks:
@@ -180,11 +186,11 @@ services:
deploy:
resources:
limits:
cpus: "0.5"
memory: 512M
cpus: "1.0"
memory: 1G
reservations:
cpus: "0.1"
memory: 128M
cpus: "0.25"
memory: 256M
environment:
MEILI_MASTER_KEY: {{ meilisearch_master_key }}
MEILI_ENV: production