Problem/Motivation
We have observed that on the first request from a page with much Javascript, the aggregate is significantly larger than subsequent requests (e.g. 810k vs. 254k). A closer look at the aggregate requests showed that the first request is not gzipped (no Content-Encoding: gzip in the response headers).
Steps to reproduce
drush cr- Open the developer tools in your browser and select Network. Disable the browser cache and filter on JS.
- Load a page with a significant amount of Javascript and observe the size associated with your aggregated Javascript (e.g. js_PJixJTcRpBgmI1Wpr2HGyIcRPTPtYUT-6M0gt7Q42bk.js).
- Reload the page and observe the size associated with the same file. It is now significantly smaller.
Proposed resolution
AssetControllerBase::deliver() should, if dumpToUri has generated a .gz version of the asset, deliver that instead of the uncomporessed data, and set the Content-Encoding to gzip.
Remaining tasks
- Add a failing test for the scenario.
- Submit a fix for the scenario which passes the test.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | gzip-aggregate-34707367-1.patch | 1.54 KB | mikeryan |
Issue fork drupal-3407367
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mikeryanComment #3
mikeryanComment #4
mikeryanTests pass - guess I didn't break anything!
Comment #8
plachRerolled the patch on the current HEAD. Raising priority to major since the performance gain may be significant.