Skip to main content

Backend Optimization Checklist

Use this checklist to audit and improve the backend paths that bypass page cache (logged-in pages, checkout, admin, search, AJAX). It is designed as a quick reference you can run after major plugin/theme changes.

Quick Reference

Backend optimization targets dynamic requests that cannot be served from full-page cache.

Database Optimization

  • Slow query log enabled and reviewed.
  • No queries exceeding 50 ms on regular page loads.
  • Total queries per page under 100 (check via Query Monitor).
  • Custom indexes added for frequently queried wp_postmeta keys.
  • Autoloaded options total under 1 MB.
  • Transient cleanup running (expired transients removed).
  • Post revisions limited (WP_POST_REVISIONS set to 5 or less).
  • Spam comments and trashed posts cleaned.
  • Database tables optimized (OPTIMIZE TABLE).

PHP Optimization

  • PHP 8.2+ installed and active.
  • OPcache enabled with sufficient memory (128–256 MB).
  • Unused WordPress features disabled (emoji, XML-RPC, self-pingbacks).
  • PHP memory limit set appropriately (256M–512M).
  • PHP error logging enabled, display errors disabled.
  • Autosave interval increased from 60s to 300s.

Object Caching

  • Redis or Memcached installed and connected.
  • Object cache drop-in active (object-cache.php present).
  • Object cache hit ratio above 90%.
  • Redis memory limit set appropriately.
  • Persistent object cache verified with wp redis status or redis-cli info.

Plugin Audit

  • Total active plugins minimized (under 15 for most sites).
  • No duplicate functionality between plugins.
  • Deactivated plugins deleted (not just deactivated).
  • Heavy plugins identified via Query Monitor profiling.
  • No plugin making external HTTP requests on every page load.

Cron and Background Tasks

  • WP-Cron offloaded to system cron (if high traffic).
  • No stale or failed cron jobs.
  • Background tasks (imports, emails) not blocking page loads.

Verification Commands

backend-verification-commands.sh
# Check total database size
sudo mysql -e "SELECT table_schema, ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS 'Size (MB)' FROM information_schema.tables WHERE table_schema = 'wordpress_db' GROUP BY table_schema;"

# Check autoloaded options size
sudo mysql -e "SELECT SUM(LENGTH(option_value))/1024/1024 AS 'Autoload MB' FROM wp_options WHERE autoload='yes';" wordpress_db

# Check PHP OPcache status
php -r "var_export(opcache_get_status()['opcache_statistics']);"

# Check Redis status
redis-cli info memory | grep used_memory_human
redis-cli info stats | grep keyspace

# Profile WordPress hooks
wp profile hook --url=https://example.com/ --spotlight

Summary

Backend optimization targets every request that bypasses cache. Audit database queries, PHP configuration, object caching, and plugin performance. Use this checklist after every major plugin or theme change.

What's Next