Drupal Performance
From Wasya Wiki
Add these to settings.php:
$settings['cache']['bins']['render'] = 'cache.backend.database' $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.database' $settings['cache']['bins']['page'] = 'cache.backend.database'
reconfigure /etc/mysql/conf.d/docker.conf
[mysqld] # skip-host-cache # skip-name-resolve max_connections = 300
part IV
See how long the request takes:
curl -o /dev/null -s \
-w 'dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} ttfb=%{time_starttransfer} total=%{time_total}\n' \
https://piousbox.com/issues/2025q2-issue
Add nginx log temporarily:
log_format timing '$remote_addr - $request '
'rt=$request_time '
'urt=$upstream_response_time '
'uht=$upstream_header_time '
'uct=$upstream_connect_time';
#
access_log /var/log/nginx/timing.log timing;
Interpretation:
- high request_time + high upstream_*
- → backend app is slow
- high request_time + no upstream times
- → nginx/static filesystem issue
- high upstream_connect_time
- → nginx struggling to reach upstream
- high upstream_header_time
- → app slow before first byte
For containerized Drupal, a 3–4 second first-hit delay is commonly one of:
- PHP-FPM worker cold start
- Drupal cache rebuild/bootstrap
- slow DB query
- uncached Twig/container compilation
- network latency to DB/Redis
- bind-mounted filesystem slowness
- OPCache not configured
- reverse DNS / external HTTP calls
check php cache
php -i | grep opcache
changes I'm making
opcache.validate_timestamps=0 # made no difference