Solved

The cost of resizing images on the fly

Posted on 2009-03-31
2
239 Views
Last Modified: 2012-05-06
My predecessor created a website for a dealer in second hand luxury cars. It has a CMS and new offers are added by the site owner. The site includes many photos of the cars. In order to have visitors see an optimal size of the photos, almost every photos is resized on-the-fly before being displayed.

By studying the visitor stats, I found out that there are a couple of car forums where the users post photos using the page which resizes the photos. The bandwidth and resizing comes from the car site. The aspx-page which does the resizing is by far the most called page in the site, it is requested an order of magnitude more often then the next most-requested page.

The site sometimes gives an Internal Server Error, which is caused - as was told us by the company which hosts the site - by memory problems. We were told to check our scripts, I did a rough check, but nothing strange caught my eye. Then I looked at the stats and thought that the resizing of images on the fly was likely the cause of the memory problems. That is my gut feeling, but I have no hard numbers about the memory cost of resizing images on the fly.

Does anyone have some information to confirm my gut feeling?
0
Comment
Question by:sybe
2 Comments
 
LVL 5

Accepted Solution

by:
Buginator earned 500 total points
ID: 24030992
Absolutely. If it's like you are describing, my best guess is that you are correct about your theory. Resizing images is a really expensive operation, and when your webserver does this on the fly everytime a user just browse your site, the resource hog must be enormous (of course depending on the popularity of your website). Remember that the images must be stored in RAM to get resized, and when you have many images multiplied with many users (clients)... I guess you understand the problem here.

So, an application, especially web applications,  should never need to resize the same images again and again. It should only do it maximum once.

If your situation is that there are no other ways to do this than resize them on the fly, then you should alter the site to use client resize instead, with css,  javascript, or xhtml, preferably the first one. But the downfall with this would of course be a bandwidth issue - your users need to download bigger images, which their browser resize anyways.

Ideally you would need to alter the code so that the server only resize each image one time.
0
 
LVL 28

Author Closing Comment

by:sybe
ID: 31564916
Thanks. Glad to have it confirmed.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now