I am still trying to wrap my head around CDN's in a real world scenario.
- Suppose I am building a Netflix clone.
- I have about 1,000 terabytes of video content stored in an S3 bucket.
- Since Netflix is used globally, I'd probably replicate it across the globe for lower latency. So, now I have 20 of the same S3 buckets full of video content.
- However, if 25 MILLION people are on the platform, that could potentially be 500tb per hour being streamed. This does not seem practical and I can't just keep making more data stores.
Here is what I understand about CDN's:
- Reduce latency (The DNS will forward you to the closest CDN server anywhere in the globe).
- Performant (CDN's will optimize caching so you may not need to fetch from origin again).
- Security (Extra protection against DDOS attacks)
However, wouldn't the CDN (server) still have to hit the data center to get the video content (suppose nothing is cached). How is the CDN helping with reducing the 500tb/h that is being streamed?
Here is what I have drawn out (I am looking for criticism).
My idea is that, with load balancers and reverse proxies, the user visits one of the many applications servers (that respond with the video page, genres page, etc). Once the user selects a particular film, then I think what I want to do is use the CDNs to deliver the GB's of data across many users... however, I am still confused how is the CDN going to serve that data? Where did it get it from? Wouldn't it still have to the datastore?