Solved

The cost of resizing images on the fly

Posted on 2009-03-31
2
240 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

22 Experts available now in Live!

Get 1:1 Help Now