Skip to content

dragoonis/symfonycon-2025-scaling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SymfonyCon 2025 - Scaling PHP Systems

This project demonstrates a scalable Symfony CQRS application with Redis and DB projections, Docker Compose, and k6 load testing. All common tasks are managed via the Makefile.

Web Interfaces & Dashboards

Service URL Description
FPM App http://localhost:8088 Main Symfony app (FPM)
Franken http://localhost:8080 FrankenPHP (HTTP, regular mode)
Franken Worker http://localhost:8081 FrankenPHP Worker (HTTP, optimized)
Grafana http://localhost:3000 Metrics dashboard (symfony/symfony)
Prometheus http://localhost:9090 Prometheus metrics
Opcache Dashboard http://localhost:42042 PHP Opcache dashboard
Opcache Metrics (FPM) http://localhost:8088/metrics PHP Opcache metrics via FPM app
Franken Metrics http://localhost:2019/metrics Caddy/FrankenPHP metrics (non-worker)
Worker Metrics http://localhost:2020/metrics Caddy/FrankenPHP metrics (worker)

Setup

Required Dependencies

  1. Docker & Docker Compose

  2. Make

    • macOS: Usually pre-installed, or install via Homebrew: brew install make
    • Linux: Install via package manager:
      • Ubuntu/Debian: sudo apt-get install make
      • CentOS/RHEL: sudo yum install make
      • Fedora: sudo dnf install make
  3. K6 (Load Testing Tool)

    • macOS: brew install k6
    • Linux:
      • Ubuntu/Debian: sudo gpg -k
      sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
      echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
      sudo apt-get update
      sudo apt-get install k6
      • CentOS/RHEL/Fedora: sudo yum install k6 or sudo dnf install k6

Verify Installation

Run the test script to verify all dependencies are installed:

./test-system.sh

This will check for Docker, Docker Compose, Make, and K6 and report their status.

Docker Images Setup

Before starting the application, you need to pull the required Docker images.

make pull-docker

This ensures all required Docker images are available locally before starting the services.

Quick Start

  1. Build and start all services:
make up
  1. Set up the database and seed data:
make migrate
make seed

Go to http://localhost:8088

PHP-FPM & OPcache Configuration

For detailed end-to-end guides on PHP-FPM and OPcache configuration, monitoring, and optimization:

See fpm.md for complete PHP-FPM documentation including:

  • Booting and running PHP-FPM
  • FPM settings and configuration
  • FPM math and right-sizing calculations
  • FPM calculator tool
  • K6 load testing
  • FPM status page and monitoring
  • FPM exporter metrics
  • Grafana dashboard integration

See php.ini.md for complete OPcache documentation including:

  • Booting and accessing the OPcache dashboard
  • PHP OPcache .ini settings and configuration
  • Metrics endpoint and export
  • Prometheus integration for OPcache
  • Grafana dashboard for OPcache monitoring

Composer Autoload Optimization

For optimal performance, this project uses Composer autoload optimizations configured in composer.json:

{
  "config": {
    "optimize-autoloader": true,
    "classmap-authoritative": true
  }
}

Performance Impact:

  • optimize-autoloader: ~10-15% faster autoloading (converts PSR-0/PSR-4 to classmap)
  • apcu-autoloader: ~50-70% faster (requires APCu extension)
  • classmap-authoritative: Set to false for development, true for production only

Reference: See the official Symfony Performance Documentation for detailed autoloader optimization guidelines and best practices.

FrankenPHP Configuration

This project uses FrankenPHP (a modern PHP runtime built on Caddy) with two different configurations for performance comparison and monitoring.

See frankenphp.md for complete FrankenPHP documentation including:

  • Service configuration and differences
  • Auto-reload (file watching) setup
  • Caddy configuration and environment variables
  • Performance testing and monitoring
  • Troubleshooting guide
  • Resource optimization guidelines

Grafana Dashboard

A detailed PHP-FPM and OPcache monitoring dashboard is available in Grafana. It includes:

  • PHP-FPM health, queue, and process metrics
  • Request rate, duration, and memory usage
  • OPcache hit ratio, memory, and script cache stats
  • JIT and interned strings monitoring
  • Alerts and color-coded panels for quick health checks

See grafana-dashboard.md for a full description of all panels and dashboard features.

PHP Configuration Reference

For detailed PHP configuration documentation and settings explanation, see php.ini.md.

This covers all settings in ./docker/symfony.prod.ini including:

  • OPcache configuration
  • Memory management
  • Security settings
  • Session management
  • Performance optimization

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published