Joomla Performance Optimization
Joomla 4/5 is significantly faster than Joomla 3—reworked architecture, Dependency Injection, improved cache system. Nevertheless, basic setup and caching are mandatory for production.
Global Configuration: Performance
// Or via Global Configuration → Server / System
// System cache
public $caching = '2'; // 2 = Progressive Caching (better)
public $cachetime = '15'; // minutes
public $cache_handler = 'file'; // 'memcache' or 'redis' if available
// Compression
public $gzip = '1'; // gzip-compress HTML
Cache Types in Joomla
Conservative Caching (1)—caches modules but not components with dynamic content.
Progressive Caching (2)—caches everything, including pages for logged-in users (considering their session).
For sites without logged-in users—Progressive. For portals with registration—Conservative.
Redis as Cache Backend
apt install redis-server
configuration.php:
public $cache_handler = 'redis';
public $redis_server_host = '127.0.0.1';
public $redis_server_port = '6379';
public $redis_server_db = '0';
CSS/JS Minification
Joomla 4/5 uses Web Asset Manager—centralized resource inclusion system. No built-in minification, but:
# Install joomla-minify or use external build
composer require joomla-extensions/minify
# Or Nginx gzip at server level
gzip on;
gzip_comp_level 5;
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
Cache-Control Plugin
// System → Page Cache plugin for full page caching
// Exclude from cache:
// /index.php?option=com_users (personal account)
// /index.php?option=com_checkout (checkout)
Database Tuning
-- Analyze Joomla slow queries
EXPLAIN SELECT * FROM jos_content WHERE state=1 AND access IN (1,2) ORDER BY created DESC;
-- Indexes for typical queries
CREATE INDEX idx_content_state_access ON jos_content (state, access);
CREATE INDEX idx_content_featured ON jos_content (featured, state);
Nginx FastCGI Cache
Similar to WordPress—Nginx caches full pages:
location ~ \.php$ {
set $skip_cache 0;
if ($http_cookie ~ "joomla_user_state=logged_in") {
set $skip_cache 1;
}
fastcgi_cache JOOMLA;
fastcgi_cache_valid 200 15m;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
}
Image Optimization
Install JCE (editor) plugin with automatic resizing or jCompress for WebP conversion on upload.
CDN Integration
CDN for Joomla plugin or manual setup via configuration.php:
public $cdn_url = 'https://cdn.yourdomain.com';
Joomla replaces /media/, /images/, /templates/ with CDN URL.
Profiling
Global Configuration → Debug → enable Debug System. Debug block appears on each page with SQL queries and execution time.
Important: disable in production ($debug = '0').
Timeline
Basic optimization (cache, gzip, Redis)—3–5 hours. Full optimization with Nginx FastCGI Cache and CDN—1–2 days.







