Page Speed Optimization

From DreamHost
Jump to: navigation, search

Overview

Page Speed Optimization is a feature DreamHost offers that reduces website loading times by automatically optimizing web pages and the resources within them. Under the hood of this feature is an Apache module that Google developed called mod_pagespeed. This feature was originally announced in DreamHost's blogin 2010.

Note2 icon.png Note: DreamHost does not have an automated way to enable the DNS-based PageSpeed Service. The only way to do so is by contacting support for assistance in configuring custom DNS records and a root redirect.


Enabling/disabling Page Speed Optimization

To activate or deactivate this feature on a per-domain basis, follow these instructions:

  1. Go to the Manage Domains section on the (Panel > 'Domains' > 'Manage Domains') page.
    The Manage Domains page opens for this domain:
  2. To the right of your domain (under the ‘Web Hosting’ column), click the Edit button.
    Under the ‘Web Options’ section, you’ll see a checkbox to the right of Page Speed Optimization:
    PageSpeedOptimization enable.fw.png
  3. Check the Page Speed Optimization box to enable or uncheck to disable.
  4. Scroll down slightly and click the blue Change settings button to save.
Note2 icon.png Note: After you have enabled or disabled this feature, please allow up to 20 minutes for it to update on the server.


FAQs

How does it work?

Page Speed Optimization dynamically adjusts the filenames of site resources, adding information about how 'old' the item is. It uses these age calculations to instruct visitor's browsers to serve cached copies of resources instead of requesting new copies. This cuts down on the number of requests to the server, which improves site speed in two ways:

  • when a visitor can use a cached version of a resource instead of requesting a new copy, there is no need for the visitor to wait for the request to be sent to the server and then wait for the server to send the resource back to their browser.
  • with the server serving less resource requests, it has more resources to jump on the requests it does receive, so those requests can potentially be filled in less time.

How can I tell if it's working?

Once you have activated Page Speed Optimization, go to your website and browse around a bit. Resources that are on multiple web pages, such as a header graphic, will have a filename like originalFileName.gif.pagespeed.ce.9-w9vHbyfP.gif. The originalFileName.gif is what you named it when you uploaded it to the web server. All the extra stuff (.pagespeed.ce.9-w9vHbyfP.gif) is added by Page Speed Optimization.

What if my page images get rewritten?

If an image with a name like "Åsen.jpg" does get rewritten by Page Speed Optimization (note the special character), try renaming it to "Aasen.jpg".

How long does it take for my edits to update?

If you've made edits to your site when Page Speed Optimization is activated, you may not see these updates until 5 to 10 minutes later. DreamHost recommends that you disable this feature when updating a live site. This way your changes will appear immediately. Once complete, you can then re-enable.

How can I clear the PageSpeed Cache?

Currently, the only way to do this on Shared Hosting is to deactivate and reactivate the feature for the domain in question. Google’s developers are working on a cache flush feature, but there is no estimated release date.

If you have a VPS or Dedicated Server, and you are an admin user, you can run:

sudo touch /var/mod_pagespeed/cache.flush

Customizations

Page Speed Optimization has a lot of additional filters which you can use to minify even further by means of custom code in an .htaccess file. You can read more about these filters on Google's site here:

Here's an example:

<IfModule pagespeed_module>
    ModPagespeed on
    ModPagespeedEnableFilters remove_comments,rewrite_javascript,rewrite_css,rewrite_images
    ModPagespeedEnableFilters elide_attributes,defer_javascript,move_css_to_head
    ModPagespeedJpegRecompressionQuality -1
</IfModule>

Below is further information about the filters used in the above example:

remove_comments
removes HTML comments (low risk)
rewrite_javascript
minifies JS (med. to high risk, depending on your site)
rewrite_css 
parses linked and inline CSS; rewrites the images found and minifies the CSS (med. risk)
rewrite_images
compresses and optimizes images (med. risk)
elide_attributes
removes attributes from tags (med. risk)
defer_javascript
combines JS and puts it at the end of your file (high risk AND experimental!)
move_css_to_head
combines CSS and moves it to the head of your file (low risk)

Other optimizations for speed

For an additional fee, mod_pagespeed and other performance-enhancing software (Zend Optimizer+, etc.) can be installed on your site by The GetPageSpeed Service.

See also