Page Speed Optimization
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.
|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:
- Go to the Manage Domains section on the (Panel > 'Domains' > 'Manage Domains') page.
- The Manage Domains page opens for this domain:
- 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:
- Check the Page Speed Optimization box to enable or uncheck to disable.
- Scroll down slightly and click the blue Change settings button to save.
|Note:||After you have enabled or disabled this feature, please allow up to 20 minutes for it to update on the server.|
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 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.
sudo touch /var/mod_pagespeed/cache.flush
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:
Below is further information about the filters used in the above example:
- removes HTML comments (low risk)
- minifies JS (med. to high risk, depending on your site)
- parses linked and inline CSS; rewrites the images found and minifies the CSS (med. risk)
- compresses and optimizes images (med. risk)
- removes attributes from tags (med. risk)
- combines JS and puts it at the end of your file (high risk AND experimental!)
- combines CSS and moves it to the head of your file (low risk)