Page Speed Optimization
|Important:||As of September 15, 2015, Page Speed Optimization has been removed from the DreamHost Panel. It remains available for use (through a VPS or Dedicated plan), but is no longer supported by DreamHost.|
Page Speed Optimization is a feature 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.
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 manually installed Page Speed Optimization, go to your website and browse around a bit. Resources that are on multiple web pages, such as a header graphic, 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" gets 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 active, 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 appear immediately. Once complete, you can then re-enable.
How can I clear the PageSpeed cache?
If you have a Dedicated Server, and you are an admin user, you can run:
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)