Apache Kafka on dedicated servers

Kafka writes sequential logs and serves reads from the page cache, so it gets the most from machines with large drives, plenty of memory and fast ports. Bare metal gives it all three without sharing.

What changed with KRaft?

Kafka no longer needs ZooKeeper. Since Kafka 4.0, clusters run only in KRaft mode, where a small quorum of controller processes stores the cluster metadata in a Raft log. Small clusters run controllers and brokers in the same processes on three machines; larger ones use three dedicated controllers. New clusters are formatted with a cluster ID before first start.

KAFKA_CLUSTER_ID="$(bin/kafka-storage.sh random-uuid)"
bin/kafka-storage.sh format -t "$KAFKA_CLUSTER_ID" -c config/server.properties
bin/kafka-server-start.sh -daemon config/server.properties

Which settings matter on each broker?

process.roles=broker,controller
node.id=1
controller.quorum.voters=1@10.70.0.1:9093,2@10.70.0.2:9093,3@10.70.0.3:9093
listeners=PLAINTEXT://10.70.0.1:9092,CONTROLLER://10.70.0.1:9093,EXTERNAL://0.0.0.0:9094
controller.listener.names=CONTROLLER
inter.broker.listener.name=PLAINTEXT
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT,EXTERNAL:SASL_SSL
log.dirs=/data1/kafka,/data2/kafka,/data3/kafka,/data4/kafka
default.replication.factor=3
min.insync.replicas=2
num.partitions=12
log.retention.hours=168

Keep the internal listener and controller port on a WireGuard mesh between brokers, and expose only a TLS listener with authentication to clients outside it.

Why spread logs over several drives?

Each directory in log.dirs holds whole partitions, and Kafka spreads partitions across them, so four drives give roughly four times the sequential write bandwidth of one. Kafka replicates between brokers, so drives do not need RAID: a failed disk takes its partitions offline on that broker, the replicas elsewhere keep serving, and Kafka recreates them when the disk is replaced. Hard drives handle Kafka's sequential pattern well, which makes the Storage line a cost-effective home for long retention.

How does memory help Kafka?

Through the operating system's page cache rather than the JVM heap. Consumers that keep up read recent messages straight from cache, and the drives only see writes. Give the JVM a modest heap of 6 to 8 GB and leave the rest of memory for cache. A broker with 128 GB holds well over 100 GB of the most recent data in cache, often several hours of traffic.

How do I size storage and network?

Multiply incoming data by replication factor and retention. An example: 50 MB/s of incoming data, replication factor 3, seven days of retention.

StepResult
50 MB/s x 86,400 s4.3 TB a day
x 7 days30 TB
x 3 replicas91 TB in the cluster
Over 3 brokers, plus 30 percent headroomAbout 40 TB per broker

Network per broker carries its share of incoming data, replication to two peers and consumer reads, often three to five times the incoming rate. Guaranteed ports of 3 Gbps on Storage-2 models and 10 Gbps on Storage-3 models cover that comfortably, and EU and Canadian ports are unmetered.

Which machines fit?

ClusterMachine, three of eachDrives
Short retention, high throughputBUSINESS-3 20242x 960 GB SSD NVMe, Soft RAID
Days of retentionSTORAGE-12x 480 GB SSD SATA (system) + 4x 14 TB HDD SAS, Soft RAID
Weeks of retentionSTORAGE-2 20262x 960 GB SSD NVMe (system) + 2x 24 TB HDD SAS, Soft RAID
Large event archivesSTORAGE-3 2024529.92 TB raw, 10 Gbps

STORAGE-1 gives 56.96 TB of raw capacity on four drives for $109.80 a month, a low entry into multi-terabyte retention. Delivery of Storage models can take up to 72 hours.

What should I monitor on brokers?

Watch under-replicated partitions, request latency, consumer lag and disk use, and alert on each. Use XFS for log directories, mount with noatime, and raise the open file and memory map limits for the Kafka user. Plan partition counts with growth in mind, since adding partitions later changes key ordering. The Apache Pulsar servers and RabbitMQ servers pages cover other messaging systems.

Machines for Kafka brokers

Lowest monthly price of each model across its data centres; the model page shows the price in every location.

ModelProcessorCoresMemoryDrivesPortPer month
BUSINESS-3 2024AMD EPYC 4464P1264 GB2x 960 GB SSD NVMe3 Gbps unmetered$141.60
BUSINESS-4 2026AMD EPYC 4585PX1664 GB2x 960 GB SSD NVMe3 Gbps unmetered$212.40
STORAGE-1AMD Ryzen 7 Pro 3700832 GB2x 480 GB SSD SATA + 4x 14 TB HDD SAS1 Gbps unmetered$109.80
STORAGE-2 2024AMD EPYC 4344P832 GB2x 960 GB SSD NVMe + 2x 22 TB HDD SAS3 Gbps unmetered$187.80
STORAGE-2 2026AMD EPYC 4345P832 GB2x 960 GB SSD NVMe + 2x 24 TB HDD SAS3 Gbps unmetered$273.00
STORAGE-3 2024Intel Xeon Gold 6554S36128 GB2x 960 GB SSD NVMe + 24x 22 TB HDD SAS10 Gbps unmetered$1,037.40

Pick drives for retention and ports for throughput; Kafka replicates, so no RAID is needed.

See all servers and prices

Related pages

Apache Pulsar servers

Run Apache Pulsar on bare metal: stateless brokers, BookKeeper bookies with separate journal and ledger disks, metadata stores, ports and tiered storage.

Read more

RabbitMQ servers

Run RabbitMQ brokers on bare metal: quorum queues and streams, the ports a node uses, memory and disk alarms, three-node clusters over WireGuard.

Read more

Storage servers

High capacity hard disk servers from 44 TB to 576 TB raw.

from $109.80 a monthRead more

Big data and analytics

High core EPYC machines and dense disk chassis for Spark, ClickHouse and data lake clusters.

Read more

Questions and answers

Does Kafka still need ZooKeeper?

No. Since Kafka 4.0, clusters run in KRaft mode, where controller processes store metadata in a Raft log.

Should Kafka drives use RAID?

Usually not. List each drive in log.dirs; Kafka replicates partitions between brokers, so another broker serves data while a disk is replaced.

How much heap does a Kafka broker need?

6 to 8 GB is typical. Kafka relies on the operating system page cache, so leave the rest of memory free for it.

How do I calculate Kafka storage?

Multiply incoming bytes per second by seconds of retention and by the replication factor, then add about 30 percent headroom.

Can Kafka run on hard drives?

Yes. Kafka writes and reads logs sequentially, which hard drives handle well, especially when spread across several drives.