advanced 2 min answer

Chat clients download the full workspace user and channel directory on connect. For large workspaces this is slow and expensive. A CDN does not help. Why, and what does?

slackedgecachingapplication-aware
Show the full answer Hide the answer

What the interviewer is testing

Whether you understand the limits of generic HTTP caching and can propose an application-aware cache.

Why a CDN does not help

A CDN caches responses keyed by URL. These requests are:

Personalised — what a user may see depends on their membership and permissions. Authenticated, so responses are per-session. Query-shaped rather than document-shaped — the client needs specific users and channels, and the set differs per session and changes as they navigate. Backed by mutable data — names, membership and channel metadata change.

There is no cacheable URL-to-response mapping here. A CDN can cache neither the full directory (it is per-workspace and mutable) nor the individual lookups (they are authenticated and unbounded in variety).

What does work

An application-aware cache at the edge, holding the domain objects — users, channels, membership — rather than HTTP responses.

Because it understands the domain, it can:

Answer a query it has never seen from data it already holds, which a response cache cannot. Be updated by the backend when an object changes, rather than relying on TTL expiry. Apply permission filtering at the edge against the requesting session.

This is what Slack's Flannel does, and the client model changes with it: from "download everything up front" to "fetch what is needed, on demand, from something nearby".

The costs

A stateful service in the request path with its own invalidation logic, failure modes and consistency questions — how stale may a display name be, and what happens when the cache is unreachable. Substantially more complex than a CDN and substantially more capable.

What a strong answer adds

The insight that precedes the caching decision: examine what clients actually need before optimising how it is delivered. The original design sent everything because it was simple; the realisation was that a client needs a small unpredictable subset, and the fix was making that subset cheap to fetch rather than compressing the whole.

And the general rule: CDNs cache responses; they cannot cache a domain. When data is personalised, authenticated and query-shaped, an application-aware cache is the tool.

Common weak answers

Compressing the payload, which reduces the symptom. Longer client-side caching, which does not solve the first connection or handle changes.