Skip to content

Design a URL Shortener, stage 5 of 9: decide

Make redirects fast far from the servers

Nothing is overloaded, but users in Sydney are waiting. Work out why before choosing a fix.

System so far· 5 parts
123CLIENTClickersSERVICERedirect serviceDATABASEPostgresSERVICELinks APICLIENTCustomerdashboard

Select a component to see what it is responsible for and which state it owns.

  1. 1Redirect service → Postgres: Look up code
  2. 2Customer dashboard → Links API: Create, edit, disable
  3. 3Links API → Postgres: Insert with unique code

What you need to know

0 of 2 checks done
  1. Two different things make a request slow:

    • Load: a component is too busy, so requests queue. You see high CPU, long queues or many open connections.
    • Latency from distance: data takes time to travel. Light in optical fibre covers about 200 km per millisecond, and nothing goes faster.

    They need different fixes, so diagnose first.

  2. Work it out

    Sydney to the US East Coast is about 16,000 km. What is the fastest possible round trip, there and back, in milliseconds?
    ms