Design a blogging platform like a small Medium. Authors write posts with text and images, readers browse a homepage of recent and popular posts, read articles and leave comments. The platform has 200,000 authors, 2 million posts and 10 million monthly readers. At peak it serves about 5,000 page views per second, and a single post can suddenly get much more traffic when it is shared widely. Authors publish around 5,000 posts a day.
Functional requirements
Authors create, edit and publish posts with images
Readers view a post and its comments
Browse a homepage of recent and popular posts
Signed-in readers comment on posts
Non-functional requirements
Post pages load in under 200 ms at p95
Published posts and comments are never lost
A post shared widely does not slow down the rest of the site
Constraints and scale
10 million monthly readers, 5,000 page views per second at peak
2 million posts, 5,000 new posts per day
Images up to 10 MB each
You will practise
Identify a read-heavy workload and cache at the right layers
Model posts, authors and comments in a relational database
Serve images and cacheable pages from a CDN
Show 2 hints
A published post rarely changes. How long could its page be cached?
Comments change often but posts do not. Do they need the same caching rules?