Monedula

Tested against Apache Kafka

The Kafka Simulator checked against Apache Kafka 4.3.1 with Kafka's own tools, with transactions and both group protocols. What passes, what differs.

Concepts 4 of 4

21 min read

Updated 30 November 2026

Markdown

On this page

To check that the simulator behaves like Kafka, we run Apache Kafka’s own verification tools against it through the bridge, and then the same tools, the same faults and the same checks against a real Apache Kafka cluster. The tools are VerifiableProducer, VerifiableConsumer, TransactionalMessageCopier and kafka-topics from Apache Kafka 4.3.1: the producer, consumer and transactional copier that Kafka’s own system tests drive, run unmodified on a JVM. A word count on Kafka Streams 4.3.1 checks exactly_once_v2.

How we test

Simulator Apache Kafka
Cluster A fresh free-play cluster for each scenario: three brokers in one data center and a KRaft controller, paired with the bridge A fresh cluster for each scenario: three brokers and a KRaft controller, Apache Kafka 4.3.1 in Docker, default broker configs
Faults A hard kill and a restart of a broker, the same actions as on the canvas; a hard kill of a client process kill -9 of the broker’s process and a start; the same kill of a client
Clients The tools above, connected through the bridge The same tools, on the same machine, with the same settings

The checks are Kafka’s guarantees, read from the events the tools print: which records the producer was told were acknowledged, at which partition and offset, and what a consumer reads back afterwards. The producer runs with idempotence on and retries enabled, as an application on the client defaults does. (VerifiableProducer turns retries off unless told otherwise; Kafka’s own idempotence tests turn them back on the same way.)

What passes

Every check below passes on the simulator and on Apache Kafka 4.3.1.

Leader failover

A topic with three partitions, replication factor 3 and min.insync.replicas=2. An idempotent producer sends 900 records at 30 a second with 60 keys. After 150 acknowledgements the leader of partition 0 is killed hard, and it is restarted 20 seconds later. Then a consumer reads the topic from the start.

Check Simulator Apache Kafka
Every send is acknowledged; the retriable errors of the failover are retried Pass Pass
No acknowledged record is lost: each is read back at the partition and offset its acknowledgement named Pass Pass
No record is written twice, retries included Pass Pass
Offsets of every partition run from 0 with no gaps Pass Pass
Records of each key keep the order they were sent in Pass Pass
Partition 0 takes writes on the new leader before the old one returns Pass Pass

min.insync.replicas

One partition, replication factor 3, min.insync.replicas=2. Both followers are killed hard.

Check Simulator Apache Kafka
A producer with acks=all is refused with NotEnoughReplicasException, and nothing is acknowledged Pass Pass
A producer with acks=1 is still served Pass Pass
Once a follower is back in the ISR, acks=all is served again Pass Pass

Consumer group rebalance

A consumer group on a topic with three partitions. This scenario and the next three run twice, with the classic protocol and with group.protocol=consumer (KIP-848), and on the consumer protocol each also checks that kafka-consumer-groups --describe --state --verbose shows a consumer group with its group epoch.

Check Simulator Apache Kafka
When a second member joins, every partition has exactly one owner Pass Pass
When that member closes (LeaveGroup), the other one takes over every partition Pass Pass
Every record is read at least once across the rebalance Pass Pass
Offset commits are accepted Pass Pass

Group coordinator failover

A consumer group reads a topic with three partitions while an idempotent producer writes 600 records to it. After the group has read 150, the broker that coordinates the group is killed hard, and it is restarted 20 seconds later.

Check Simulator Apache Kafka
The group keeps reading while its coordinator is down: fetches go to the partition leaders Pass Pass
Offset commits succeed again, on the coordinator now in charge Pass Pass
Every acknowledged record is read Pass Pass
The group’s committed offsets reach the log end of every partition (kafka-consumer-groups shows lag 0) Pass Pass

Consumer group restart

300 records in a topic with three partitions. A consumer of a group reads 100 and closes, committing on the way out; a new consumer of the same group reads the rest.

Check Simulator Apache Kafka
kafka-consumer-groups shows the offsets the first consumer committed Pass Pass
The new consumer starts every partition at its committed offset, not earlier and not later Pass Pass
No record is skipped across the restart Pass Pass

On the consumer protocol both consumers ask for the server’s range assignor; the other group scenarios use the default, uniform.

Consumer group reconciliation

A topic with six partitions and an idempotent producer writing 2400 records at 20 a second. Three members join a group, then a fourth; then the member that owns the most partitions is killed hard, so it never leaves the group. Neither protocol sets a session timeout of its own: the client default and the broker’s group.consumer.session.timeout.ms are both 45 seconds.

Check Simulator Apache Kafka
The fourth member gets partitions, and every partition has one owner Pass Pass
No partition ever has two owners at once, from the members’ own assigned and revoked events Pass Pass
The killed member’s partitions go to the live members once its session expires: about 48 seconds after the kill Pass Pass
Every acknowledged record is read at least once Pass Pass

When the fourth member joins, the three others give up all six partitions on the classic protocol (the eager range assignor) and only the one that moves on the consumer protocol, on both.

Online migration between the group protocols

A topic with six partitions and an idempotent producer writing 4000 records at 20 a second. Three classic members (Kafka’s VerifiableConsumer with its eager range assignor) form a group. One after another each reads its share of records, closes cleanly and is replaced by a member with group.protocol=consumer; then those leave one after another the same way, each replaced by a classic member again. Kafka 4.4’s default group.consumer.migration.policy, bidirectional, is the simulator’s.

Check Simulator Apache Kafka
The group starts as a classic group Pass Pass
The first consumer-protocol member turns it into a consumer group, and its classic members stay in it Pass Pass
It is a classic group again once the last consumer-protocol member left Pass Pass
No partition ever has two owners at once, over all nine members, classic and consumer alike Pass Pass
Every offset commit succeeds Pass Pass
Every send is acknowledged, and every acknowledged record is read at least once Pass Pass

This scenario runs with Kafka’s Java tools only: it switches Kafka’s own consumer between the two protocols.

Server-side regular expressions

Kafka’s Java consumer with group.protocol=consumer subscribes with subscribe(SubscriptionPattern("fid-rx-.*")), so the coordinator resolves the regular expression. Two topics exist, fid-rx-a and fid-other; a third that matches, fid-rx-b, is created while the consumer runs. A second member then subscribes with a lookahead, which RE2/J, the syntax Kafka uses, does not have.

Check Simulator Apache Kafka
The group gets the matching topic only Pass Pass
The topic created later is assigned: 10 to 12 seconds after its creation in the simulator, 15 on Kafka Pass Pass
The lookahead is refused with INVALID_REGULAR_EXPRESSION and the same message Pass Pass
Every record of both matching topics is read, and every offset commit succeeds Pass Pass

A created topic is picked up at a heartbeat once 10 seconds passed since the last resolution, on both.

Static members

Kafka’s VerifiableConsumer with --group-instance-id. In a classic group a static member and a dynamic one share a topic of four partitions; a second instance then starts with the first one’s group.instance.id while the first still runs. In a consumer group with a member of the consumer protocol, a static classic member reads 40 records and closes, which a static member does without leaving the group, and a new instance starts with its id.

Check Simulator Apache Kafka
Classic group: the first instance is fenced (FencedInstanceIdException) Pass Pass
Classic group: the second instance owns exactly the first one’s partitions Pass Pass
Classic group: the dynamic member revokes nothing, as no rebalance starts Pass Pass
Consumer group: the group is a consumer group with a static classic member Pass Pass
Consumer group: the restarted instance gets its partitions back Pass Pass
Consumer group: the group epoch stays and the other member keeps its partitions Pass Pass
Every record is read by both groups, and every commit of the members left succeeds Pass Pass

Two live instances of one id in a consumer group replace each other back and forth on Kafka as in the simulator: a commit with the replaced member id is refused, the client joins again and replaces the other one. The scenario restarts the member there instead.

A topic created again

Kafka’s VerifiableConsumer with group.protocol=consumer reads a topic of three partitions. The topic is deleted with kafka-topics --delete and created again under the same name and partition count, and 60 records are written to it. The consumer does not create topics itself (allow.auto.create.topics=false): with the default, its next metadata request would create the deleted topic again at once, with one partition, on Kafka as in the simulator.

Check Simulator Apache Kafka
The new topic has another topic id Pass Pass
The group epoch moves Pass Pass
The member gives up the old topic’s partitions and is assigned the new ones Pass Pass
The member reads every record of the new topic from the start Pass Pass

The transaction scenarios run at transaction version 2 (KIP-890 part 2) on both, the default of a Kafka 4.x cluster: Kafka’s Java client and franz-go add each partition with their first write to it and bump the producer epoch at every commit or abort. librdkafka 2.16.0 has version 1 only, so it adds every partition and the group’s offsets with AddPartitionsToTxn and AddOffsetsToTxn and keeps its epoch, on Apache Kafka as in the simulator, which serve it as version 1.

Exactly-once copy

Kafka’s TransactionalMessageCopier, the tool of Kafka’s own transactions system test, copies 900 records from an input topic to an output topic, three partitions each, in transactions of 10 records, and commits the offsets it consumed in each transaction. One copier runs per input partition, with a 40 second transaction timeout as in Kafka’s test. A copier is killed hard after 20 records and a new one starts with the same transactional.id; after it copied 20 more, the broker that coordinates that transactional.id is killed hard and restarted 20 seconds later. A second producer keeps a transaction open on one output partition through the whole copy, and a third one is fenced by a new producer with its transactional.id.

Check Simulator Apache Kafka
A new producer with the same transactional.id fences the old one: its commit fails with ProducerFencedException Pass Pass
Every copier finishes through the kills Pass Pass
While a transaction is open, read_committed stops at its first record and read_uncommitted reads on; after its abort both reach the end Pass Pass
A read_committed consumer reads every input record exactly once, each key in order, nothing of an aborted transaction Pass Pass
A read_uncommitted consumer reads the records of the aborted transactions Pass Pass
The offsets the copiers committed in their transactions reach the end of the input Pass Pass
Every commit and abort marker takes an offset: the output’s log ends pass its records by at least one offset per transaction Pass Pass

Kafka Streams exactly-once

Kafka’s own WordCountDemo from Kafka Streams 4.3.1 counts words, with processing.guarantee=exactly_once_v2 and Streams’ defaults otherwise, its 10 second transaction timeout included. It splits lines into words, groups them by word through a repartition topic, keeps the counts in a store backed by a changelog topic and writes every new count to an output topic; the two internal topics keep the names Streams generates, 71 and 69 characters long. A producer writes 300 lines of three words over 20 distinct words, five lines a second, so each word occurs 45 times. After 150 words were counted, the leader of an output partition is killed hard and restarted 20 seconds later; then the app itself is killed hard, and a new instance with the same application.id and state directory takes over, wiping its local state and restoring it from the changelog.

Check Simulator Apache Kafka
The app creates its internal topics under Streams’ generated names Pass Pass
Every input line is acknowledged Pass Pass
The new instance takes over and runs Pass Pass
A read_committed consumer of the output sees every word reach its number of occurrences Pass Pass
Every count appears once: each word’s counts run 1, 2, 3 and on, none repeated or skipped, through both kills Pass Pass

read_uncommitted also reads the counts of the transactions the kills aborted. No transaction timed out: after the app kill, the new instance writes its backlog inside its transactions, since the produce quota lets an app write up to 3000 saved-up records at once (see Limits).

Hanging transactions

Kafka’s own kafka-transactions.sh from Apache Kafka 4.3.1, on a topic with three partitions. A Java producer opens a transaction on one partition and keeps it open. Then a transaction is left hanging on another partition: an open transaction that its coordinator does not hold, so no commit or abort marker ever ends it. On Apache Kafka it is made the way Kafka’s documentation describes one: with transaction.partition.verification.enable=false on the brokers, a raw client writes a transactional record to a partition its transaction never added. The simulator checks every transactional write against the coordinator, which keeps its state through broker kills, so no client can leave a transaction hanging there. In its place the scenario injects a stand-in through the test host: a record of a transaction no coordinator holds, what a coordinator that lost its state would leave behind. The tool’s steps and checks are the same on both.

Check Simulator Apache Kafka
describe-producers shows the open transaction’s producer and first offset; describe shows it Ongoing Pass Pass
find-hanging does not list a transaction its coordinator holds Pass Pass
A transactional write to a partition the transaction did not add is refused with TRANSACTION_ABORTABLE Pass Pass
A hanging transaction holds read_committed back at its first record Pass Pass
find-hanging, by broker and by topic, lists the hanging transaction with its producer and start offset, and not under the default 15 minute --max-transaction-timeout Pass Pass
abort with a wrong --start-offset fails with the same error Pass Pass
abort with the right one ends the transaction: find-hanging lists nothing, and read_committed reads the record after it and not the aborted one Pass Pass
abort on a live transaction ends it on the partition, behind its coordinator, which still shows it Ongoing Pass Pass
abort --producer-id for a producer with no open transaction on a partition writes a marker all the same: the log end moves by one Pass Pass

This scenario runs with Kafka’s Java tools only: the tool under test is a Java tool.

Last run: 26 November 2026, Kafka 4.3.1 tools on Java 25, monedula-sim-bridge built from its main branch (playground protocol 4); the online migration on 26 November with the bridge’s main branch and its ConsumerGroupDescribe member types, the regular expressions on 26 November with its main branch, the exactly-once copy and the hanging transactions (with the abort of a producer that has no open transaction) again on 26 November, and the static members on 26 November with the bridge’s main branch. The librdkafka runs of the exactly-once copy on the single data center, Apache Kafka, AutoMQ, WarpStream and Redpanda, and of the group scenarios on those three, are from 27 November. The first five scenarios on the classic protocol were last run on 24 November with the bridge’s main branch; the first three also pass with a ten times shorter tick, a test setting that answers requests sooner.

Other free-play setups

The scenarios also run on the other free-play setups the bridge serves, with the same tools, faults and checks: the six scenarios without transactions on the classic protocol, the four group scenarios on the consumer protocol too, and the exactly-once copy. The Kafka Streams and the hanging transactions scenarios run on them too. A multi-region setup is served as its first region, so the checks see that region’s brokers. A scenario that cannot apply is left out, not counted as a pass: the min.insync.replicas one needs a topic with followers and an ISR, the exactly-once copy, Kafka Streams and the hanging transactions a setup that takes transactions from real clients, and the consumer protocol a setup whose implementation has it. A setup that refuses is checked to refuse as its implementation does. Where a setup caps a topic at three partitions, the reconciliation runs with three, two members and a third that joins. The online migration and the regular expressions pass on the setups that have the consumer protocol: the diskless ones of the KIP-1163 draft and Inkless, WarpStream and the Confluent Streamhouse preview; on AutoMQ, Redpanda, KafScale, Nisshi and Ursa it does not apply, and their refusal of the consumer protocol is checked.

Setup Result
3-DC stretched, 2.5-DC stretched Every check passes, on both protocols and with transactions, Kafka Streams and the hanging transactions included
Active / passive (mirror), Active / active (its first region, two brokers) Every check passes, on both protocols and with transactions, Kafka Streams and the hanging transactions included
Diskless 3 AZ Every check passes, on diskless topics and on both protocols. min.insync.replicas does not apply: a diskless topic keeps no ISR. The exactly-once copy, Kafka Streams and the hanging transactions do not apply: the KIP-1163 draft refuses a transactional produce to a diskless topic with INVALID_TXN_STATE, Kafka Streams’ first transactional write included; its classic topics take transactions
Diskless 3 AZ · Inkless Every check passes, on diskless topics and on both protocols. min.insync.replicas does not apply: a diskless topic keeps no ISR. The exactly-once copy, Kafka Streams and the hanging transactions do not apply: Inkless refuses a diskless topic in a transaction (INVALID_TOPIC_EXCEPTION when the client adds the partition), Kafka Streams included; its classic topics take transactions
Diskless 3 AZ · WarpStream Every check passes, on both protocols, with the exactly-once copy and Kafka Streams. min.insync.replicas does not apply: a topic keeps one replica, and object storage is its durability. The hanging transactions do not apply: WarpStream has no DescribeProducers (UNSUPPORTED_VERSION), which describe-producers and find-hanging need
Diskless 3 AZ · AutoMQ Every check passes on the classic protocol, with the exactly-once copy, Kafka Streams and the hanging transactions. min.insync.replicas does not apply: a topic keeps one replica, and object storage is its durability. The consumer protocol does not apply: the setup answers UNSUPPORTED_VERSION, as AutoMQ 1.7.4 serves only the classic one
Diskless · KafScale Every check passes on the classic protocol. min.insync.replicas does not apply: a topic keeps one replica, and object storage is its durability. KafScale has neither the consumer protocol nor transactions (UNSUPPORTED_VERSION)
Diskless · Nisshi, on PostgreSQL and on S3 Every check passes on the classic protocol. min.insync.replicas does not apply: a topic keeps one replica, and the storage engine is its durability. Nisshi has neither the consumer protocol (UNSUPPORTED_VERSION) nor transactions (TRANSACTIONAL_ID_AUTHORIZATION_FAILED)
Diskless 3 AZ · Redpanda Cloud Topics Every check passes on the classic protocol, with the exactly-once copy, Kafka Streams and the hanging transactions up to abort: Redpanda has no WriteTxnMarkers, so abort gets UNSUPPORTED_VERSION. min.insync.replicas does not apply: Raft waits for a majority instead. Redpanda has no consumer protocol (UNSUPPORTED_VERSION)
Diskless 3 AZ · Ursa for Kafka Every check passes on the classic protocol, the exactly-once copy, Kafka Streams and the hanging transactions on disk topics, which take transactions. The consumer protocol does not apply: Ursa’s docs do not say it serves it (UNSUPPORTED_VERSION)

Other clients

The scenarios also run with franz-go 1.22.3 and with librdkafka 2.16.0, through confluent-kafka-python 2.16.2, in place of Kafka’s Java producer, consumer and copier: small tools with the same flags, the same printed events and the same defaults as VerifiableProducer, VerifiableConsumer and TransactionalMessageCopier, so the same checks read them. Otherwise each keeps its library’s own defaults: franz-go compresses with snappy, and librdkafka lingers 5 ms and keeps any number of requests in flight. On the consumer protocol franz-go opts in with kgo.ServerSideBalancer() and librdkafka with group.protocol=consumer. franz-go’s copier is a member of the consumer group and copies the partitions the group gives it, because its exactly-once API commits offsets in a transaction only for a group member; librdkafka’s copies one partition, as Kafka’s does. Both clients also run the four group scenarios, on both protocols, and the exactly-once copy on every other free-play setup: the 3-DC and 2.5-DC stretched clusters, both two-region setups, the diskless ones of the KIP-1163 draft and Inkless, AutoMQ, WarpStream, KafScale, Redpanda, Ursa, and Nisshi on PostgreSQL and on S3. A setup refuses the consumer protocol or transactions as it does with Kafka’s tools: franz-go falls back to the classic protocol, librdkafka stops with a fatal error, as the Java consumer does. Every check passes with franz-go, on both protocols. The exactly-once copy also passes with franz-go on AutoMQ, WarpStream and Redpanda, which take transactions from real clients since 26 November. With librdkafka every check passes but those of the exactly-once copy that need the whole copy, wherever the copy ran with it (the single data center, the stretched clusters, both two-region setups, Ursa, and since 27 November AutoMQ, WarpStream and Redpanda): when the broker that dies also coordinates the copiers’ consumer group, librdkafka’s send_offsets_to_transaction never returns, on Apache Kafka as in the simulator, so a copier still copying then stops. It is a known librdkafka bug, still open in 2.16.0, the latest release on 27 November: the call waits for the dead broker that librdkafka has already dropped. The simulator drops a dead broker at once, so the copy meets the bug every time its group’s coordinator dies; on Apache Kafka it is a race against the 9 seconds Kafka takes to fence the broker. Exactly-once still holds: nothing is read twice, and nothing of an aborted transaction.

Where it differs

Kafka’s guarantees hold; the timing around a failure does not match. The simulator steps in 1200 ms ticks and moves faster or slower than a broker in places, so the scenarios stay short enough to watch.

What Simulator Apache Kafka 4.3.1
A new leader after a hard kill About 1 second 9 to 10 seconds: the controller first waits broker.session.timeout.ms (9 seconds by default) before it fences the broker
How long the killed leader’s partition takes no writes 12 to 16 seconds 9 to 11 seconds
Time to answer a produce About one tick, 1200 ms Milliseconds
When the old leader comes back Leadership moves back to it at once, which is one more short failover of 1 to 5 seconds The new leader stays until the next leader-imbalance check, every 300 seconds by default (leader.imbalance.check.interval.seconds)
A copier restarted after a hard kill Its first commit came 43 seconds later: a transaction lasts a few ticks, so the kill landed inside one, and the new copier waits for the coordinator to abort it at its 40 second timeout 2 seconds later: a transaction lasts milliseconds, so the kill landed between two. A kill inside one waits for the timeout the same way

The first and fourth rows are approximations the simulator makes on purpose and lists on its Fidelity page: compressed timeouts, so a scenario plays in seconds, and auto.leader.rebalance.enable returning leadership as soon as the preferred replica is back. The runs confirm both against a real cluster.

The second row follows from the third. The simulator elects the new leader sooner, but it answers produces once a tick, and a client keeps several produces in flight on a connection. Responses on a connection come back in request order, so the metadata request that would tell the client about the new leader waits behind them, and the client keeps writing to the dead leader for several seconds. In both cases the client retries and nothing is lost.

Not covered yet

  • What the bridge does not support at all: TLS and SASL. See Limits.
  • Kafka Streams beyond the word count: other topologies, and the streams group protocol of KIP-1071.

For everything else the simulator models and approximates, see the Kafka Simulator’s Fidelity page.