Skip to content

DimDev/php-runtimes-benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP runtimes benchmark

The repo contains the Symfony 7 application skeleton to be run in different runtimes:

  • Apache(prefork mode) + mod_php
  • Apache + PHP-FPM
  • Nginx + PHP-FPM
  • Nginx Unit
  • Roadrunner
  • Nginx + Roadrunner
  • FrankenPHP
  • FrankenPHP (worker mode)
  • Swoole

URLs

Run load tests

Load tests are run inside docker container, which is in the same network as the runtime.

Bombardier

make run/loadtest/bombardier-c5-d30s # Run bombardier concurrent connections: 5, duration: 30s
make run/loadtest/bombardier-c10-d30s # Run bombardier concurrent connections: 10, duration: 30s
make run/loadtest/bombardier-c100-d30s # Run bombardier concurrent connections: 100, duration: 30s
make run/loadtest/bombardier-c1000-d30s # Run bombardier concurrent connections: 1000, duration: 30s
make run/loadtest/bombardier-c10000-d30s # Run bombardier concurrent connections: 10000, duration: 30s

Apache HTTP server benchmarking tool

make run/loadtest/ab-n100-c5
make run/loadtest/ab-n1000-c100
make run/loadtest/ab-n10000-c1000

K6 (by Grafana Labs)

See js scripts in 001_symfony7_wo_db/testing-tools/k6

make run/loadtest/k6-vus5-dur30s
make run/loadtest/k6-vus10-dur30s
make run/loadtest/k6-vus100-dur30s
make run/loadtest/k6-vus1000-dur30s
make run/loadtest/k6-vus10000-dur30s

001: Apache(prefork mode) + mod_php

make start/runtime/001-apache-modphp
make stop/runtime/001-apache-modphp
make rebuild/runtime/001-apache-modphp
make down/runtime/001-apache-modphp
make shell/runtime/001-apache-modphp

002: Apache + PHP-FPM

make start/runtime/002-apache-phpfpm
make stop/runtime/002-apache-phpfpm
make rebuild/runtime/002-apache-phpfpm
make down/runtime/002-apache-phpfpm
make shell/runtime/002-apache
make shell/runtime/002-phpfpm

003: Nginx + PHP-FPM

To calculate PHP-FPM pm.max_children, the following formula was used:

pm.max_children = Memory available to container / Memory consumed by 1 process

Memory consumed by 1 process:

ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"Mb") }'
make start/runtime/003-nginx-phpfpm
make stop/runtime/003-nginx-phpfpm
make rebuild/runtime/003-nginx-phpfpm
make down/runtime/003-nginx-phpfpm
make shell/runtime/003-nginx
make shell/runtime/003-phpfpm

004: Nginx Unit + PHP Language module

make start/runtime/004-nginx-unit
make stop/runtime/004-nginx-unit
make rebuild/runtime/004-nginx-unit
make down/runtime/004-nginx-unit
make shell/runtime/004-unit

005: Roadrunner

The symfony/runtime component is used

make start/runtime/005-roadrunner
make stop/runtime/005-roadrunner
make rebuild/runtime/005-roadrunner
make down/runtime/005-roadrunner
make shell/runtime/005-roadrunner

006: Nginx + Roadrunner(fcgi mode)

The symfony/runtime component is used

make start/runtime/006-nginx-roadrunner
make stop/runtime/006-nginx-roadrunner
make rebuild/runtime/006-nginx-roadrunner
make down/runtime/006-nginx-roadrunner
make shell/runtime/006-nginx
make shell/runtime/006-roadrunner

007: Frankenphp

The symfony/runtime component is used

make start/runtime/007-frankenphp
make stop/runtime/007-frankenphp
make rebuild/runtime/007-frankenphp
make down/runtime/007-frankenphp
make shell/runtime/007-frankenphp

008: Frankenphp (workermode)

The symfony/runtime component is used

make start/runtime/008-frankenphp-workermode
make stop/runtime/008-frankenphp-workermode
make rebuild/runtime/008-frankenphp-workermode
make down/runtime/008-frankenphp-workermode
make shell/runtime/008-frankenphp-workermode

Issues

  • FrankenPHP can't start with production version of php.ini, which is provided with official PHP image

009: Swoole

The symfony/runtime component is used

make start/runtime/009-swoole
make stop/runtime/009-swoole
make rebuild/runtime/009-swoole
make down/runtime/009-swoole
make shell/runtime/009-swoole

About

Performance comparison of PHP runtimes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published