liveBook · Manning

Replication factor

As explained in Kafka for Architects

A replication factor is the configured number of copies maintained for each Kafka partition.

A dashboard that depends on Kafka events must still reach its data when a broker fails. A topic’s replication factor sets the number of copies maintained for each partition, with copies placed on different brokers. Because a partition is the unit of replication, the factor cannot exceed the cluster’s broker count. section 2.3

Choose the value alongside the write-availability requirements:

  • The default replication factor is 1. Override it when a single broker failure must not put the partition’s data at risk. section 2.3.2
  • Set min.insync.replicas to the minimum number of caught-up replicas, including the leader, required for a successful write. If fewer remain in sync, producers encounter an exception. section 2.3.2
  • Treat the two settings as a durability decision informed by how critical the business data is, alongside producer acknowledgments and consumer offset commits. section 10.1.3

Three-broker dashboard cluster

A Customer 360 deployment starts with three brokers and specifies three replicas and min.insync.replicas of 2 for its topics. Copies remain distributed across the brokers; a successful write requires at least two replicas to be in sync. If fewer than two remain in sync, new writes fail rather than meeting a weaker acknowledgment requirement. section 2.3.3 section 2.3.2

asyncapi: 3.0.0
info:
  title: Customer 360 Project
  version: 1.0.0
  description: >
    This project aims to aggregate data from various sources, providing a
    comprehensive view of customer information.

channels:
  customerProfile: 
    description: Storing profile information of customers.
    address: CUSTOMER_PROFILES
    bindings: 
      kafka:
        partitions: 9 #1
        replicas: 3    
        topicConfiguration:
          min.insync.replicas: 2    #2
  transactions:
    description: Information about customer transactions.
    address: TRANSACTIONS 
    bindings:
      kafka:
        partitions: 9 
        replicas: 3 
        topicConfiguration:
          min.insync.replicas: 2

The AsyncAPI 3.0.0 Kafka bindings record `replicas: 3` and `min.insync.replicas: 2` alongside each topic’s partition count. section 2.3.3

Record replication choices per topic rather than relying unexamined on defaults. Early topic design can focus on partition count, replication factor, and minimum in-sync replicas, then refine other settings as requirements become clearer. section 2.3 section 2.4.7

How Kafka for Architects covers it

How deep it goes
Explains per-topic placement, broker-count limits, and write thresholds; stops short of replication internals.
Examples
Uses a three-broker Customer 360 cluster and AsyncAPI topic bindings specifying three replicas and two minimum in-sync replicas.
What you can do after
Operate/configure it by choosing per-topic replica counts and in-sync thresholds against broker count and failure tolerance.
How it connects
Links topic partitions and brokers to in-sync replicas, producer acknowledgments, and data durability.

Also explained in

Compare how 4 books explain replication factor →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka for Architects. The section links point to the parts of the book it draws on.