#21716TYPO3 randomly needs up to 1 minute to answer requests (includes bugfix)
Description
We have a large TYPO3 installation powering 19 different websites with over 3.000 pages and a lot of page impressions. We found out that TYPO3 sometimes needed up to 1 minute to answer a request (while concurrent requests where answered in under 1 second). These delays seemed to occur randomly and independently of plugins or “plain” pages. If a user noticed the delay and immediately reloaded the page, it was displayed in under 1 second.
It turned out that the cause was a slow database query:
DELETE FROM fe_session_data WHERE tstamp < 123456789;
This query is performed on a regular basis to clean up the session table and sometimes takes up to 1 minute.
We tried different approaches to fix this and finally simply added a MySQL index:
ALTER TABLE fe_session_data ADD INDEX tstamp (tstamp);
Since then all requests get answered in under 1 second.
Therefore I would suggest to add that index to typo3_src/sysext/cms/ext_tables.sql:
103c103,104
< PRIMARY KEY (hash)
—-
> PRIMARY KEY (hash),
> KEY tstamp (tstamp)
(issue imported from #M12798)
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.