Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an app running on a windows webserver 2008. It generates thumbnails which are then cached on disk.

But loading these static thumbnail images takes a bit long, as I dont have a slow connection. For example, Firebug tells me that most thumbnails (size between 30 - 50 kb) take between 600 ms and 1.2 second to load. And almost the whole time is spent while "waiting for response". Therefore I suspect that the server is responding too slow. Is there a way to optimize the serving of static content via IIS 7?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Newer browsers (IE8, Chrome) have upped the max number of connections per server to 6 which is a good trend.

However, to get around the 2 connection limit (without requiring a browser config change) a trick you can use is to create multiple CNAMES (aliases) in dns that point to your web server. Then in your app you generate the image tags with patterned (or random) HREFs that utilize all of your. This tricks the browser into thinking that the images are coming from different sources and then will open more than 2 connections to your site at one time. This won't necessarily help your serve time for a single image, but for your overall page load time it should provide you some relief.

You would need to consider a couple of things before employing this technique:

  1. How this would work with your application's caching mechanism. You might end up with a much larger cache of your images
  2. You would need to pay attention the number of concurrent connections on your web server as it'll go up as the number of concurrent sessions remains the same

There are a ton of posts are there that explain this technique in detail. Here is a good one from DevCentral:
The third greatest (useful) hack in the history of the Web

share|improve this answer

I'm not sure about IIS 7 but you should probably have the images loading from a different domain that way the browser can try to load them in parallel. A browser (depending on browser) will only try to load 2 files from 1 domain at a time. I believe firefox will try to load up to 6 files at once if they're from different domains. I also recommend lighter webservers for static content, like nginx. I realize it may not be the answer your looking for but maybe it will help.

share|improve this answer
    
Do the domains have to point to physically different server? –  Max Nov 11 '09 at 11:51
    
no. the browser only cares about DNS, not even a different IP address. –  xenoterracide Nov 11 '09 at 19:41
    
also squillman is right that it would cause your concurrent sessions to go up if you use the same http server. I still recommend putting serving static images from a much lighter server (they can even be served on a different port, as long as the links to them in the page are a different domain) –  xenoterracide Nov 11 '09 at 19:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.