This issue is to explore if the same issue as described in Stampedes and cold cache performance issues with css/js aggregation exists in Backdrop, and if we could benefit by implementing the same/equivalent changes.
Problem/Motivation
Our current logic for building CSS and Javascript aggregates relies on creating the aggregates from within the page being requested, this leads to a number of issues:
When there are no aggregates on disk, the page response has to create the files on disk before it can be served. This adds hundreds of millisecond or seconds to uncached page requests. Additionally, each aggregate is created in sequence. So if you have 30 requests in a second, and the pages they're requesting have the same ten aggregates on, each individual aggregate needs to be created, one by one, before any of those 30 pages can actually serve any HTML at all. This can take hundreds of milliseconds or seconds, which can lead to 503s on cache clears.
Filenames have to be tracked in state - this means additional queries (and sometimes writing back to state) on every HTML request. When this issue was originally opened, filenames were tracked in variables which was a much bigger issue, now it's a minor one, but still adds to general post-cache-clear churn.
Because it's expensive already, it makes it difficult to add on-the-fly js minification and similar, since that would further degrade cold cache performance.
...
Before
- HTML request.
- Check if the file exists on disk
- Build the aggregate and write it back to disk if it doesn't, link from the head tag.
- Back to step 2 for each CSS and JS aggregate potentially a dozen times.
- Serve the HTML page to the browser.
- Browser requests files that already exist on disk.
After
- HTML request
- Generate just a filename as part of the head tag (no filesystem access, no writes to database)
- Serve the HTML page to the browser.
- Browser requests the asset URLs. If they don't exist, they're created and served from PHP. If they do they're served from the filesystem. This allows multiple aggregates to be generated simultaneously by separate HTTP requests, all without blocking any HTML being served.
Recent comments
In page.tpl.php you can get the current path and add it to the class array $classes[] = 'path-' . str_replace('/', '', $_SERVER['REQUEST_URI']); You will get an original class for each page....
Insert custom class into body tag
https://www.drupal.org/project/views/issues/1266388 shows that this is an architectural issue, and requires another 2 hooks being adjusted. It would be really nice to add comments/notes to...
node access
Hmmm, from D7 ancient tomes: from https://drupal.stackexchange.com/questions/7056/limit-which-roles-can-view-a-node-basing-on-its-content-type yet https://docs.backdropcms.org/api/...
node access