Configure Read Timeout and Keep-Alive Timeout values for your Amazon CloudFront Custom Origins
We are pleased to announce that starting today you can configure the read and keep-alive idle timeout values used by Amazon CloudFront when communicating with custom origins. You can increase or lower either of these values based on the needs of your applications.
Read timeout value specifies the amount of time CloudFront will wait for a response from your custom origin. For instance, applications that perform heavy backend processing (e.g., database query, image processing) before responding to CloudFront may require a higher read timeout value than the default value of 30 seconds. You can also lower your read timeout, if you want to reduce load on a busy origin or serve an error response to the viewer quicker. For instance, for video streaming use cases, you may rely on the video player to quickly failover to a secondary URL by configuring a short timeout for your origin that CloudFront then proxies to your player.
The keep-alive idle timeout value specifies the maximum amount of time that CloudFront will maintain an idle connection with a custom origin server before closing the connection. The default keep-alive idle timeout value is 5 seconds, but you can now configure a higher value up to 60 seconds. Applications that incur less-frequent origin fetches may benefit from maintaining longer keep-alive connections with CloudFront to avoid the latency penalty incurred from re-establishing connections for subsequent requests or users. Note that this may require you to increase the keep-alive timeout value at your origin, in addition to scaling your origin infrastructure to keep connections open with CloudFront for a longer duration.
These features are available today at no additional charge. You can use the AWS Management Console or the Amazon CloudFront API to configure these values. Visit the Amazon CloudFront Developer Guide to learn more about read timeout and keep-alive idle timeout values. To learn more about Amazon CloudFront, please visit our website. To ask questions to our AWS experts, please join one of the upcoming Webinars.