Kafkatorio/docs/kafkatorio-platform/unraid/docker-compose.yml
Lazzexus 424e12309d Speed up map processing 14x by merging aggregate updates before forwarding
The zoom-out map layers aggregate 32x32 chunks into 256x256 and 512x512
chunks, holding up to 65k/262k tiles. Every incoming chunk rebuilt the
whole aggregate, and with exactly_once_v2's default 100ms commit
interval nearly every intermediate result was forwarded downstream,
cascading into the next level. A small map also has few 512-level keys,
so this work landed on one partition and one thread.

Make commit.interval.ms and cache.max.bytes.buffering configurable
(defaults unchanged), and in the Unraid example use a 10s commit
interval with a 128MB cache, so repeated updates to the same chunk are
merged in the record cache first. Measured on a live backlog: 41 -> 575
chunks/minute. Map updates now appear within ~10s instead of instantly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 19:43:17 +02:00

106 lines
3.7 KiB
YAML

name: kafkatorio
services:
## Kafka (KRaft mode). Only reachable by the other containers.
infra-kafka:
image: ${REGISTRY_HOST}/dev.adamko.kafkatorio/kafka-kraft:${KAFKATORIO_VERSION}
container_name: kafkatorio-kafka
restart: unless-stopped
networks:
kafkatorio-nw:
aliases: [ kafka ]
volumes:
- "${APPDATA}/config/kafka-server.properties:/kafka/server.properties:ro"
# fixed cluster ID, so persisted data survives image rebuilds
- "${APPDATA}/config/cluster_id:/kafka/cluster_id:ro"
# direct disk path: bypasses Unraid's FUSE layer (shfs), which is slow for Kafka's small writes
- "${KAFKA_DATA_DIR}:/tmp/kraft-combined-logs"
## Process Kafkatorio events
events-processors:
image: ${REGISTRY_HOST}/dev.adamko.kafkatorio/events-processors:${KAFKATORIO_VERSION}
container_name: kafkatorio-events-processors
restart: unless-stopped
environment:
KAFKA_BOOTSTRAP_SERVERS: "kafka:29092"
# one stream thread per partition (topics have 3) - parallelises map processing
KAFKA_STREAMS_NUM_THREADS: "3"
# merge repeated map-chunk updates for 10s before forwarding them (128MB cache per topology)
KAFKA_STREAMS_COMMIT_INTERVAL_MS: "10000"
KAFKA_STREAMS_CACHE_MAX_BYTES: "134217728"
JAVA_OPTS: "-Xmx4g"
networks: [ kafkatorio-nw ]
depends_on: [ infra-kafka ]
volumes:
- "${APPDATA}/state/events-processors:/app/state"
secrets:
- source: kafkatorio_config
target: /.secret.config.yml
## Receives packets from the Factorio server, forwarded by the Docker syslog log driver.
## The log driver runs in the Docker daemon on the host, so localhost-only is enough.
events-server-syslog:
image: ${REGISTRY_HOST}/dev.adamko.kafkatorio/events-server-syslog:${KAFKATORIO_VERSION}
container_name: kafkatorio-events-server-syslog
restart: unless-stopped
environment:
KAFKA_BOOTSTRAP_SERVERS: "kafka:29092"
JAVA_OPTS: "-Xmx256m"
SOCKET_SERVER_HOST: "0.0.0.0"
SOCKET_SERVER_PORT: "9002"
ports:
- "127.0.0.1:12035:9002"
networks: [ kafkatorio-nw ]
depends_on: [ infra-kafka ]
secrets:
- source: kafkatorio_config
target: /.secret.config.yml
## Hosts map tiles and forwards websocket messages to browsers
events-server-web:
image: ${REGISTRY_HOST}/dev.adamko.kafkatorio/events-server-web:${KAFKATORIO_VERSION}
container_name: events-server-web # web-map's nginx proxies to this hostname
restart: unless-stopped
environment:
KAFKA_BOOTSTRAP_SERVERS: "kafka:29092"
KAFKA_STREAMS_NUM_THREADS: "3"
JAVA_OPTS: "-Xmx1536m"
WEB_SERVER_PORT: "80"
networks: [ kafkatorio-nw ]
depends_on: [ infra-kafka ]
volumes:
- "${APPDATA}/data/events-server-web:/app/data"
- "${APPDATA}/state/events-server-web:/app/state"
secrets:
- source: kafkatorio_config
target: /.secret.config.yml
## Web map (also proxies /kafkatorio/ to events-server-web). Point Nginx Proxy Manager here.
web-map:
image: ${REGISTRY_HOST}/dev.adamko.kafkatorio/web-map:${KAFKATORIO_VERSION}
container_name: kafkatorio-web-map
restart: unless-stopped
ports:
- "12081:80"
networks: [ kafkatorio-nw ]
## Kafka admin UI - LAN/DMZ only, don't proxy this publicly
infra-kafka-ui:
image: provectuslabs/kafka-ui:v0.4.0
container_name: kafkatorio-kafka-ui
restart: unless-stopped
ports:
- "18090:8080"
networks: [ kafkatorio-nw ]
depends_on: [ infra-kafka ]
environment:
KAFKA_CLUSTERS_0_NAME: "kafkatorio"
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: "kafka:29092"
secrets:
kafkatorio_config:
file: ${APPDATA}/.secret.kafkatorio-config.yml
networks:
kafkatorio-nw: