Link to home
Start Free TrialLog in
Avatar of Notwise
Notwise

asked on

Slow image loading on IIS ASP app (but everything else is fine)

We're running IIS on Win 2k Advanced Server. We also use https.  The ASP application hits all kinds of stuff, SQL, ASP calculations, different vendors, etc.  The performance is great, but the images take much longer to load than the rest of the text.  

These are _small_ little icon-type images -- most times the file size is 1 to 2k. Most are gifs, some are jpgs.

I'll go to the site and the most complicated of queries and page formatting is immediately done, but this little image is still loading for 5 or 6 seconds.

Is this an IIS tuning thing?  Any ideas?
Avatar of ASPGuru
ASPGuru

right-click on the web-site->Proerties

make sure, that "HTTP Keep-Alives Enabled" is checked on the WebSite-Tab.

This is actually checked by default, but maybe someone unchecked it ...

are the images on the same server / protocoll ?
or are the asp stuff on https and the images on http?

ASPGuru
Avatar of Notwise

ASKER

ASP Guru,

Thanks for the comment -- I checked the site properties and HTTP keep-alives Enabled is checked.

The images are on the same server, in the same site, just in sub-directory. Within in the asp pages, we tried hard-coding the image path as well as the '../images/image.gif' and it doesn't seem to make a difference.


does this happen with every browser/client computer?
is bandwidth throttling enabled(Internet Information Services -> Properties)

ASPGuru

Well, what you are saying is to be expected.  You note that you are doing ASP logic, database access, and yet the images are loading last.

Here is what is happening starting when your user clicks someone in his browser to call your ASP page:

1) (Browser) User clicks something significant and waits for an HTML page to be returned.

2) (Server) Server receives the request and loads the requested .ASP document.

3) (Server) Server interprets ASP page, executing script, calling database, etc.  During this process it generates the HTML page and begins to pass it back to the web browser.

4) (Browser) Web browser recieves HTML page, and when the HTML requires an IMAGE, the browser makes a seperate call BACK to the web server to recieve the image.

5) (Server) Intercepts request for image and returns it to browser (between other processing requests)

6) (Browser) Browser displays images when they are downloaded.

The Browser makes seperate requests for each item it finds it needs within the HTML document.  It cannot even make the requests for these items until it recieves the HTML describing these dependencies (it will begin requesting dependencies even if the whole document has not been recieved yet).

One way you can speed the performance up, is to move all of your images to a different web server.  This way, image requests can be served efficiently, without having to compete for CPU and bandwidth against the HTTP and ASP overhead.

Inside your HTML, instead of having:

<img src="/images/eeLogoTop.gif">

Your code would be:

<img src="http://images.mysite.com/images/eeLogoTop.gif">

Depending on your traffic, this could have a profound impact on how quickly your pages load.

CodeWizrd

Pardon the typo above.  The user doesnt click "someone", but "something".  Im sure you get the drift...
CodeWizrd,

of course the images get fetched after the html is built, but some small images shouldn't take 6 seconds...
least of all, if the page is called a second time and all images are cached....
and in fact the browser starts fetching images before the html is finished...

notwise,
how many images do you use? how many different images?
do you set the size of the images in the img tags?
do you use an older computer as a test client?
how big is the html page which gets produced?
does it use complicated hierarchical table structures/formating?

ASPGuru
Avatar of Notwise

ASKER

In theory I can understand Codewizrd's points, but in reality the image sizes are tiny, there are no more than 30 total images in the whole site, and they take fundamentally longer than the rest of the page to display.

As regards ASPGuru's questions:
1. 30 images total, no more than 2 or 3 on a given page.
2. No, I don't specify the size
3. The test client is a new machine with modern specs.
4. Most of the ASP pages are 10 to 20k of text and when displayed generally fit in a 800 x 600 window.
5. Some of the structures are indeed complicated, but the image delay occurs even in simple pages.
ASKER CERTIFIED SOLUTION
Avatar of ASPGuru
ASPGuru

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Again, it may be a an issue with resource contention if your server has a decent amount of traffic on it.
Avatar of Notwise

ASKER

ASP Guru is very helpful.  Thanks!