How to speed up image loading from amazon cloudfront
We are working on an iPhone application that shows images from amazon S3 using a cloudfront Even though cloudfront improved the download speed of images, it is a touch slow if we compare with another linux server without CDN. So we would like to know how we can improve further on the image loading to iPhone application.
Please let us know
You haven't explained how you tested the two environments and what the speed differences were.
Keep in mind that to get a real evaluation of a CDN's performance you have to test it from multiple points around the globe, not from a single location. Also, when talking about an image's loading performance is not enough to measure the actual transfer rate (download speed), but also the connection latency and DNS resolving times.
Usually, to get the best results when downloading images, you need to make sure you handle four things correctly: dns, caching, persistent connections and parallel download.
to decrease the DNS resolving time, make sure you optimize your DNS rules and use fast DNS service (having too many CNAME resolutions could slow down dns for example).
to take advantage of the full powers of a CDN, your caching rules should have very high expiration times (using the Cache-Control or Expires headers).
if you download multiple images from any server it's best to use a client that supports persistent connections (supports Keep-Alive). This way, if you reuse the same connection, you won't loose time reestablishing a new one.
it's also best to download multiple images in parallel rather than using a sequential download. Web browsers usually open up to 6 connections per server but you could go slightly higher than that. Don't exaggerate that number though, as it will hurt performance.