Kapazitätsplanung: Partitionen und Replikation
Lernen Sie, Topics mit der richtigen Anzahl an Partitionen und dem passenden Replikationsfaktor zu dimensionieren, um Durchsatz, Parallelität, Ausfallsicherheit und Betriebskosten auszubalancieren.
Kapazitätsplanung: Partitionen und Replikation ist eine kostenlose Advanced Spring Boot 4: Event-Driven Architecture (Kafka)-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Advanced Spring Boot 4: Event-Driven Architecture (Kafka)-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Advanced Spring Boot 4: Event-Driven Architecture (Kafka)-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Why Sizing Matters
Partition count and replication factor are hard to change after launch and directly shape throughput, parallelism, and durability. Good capacity planning avoids painful migrations later.
Partitions Drive Parallelism
A consumer group can have at most as many active consumers as there are partitions. More partitions allow more parallel consumers and higher throughput.
Estimating Partition Count
A common heuristic: divide target throughput by per-partition throughput.
- Measure max producer throughput per partition (p).
- Measure max consumer throughput per partition (c).
- partitions = max(target/p, target/c).
partitions = ceil( targetMBs / min(producerMBs, consumerMBs) )The Cost of Too Many Partitions
More partitions are not free:
- More open file handles and memory on brokers.
- Longer leader-election and rebalance times.
- Higher end-to-end latency.
Plan headroom, but do not wildly over-provision.
Replication Factor
The replication factor is how many copies of each partition exist across brokers. A factor of 3 is standard for production durability.
In-Sync Replicas
With min.insync.replicas=2 and acks=all, a write succeeds only when at least two replicas confirm. This tolerates one broker failure without data loss.
min.insync.replicas=2
replication.factor=3Creating a Sized Topic
Specify partitions and replication when creating a topic so it starts correctly sized.
kafka-topics.sh --create --topic orders \
--partitions 12 --replication-factor 3 \
--bootstrap-server localhost:9092Planning for Growth
You can increase partitions later but never decrease them, and adding partitions breaks key-based ordering. Pick a count with growth headroom from the start.
Retention and Disk Sizing
Disk need = throughput x retention x replication factor. A topic at 10 MB/s with 7-day retention and RF 3 needs roughly 17 TB. Plan storage accordingly.
Spreading Across Brokers
Ensure partitions and replicas are evenly distributed so no broker becomes a hotspot. Rack-awareness places replicas across failure domains.
Putting It Together
Capacity planning balances parallelism, durability, latency, and cost. Size partitions from throughput, use RF 3 with min ISR 2, and plan disk from retention.
Quick Check
Test your understanding of capacity planning.
Recap
You learned capacity planning.
- Partition count drives consumer parallelism and throughput.
- Too many partitions add latency and broker overhead.
- RF 3 with min ISR 2 tolerates one broker failure.
- Plan disk from throughput x retention x replication.
Häufig gestellte Fragen
Ist die Lektion „Kapazitätsplanung: Partitionen und Replikation“ kostenlos?
Ja — der vollständige Text von „Kapazitätsplanung: Partitionen und Replikation“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Advanced Spring Boot 4: Event-Driven Architecture (Kafka)-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Advanced Spring Boot 4: Event-Driven Architecture (Kafka)-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Kapazitätsplanung: Partitionen und Replikation“?
Lernen Sie, Topics mit der richtigen Anzahl an Partitionen und dem passenden Replikationsfaktor zu dimensionieren, um Durchsatz, Parallelität, Ausfallsicherheit und Betriebskosten auszubalancieren. Du übst Advanced Spring Boot 4: Event-Driven Architecture (Kafka) mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Advanced Spring Boot 4: Event-Driven Architecture (Kafka) zu starten?
Keine Vorkenntnisse erforderlich. Advanced Spring Boot 4: Event-Driven Architecture (Kafka) auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „Kapazitätsplanung: Partitionen und Replikation“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Advanced Spring Boot 4: Event-Driven Architecture (Kafka)-Lektion Code schreiben und ausführen?
Ja. Jede Advanced Spring Boot 4: Event-Driven Architecture (Kafka)-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Tipps zur Kafka-Performance-Optimierung
- Idempotente Producer und Consumer
- Spring-Boot-Kafka-Anwendungen in der Cloud bereitstellen
- Kapazitätsplanung: Partitionen und Replikation