Bug #43540

Task #52304: Performance issues

TS is fetched from cache incorrectly sometimes

Added by Dmitry Dulepov over 9 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Must have
Category:
TypoScript
Target version:
-
Start date:
2012-12-03
Due date:
% Done:

100%

Estimated time:
8.00 h
TYPO3 Version:
6.0
PHP Version:
Tags:
Complexity:
hard
Is Regression:
No
Sprint Focus:

Description

If $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_constants'] or $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_setup'] are set in the Install tool, cached TS will not be found in cache. This would result in TS parsing every time when there are USER_INT objects on the page. Generally it will slow down the page with USER_INT objects by at least 300% comparing to the non-cached version.

More information

When template parser processes the TS, it makes a hash to load a cached version of TS:

$this->runThroughTemplates($theRootLine);
...
$rowSumHash = md5('ROWSUM:' . serialize($this->rowSum));
$result = \TYPO3\CMS\Frontend\Page\PageRepository::getHash($rowSumHash);

There TS can be fetched from the cache. If nothing is returned, the TS is parsed and stored into the cache:

$this->generateConfig();
...
$rowSumHash = md5('ROWSUM:' . serialize($this->rowSum));
\TYPO3\CMS\Frontend\Page\PageRepository::storeHash($rowSumHash, serialize($cc['all']), 'TMPL_CONDITIONS_ALL');

Function generateConfig() prepends values from the above-mentioned variables before processing the data. The earlier called function runThroughtTemplates() does not do that. If the variables are empty, it does not make any difference and everything is cached. But if those variables are not empty (even if there is a single space), the $this->rowSum will be different in two quoted code extracts above. Thus TS will be stored with one hash value and the next request will try to retrieve it with another hash value. This means that cached TS will never be retrieved and will be always parsed.

We were able to decrease page generation from 2.88s to 0.8s by fixing the issue. 2 seconds make a huge difference in speed and load of the web server.


Related issues

Blocks TYPO3 Core - Bug #53352: Template Analyzer produces wrong resultsClosed2013-11-05

Actions
#1

Updated by Dmitry Dulepov over 9 years ago

Should be read: "...comparing to the cached version".

#2

Updated by Gerrit Code Review over 9 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16939

#3

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16939

#4

Updated by Gerrit Code Review over 9 years ago

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/18056

#5

Updated by Dmitry Dulepov over 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 10 to 100
#6

Updated by Gerrit Code Review over 9 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at https://review.typo3.org/18059

#7

Updated by Gerrit Code Review over 9 years ago

Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at https://review.typo3.org/18061

#8

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch TYPO3_4-7 has been pushed to the review server.
It is available at https://review.typo3.org/18059

#9

Updated by Gerrit Code Review over 9 years ago

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at https://review.typo3.org/18062

#10

Updated by Gerrit Code Review over 9 years ago

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18072

#11

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18072

#12

Updated by Gerrit Code Review over 9 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18072

#13

Updated by Gerrit Code Review over 9 years ago

Patch set 1 for branch master_new has been pushed to the review server.
It is available at https://review.typo3.org/18621

#14

Updated by Gerrit Code Review over 9 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18072

#15

Updated by Gerrit Code Review about 9 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18072

#16

Updated by Markus Klein over 8 years ago

  • Parent task set to #52338
  • Is Regression set to No
#17

Updated by Markus Klein over 8 years ago

  • Parent task changed from #52338 to #52304
#18

Updated by Kasper Ligaard over 8 years ago

This solves the problem described in this thread: http://forum.typo3.org/index.php/m/695487/#page_top

#19

Updated by Gerrit Code Review over 8 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18072

#20

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/24177

#21

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/24178

#22

Updated by Dmitry Dulepov over 8 years ago

  • Status changed from Under Review to Resolved
#23

Updated by Gerrit Code Review over 8 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at https://review.typo3.org/24182

#24

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at https://review.typo3.org/24981

#25

Updated by Jigal van Hemert over 8 years ago

  • Status changed from Under Review to Resolved
#26

Updated by Simon Schaufelberger over 8 years ago

Hey, Why is this NOT included in 4.5??? so sad...

#27

Updated by Markus Klein over 8 years ago

@Simon: It will be finally included.

#28

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF