简体   繁体   中英

Aws S3 or server storage using CDN

I'm building a social media platform for practice like Facebook and I'm pondering between using aws S3 cloudfront or a CDN server to store images and videos every time a user uploads them and of course sending these images and videos to the client side every time the client requests them which will be when they swipe down in the news feed section of my platform.

Each time a client swipes down a request will be sent to my server to load the latest 15 posts and these posts will contain images and videos and the src in the and tag will be pointing to the CDN source.

Because 15 images/videos will need to load each time a client swipes down, I'm wondering if aws S3 cloudfront would deliver this content fast enough or should I just bite the bullet and store all these videos and files directly to my CDN server?

Please tell me if aws S3 with cloudfront will be fast enough for a rich user experience.

Thanks

I don't know what you consider fast enough, but most likely S3 + CloudFront will work for you.

The idea is to set up CloudFront with an S3 bucket as the origin for the data. When a user requests content, they're routed to the nearest CloudFront edge location of which there are over 200 all over the world. CloudFront will then check if the data is in the local cache and if that's the case ( cache-hit ) directly return it to the user. If the data isn't yet in the cache ( cache-miss ) it will talk to the origin, download the image, add it to the cache and send it back to the end user.

Subsequent requests to that edge location will then be faster. There is no built in mechanism to pre-populate the cache though, but I don't think this will matter in the context of your toy application.

You'll probably benefit more from the tight integration in the AWS ecosystem and the resulting enhanced developer experience than if you were trying to set up another CDN as well. If the goal of your practice project is to learn about programming, go for CloudFront + S3, if the primary goal is to test different CDNs, do that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM