Chapter 7 checkpoint: asynchronous processing and events
Every question from this chapter’s lessons. Your first answer to each is the one that counts; afterward you can practice again as often as you like. Passing needs 75% right on the first attempt.
0 of 17 answered0 right on the first attempt
Question 1 of 17
A server has 200 worker threads, and each request holds a thread for 5 seconds while a PDF renders. At most how many requests per second can it sustain?
RPS
Answers within 2% count.
Question 2 of 17
An upload endpoint now puts a transcoding job on a queue instead of doing the work. What should it answer straight away?
Question 3 of 17
Match each system to how it treats messages.
Question 4 of 17
A Kafka topic has 12 partitions, and a consumer group runs 20 consumers on it. How many of them are actually consuming?
consumers
Answers within 1% count.
Question 5 of 17
A payment consumer reads charge events from an at-least-once queue. How should it make sure a redelivered event never charges a customer twice?
Question 6 of 17
Match each delivery guarantee to what it means.
Question 7 of 17
A consumer first sets a Redis key for each message id with
SET NX, then applies the payment in the database. After a crash, some payments were never applied, though their messages were redelivered. Why?Question 8 of 17
Each customer’s deposits and transfers must be processed in order, but customers are independent of each other. How do you get that ordering without a single bottleneck?
Question 9 of 17
For 10 seconds, 12,000 jobs per second arrive. There are 20 workers, each handling 500 jobs per second. Afterward arrivals drop to 2,000 per second. How many seconds does the backlog take to drain?
Answers within 5% count, in any unit you choose.
Question 10 of 17
One malformed message makes the consumer of a Kafka partition throw every time it reads it, and nothing behind that message is processed. What fixes it?
Question 11 of 17
A client retries with full jitter: it waits a random time between 0 and min(M,B⋅2i), with base B=100 ms, cap M=30 s and i the attempt number. What is the longest it can wait on attempt i=5, in seconds?
Answers within 2% count, in any unit you choose.
Question 12 of 17
Why add random jitter to exponential backoff?
Question 13 of 17
A service inserts an order into its database and then publishes an
OrderPlaced event to Kafka from application code. What can go wrong?Question 14 of 17
Put the steps of the transactional outbox in order.
- A relay reads the outbox, by polling or from the change log
- The relay publishes the event to the broker
- Commit the transaction
- Consumers apply the event idempotently
- Insert the order and an outbox row in one transaction
Question 15 of 17
What is event sourcing?
Question 16 of 17
When does Martin Fowler suggest using CQRS?
Question 17 of 17
Producers publish 12,000 events a second, 1 KB each, to a Kafka topic with 6 partitions. One consumer group reads them and writes each to a database. Which component falls behind?