Apache Kafka Tutorial 0/111 lessons ~6 min read Lesson 77

    Capacity Planning

    What is Capacity Planning?

    Course progress0%
    Focus
    9 guided sections
    Practice signal
    Examples included
    Career prep
    Foundation builder

    Introduction

    What is Capacity Planning? Capacity planning estimates throughput, retention, replication, partitions, broker count, disk, network, and growth headroom.

    Understanding the topic

    What happens — Capacity Planning:

    • Define RPO/RTO and data sovereignty.
    • Replicate selected topics cross-cluster.
    • Plan failover and conflict handling.
    • Capacity-plan for peak + replay.
    TermDescription
    MirrorMaker 2Cluster-to-cluster replication.
    RPO/RTORecovery point/time objectives.
    Event sourcingState from event replay.
    CQRSSeparate write and read models.

    Visual explanation

    Pipeline view:

    text
    Topic partitions
    replicas across brokers
    ISR health
    disk + network + controller
    SLO dashboards

    Step-by-step explanation

    1. Design — Clusters, topics, mapping.
    2. Replicate — MM2 or cluster link.
    3. Failover — Test DR runbooks.
    4. Govern — Schema and ownership.

    Informative example

    Example:

    bash
    kafka-topics --bootstrap-server localhost:9092 --create --topic capacity-planning --partitions 6 --replication-factor 3
    kafka-console-producer --bootstrap-server localhost:9092 --topic capacity-planning
    kafka-console-consumer --bootstrap-server localhost:9092 --topic capacity-planning --from-beginning
    kafka-consumer-groups --bootstrap-server localhost:9092 --describe --group capacity-planning-service

    Execution workflow

    1Capacity Planning workflow
    1 / 4

    Design

    Clusters, topics, mapping.

    Best practices

    • Use replication factor 3 for critical topics.
    • Set min.insync.replicas with acks=all.
    • Alert on under-replicated partitions, offline partitions, disk usage, and lag.
    • Document topic ownership and cleanup policy.

    Common mistakes

    • Changing partitions without understanding ordering impact.
    • Ignoring hot partitions caused by skewed keys.
    • Letting retention grow until disks become the outage.

    Summary

    Capacity Planning — Operate Kafka through SLOs: durability, availability, latency, lag, disk headroom, and recovery time.

    Ready to mark this lesson complete?Track your journey across the entire course.