Bitpath

Boss lesson · Unit 02

Don't make the user wait

Move slow work to a queue, and survive doing it twice

13 exercisesabout 3 min

What you practise

  • Message queues and background workers, smoothing spikes, at-least-once delivery and idempotent consumers, dead-letter queues, pub/sub fan-out, when a queue hides a problem

Try a question from this lesson

Pick one

Uploading a photo takes 8 s: save the file (0.3 s), make thumbnails (4 s), scan it (3 s), notify followers (0.7 s). Which steps must finish before replying "uploaded"?

The idea

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

A queue between now and later

The app does the minimum, puts a job on a queue and replies. Workers take jobs off the queue and do the slow part.

A worker acks a job when it has finished. Only then does the queue delete it. If a worker dies first, the job is handed to another worker.

App --job--> [ queue ] --> Worker 1
 |                     --> Worker 2
 '--> reply "accepted"

11 more exercises in the app

  • 2× type the answer
  • 5× multiple choice
  • 1× fill the blanks
  • 1× true or false
  • 1× match the pairs
  • 1× order the lines

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy