Kafka Flashcards

(35 cards)

1
Q

How does a producer send a message in a log-based broker like Kafka?

A

It appends the message to the end of the log.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does a Kafka consumer receive messages?

A

By reading the log sequentially from its current offset.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Can a Kafka log be partitioned across machines?

A

Yes; partitions are spread across brokers for scalability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a topic in Kafka?

A

A named group of partitions that store messages of the same type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What property does every message within a partition have?

A

A monotonically increasing offset.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Are messages within a partition totally ordered?

A

Yes; total order is guaranteed only inside a single partition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Does reading a message delete it from the Kafka log?

A

No; reading is non-destructive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When is Kafka a good fit?

A

When you need high throughput fast processing and per key ordering.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you keep related messages in order?

A

Route them to the same partition using a consistent partition key such as userId.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does a consumer offset represent?

A

The position of the next message the consumer will read.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why does the broker periodically store consumer offsets?

A

So consumers can resume after failures without rereading processed messages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How does Kafka reclaim disk space on a log?

A

By splitting logs into segments and deleting or archiving old segments based on retention policy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What happens if a consumer offset points to a deleted segment?

A

It permanently misses those messages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you detect slow consumers?

A

Monitor consumer lag and alert when it grows large.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What tool captures database changes and publishes them to Kafka?

A

Debezium.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How does the Debezium PostgreSQL connector read changes?

A

It opens a logical replication slot and streams WAL insert update delete events into Kafka.

17
Q

In Debezium what is the default topic strategy per table?

A

One topic per table.

18
Q

What is a Kafka broker?

A

A server that stores partitions and serves read and write requests.

19
Q

How is fault tolerance provided for partitions?

A

By replicating each partition across multiple brokers with one leader and followers.

20
Q

What protocol has replaced ZooKeeper in modern Kafka?

A

KRaft the built in Raft metadata quorum.

21
Q

What is a consumer group?

A

A set of consumers that share work each partition is consumed by at most one member of the group.

22
Q

What happens when membership of a consumer group changes?

A

Kafka triggers a rebalance to redistribute partitions.

23
Q

What delivery semantics can Kafka provide?

A

At least once at most once and exactly once.

24
Q

How do idempotent producers help exactly once semantics?

A

They assign sequence numbers per partition so retries do not create duplicates.

25
Which producer acks setting waits only for the leader?
acks equals one waits for leader only.
26
Which acks setting waits for all in-sync replicas?
acks equals all waits for all in sync replicas.
27
Name two common log retention configurations.
retention dot bytes and retention dot ms.
28
What is log compaction?
A mode where Kafka keeps only the latest record per key and removes older versions.
29
Why might you use log compaction?
To provide fast snapshots of the latest state while still supporting history.
30
What is Kafka Connect?
A framework to run source and sink connectors that move data in and out of Kafka.
31
What is Kafka Streams?
A client library for building stateful stream processing applications on Kafka.
32
How is exactly once achieved end-to-end in Kafka Streams?
By using transactional producers and commit markers that write records and offsets atomically.
33
What metric shows partition fullness relative to retention?
Log end offset minus retention start offset size.
34
How can a Django backend fetch a specific message from Kafka?
By using Kafka consumer API to seek by offset or timestamp and reading the record payload.
35
Does Debezium act as the CDC layer between Postgres and Kafka?
Yes it captures database change events and publishes them to Kafka topics.