pastebin.com/abc123) the user can share.DAU - 5000000
Pastes per day - 1000000
Read to write ratio - 10:1
RPS(write) = 1000000 / 86400 = 12
RPS(read) = 120
Avg paste size = 10 KB
Storage per day = 1000000 * 10 = 10 GB/day
Storage over 5 year = 10 * 365 * 5 = 18 TB
Bandwidth = 120 * 10 KB = 1200
POST /pastes
{
"content": "...",
"expiration": "24h"
}
-> 201 Created
{
"key": "abc123",
"url": " https://pastebin.com/abc123",
"expire_at": "..."
}
GET /pastes/abc123
-> 200 Ok
{
"content": "...",
"created_at": "...",
}
-> 404 Not Found
{
"error": "Paste expired or does not exist"
}
CDN - the client sends a request to the CDN to find cacheable content
Load Balancer - if the required content is not cached, the request is sent to a load balancer to distribute the load.
API Gateway - accepts incoming requests from clients and redirects them to the required microservices
Expiration Service - a microservice for checking and monitoring content for elapsed time; if the availability time is exceeded, a message is returned stating that the content is no longer available
Content Service - microservice for working with content that creates new texts by link and returns existing content by short link
Short URL Service - microservice for working with short URLs that creates new short links and returns the full URL for a short link.
Redis - a database for storing the mapping of Short URLs to full URLs
PostgreSQL - database for storing texts
Define the data model. Identify the main entities, their attributes, and relationships. Consider the choice of database type (SQL vs NoSQL) and justify your decision based on access patterns...
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.