receive long URL, return shortened url
receive shortened URL, redirect to long url
need to persist for 30 days
should be highly available (aka fast)
100s of users per minute
tens of thousands of records per day
REST
shorten
retrieve
one table
columns:
original url, shortened url, created_at
primary key would be shortened url since that's what we'll be querying by
expiring records?
would use sql, but could use nosql since it's so simple.
Pretty simple. only two possible types of request, basically a save and retrieve.
save will take long url, generate. short url, then return it to the client
retrieve will take short url, map it back to long, and redirect
wanted to keep this as simple as possible. no need for users or auth
extremely high use could bog it down.
many stale URLs, could be cleaned up
add periodic cleanup logic or expiration
could have multiple instances and a load balancer,
rate limiting to prevent abuse