Optimizing Server Performance, Part 2

April 2, 2008 · Print This Article

Part 2 of 3: Part 1 | Part 2 | Part 3

This is part 2 in a series of posts covering server performance optimization. You should try to follow these tips in order; i.e. start at the top of post one and work you way through each post. If you’re coming here from anywhere other than Part 1 of this post, head there first before continuing on.

Most of the tips in this section could be classified as incremental improvements. Taken by themselves, they each have a small impact on overall performance; whereas the previous chapter’s tips all have rather significant effects.

Use Feedburner

Your RSS feeds are a silent killer that could quietly be eating 20 to 40 percent of your bandwidth. RSS readers automatically pull the latest posts from your site and aggregate them for your subscribers. And they do this often and many times, inefficiently.

You can use a service like Feedburner to handle this traffic for you. A word of warning for established sites: you’ll need to redirect your existing subscribers (preferably, automatically and seamlessly) to your new feeds.

If you don’t want to entrust your RSS feed to a third party, another option is to serve your feeds from another server or hosting account.

Profile your Pages

workmen-2.jpgIf you use a profiler to look at what is required to be downloaded to run each of your blog pages, you might be surprised. You’ll see a mixture of scripts, stylesheets, images, and maybe Flash in the page. Yahoo! determined that 80 percent of the end-user response time is spent downloading these front-end components.

If you’re a Firefox user, download the Firebug extension and examine each of your blog pages. This is a great way to examine the effect of your plug-ins, images, styles, scripts, ads, and anything else you might be serving to the public.

If you don’t use Firefox, you can get a lite profile by using a web-based profiler.

Trim the fat!

Any static file can be offloaded to another server. Aside from images (mentioned above), you can also offload JavaScript, CSS, Flash, and other static files. Amazon S3, Steady Offload, and even another hosting account or server are all options.

YSlow

Yahoo! also has a Firefox extension called YSlow. Its analysis of your page is based on 13 strategies that they use to optimize their pages for download. To use it you must first have Firebug installed. Read more about it on Yahoo’s Developer Network.

Reduce the Number of HTTP Requests

Reducing the number of HTTP requests required to render a page reduces server load.

Use Image Maps

Combine multiple, contiguous images into one image, and use an image map to link it. The file size will be the same, but you eliminate separate requests for each image. This is not a feasible strategy in all situations, but it should work for some.

Use CSS Sprites

You can combine all of the images in your page into a single image and then use CSS properties to display the desired image segment. Dave Shea has an article on A List Apart and there’s a good sprite generator from Ed Eliot and Stuart Colville (authors of High Perform-ance Web Site Techniques).

Combine Files

If you use more than one stylesheet or more than one script, consider combining like types together. The weight of the page won’t change, but you’ll reduce the number of requests required to build the page.

Use External Files

To allow for caching, your CSS and JavaScript should be stored in external files, and linked / imported into the page being downloaded to allow for caching.

Optimize Images

workmen-2.jpgMost bloggers don’t use image editing tools to resize or polish their images. They should. By using a high-quality web graphics program like Adobe Photoshop or Adobe Fireworks (formerly Macromedia), you can ensure that you’re using the appropriate file format (e.g. jpeg’s for photos, gif’s for line art), and that your images are optimized for web viewing.

I often see JPEG’s decrease in size from 40 KB to 20 KB with a negligible impact on image quality.

Turn off or Slow Down Comments

If your blog posts are receiving a large number of comments, you can do one of two things to temporarily ease the load on your server:

Temporarily turn off comments

Find which of your posts is receiving heavy comment traffic, and disable commenting on it until traffic has died down a bit.

  1. Open the WordPress administrative panel
    Go to Manage | Posts
    Deselect the “Allow comments” checkbox for each high traffic post

After a few hours or days, turn them back on again.

Update the Cache Less Frequently

Every time a new comment is posted, WP-Cache will try to update the static version of the page. Tell it not to. Comments might appear stale throughout the day, but it’s a better alternative than a server crash.

  1. Open the wp-content | plugins | wp-cache plugin folder.
  2. Open wp-cache-phase2.php for editing
  3. Comment the line: add_action(’comment_post’, ‘wp_cache_get_postid_from_comment’, 0);

Pages will now not be regenerated every time a new comment is entered. After a few hours or days, uncomment the line. Thanks to Simple Thoughts blog for this tip.

Monitor your Site

This is not really an optimization tip, but monitoring your server will at least tell you when you’re in trouble. Think of it as a first line of defense or an early warning system. You know the call from the host will be coming!

I use iWeb for dedicated servers, and they have a free monitoring tool that’s simple to setup. Create an account, add an address to monitor, and then specify ports to watch and query intervals. Common ports include 80 (web), 8080 (Tomcat), 3306 (MySQL), and 110 (mail).

That’s it for part 2 of this series. Tune in tomorrow for the third and final installment.

Part 2 of 3: Part 1 | Part 2 | Part 3

Comments

2 Responses to “Optimizing Server Performance, Part 2”

  1. Optimizing Server Performance, Part 1 | The Mobile Technology Journal of Smilin' Joe Fission on April 2nd, 2008 11:13 am

    [...] 1 of 3: Part 1 | Part 2 | Part [...]

  2. Optimizing Server Performance, Part 3 | The Mobile Technology Journal of Smilin' Joe Fission on April 3rd, 2008 10:48 am

    [...] 3 of 3: Part 1 | Part 2 | Part [...]

Got something to say?