Make Kafka Streams thread count configurable, cap JVM heaps on Unraid
- config.yml: num.stream.threads can be set with KAFKA_STREAMS_NUM_THREADS (default unchanged: 1). Map processing was bottlenecked on a single stream thread while the host was mostly idle. - Unraid example: run 3 stream threads (topics have 3 partitions), and cap each JVM's heap via JAVA_OPTS. Without a cap each JVM defaults to 1/4 of the host's RAM, and the stack grew to ~14 GB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ce50d9f1bb
commit
5ad3e6f27b
2 changed files with 7 additions and 1 deletions
|
|
@ -24,6 +24,9 @@ services:
|
|||
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"
|
||||
JAVA_OPTS: "-Xmx4g"
|
||||
networks: [ kafkatorio-nw ]
|
||||
depends_on: [ infra-kafka ]
|
||||
volumes:
|
||||
|
|
@ -40,6 +43,7 @@ services:
|
|||
restart: unless-stopped
|
||||
environment:
|
||||
KAFKA_BOOTSTRAP_SERVERS: "kafka:29092"
|
||||
JAVA_OPTS: "-Xmx256m"
|
||||
SOCKET_SERVER_HOST: "0.0.0.0"
|
||||
SOCKET_SERVER_PORT: "9002"
|
||||
ports:
|
||||
|
|
@ -57,6 +61,8 @@ services:
|
|||
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 ]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ kafka-streams-config:
|
|||
application.id: kafkatorio-events-processor
|
||||
bootstrap.servers: ${KAFKA_BOOTSTRAP_SERVERS:-localhost:9092}
|
||||
state.dir: ${KAFKA_STREAMS_STATE_DIR:-.state/kafka}
|
||||
num.stream.threads: 1
|
||||
num.stream.threads: ${KAFKA_STREAMS_NUM_THREADS:-1}
|
||||
processing.guarantee: exactly_once_v2
|
||||
auto.offset.reset: earliest
|
||||
default.key.serde: org.apache.kafka.common.serialization.Serdes$StringSerde
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue