I’m already using extensive disk caching on NVMe instances, and CloudFront has a 70% hit rate. But inside the 30% non-cached requests where my application needs to fetch data from S3, 1-5 MB worth, it takes ~75% of the overall time from incoming request to data served.
My application is running on m5ad.xlarges right now, would a VM with more than “up to 10 Gbps” Ethernet make any difference? Is there an accelerated path to retrieving data from S3, or maybe some tricks/upgrades?
Make sure your app is streaming the data from S3 to the requester, and not downloading the object first and then only afterwards outputting it to the requester. This reduces your time to first byte.
I second the VPC endpoint. Don’t quote me on this but if I remember right requests from EC2 to S3 traverse the internet unless you use an endpoint. Using an endpoint makes traffic traverse the AWS backbone. I remember reading that from an AWS support doc that talked about securing S3, but I can’t seem to find it.
if I remember right requests from EC2 to S3 traverse the internet unless you use an endpoint. Using an endpoint makes traffic traverse the AWS backbone.
This is what I was looking for, I think. I imagined it stayed internal, but if it doesn’t that’s going to add a lot of overhead.
1.25Gbps for m5ad.xlarges. So it sounds like you’re not close to the baseline at peak throughput (measure this!). There is m6id(n) with more bandwidth but I guess it’s not what you need.
Which both offer similar guidelines for improving S3 performance. Given the following info:
“5,500 GET/HEAD requests per second per partitioned prefix” ← this is maximum per-item in S3, you’re at 10 reqs/sec (though you mention per VM, how many total nodes are you using?)
I would suggest the following sections would likely be most useful for you:
Use Byte-Range Fetches - parallelize requests to a single object, though you need to know the size of the object to start so you can slice it up
S3 Transfer Acceleration - I’m not sure where you’re utilizing CloudFront in this situation, if it’s in front of your application, or you’re using it to cache between your app and S3.
I’d also ask if it’s possible to take your application out of the equation and have Cloudfront just cache S3 to your end-users directly. If your S3 data requires authorization, there’s still ways to do that, such as Lambda@Edge or have your app handle the auth.