CSE Roadmap

Specialist tier · about 2 hours · 6 parts

Part 6 of 6 · 4 min read

Exercises

Easy

Easy 1: Name the parts (10 minutes)

A weather station sends a temperature reading every minute to a dashboard that displays the latest value. Identify the event, the producer, and the consumer.

Done when: all three are named correctly with a one-line reason each.

Hint

the event is the reading itself; the producer sends it; the consumer displays it.

Easy 2: Queue or log (10 minutes)

A payments team needs every consumer, including ones added next year, to be able to replay the full history of transaction events from the beginning. Should they use a traditional deleting message queue or a log-based broker, and why?

Done when: you pick the log-based broker and explain using the replay requirement.

Hint

replay from the beginning is only possible with a durable, non-deleting log.

Easy 3: Read the offsets (10 minutes)

A partition has offsets 0 through 20, and a consumer's last committed offset is 14. Which messages has it already processed, and which has it not yet seen?

Done when: you correctly state 0 through 14 as processed and 15 through 20 as not yet seen.

Hint

the committed offset marks the boundary between processed and unprocessed messages.

Medium

Medium 1: Size the consumer group (20 minutes)

A topic has 5 partitions. Explain what happens if a consumer group for that topic has 3 consumers, and what happens if it has 7 consumers.

Done when: you explain the uneven split at 3 and that 2 of the 7 consumers at the second count sit idle.

Hint

with 5 partitions and 3 consumers, some consumers get two partitions; with 7 consumers, 2 have none to read.

Medium 2: Pick the window (20 minutes)

The bookstore wants a count of page views per book for each calendar minute, with no minute's count ever including a view from another minute. Which window type fits, and how would you compute the window key for an event timestamped 10:07:42?

Done when: you name the tumbling window and compute the correct window key.

Hint

a tumbling window fits because it never overlaps; floor(timestamp in seconds / 60) gives the window key for 10:07:42.

Medium 3: Trace a slow consumer (20 minutes)

A log-based broker's partition 2 is being read by a consumer that is unusually slow to process each message. Explain what happens to messages arriving on that partition while the consumer is behind, and what happens to a different partition's consumer in the same group.

Done when: you explain that partition 2's unprocessed messages simply wait in the log and that other partitions' consumers in the group are unaffected.

Hint

a log-based broker lets partitions progress independently, so a slow consumer on one partition never blocks another partition's consumer.

Hard

Hard 1: Compare broker styles for a workload (25 minutes)

The bookstore has two needs: a fraud-detection system that must process every transaction event in order and replay history after a bug fix, and a notification system where occasionally dropping a "low stock" alert is acceptable if the consumer is briefly offline. Recommend a broker style for each and justify the choice.

Done when: you pick log-based for the first and justify why a simpler queue can suffice for the second, naming the trade-off each time.

Hint

ordering and replay needs point to a log-based broker; tolerance for occasional loss opens the door to a simpler queue.

Hard 2: Design a partitioning key (25 minutes)

The bookstore wants every event for a given customer to be processed in order, but is fine with no ordering guarantee across different customers. Explain how to choose a partitioning key to achieve this, and why hashing on customer_id achieves it.

Done when: your answer names customer_id as the partition key and explains that same-key events land in the same partition, preserving their order.

Hint

hashing customer_id into a fixed number of partitions sends every event for one customer to the same partition, where order within a partition is preserved.

Hard 3: Diagnose a replay bug (30 minutes)

A consumer group member crashes after processing a message but before committing its offset, then a new member is assigned that partition. Explain what the new member will do when it resumes, and why an application built on top of this needs to tolerate processing the same message more than once.

Done when: your explanation states the new consumer resumes from the last committed offset, which may be before the crashed message, and that this can cause the same message to be processed twice.

Hint

the new consumer resumes at the last committed offset, which is before the crashed message, so that message gets delivered again; the application must handle duplicate processing safely.