Bug #52235
closedEpic #55070: Workpackages
Epic #55065: WP: Overall System Performance (Backend and Frontend)
Bug #52949: Speed decrease since 4.5
Timeout when copying pages recursively due to cache-clearing overload
100%
Description
We currently experience a problem resulting in timeouts when copying more than a few pages, especially if the site is mounted over NFS. The problem seems to arise due to several issues.
The clear_cache command i DataHandler calls $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flushByTag('pageId_' . $pageId); for each page it calculates should be cleared (including siblings, and possibly parents, grand-parents etc.).
Since this will ask all registered caches to clear for the desired tag, this results in many, many checks for flush caching. Combine this with a massively inefficient cache FileBackend (see #52125) this results in timeouts when copying more that 3-4 pages.
The result is even worse, since the clear_cache is called for the page being copied AND for each content element on the page, and for each content element the cache is cleared for its PID (if using workspaces, there is yet another problem with this, but that seems to be fixed in another ticket).
So copying a page with 4 content elements, will clear cache for the page 5 times! And for each of these, the siblings and possibly parents are cleared as well.
I would suggest a few changes and would like some feedback on this:
1: Make sure that only the cache_pages and possibly cache_pagesection is cleared by only calling $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flushByTag('pageId_' . $pageId);
2: Make DataHandler collect a list of all pages it wants to clear, and then defer the actual clearing to later, to make sure we only clear cache one time for each page. We could either defer until the destructor of DataHandler is called, or we could just put everything
3: As suggested in #52125 FileBackend should either be fixed, or not used by default.
Feedback is welcome. I will push a changeset to gerrit with the suggested changes when possible feedback is collected.
Updated by Markus Klein about 11 years ago
I'd suggest to implement some sort of batch cache clearing in the caches.
Example:
* $GLOBALS['typo3CacheManager']->getCache('cache_pages')->setBatchFlushing(TRUE);
* $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flushByTag('pageId_' . 1);
* $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flushByTag('pageId_' . 2);
* $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flushByTag('pageId_' . 3);
* ...
* $GLOBALS['typo3CacheManager']->getCache('cache_pages')->setBatchFlushing(FALSE);
Once the batch flushing is disabled, the actual flushing will be executed.
Updated by Jan-Erik Revsbech about 11 years ago
Markus Klein wrote:
I'd suggest to implement some sort of batch cache clearing in the caches.
Example:
- $GLOBALS['typo3CacheManager']->getCache('cache_pages')->setBatchFlushing(TRUE);
- $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flushByTag('pageId_' . 1);
- $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flushByTag('pageId_' . 2);
- $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flushByTag('pageId_' . 3);
- ...
- $GLOBALS['typo3CacheManager']->getCache('cache_pages')->setBatchFlushing(FALSE);
Once the batch flushing is disabled, the actual flushing will be executed.
That is not a bad idea, but perhaps the DataHandler should be the one actually "queueing" things for cache_clearing? It could be done in the CachingLayer, but I'm not sure thats a good idea.
Updated by Christian Kuhn about 11 years ago
just and idea on the 'batch' clearing (don't know if it works out): we have this "shutdown" method in bootstrap ... maybe we could execute the tag clearing there?
Updated by Markus Klein almost 11 years ago
- Parent task changed from #52304 to #52949
Updated by Ernesto Baschny over 10 years ago
This currently also makes importing a t3d file (used by the Distribution Management). Since we will see more people using this, we should try to tackle this issue soon.
Work in progress is here: https://review.typo3.org/#/c/25423/
Updated by Philipp Gampe over 10 years ago
- Status changed from New to Under Review
Updated by Philipp Gampe over 10 years ago
- Priority changed from Should have to Must have
Updated by Gerrit Code Review over 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25423
Updated by Gerrit Code Review over 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25423
Updated by Gerrit Code Review over 10 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25423
Updated by Gerrit Code Review over 10 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25423
Updated by Gerrit Code Review over 10 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25423
Updated by Gerrit Code Review over 10 years ago
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25423
Updated by Gerrit Code Review over 10 years ago
Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25423
Updated by Jan-Erik Revsbech over 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset c9738f8c7af749adffb8b0093ddc852e62f4ba1b.