We suppose QPS is 100, and there are 10% of content will be written into cache. Each item is 0.5mb, so the storage would be 5 MB/s, which is about 400 GB/day, and 150 TB/year.
For cacheCheck, return true if we find the key {resource_id} in the cache, and the resource_id is not expired.
For cacheReturn, if cacheCheck is true, it will be called to return the content.
For cacheWrite, if cacheCheck is false, it will be called to request content from the server, and write the key-value into the cache. To increase the performance, it can be run asynchronously. Consider the contents are static and does not require strong consistency. It's reasonable.
Database should be divided into memory cached database and persistent database. For contents which are most frequently accessed, we can store them in memory, and for others we can store them on S3 and use database to store their URL. Because the storage increases so quickly, and the web contents are not structured like css, images. We should use NoSQL. Each item will have resource_id, version, expired_date, and URL.
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
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?