Sobes.tech
Junior — Middle

Can you explain the concept of Insync Replica in Apache Kafka and how it ensures data reliability?

sobes.tech AI

Answer from AI

In Apache Kafka, the concept of Insync Replica (ISR) refers to the group of partition replicas that are currently synchronized with the leader. This means that these replicas have received all the latest records acknowledged by the leader.

When a producer sends a message with a confirmation requirement (for example, acks=all), Kafka guarantees that the message will be considered written only after all replicas in the ISR confirm receipt. Thus, ISR ensures data reliability, as data is considered stored only when it is duplicated on multiple brokers.

If a replica falls behind or becomes unavailable, it is excluded from the ISR, and the leader does not wait for its confirmation. This prevents blocking but guarantees that data will not be lost as long as at least one replica in the ISR is available.

Example:

  • Partition leader and 2 replicas.
  • All three are in ISR.
  • Producer sends a message with acks=all.
  • Leader writes the message and waits for confirmation from both replicas.
  • After confirmation, the message is considered reliably written.

Thus, ISR is a mechanism to ensure data consistency and reliability in Kafka.

Can you explain the concept of Insync Replica in… - sobes.tech