It seems like the images read from amazon s3 load really slow. I had the images on the same server as the website and it loaded super fast. Is it loading slow cause it has to access it from s3 now?
Is there nothing i can really do about it ??
Using this to read the image files:
$secure_link = gs_prepareS3URL("myAmazon."/thumb/thumb_".$id, $bucket);
readfile($secure_link);
Function is from : http://www.richardpeacock.com/blog/2010/07/amazon-aws-s3-query-string-authentication-php
If you're embedding the images, you should serve them through Amazon CloudFront (Amazon's CDN Service). CloudFront loads the image/file from S3 (or a custom origin) then caches it on their edge servers.
CloudFront Tutorial - http://www.hongkiat.com/blog/amazon-cloudfront-how-to-setup-cloudfront-to-work-with-s3/
S3 is just for Static Storage, by default it does not have the optimized performance, though there are ways to make it better.
Before you configure CloudFront, you should try enabling `Transfer Acceleration' on S3 bucket.
Source: https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration.html
Benefits are,
This comes at a price.. (https://aws.amazon.com/about-aws/whats-new/2016/04/transfer-files-into-amazon-s3-up-to-300-percent-faster/)
Pricing for Amazon S3 Transfer Acceleration is simple, with no upfront costs or long-term commitments. You simply pay a low, per-GB rate for data transferred through the service. The pricing is designed to be risk free: if Amazon S3 Transfer Acceleration isn’t likely to make a difference in the speed of an upload (like when you upload data over the short distance from a client in Tokyo to an S3 bucket in Japan), you won’t be charged anything extra for that upload. For more information on pricing, see Amazon S3 pricing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With