System requirements
Traffic Assumption:
Storage:
Total: 150 bytes => roundoff to 200 bytes
Daily Storage => 200×60×60×24×200 => 3.4 GB/day
1 year storage => 3.4 * 365 => 1.241 TB =>roundoff 2 TB
We can use Dynamo Db to store the mappings, since the system is read heavy and requires strong consistency.
DynamoDB provides horizontal scalability, high performance, and optional strong consistency.
Write Path:
Read Path:
API gateway: This allows us to streamline user requests to different API, acting as a bridge between client and different background services.
We can allow rate limiting, which in turn, can limit the number of requests made to the application and save the application from DDoS attacks.
Cache: Caching with tools like Redis can reduce the overload on the servers, by caching the mappings and directly responding to client. This results in low latency and high scalability of the application.
DynamoDB: This offers heavy read operations, which is necessary for this application and offers strong consistency, since the shortURL should be readily available to the user.
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?