Fast 404s are slower than regular 404s

Created on 27 June 2022, about 2 years ago
Updated 16 May 2023, about 1 year ago

Problem/Motivation

When we converted Drupal 7 to the Symfony routing system we made fast 404s only do stuff on exception - i.e. when routing has determined there is a 404 already. This makes the system/files part of the suggested config in default.settings.php pointless but also it means that we have to do routing for paths that we would previously (in Drupal 7) not have done.

Locally fast 404s are not fast for me. In fact they are slower. Compare:

Request: /something

Document Path:          /something
Document Length:        23112 bytes

Concurrency Level:      1
Time taken for tests:   4.321 seconds
Complete requests:      1000
Failed requests:        0
Non-2xx responses:      1000
Total transferred:      24727000 bytes
HTML transferred:       23112000 bytes
Requests per second:    231.42 [#/sec] (mean)
Time per request:       4.321 [ms] (mean)
Time per request:       4.321 [ms] (mean, across all concurrent requests)
Transfer rate:          5588.09 [Kbytes/sec] received

Request: /something.jpg

Document Path:          /something.jpg
Document Length:        193 bytes

Concurrency Level:      1
Time taken for tests:   6.423 seconds
Complete requests:      1000
Failed requests:        0
Non-2xx responses:      1000
Total transferred:      704000 bytes
HTML transferred:       193000 bytes
Requests per second:    155.68 [#/sec] (mean)
Time per request:       6.423 [ms] (mean)
Time per request:       6.423 [ms] (mean, across all concurrent requests)
Transfer rate:          107.03 [Kbytes/sec] received

Proposed resolution

Emit a cacheable exception from Fast404ExceptionHtmlSubscriber so that it can be cached in the same way as other 404s.

Remaining tasks

User interface changes

None

API changes

Fast404ExceptionHtmlSubscriber now takes the cache_tags.invalidator service instead of http_kernel service.

Data model changes

Fast 404s are cacheable in the page cache and work the same way as other 404s.

Release notes snippet

It is no longer necessary or recommended to configure fast 404s in settings.php β†’ .

πŸ› Bug report
Status

Fixed

Version

9.5

Component
BaseΒ  β†’

Last updated 21 minutes ago

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024