Loading...
Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
We need two API endpoints.
POST /create
Takes a URL in the POST body and returns the unique ID associated with the URL.
GET /{id}
Returns the URL associated with the ID.
When creating a short-URL, the server adds a row to a database column contains the ID and the URL. For low latency, we use a redis cache for retrieval requests to avoid excessive database requests.
Let us keep it simple and have a table with 3 columns: id, shorturl_id, url.
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.