How can I troubleshoot slow loading times when I use a web browser to download an object stored in Amazon S3?

Last updated: 2020-03-06

I'm trying to download an object from Amazon Simple Storage Service (Amazon S3) using a web browser, but the download is slow. Why is this happening?

Resolution

Check the following to identify what's contributing to the slow download times from Amazon S3 using a web browser:

Low internet bandwidth

Verify the network speed that you're getting from your internet service provider (ISP). If the speed is lower, it can cause a bottleneck when you try to connect to the Amazon S3 bucket and download objects.

Large object size

If some objects take longer to download, while other objects download at a normal speed, then check the size of the objects that take a longer time to download. For very large Amazon S3 objects, you might notice slow download times as your web browser tries to download the entire object. Instead, try downloading large objects with a ranged GET request using the Amazon S3 API. Because a ranged GET request allows you to download a large object in separate, smaller chunks, it can help you avoid latency.

Geographical distance between the clients and the Amazon S3 bucket

If you have clients from different parts of the world that download from your Amazon S3 bucket, then the clients that are geographically distant from the AWS Region of your bucket might experience slow download times. To improve download times for geographically distant clients, you can:

  • Serve your Amazon S3 objects from an Amazon CloudFront distribution. CloudFront can serve your clients from an edge location that's geographically closer to them, which can minimize latency.
  • Consider moving your bucket to an AWS Region that's geographically closer to your clients. You can use cross-Region replication to copy objects from the source bucket into the destination bucket in another Region.

Intermediate network-related issues

Network-related issues such as packet loss, high number of hops, or any other ISP-related issue can affect Amazon S3 download times using a web browser.

To determine if a network-related issue is contributing to the slow downloads, you can use tools such as mtr and traceroute. These tools can help identify possible network issues while sending packets to a remote host. For example, the following traceroute command sends a TCP traceroute to the Amazon S3 endpoint in us-east-1 over port 80:

sudo traceroute -P TCP -p 80 s3.us-east-1.amazonaws.com

Note: It's a best practice to run a TCP traceroute, because many network devices don't respond over ICMP.

Workstation resources

Confirm that there's no resource contention within your workstation (for example, CPU, memory, or network bandwidth) that might be contributing to the overall latency.

You can check the resource usage on most client systems using tools such as Resource Monitor or the top command, depending on your operating system.

Isolate processing time from Amazon S3

To help identify what's contributing to the slow download times, you can isolate the processing time from Amazon S3. You can enable server access logging, and then review logs for Total Time, which shows how long Amazon S3 took to process the request.

Additionally, you can analyze the Amazon CloudWatch metric FirstByteLatency. FirstByteLatency shows how long it took for Amazon S3 to process the request from the client and then begin sending the response to the client. The CloudWatch metric provides a bucket-level perspective of performance.

Note: Amazon S3 CloudWatch request metrics are billed at the same rate as custom metrics.


Did this article help you?

Anything we could improve?


Need more help?