Last updated: May 12, 2025
Picture this: You've just launched a critical campaign, your marketing team is driving traffic to your Drupal site, and then... the complaints start rolling in. "The site is taking forever to load." "I can't even get past the homepage." "Is the server down?"
Your stomach drops. You know every second of delay is costing you visitors, conversions, and credibility.
Here's the good news: Most Drupal performance issues can be dramatically improved within 24 hours. Not next week. Not after a complete rebuild. Today.
I've spent the last decade optimizing Drupal sites in crisis mode, and I'm going to share exactly what works—the same strategies we use when clients call us at 11 PM because their site is crawling. Whether you fix it yourself or need our help, this guide will show you the path forward.
Critical Update: If you're on Drupal 7, you have until January 5, 2025 before support ends. Performance issues now could become security nightmares later. We'll show you quick fixes for D7 and migration considerations.
Before we dive into solutions, let me ease your mind: Drupal sites don't start slow. They become slow. It's rarely one catastrophic issue—it's usually a death by a thousand cuts. A module here, a view there, some unoptimized images, and suddenly your once-speedy site is gasping for breath.
The truth is, Drupal is incredibly powerful, but that power comes with complexity. Without regular maintenance and optimization, even the best-built sites will eventually slow down. It's like a high-performance car—amazing when tuned, frustrating when neglected.
Before we start, identify your Drupal version—the optimization approach varies significantly:
Check your version: drush status or Admin → Reports → Status
I'm going to walk you through a battle-tested process that we've refined over hundreds of performance emergencies. You can follow this yourself, or if you need expert hands, we're here to help. Either way, you'll know exactly what needs to happen.
First things first: Don't guess. Measure. You wouldn't take medicine without knowing what's wrong, and the same applies here.
If it's over 3 seconds, you have a problem. Over 5 seconds? It's an emergency.
Run your site through Google PageSpeed Insights to check:
Run these checks immediately:
# Check your PHP memory limit (SSH into your server)
php -i | grep memory_limit
# Check PHP version (Drupal 10 needs PHP 8.1+)
php -v
# Look for slow database queries (if you have MySQL access)
mysql -u youruser -p -e "SHOW FULL PROCESSLIST;" yourdatabase
# Check your error logs for clues
tail -100 /var/log/apache2/error.log | grep -i "fatal\|error\|exception"
# Check Drupal's status report
drush core-requirementsWhat we typically find:
Your database is usually the primary bottleneck. Here's how to give it immediate relief:
-- Clear out old data (backup first!)
TRUNCATE cache_bootstrap;
TRUNCATE cache_page;
TRUNCATE cache_menu;
TRUNCATE watchdog; -- Yes, your logs might be massive
TRUNCATE sessions; -- If you have millions of old sessions
-- Optimize all tables
mysqlcheck -o yourdatabase -u youruser -p
-- Check table sizes to find bloat
SELECT
table_name AS 'Table',
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS 'Size (MB)'
FROM information_schema.TABLES
WHERE table_schema = 'yourdatabase'
ORDER BY (data_length + index_length) DESC
LIMIT 20;Pro tip: If your watchdog table has millions of rows (I've seen it), that alone could be killing your site. We once improved a site's speed by 70% just by managing the logs properly.
Enable slow query logging temporarily:
# Add to my.cnf
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow-query.log
long_query_time = 1
# Restart MySQL
sudo service mysql restartCheck your Views for these common mistakes:
For Drupal 8+ with Views in core:
While backend issues hurt, frontend problems are what users actually feel. Let's fix what they see:
First, install optimization tools:
# Install image optimization tools
sudo apt-get install jpegoptim optipng webp
# Batch optimize existing images
find /path/to/files/directory -name "*.jpg" -exec jpegoptim -m80 {} \;
find /path/to/files/directory -name "*.png" -exec optipng {} \;
# Convert images to WebP (50-80% smaller!)
for file in *.jpg; do cwebp -q 80 "$file" -o "${file%.jpg}.webp"; doneFor Drupal-managed optimization, install Image Optimize module:
composer require drupal/imageapi_optimize
drush en imageapi_optimize imageapi_optimize_webp -yThe biggest frontend killer? Loading everything at once. Here's the emergency fix:
composer require drupal/advagg
drush en advagg advagg_css_minify advagg_js_minify -y composer require drupal/lazy
drush en lazy -yFor Drupal 7, add to your theme:
// Add loading="lazy" to all images
Drupal.behaviors.lazyImages = {
attach: function(context) {
$('img', context).once('lazy').attr('loading', 'lazy');
}
}; drush en big_pipe -yThis Facebook-developed technique can improve perceived performance by 50%+!
Good caching can make a slow site feel fast. Bad caching (or no caching) makes even fast sites feel slow.
When in crisis, enable all caching first, then dial back if needed:
Drupal 7:
drush dl boost && drush en boost -yDrupal 8/9/10:
// In your render arrays
'#cache' => [
'tags' => ['node:' . $node->id()],
'contexts' => ['url.path', 'user.roles'],
'max-age' => 3600,
],If you have server access, this is a game-changer:
# Install Redis
sudo apt-get install redis-server php-redis
# Configure Drupal to use Redis
composer require drupal/redis
# Add to settings.php
$settings['redis.connection']['interface'] = 'PhpRedis';
$settings['redis.connection']['host'] = '127.0.0.1';
$settings['cache']['default'] = 'cache.backend.redis';
# For Drupal 7
$conf['cache_backends'][] = 'sites/all/modules/redis/redis.autoload.inc';
$conf['redis_client_interface'] = 'PhpRedis';
$conf['cache_default_class'] = 'Redis_Cache';Real-world impact: We've seen this single change reduce page load times from 8 seconds to under 2 seconds.
Modules are like browser tabs—we all have too many open. Time for a cleanup:
# Find enabled modules
drush pm-list --status=enabled --type=module
# For suspicious modules, disable and test
drush pm-uninstall MODULE_NAME
# Use Module Filter for better management
composer require drupal/module_filter
drush en module_filter -yFor All Drupal Versions:
For Drupal 8+:
composer require drupal/quicklink
drush en quicklink -yIf you have server access (or can ask your host), these changes are massive:
# Check current PHP version
php -v
# For Drupal 10, you need PHP 8.1+
# Enable OpCache (if not already)
sudo phpenmod opcache
# Optimal PHP-FPM settings for Drupal
# Edit /etc/php/8.1/fpm/pool.d/www.conf
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
# PHP.ini optimizations for Drupal
memory_limit = 256M
max_execution_time = 60
opcache.memory_consumption = 256
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 10000
opcache.revalidate_freq = 60For Apache:
# Enable compression (.htaccess)
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
</IfModule>
# Enable browser caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>
# Enable HTTP/2 (if available)
Protocols h2 http/1.1For Nginx:
# In your server block
gzip on;
gzip_vary on;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/json;
# Browser caching
location ~* \.(jpg|jpeg|png|gif|webp|ico|css|js)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Enable HTTP/2 in your server block
listen 443 ssl http2;You've made it this far. Now let's verify the improvements:
# Simple load test with Apache Bench
ab -n 1000 -c 10 http://yoursite.com/
# More advanced with k6
k6 run --vus 10 --duration 30s script.jsInstall New Relic or similar:
# For New Relic (if you have an account)
curl -L https://download.newrelic.com/install/newrelic-cli/scripts/install.sh | bashSometimes you don't have 24 hours. Here are the emergency moves that give immediate relief:
drush cr # Drupal 8+
drush cc all # Drupal 7
# Nuclear option - clear everything
cd sites/default/files && rm -rf css js
mysql -u user -p database -e "TRUNCATE cache_data; TRUNCATE cache_render;"Disable these RIGHT NOW if they're enabled:
# Drupal 8+
drush pm-uninstall statistics dblog devel webprofiler
# Drupal 7
drush dis statistics dblog devel update -y# Temporarily resize all large images
find . -name "*.jpg" -size +1M -exec mogrify -resize 1920x1920\> {} \;
# Quick WebP conversion for biggest images
find . -name "*.jpg" -size +500k -exec cwebp -q 80 {} -o {}.webp \;Sign up for Cloudflare (free tier), point your DNS, enable:
20-minute setup, immediate improvement.
Add to settings.php:
ini_set('memory_limit', '256M');
ini_set('max_execution_time', '60');-- Quick wins (backup first!)
DELETE FROM watchdog WHERE timestamp < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY));
DELETE FROM sessions WHERE timestamp < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY));
OPTIMIZE TABLE cache_form, cache_page, cache_menu;If you're on Drupal 10 with HTTP/2 enabled:
# In .htaccess
<IfModule http2_module>
Header add Link "</themes/custom/yourtheme/css/critical.css>; rel=preload; as=style"
</IfModule> composer require drupal/http2_server_push
drush en http2_server_push -yWith Google's AI Overviews affecting search:
composer require drupal/yoast_seo drupal/metatag drupal/schema_metatag
drush en yoast_seo metatag schema_metatag -yIf using Docker or cloud hosting:
# Optimized Drupal Dockerfile snippet
FROM php:8.1-fpm-alpine
# Install opcache and redis
RUN docker-php-ext-install opcache
RUN pecl install redis && docker-php-ext-enable redis
# Opcache settings
RUN echo "opcache.memory_consumption=256" >> /usr/local/etc/php/conf.d/opcache.ini
RUN echo "opcache.interned_strings_buffer=16" >> /usr/local/etc/php/conf.d/opcache.iniThe E-commerce Site: Black Friday was approaching, and their Drupal commerce site was taking 12 seconds to load. We found 3.2 million rows in the watchdog table and a view loading every product on every page. Fixed in 6 hours. Black Friday sales increased 240%.
The University Portal: 50,000 students trying to register for classes, site crashing every hour. Problem? Custom authentication module making 5 database calls per page view. Rewrote it to use caching, reduced load by 85%.
The News Site: Breaking story going viral, servers melting. Emergency fix: Enabled Varnish cache with 1-minute TTL, served 1 million visitors on a single server.
The Government Portal: Drupal 7 site struggling with performance and approaching EOL. We implemented Redis caching, optimized the database, and created a migration plan to Drupal 10. Site speed improved 60% immediately, with a clear path to long-term stability.
Establish performance budgets to maintain speed:
// Example performance budget
{
"timings": {
"firstContentfulPaint": 1800,
"largestContentfulPaint": 2500,
"timeToInteractive": 3500
},
"resources": {
"script": 300,
"style": 150,
"image": 500,
"total": 1500
}
}Use tools like Lighthouse CI to enforce these in your deployment pipeline.
Look, I've given you the tools, but sometimes you need an expert. Here's when to get help:
We've been in those situations. We've gotten those panic calls. And we've always delivered.
Sometimes you need someone who's been there. Our 24-hour tune-up includes:
Site down? Losing customers? We offer emergency response with:
Your Drupal site doesn't have to be slow. Whether you fix it yourself using this guide or bring us in to help, the important thing is to act now. Every hour of poor performance costs you visitors, rankings, and revenue.
We've rescued hundreds of Drupal sites from the brink. Some needed minor tweaks, others required major surgery. But every single one got faster.
Ready to get started?
If you're going the DIY route, start with the 5-minute health check above. If you need expert help, schedule a performance consultation or call us directly at [phone]. We'll have someone looking at your site within the hour.
Remember: Performance isn't a luxury—it's a necessity. Your visitors expect speed, search engines demand it, and your business depends on it.
Let's get your site running the way it should.
P.S. Still reading? That means your site probably needs help. Don't wait for the next crisis. Take action now, and thank yourself later.
P.P.S. Yes, we really do answer emergency calls at 2 AM. We've been there, and we know that sometimes you just need someone who understands Drupal to make the pain stop.
P.P.P.S. Drupal 7 users: With EOL on January 5, 2025, now's the perfect time to fix performance AND plan your migration. We can help with both.