Producers & Consumers Flashcards

(8 cards)

1
Q

What is a Kafka Producer?

A

A Producer is a client application that publishes (writes) records to Kafka topics. Producers decide which partition to send data to and can configure acknowledgment settings for reliability.

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

What is a Kafka Consumer?

A

A Consumer is a client application that reads records from Kafka topics. Consumers subscribe to topics and process the stream of records produced to them, tracking their position via offsets.

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

What is a Consumer Group?

A

A Consumer Group is a set of consumers that work together to consume topics. Partitions are distributed among consumers in the group, providing both scalability and fault tolerance.

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

How does Kafka ensure message ordering?

A

Kafka guarantees order only within a partition, not across partitions. For strict ordering, use single-partition topics or use keys to ensure related messages go to the same partition.

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

What is the role of message keys in partitioning?

A

When a producer sends a message with a key, Kafka hashes the key to determine the target partition. This ensures all messages with the same key go to the same partition, maintaining order for related messages.

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

What are Producer Acknowledgments (acks)?

A

acks=0: Fire and forget, acks=1: Wait for leader acknowledgment, acks=all: Wait for all in-sync replicas acknowledgment. Higher acks increase durability but decrease throughput.

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

What is Consumer Offset?

A

Offset is a sequential ID number assigned to each record in a partition. Consumers track their current position (offset) in each partition, allowing them to resume from where they left off.

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

What is the difference between Earliest and Latest offset reset?

A

Earliest: Start from beginning of partition. Latest: Start from only new messages. This setting is used when a consumer group starts for the first time or has invalid offsets.

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