Skip to content

Performance Analyzers

18 analyzers identifying bottlenecks and optimization opportunities in Laravel applications.

Overview

Performance analyzers focus on optimizing application speed, reducing resource consumption, and ensuring your Laravel application runs efficiently in production. These analyzers help identify configuration issues, caching problems, inefficient queries, and other performance bottlenecks that can slow down your application.

Key Analyzers

Caching & Optimization

Cache & Session Configuration

Queue & Background Jobs

Database & Queries

Assets & Frontend

Configuration & Environment

How They Work

Performance analyzers use a combination of:

  1. Configuration Analysis: Checks Laravel configuration files for optimal settings
  2. File System Checks: Validates cache files, compiled views, and optimized autoloaders
  3. Code Analysis: Detects inefficient patterns like collection operations that should be database queries
  4. Environment Validation: Ensures production environments are properly configured
  5. Asset Analysis: Checks frontend assets for minification and cache headers

Severity Levels

SeverityDescriptionExamples
CriticalIssues that severely impact performanceMissing OPcache, debug mode in production, no caching enabled
HighIssues that significantly slow down the applicationInefficient queries, missing route caching, wrong cache driver
MediumIssues that reduce performanceUnminified assets, unused middleware, collection operations
LowOptimization opportunitiesMissing cache headers, suboptimal configuration

Running Performance Analyzers

Run All Performance Analyzers

bash
php artisan shield:analyze --category=performance

Run Specific Analyzer

bash
php artisan shield:analyze --analyzer=opcache-enabled
php artisan shield:analyze --analyzer=config-caching
php artisan shield:analyze --analyzer=collection-call-optimization

Run Multiple Analyzers

bash
php artisan shield:analyze --analyzer=opcache-enabled,config-caching,route-caching,view-caching

Best Practices

Development

  • Run performance analyzers before deploying to production
  • Fix Critical and High severity issues immediately
  • Use performance analyzers to identify bottlenecks during development

Production Deployment

  • Ensure all caching is enabled (config, routes, views)
  • Verify OPcache is enabled and configured
  • Check that debug mode is disabled
  • Validate cache drivers are production-ready (Redis, Memcached)

CI/CD

  • Run performance analyzers in staging environment
  • Fail builds on Critical performance issues
  • Monitor performance metrics over time

Monitoring

  • Track performance improvements after fixes
  • Monitor cache hit rates
  • Measure response times before and after optimizations

Performance Checklist

Before deploying to production, ensure:

  • ✅ OPcache is enabled and configured
  • ✅ Configuration is cached (php artisan config:cache)
  • ✅ Routes are cached (php artisan route:cache)
  • ✅ Views are compiled (php artisan view:cache)
  • ✅ Autoloader is optimized (composer install --optimize-autoloader --no-dev)
  • ✅ Debug mode is disabled (APP_DEBUG=false)
  • ✅ Cache driver is production-ready (Redis/Memcached)
  • ✅ Session driver is production-ready (Redis/database)
  • ✅ Queue driver is configured (Redis/database/SQS)
  • ✅ Assets are minified and have cache headers
  • ✅ No development dependencies in production
  • ✅ No env() calls outside config files