Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Production-Ready URL Cache Service

Evolve a process-local HTTP URL-cache service into a horizontally scalable, versioned, and observable production service with explicit error semantics.

Problem statement

For this exercise, assume an existing HTTP service lets clients write and read cached URL entries by an opaque cache key. Each entry contains a URL string as application data; the service does not shorten URLs and does not fetch remote content. The starting implementation keeps every entry in one application process.

Design a production-ready version that preserves this small product boundary while allowing several service instances to share state through an external distributed cache or database.

Define global exception handling and a stable response contract that distinguishes invalid client requests reported as HTTP 400 from unexpected server failures reported as HTTP 500. Explain how the API is versioned and how operators observe both business behavior and infrastructure health.

The report does not provide traffic volume, entry count, latency or availability targets, expiration or eviction semantics, or retention requirements. Identify those gaps, state only the assumptions needed to evaluate your design, and do not silently turn the service into a URL shortener, web crawler, or content cache.

What to build

  1. A client can write a URL cache entry under an opaque cache key and read the current entry or a documented absence outcome through a versioned HTTP contract.
  2. Invalid client input produces a safe HTTP 400 response, while an unexpected server failure produces a safe HTTP 500 response through one global exception contract.
  3. Several stateless HTTP service instances can observe and update one shared URL-entry state through an external distributed cache or database instead of process-local memory.
  4. Operators can measure business and infrastructure behavior, diagnose failures, and introduce a new API version without silently breaking callers of the existing version.

At scale

  • Source fact: the starting implementation stores cached URL entries only in one server process.
  • Source fact: the production discussion requires replacing process-local state with an external distributed cache or database so multiple service instances can scale together.
  • Source fact: the production discussion explicitly covers global exception handling, HTTP 400 and HTTP 500 responses, business and infrastructure telemetry, and API versioning.
  • The source supplies no numeric workload, entry-size, latency, availability, expiration, eviction, or retention target; the candidate should identify and justify any assumption used to choose or size the shared store.