Task #90143

Redirects: Poor performance of redirect matching for large redirects table

Added by Mario Lubenka almost 2 years ago. Updated about 1 month ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Start date:
2020-01-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
medium
Sprint Focus:

Description

Problem description

The current redirect matching retrieves all redirects from the database table and stores it in an internal cache.
This is then fetched and filtered for the route that matches the request.

Related files:

With a large redirects table this takes a pretty long time.
I created 350.000 unique redirects and it took the page about 5 seconds to redirect to the target page.
Before you say "350.000 will never be reached": On a long term a heavily edited website might reach that number at some point in time (assuming this feature will continue to exist with further TYPO3 versions).

Suggested solution

I suggest that the redirect matching is mainly done via the database query.
Most of the logic can be moved into a WHERE clause. Operations which are not available via database operations would then be applied to the remaining records.
With that the above 5 seconds of loading time could be reduced to merely 1 second.

This might also imply that the redirect cache via RedirectCacheService is not needed anymore.
Databases already come with caching mechanisms, as to such I fail to understand why a PHP cache is also needed.

This is a perfomance improvement which should be applied to TYPO3 9.5 as well.


Files

redirect-measure-time.ods (17.5 KB) redirect-measure-time.ods Complete runtime measurement Mario Lubenka, 2020-01-20 15:24

Related issues

Related to TYPO3 Core - Bug #93287: Avoid creation of unnecessary redirects on Slug changesNew2021-01-14

Actions
Related to TYPO3 Core - Epic #93547: Collection of problems with large sitesAccepted2021-02-19

Actions
Related to TYPO3 Core - Bug #91792: Automatically created redirects are not created using the DataHandlerNew2020-07-13

Actions

Also available in: Atom PDF