Performance Issues
Diagnose and fix slow page loads, memory issues, and performance bottlenecks.
Having performance problems? This guide will help you diagnose and optimize your YMCA website.
Slow Page Loads
Symptoms: Pages take 5+ seconds to load.
Diagnosis:
Check Caching
- Admin:
/admin/config/development/performance
- Ensure “Aggregate CSS files” is checked
- Ensure “Aggregate JavaScript files” is checked
- Enable page caching for anonymous users
- Admin:
Install Devel Module (Development only)
composer require drupal/devel --dev drush en devel webprofiler -y
- Visit any page to see performance metrics
- Check for slow queries
Database Performance
# Check slow queries drush sql-query "SHOW FULL PROCESSLIST;" # Check database size drush sql-query "SELECT table_name AS 'Table', ROUND(((data_length + index_length) / 1024 / 1024), 2) AS 'Size (MB)' FROM information_schema.TABLES WHERE table_schema = 'DATABASE_NAME' ORDER BY (data_length + index_length) DESC;"
Solutions:
Enable Redis/Memcache
composer require drupal/redis drush en redis -y
// In settings.php $settings['redis.connection']['interface'] = 'PhpRedis'; $settings['redis.connection']['host'] = '127.0.0.1'; $settings['cache']['default'] = 'cache.backend.redis';
Optimize Images
- Use WebP format where possible
- Enable image optimization:
/admin/config/media/image-styles
Clean Up Database
# Truncate watchdog logs drush sql-query "TRUNCATE watchdog;" # Remove old revisions drush entity:delete node --bundle=article --chunks=10
High Memory Usage
Error: PHP Fatal error: Allowed memory size of ... bytes exhausted
Solutions:
Increase PHP Memory Limit
// In settings.php ini_set('memory_limit', '512M');
For Composer
php -d memory_limit=-1 /usr/local/bin/composer update
Optimize Composer Autoloader
composer dump-autoload --optimize
Need more help? See Debugging Techniques or Get Support.