Introduction
WordPress is the most popular CMS, but it requires optimization to run well under traffic. These techniques can make your WordPress site load in under 2 seconds.
Install a Caching Plugin
Caching plugins serve pre-generated HTML instead of running PHP for every request:
- WP Super Cache — simple, reliable, by Automattic
- W3 Total Cache — comprehensive with CDN integration
- LiteSpeed Cache — best if running OpenLiteSpeed
Object Caching with Redis
# Install Redis
sudo apt install -y redis-server php-redis
sudo systemctl restart php8.2-fpm
# Install Redis Object Cache plugin in WordPress
# Settings → Redis → Enable Object CacheImage Optimization
- Use WebP format (30% smaller than JPEG)
- Lazy load images below the fold
- Use the
srcsetattribute for responsive images
Database Optimization
# Clean up from MySQL CLI
DELETE FROM wp_posts WHERE post_type = 'revision';
DELETE FROM wp_options WHERE option_name LIKE '_transient_%';
OPTIMIZE TABLE wp_posts, wp_postmeta, wp_options;PHP Configuration
# In php.ini
opcache.enable=1
opcache.memory_consumption=128
memory_limit=256MPerformance Checklist
- Enable page caching
- Enable object caching (Redis)
- Minimize plugins (each adds overhead)
- Use a lightweight theme
- Enable Gzip compression
- Set browser cache headers