Apache Kafka
medium 34 minApache Kafka is a distributed log for events.
Check yourself
One question at a time. Each answer explains why.
Question 1 of 12
What sets the most consumers of one consumer group that can work on a topic at once?
With acks=all and replication factor 3, who must have the record before the acknowledgement?
A consumer processes a record and crashes before the commit. What happens?
Which set makes a read, process, write application exactly once inside Kafka?
Where does the extra cost of transactions mainly arise?
When is at-most-once delivery acceptable?
What is the usual cause of a hot partition?
Why might more partitions fail to help a hot partition?
Replication factor 3, min.insync.replicas 2, acks=all. Two brokers of a partition are gone. What happens?
Which stream processor is a library inside your own service?
Since Kafka 4.0, where does cluster metadata live?
Jobs are independent, take minutes, and you want 200 workers on a topic with 12 partitions. Which fits?
Pick an answer to see why.
Not quite. Each partition has one reader in a group.
Not quite. All means all in-sync replicas. min.insync.replicas sets the floor.
Not quite. The next owner starts at the last committed position.
Not quite. Retries, atomic output with positions, and readers that skip aborted data are three separate problems.
Not quite. Coordination and markers are paid per transaction and partition.
Not quite. Only when an occasional loss does no harm.
Not quite. A key always goes to one partition.
Not quite. Change the key, not the count.
Not quite. One in-sync copy is below the minimum of two.
Not quite. The others run on a cluster of their own.
Not quite. KRaft is the only mode.
Not quite. Share groups let consumers outnumber partitions and acknowledge records one by one.
Flashcards
Say your answer, then reveal it.
Card 1 of 11
What gives order in Kafka?
The partition. Same key, same partition, same order.
Say your answer, then reveal it.
What limits the consumers of one group?
The number of partitions. Share groups lift the limit and lose the order.
Say your answer, then reveal it.
The safe write settings?
Replication factor 3, min.insync.replicas 2, acks=all, idempotence on.
Say your answer, then reveal it.
Default of min.insync.replicas?
1. Set it yourself.
Say your answer, then reveal it.
What is the high watermark?
The point up to which records are committed and readable.
Say your answer, then reveal it.
Commit before or after the work?
After: at least once. Before: at most once.
Say your answer, then reveal it.
What does exactly once need?
Idempotent producer, a transaction with the offsets in it, read_committed readers. Inside Kafka only.
Say your answer, then reveal it.
Why not add partitions to cure a hot key?
One key always hashes to one partition. Split the key.
Say your answer, then reveal it.
Default retention and segment size?
7 days and 1 GiB.
Say your answer, then reveal it.
What replaced ZooKeeper?
KRaft controllers, usually 3 or 5. Since 4.0 there is nothing else.
Say your answer, then reveal it.
How do you delete a key from a compacted topic?
Send a tombstone: the key with a null value.
Say your answer, then reveal it.
These cards come back in Today, just before you would forget them.