Project

General

Profile

Actions

Bug #72043

closed

File cache clearing inefficient causing backend timeout

Added by Kees Hoogendijk almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Caching
Target version:
-
Start date:
2015-12-03
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

When using the FileBackend for: cache_hash, cache_pages, cache_pagesection, cache_rootline, TYPO3 is inefficient in clearing cache causing massive io action, which can lead to a timeout of the backend. Each time time a page is added, the \TYPO3\CMS\Core\DataHandling\DataHandler will collect all pageId_{uid} tags (from DataHandler:7168 in 6.2.15) that need flushing.
After that, all files in the directories Cache/Data/cache_hash, Cache/Data/cache_pages, Cache/Data/cache_pagesection and Cache/Data/cache_rootline are opened and (though partially) read and compared with the pageId_ tag.
This opening and reading of all files is repeated for each of the collected pageId tags. In my case this can result in over 80000 file_get_content actions in de FileBackend for adding a single page.

In an attempt for a work around I added a TCEMAIN.clearCacheCmd = pages in my pageTSConfig. But in that case, first all sibling pages are collected and those pageId_{uid}'s are one at the time removed as described above (from DataHandler:7197), after which the entire cache directories are removed without the reading interaction. Resulting in a massive load of pointless io.
To fix this I've implemented a hook:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][] to call $this->clear_cacheCmd('pages'); 

before the inefficient cache clearing.

So I in my opinion these 2 things should be fixed:
  1. Can you combine the checking of all these tags so the cache files only need to be read a single time.
  2. Can you perform clearCacheCmd = pages instead of clearing some of the pageId tag before doing the clearCacheCmd = pages afterwards.

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #53467: Improve flush by tag performance for the file cache backendRejectedTymoteusz Motylewski2013-11-08

Actions
Actions

Also available in: Atom PDF