キャパシティプランニング:パーティションとレプリケーション
スループット、並列性、耐久性、運用コストのバランスを取るため、適切なパーティション数とレプリケーション係数でトピックの規模を決める方法を学びます。
「キャパシティプランニング:パーティションとレプリケーション」はCoddyKit上の無料Advanced Spring Boot 4: Event-Driven Architecture (Kafka)レッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはAdvanced Spring Boot 4: Event-Driven Architecture (Kafka)学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Advanced Spring Boot 4: Event-Driven Architecture (Kafka)コースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
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.
よくある質問
「キャパシティプランニング:パーティションとレプリケーション」レッスンは無料ですか?
はい。「キャパシティプランニング:パーティションとレプリケーション」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Advanced Spring Boot 4: Event-Driven Architecture (Kafka)コースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Advanced Spring Boot 4: Event-Driven Architecture (Kafka)コースには全4レッスンが含まれています。
「キャパシティプランニング:パーティションとレプリケーション」で何を学びますか?
スループット、並列性、耐久性、運用コストのバランスを取るため、適切なパーティション数とレプリケーション係数でトピックの規模を決める方法を学びます。 ブラウザで直接実行するハンズオンコードでAdvanced Spring Boot 4: Event-Driven Architecture (Kafka)を演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Advanced Spring Boot 4: Event-Driven Architecture (Kafka)を始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのAdvanced Spring Boot 4: Event-Driven Architecture (Kafka)は初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「キャパシティプランニング:パーティションとレプリケーション」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このAdvanced Spring Boot 4: Event-Driven Architecture (Kafka)レッスンでコードを書いて実行できますか?
はい。すべてのAdvanced Spring Boot 4: Event-Driven Architecture (Kafka)レッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- Kafkaのパフォーマンスチューニング
- 冪等なプロデューサーとコンシューマー
- Spring Boot Kafkaアプリケーションのクラウドへのデプロイ
- キャパシティプランニング:パーティションとレプリケーション