Click here to register.
      

How to Improve Performance for Images

Design Squid
Other Design Articles
How to Improve Performance for Images
preaction · 4/12/2010 1:58 pm
Design Squid

Today I got a call at 9:00am: An upgrade had made a site unusable, server load was hovering around 80. After checking all the usual suspects, I got nothing: mysql wasn't choking, navigations were not slow, pages were rendering quickly, Apache2::SizeLimit was not killing too many processes, wremonitor was not out of control, but httpd was still sucking up as much processor as it could ask for.

So I set my loglevel to INFO and sat back and watched. Redirects, redirects everywhere, always to images. My screen exploded with redirects, dozens every second. All the Article assets were using the Image asset URL and not the FileUrl macro. It might not have been the problem, but it was a start.

An hour later I had a script to go through all HTML in user-added content and add FileUrl where ever I could [script attached]. Switched my loglevel back to ERROR, and let 'er rip.

Calm. Serenity. Peace. The difference was incredible.

Before the FileUrl macro was used, every Image request would actually be three HTTP requests: first to the proxy, second the proxy would talk to WebGUI, third WebGUI would Redirect back to the proxy.

With the FileUrl macro, there's only one request: The proxy is asked for the image and delivers it.

Since we believe in Open-Source, here's my script, all polished up and ready for consumption. To use it, simply place it into your /data/WebGUI/sbin directory and then:

# BACK UP YOUR DATABASE FIRST!
cd /data/WebGUI/sbin;
perl fixImageFileUrl.pl --configFile=<config file name>

Once it completes, clear your cache and test your site.

Stay tuned for more ways to improve performance on your WebGUI sites.

EDIT: To make sure that /uploads URLs are used by the Rich Text Editor instead of Asset URLs, edit your WebGUI config to change "richEditorsUseAssetUrls" to 0 (instead of 1). This will make any new content use the fast /uploads URL instead of the slow Asset URL.

Previous
·
Stick
Lock
Subscribe