Learning pathsPricingChecking sign-in…
GUIDED PRACTICE

Slack Job Queue

Slack describes a Redis queue outage caused by backlog and memory pressure.

Slack describes a Redis queue outage caused by backlog and memory pressure. Its incremental redesign put Kafka before Redis rather than immediately replacing every queue behavior. Kafkagate accepted jobs into Kafka and relay components fed the existing execution layer. Preserving established scheduling and deduplication behavior made the migration smaller. This historical account illustrates durable buffering and controlled change, not unlimited downstream throughput. Source publication: 2017-12-06; updated 2020-06-25. The walkthrough below is an original interview exercise, not an undocumented claim about the company.

Bound staging bytes separately from durable ingress

In our exercise, memory staging has a 100 MB budget. Stop the relay at 80 MB and resume below 60 MB; the two thresholds prevent rapid oscillation. Count pending and in-flight payloads, retries and metadata. A queue with only 10,000 items can still overflow if each item is large.

Contract / pseudocode
durable ingress: partition 0 offset 42
relay stages job j42; acknowledgement lost
retry stages same j42 -> identity-aware recovery
worker side effect: separately deduped under job operation
durable ingress: partition 0 offset 42; relay stages job j42; acknowledgement lost; retry stages same j42 -> identity-aware recovery; worker side effect: separately deduped under job operation
Bound staging bytes separately from durable ingress
Read the diagram

durable ingress: partition 0 offset 42; relay stages job j42; acknowledgement lost; retry stages same j42 -> identity-aware recovery; worker side effect: separately deduped under job operation

Open original
Bound staging bytes separately from durable ingress
durable ingress: partition 0 offset 42; relay stages job j42; acknowledgement lost; retry stages same j42 -> identity-aware recovery; worker side effect: separately deduped under job operation

Bound staging bytes separately from durable ingress

The relay checkpoint cannot advance past work not safely owned by the next stage under the protocol. Adding a durable buffer protects acceptance during a downstream outage, but drain capacity still must exceed new arrival rate. Preserve priority, scheduling and retries when changing ingress: a new log is not automatically equivalent to the old queue interface. During rollback, drain or replay jobs accepted only through the new path.

Show answer and explanation

Answer: Recovering the database does not instantaneously clear a backlog or free overloaded memory. Admission, staging limits and a measurable drain plan complete the recovery. The thresholds above are not sourced Slack production settings.

Step-by-step reasoning

1. Calculate the overload window

In an independent queue exercise, arrival is 12,000 jobs/s and execution is 8,000/s. The difference adds 4,000 jobs/s to backlog. After 15 minutes that is 3.6 million jobs. A durable buffer buys recovery time but leaves the throughput deficit unchanged.

2. Bound the staging queue

A relay should stop moving work into a memory queue when it reaches a safe high-water mark. Resume below a lower threshold to avoid rapid oscillation. Include in-flight jobs and retries in capacity accounting; pending length alone understates memory use.

3. Preserve execution semantics

Moving the ingestion boundary does not automatically preserve delayed scheduling, priority or deduplication. Write down each old behavior, identify the new owner and test the transition. The worker must still make side effects safe under repeated delivery.

4. Plan rollback with offsets

For a generic migration, route a small cohort through the new ingress and compare accepted-to-completed counts. Track log offsets and relay acknowledgements. Rollback must not abandon jobs accepted only by the new path, so drain or replay them deliberately.

Contracts and state

The following sketch makes the decision boundary concrete. Field names and capacity assumptions are illustrative; adapt them to the stated product contract.

Contract / pseudocode
job(id,type,arguments_hash,priority,not_before)
relay_checkpoint(partition,offset)
execution(job_id,attempt,state)
staging_budget(pending_bytes,inflight_bytes,limit)

Worked example

Original exercise: a downstream database is slow for ten minutes. Pause relay transfer when staging memory reaches its limit, keep durable ingress within a finite retention budget, and calculate the drain time after recovery. If arrivals remain 12,000/s and execution recovers only to 12,000/s, backlog never shrinks.

Failure walkthrough

Original failure probe: relay enqueues a job but crashes before checkpointing the log offset. The same job will be transferred again. Stable job IDs and idempotent execution must tolerate it. Committing the offset before enqueue would instead create a job-loss window.

Accept into durable log → Relay under staging budget → Worker claims job → Commit business effect → Acknowledge completion safely
Slack Job Queue · scenario walkthrough
Read the diagram

Accept into durable log → Relay under staging budget → Worker claims job → Commit business effect → Acknowledge completion safely

Open original
Slack Job Queue · scenario walkthrough
Accept into durable log → Relay under staging budget → Worker claims job → Commit business effect → Acknowledge completion safely

Slack Job Queue · scenario walkthrough

Decisions and trade-offs

DecisionUseful whenCost to explain
Adopt the mechanismThe same workload constraint is demonstratedValidate with your own measurements
Keep a simpler designYour scale and guarantees are already metMonitor the trigger for changing it

Check your understanding

After recovery, service reaches 16,000 jobs/s while arrival remains 12,000/s. How long to drain 3.6 million jobs?

Show answer and explanation

Answer: The net drain is 4,000 jobs/s, so the ideal lower bound is 900 seconds or 15 minutes. Retries, uneven job costs and other limits can extend it.

Primary documentation

Read the first-party engineering account or official technical reference. Company engineering posts describe the scope and date of that publication; the interview reconstruction and scenarios here are original teaching examples.

Continue the connection

Study Job Scheduler and explain which guarantee from this lesson carries into that topic.

Decision review: Slack Job Queue

Slack Job Queue: What it is

This case studies a historical queue redesign and separates durable ingress from the bounded executable staging path.

Slack Job Queue: Why it is needed

A slow sink can fill staging memory while accepted work still needs recoverable storage, and offset/checkpoint order can lose or repeat transfer.

Slack Job Queue: When to use it

Use it to investigate admission, memory and recovery limits; preserve the article’s original and update dates instead of making a current-traffic claim.

Slack Job Queue: How to use it

In our model, pause bounded staging when full, retain accepted ingress within a finite recoverable horizon and make relay/execution tolerate the same stable job identity. Define what acceptance means when every buffer is full.

Slack Job Queue: Compare an alternative

One durable queue may be simpler for a moderate workload. A relay/staging split can isolate limits but adds checkpoint, retention and recovery coordination.

Slack Job Queue: Published evidence and limits

First-party engineering article — published 2017-12-06; updated 2020-06-25.

The post describes a historical redesign involving Kafka and Redis after resource contention and queue memory failure.

Neither its historical rates nor our relay fixture establishes today’s traffic, retention policy or exactly-once external effects.

Slack Job Queue: Worked decision exercise

The following inputs and policies are original exercise assumptions; they are not measurements or undisclosed company behavior.

Assume arrivals 12,000/s and completions 8,000/s for ten minutes. Backlog grows by 2.4 million jobs. If arrivals fall to 4,000/s while completions remain 8,000/s, the spare 4,000/s drains that backlog in at least ten minutes.

Slack Job Queue: Exercise deficit: 12,000/s - 8,000/s = 4,000/s; 10 minutes adds 2,400,000 jobs; After recovery spare capacity 4,000/s; Drain lower bound 600 seconds with stated assumptions
Slack Job Queue: a concrete state and recovery trace under the exercise assumptions.
Read the diagram

Exercise deficit: 12,000/s - 8,000/s = 4,000/s; 10 minutes adds 2,400,000 jobs; After recovery spare capacity 4,000/s; Drain lower bound 600 seconds with stated assumptions

Open original
Slack Job Queue: worked example
Slack Job Queue: Exercise deficit: 12,000/s - 8,000/s = 4,000/s; 10 minutes adds 2,400,000 jobs; After recovery spare capacity 4,000/s; Drain lower bound 600 seconds with stated assumptions

Slack Job Queue: a concrete state and recovery trace under the exercise assumptions.

Which relay order is safe if enqueue succeeds but checkpoint storage times out?

Show answer and explanation

Answer: Expect replay of the same transferred job when checkpoint follows enqueue; execution must tolerate it. Checkpoint-before-durable-enqueue can skip work after a crash. Include staging bytes and ingress retention in the recovery budget rather than assuming infinite storage.

Slack Job Queue: Check the design

Check staging bytes, oldest ingress age, retained horizon, relay retries and sink recovery. Keep each reported historical metric attached to its source context.

9:00Self-guided practice timer
The timer resets when you leave this page. Save your design separately.
Your challenge

After recovery, service reaches 16,000 jobs/s while arrival remains 12,000/s. How long to drain 3.6 million jobs?

Your design draft

Clarify assumptions, explain your approach, and test the difficult cases. Save your draft, then compare it with the study notes.

Read study notes

Self-review checklist

Self-guided practice. Automated AI feedback and code execution are not connected.