Deprecation Notice: The App Engine integration with the PageSpeed service is deprecated as of May 6, 2015 and will be turned off on December 1, 2015. For complete details, see the PageSpeed service turndown documentation.
The PageSpeed service optimizes the way your application serves web content. It compresses and caches your HTML. It can also inline and combine resources.
- Enabling the PageSpeed Optimization Service
- Customizing the PageSpeed Optimization Service
- Disabling the PageSpeed Optimization Service
Enabling the PageSpeed Optimization Service
PageSpeed is a family of tools for optimizing the performance of web pages. App Engine offers PageSpeed as a service; it automatically optimizes your application. Fast pages create a better user experience and lead to increased traffic and reduced bounce rates, which might improve your business overall. PageSpeed doesn't touch some types of requests (such as POSTs), so don't be surprised if some non-PageSpeed requests arrive.
If your application tries to serve a large response (more than 32Mb)
through PageSpeed, PageSpeed truncates it at 32Mb. If your application
serves large things like this (audio, video, "big data"), then add their
URLs to PageSpeed's blacklist in the PageSpeed configuration in your
app.yaml file (Python, Go) or
appengine-web.xml file (Java).
You must have billing enabled to use the PageSpeed service. To enable billing, go to the Administration>Application Settings section of the Admin Console, click the Enable PageSpeed Service checkbox, and click Save Settings.
When the PageSpeed service is enabled, it is applied globally to your application. All versions of your app are optimized using the configuration of the most-recently updated version. To measure PageSpeed's improvements without turning it on for every running version, use the PageSpeed Service comparison tool. This tool measures how much faster a specific page will display using PageSpeed's default configuration.
Customizing the PageSpeed Optimization Service
When you activate the PageSpeed service for an application, the default
configuration is applied. You can create a custom configuration by adding a
pagespeed section to the appropriate configuration file:
app.yaml (Python, Go),
app.yaml (PHP), or
PageSpeed works well with most sites but custom configurations can contain aggressive optimizations that may break some Web pages. Before applying a custom configuration to your live site, you should test your site's behavior and ensure that all pages are displayed correctly.
You can test your site by installing and running the App Engine PageSpeed Service Preview extension for the Chrome Web browser. This extension allows you to view your site with the PageSpeed optimizations applied, and verify that your pages display correctly. (Note that the extension does not measure your PageSpeed speed-up.) Follow these instructions:
- If PageSpeed is enabled for your application, disable it in the Application Settings screen of the Administration Console.
- Edit your application configuration and upload it.
- Run Google Chrome. Click on the extension. (It displays as an App Engine icon.) A small dialog box should appear.
- In the dialog box, enter your application's URL in the form
your_app_id.appspot.comand check the "Preview PageSpeed Service" checkbox. Your browser is now configured to send this domain's requests through the PageSpeed Service.
- Navigate to your application's pages. See what your site looks like when optimized. We recommend reloading each page a few times, as the PageSpeed Service needs to process a page few times before it is fully optimized.
- If you encounter any issues with pages not rendering correctly, modify your PageSpeed configuration file to disable PageSpeed for the broken URLs, and preview your site again.
When your configuration and site are working well, enable PageSpeed for your site in the Application Settings screen of the Administration Console.
Disabling the PageSpeed Optimization Service
Go to the Administration > Application Settings section of the Admin Console, uncheck the Enable PageSpeed Service checkbox, and click Save Settings.