Search code examples
file-uploadamazon-web-servicesamazon-s3amazon-cloudfront

How does using CloudFront improve upload speed?


Amazon supports POST and PUT requests with its CloudFront CDN service.

The FAQ says that

Amazon CloudFront does not cache the responses to POST, PUT, DELETE, and PATCH requests – these requests are proxied back to the origin server. You may enable caching for the responses to OPTIONS requests.

I understand how a CDN improves performance in getting content from a server to a client. How does it improve performance in getting getting content from the client to a server? How can uploads be made faster by introducing a middleman?

In the context of uploading files, does having the CloudFront distribution backed by S3 make a difference? If so, how?


Solution

  • Yes, even uploads (and no-cache GETs) can be made faster by using a CDN (like CloudFrond), but latency is not usually the point for them.

    There are two reasons for the possible latency reduction:

    1. The network path from the user to the origin is unpredictable, but if the origin is inside AWS, the path from the edge location to the AWS (and your origin) is managed, and thus probably faster.

    2. The HTTP connections from the edge location to the origin can be kept alive, resulting in less overhead from establishing new connections.

    But these features are useful not only for latency, but to place your whole site under CloudFront and not mind about Single Origin Request Policy and Cross Origin Resource Sharing.

    See this presentation for more information.