Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
72 lines (68 loc) · 2.9 KB
/
Copy pathdocker-compose.yml
File metadata and controls
72 lines (68 loc) · 2.9 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
services:
kafka:
image: apache/kafka
# The official image's own launch script defaults KAFKA_HEAP_OPTS to -Xmx1G -Xms1G when unset -
# undocumented on the image's own page, and never sized for this container's actual budget,
# same gap postgres/mongo close below via mem_limit + explicit tuning. mem_limit leaves ~1GB
# of the 3g ceiling outside the heap for metaspace/direct buffers/page cache (Kafka leans on
# OS page cache for log segment reads/writes, unlike a JVM-heap-only workload).
environment:
CLUSTER_ID: cluster
KAFKA_NODE_ID: 0
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_LISTENERS: CLIENT://:9092,CONTROLLER://localhost:9093
KAFKA_ADVERTISED_LISTENERS: CLIENT://localhost:9092
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_INTER_BROKER_LISTENER_NAME: CLIENT
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,CLIENT:PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 0@localhost:9093
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_HEAP_OPTS: "-Xmx2G -Xms2G"
mem_limit: 3g
ports:
- 9092:9092
postgres:
build:
context: .
dockerfile: Dockerfile.postgres
# shared_buffers/effective_cache_size/work_mem/maintenance_work_mem sized off mem_limit below
# (25%/75%/16MB/128MB), per Docker's own Postgres tuning guide - the built-in default
# (shared_buffers=128MB) is deliberately conservative and was never sized for this container's
# actual memory ceiling. mem_limit is set explicitly on both postgres and mongo so the two are
# bounded to the same memory budget instead of Mongo's WiredTiger auto-sizing off the whole VM
# while Postgres stays pinned to its 128MB default.
# max_connections=200 gives headroom above no-mongodb-demo's HikariCP pool (maximum-pool-size:
# 100) - the default 100 left zero room for anything else once Hikari's pool filled it.
command: >
postgres -c wal_level=logical -c timezone=UTC
-c shared_buffers=512MB -c effective_cache_size=1536MB
-c work_mem=16MB -c maintenance_work_mem=128MB
-c max_connections=200
environment:
POSTGRES_DB: demo
POSTGRES_USER: demo
POSTGRES_PASSWORD: demo
LANG: en_US.utf8
mem_limit: 2g
ports:
- 5432:5432
redis:
image: redis:alpine
ports:
- 6379:6379
rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672
- 15672:15672
mongo:
image: mongo:7
# Same 2g ceiling as postgres above, for a comparable memory budget between the two. mongo:7
# reads cgroups v2 limits correctly (fixed in MongoDB SERVER-60412, well before this release),
# so WiredTiger auto-sizes its cache to ~50% of (this limit - 1GB) without needing a manual
# --wiredTigerCacheSizeGB override.
mem_limit: 2g
ports:
- 27017:27017