Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

The cost of resizing images on the fly

Posted on 2009-03-31
2
Medium Priority
?
252 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

885 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