How can I troubleshoot slow loading times when I use a web browser to download an object stored in Amazon S3?
3 minute read
I'm trying to download an object from Amazon Simple Storage Service (Amazon S3) using a web browser, but the download is slow.
To identify the cause of slow download times from Amazon S3 in a web browser, check the following potential issues.
Low internet bandwidth
Verify the network speed that you get from your internet service provider (ISP). If the speed is lower, then it might cause a bottleneck when you try to connect to the S3 bucket and download objects.
Large object size
If some S3 objects take longer to download than other objects, 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 when 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 lets you 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 S3 bucket, then those clients' locations might impact download speed. Clients that are geographically distant from the AWS Region of your bucket might experience slower download times. To improve download times for geographically distant clients, you can take the following actions:
Serve your S3 objects from an Amazon CloudFront distribution. CloudFront can serve your clients from an edge location that's geographically closer to them, and therefore minimize latency.
Move your bucket to a 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.
To determine if a network-related issue contributes to the slow downloads, use tools such as mtr and traceroute. These tools can help identify possible network issues when 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:
Note: Because many network devices don't respond over ICMP, it's a best practice to run a TCP traceroute.
Confirm that there's no resource contention within your workstation (for example, CPU, memory, or network bandwidth) that might contribute to the overall latency.
Depending on your operating system, you can use tools such as Resource Monitor (from the Microsoft website) or the top command to check the resource usage on most client systems.
Isolate processing time from Amazon S3
To help identify what's contributing to the slow download times, isolate the processing time from Amazon S3. Activate server access logging, and then review logs for Total Time. This shows how long Amazon S3 takes to process the request.
You can also analyze the Amazon CloudWatch metric FirstByteLatency. FirstByteLatency shows how long it takes for Amazon S3 to process the request from the client and then send the response to the client. This CloudWatch metric provides a bucket-level perspective of performance.