Scalable: highly scalable; horizontal scaling
Consistency: eventually consistent (its okay to provide stale data, but not okay to return nothing or fail)
Availability: high
Partition tolerance: high
faster read than writes: its okay to take time to add entry, but short to long retrival has to be faster(better for UX)
100K requests in a day:
in a sec 100000/24*60*60 ~ 2 req/sec
say a entry is like 4KB,
total storage for 10years is
4KB *100000* 365*10 = 1.46TB
data is relatively less;
this can be done on SQL database(less data, easy to manage, no need for distributed systems)
URL table columns (uniqueId, bigUrl, shortUrl)
indexed on bugUrl for faster search
user -> API gateway ->(encode service, decode service, delete service) each horizontally scaled with individual load balancer -> decode service is cached with redis -> else all three services hit DB -> SQL(PostgresSQL)
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?