Configuring for Multiple Servers
When running PageSpeed on multiple servers, it is important that each have the same configuration file. This ensures that when a browser requests an image or other resource from one server, it will be optimized using the same options that were used to compute the optimized resource when HTML was served. It is helpful to use memcached to share cache between servers as it improves multi-server performance and scalability, but it is still important that the configurations are consistent to get the desired behavior when optimized images are evicted from cache.
Note also that location-specific configuration settings should be consistent between the HTML paths and the resource paths.
In some sites, the URL path layout or network deployment strategy may not allow for consistent configuration between HTML and images. PageSpeed offers a workaround for such sites by encoding relevant configuration settings for each rewritten resource into the URLs:
pagespeed AddOptionsToUrls on
This adds an encoding of the options that are relevant to each rewritten resource to the URLs. While the produced URLs are larger, this provides a mechanism to propagate configuration without having to share a configuration file. For example, a site with image recompression on and JPEG compression set to 85 would see URLs like
http://example.com/ximage.jpg.pagespeed.gp+jw+pj+rj+rp+rw+iq=85.ic.HASH.jpg. While it is better to have the extra configuration details in the configuration file, this option offers a fallback plan when that is not practical.