4/6 Followers continuously pull and actively replicate data from the Leader. If a broker node goes offline or dies, the cluster instantly notices. Other brokers will immediately step up and take over the leadership of the partitions that the dead broker previously led.
1/6 What happens to data if Kafka broker catches fire? If you propose a single node for your message broker in a system design interview, you'll fail. Here’s how Kafka guarantees High Availability 🧵👇 #SystemDesign#Kafka
3/6 But how to keep the 3 distributed copies in sync? Kafka uses a Single-Leader Replication Model. Anytime, only ONE replica serves as the "Leader". It accepts all new writes and is the ultimate source of truth, while the other two replicas act as "Followers" (hot standbys)
6/6 💡 System Design Takeaway: To achieve limitless horizontal scale: 1️⃣ Shard massive datasets into independent partitions 2️⃣ Distribute partitions across a cluster of multiple nodes 3️⃣ Keep core servers “dumb” to save CPU cycles, and push heavy processing to the edge clients
1/6 You know Kafka is fast, but how does it scale to handle PBs of data without choking? 🤯 A single machine, no matter how powerful, has physical limits. To bypass this, Kafka uses Sharding. Let’s dive into Kafka’s secret to infinite horizontal scaling! 🧵👇
#SystemDesign#Kafka
5/6 Another scaling secret: “Dumb Brokers, Smart Clients”. 🧠 Kafka brokers don’t parse JSON, check data types, or enforce schemas. To the server, your data is just raw byte[]. The CPU-heavy lifting of serializing/deserializing is offloaded entirely to the Producer and Consumer!
6/6💡 System Design Takeaway:When you need to design for ultra-high write throughput: 1️⃣ Avoid random disk access 2️⃣ Use sequential, append-only logs 3️⃣ Remove complex locking mechanisms
Offload the heavy computing to the clients, and let the disk do what it does best!
1/6 Ever wonder how Apache Kafka handles insane 50 GiB/s of writes? 🤯 In system design interviews, people throw around the term “pub/sub messaging system,” but Kafka’s secret weapon is all about the humble Log. 🪵 Here’s why Kafka is lightning fast 🧵👇
#SystemDesign#Kafka
5/6 Brokers (servers) are also “dumb” to save CPU cycles. Kafka does not support specific data types or schemas. To the broker, message is just a pair of raw bytes (byte[] key and byte[] value). It just takes those raw bytes and appends them as fast as the physical disk allows.
Thinking of posting System Design, LLD , Java deep dive content everyday. Just the important parts to serve as a reminder. It will be based on the no of interviews I gave and what i learn everyday.
Lets see If I am consistent.