简体   繁体   中英

Loading Thumbnails in ASP.Net Web Page using HttpHandler

My requirement is load 100 thumbnails under 2 seconds in my Asp.Net Web Application. Actual size of each images are approx.800 KB. So I used a web handler method to re-size the image on the fly(Here image size reduced to 8KB). Here I found 96 requests are sent to the server and thumbnails are loaded under 4 seconds. I found 90% of the time is losing in blocking inspected in Firebug net tab. So I moved from 96 request to a single request. Thus web handler accept a single request and creates 96 thumbnail images and combine 96 thumbnails into a big single image and write this single image to the output stream.This case I found about 6 seconds was taken for loading the single image. Then I used a .Net Thread Pool mechanism for creating the thumbnails in the web handler.Thus load time reduced to 2.6 seconds.I found that only 1 second or below time is actually taken for the server processing.Remaining 1.6 seconds is losing. My Questions are below

  1. Where is losing my processing time. Server side or client side? If it is in server side where is the bottle neck? How can I identify the request processing and page load time?

  2. Is Web handler a better way to do the image resizing?

  3. Can I have any alternative solution.?

My System Config is

Processor - Intel Core - i7 , RAM: - 4 GB

Web Server: IIS 7

OS : Windows 7

Please help me

> Where is losing my processing time. Server side or client side?

Maybe its in between... 1.6 seconds sounds about right for transferring the data:

8KB per image * 100 images ~= 1MB of data
1 M bytes = 8 M bits
8 M bits / 1.6 secs = 5 Mbps transfer rate
... sounds reasonable to within an order of magnitude

Your one-big-image approach is probably better, as this will reduce the overhead of 100 separate requests. Beware of using background threads in the ASP.NET process, though.

The transfer time is one limiting factor. Even if you could make the server respond immediately, you would still have to wait for the data to get back to the client.

The other limiting factor is the speed that the client browser can render the images.

Basically, your requirements are pushing the boundaries of what is practical ATM.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM