liveBook · Manning

Consistency

As explained in Apache Kafka in Action

Data consistency is the property that maintained copies or views of data agree with the intended current data.

Data consistency means keeping persisted Kafka data exactly as intended across a distributed cluster. It becomes difficult when brokers fail, recover, or fail in succession: producers and consumers must balance continued operation against the risk of inconsistent or lost data. Kafka addresses this with replication, acknowledgments, idempotent writes, and transactions. section 5.0

Producer acknowledgment settings trade performance and tolerated loss against consistency:

  • acks=0 sends without waiting for confirmation; it offers the highest performance when data loss is acceptable. section 5.1.1
  • acks=1 waits for the leader to receive the message, providing an intermediate reliability level. section 5.1.1
  • acks=all, also written acks=-1, waits until all in-sync replicas have replicated the message and gives the best data consistency. section 5.1.1

Choosing acknowledgments for a sensor stream

A temperature sensor reporting every millisecond may tolerate losing occasional readings when only the current value matters, making acks=0 attractive. For data that must be replicated consistently, configure a producer with --producer-property acks=all. section 5.1.1

Consistency also depends on compatible data definitions. Schema registries centralize schemas, support versioning, and enforce compatibility checks so producers and consumers can evolve without introducing breaking data changes. section 13.4

How Apache Kafka in Action covers it

How deep it goes
Defines consistency and introduces acknowledgments, replication, idempotent writes, and transactions before deferring detailed mechanisms.
Examples
Uses a three-broker failure scenario, a millisecond temperature sensor, ACK configuration diagrams, and console-producer commands.
What you can do after
Configure producer acknowledgment levels using Kafka console-producer commands and select settings according to tolerated data loss.
How it connects
Ties consistency to data durability, availability, replication, acknowledgments, idempotent writes, transactions, and schema compatibility.

Also explained in

Compare how 20 books explain consistency →

Related concepts

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