views:

27

answers:

2

Hi all

I was wondering, which way of managing thumbnail images make less impact to web server performance.

This is the scenario:

1) each order can have maximum of 10 images. 2) images does not need to store after order has completed (max period is 2 weeks). 3) potentially, there may have a few thousands of active orders at anytime. 4) orders with images will frequently visit by customers.

IMO, pre-generate thumbnail in hard disk is a better solution as hard disk are cheaper even with RAID.

But what about disk I/O speed, and resource it need to load images? will it take more resource than generate thumbnails at real-time?

It would be most appreciate if you could share your opinion.

+1  A: 

If the orders are visited frequently by customers, it is better to create the thumbnails ones and store on disk. this way the webserver doesn't need to process the page that long. It will speed up the loading time of your webpages.

Kevin Bakker
+1  A: 

It depends on your load. If the resource is being requested multiple times then it makes sense to cache it.

Will there always have to be an image? If not, you can create it on the first request and then cache it either in memory, or more likely a database, for subsequent requests.

However, if you always need the n images to exists per order, and/or you have multiple orders being created regularly, you will be better off passing the thumbnail creation off to a worker thread or some kind of asynchronous page. That way, multiple request's can be stacked up, reducing load on the server.

Bigfellahull
caching images of many orders, will it potentially consume lots of memories?
Bryan Fok
In memory? That depends on the size of the image and how much memory you have available. Unless the image is request hundreds of times an hour, you would be better off storing the images on disk. Very cheap. The IO cost of reading an image is normally pretty small and HHD's are cheap to buy. You could even create a scheduled tasks to delete images after a set expiration criteria has been met i.e. 2 weeks have passed.
Bigfellahull