Chapter 3: Pastebin Flashcards
1
Q
Requirements
A
Functional 1. Users should be able to upload or paste their data and get a unique URL. 2. Only text data 3. Liks will have a expiry date. 4. Custom alias Non Functional 1. Highly reliable 2. Highlt Available 3. Realtime with low latency 4. Links should not be guessable. Extended: 1. Analytics 2. Rest api service.
2
Q
Design Considerations
A
- 10 MB paste limit
2. URL size limit
3
Q
Capacity estimation
A
- One million pastes per day.
- Approx 12 pastes per second
- Approx 60 reads per second
4
Q
Storage estimation
A
- 1M * 10kb per day == 10GB per day
- For 10 years, it will be 36 TB
- At 70 percent capacity, we need 50TB.
- Ingress -> 10 KB * 12 == 120KB
- Egress -> 10 KB * 60 == 600KB
- Cache for 20% == 10GB
5
Q
API
A
addPaste(key, data, custom_url, user, paste, expiry_date)
deletePaste(key, url)
6
Q
HLD
A
I would use a key value store with consistent hashing. He has written two databases, one for metadata and one for pastes, but I don’t think it is good.
7
Q
Application Layer
A
- Key generation
2. Duplicates and collision
8
Q
Datastore Layer
A
- Key value store
- Cleanup
- Partitioning
- Cache and Load Balancer
- Security and Permissions