Pastebin is a website that allows users to share plain text through public posts called “pastes”.
Prerequisites:
System design introduction : 3 principles of distributed system, 5 step guide for System design.
System design concepts & components : Horizontal scaling, Databases
Functional requirements
Non-functional requirements
String createPaste(pasteData, expirationDate : optional, title : optional) : returns shortUrl
PasteData getPaste(shortUrl)
PasteUrl: ShortUrl<PK>, CreationDate, ExpirationDate, PasteData
What kind of database to use?
NoSQL document databases
Partition key?
Consistent hashing on short url.
We need to calculate 3 estimations
Answer 1 :
Answer 2 :
Answer 3 :
Number of servers required?
Say each server handles 10MB reads per second we would need minimum 10 servers for reading and 1 server for writing.
Caching capacity using 80-20 rule?
Problem statement :
Create unique URLs for the pastes generated. Also save all the pastes in document db.
Solution :
Additional requirements