Code Monkey home page Code Monkey logo

php-runtimes-benchmark's Introduction

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

php-runtimes-benchmark's People

Contributors

dimdev avatar joanhey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

php-runtimes-benchmark's Issues

Nginx create for any Request a log in the log file

Caddy and Unit don't create an access log or error log.

Nginx create it for every request, that is an IO blocking log, and with 1 CPU is still more severe.

All the php-runtimes need to not create an Access log for each request, the more the concurrent connections, bigger is the problem.

We need to create a fair benchmark !!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.