Skip to content
Muhammet Şafak
tr

Seven PHP frameworks, four measurements

Cold request, load test, OPcache preload and the Laravel preload curve: the measured cost of seven PHP frameworks on a single page.

4.4×

Empty route, req/s

gap between the fastest and the slowest

Slim 25,975, Laravel 5,966 req/s. Once the database joins in, the gap shrinks to 3.7×.

Footprint

Files loaded per request

files

  • Phalcon7
  • Yii262
  • Slim79
  • CodeIgniter96
  • Symfony224
  • Laminas269
  • Laravel359
Source: PHP framework footprint measurement

Footprint

Cold first request

ms

  • Phalcon2.2
  • Slim7.9
  • Yii217.4
  • CodeIgniter22.2
  • Laminas27.7
  • Symfony35.7
  • Laravel72.2
Source: PHP framework footprint measurement

Load test

Throughput on an empty route

req/s

  • Slim25,975
  • Yii219,834
  • Phalcon15,021
  • Symfony13,067
  • Laminas8,349
  • CodeIgniter6,431
  • Laravel5,966
PHP 8.4.24, JIT off, nginx + php-fpm with 8 workers, 64 connections, 15 s. Docker Desktop, Apple M4 Pro.

Load test

Req/s by scenario

Requests per second for seven frameworks in the empty route, template, single-row and 20-row database scenarios
FrameworkEmpty routeTemplateDB single rowDB 20 rows
Slim25,97522,78014,4434,551
Yii219,83416,9959,3663,245
Phalcon15,02110,5635,2222,040
Symfony13,0679,3556,9723,060
Laminas8,3497,4195,4212,874
CodeIgniter6,4315,5574,5272,494
Laravel5,9665,2903,8871,293

Load test

The gap narrows as work is added

  • 3.7×Gap at a single DB row4.4× on an empty route, 3.5× at 20 rows
  • 1.3×Phalcon / LaravelAt a single DB row, versus 2.5× on an empty route
  • 0-7%Cost of routingLoss compared to an empty route
  • 1-8%Cost of middlewareWhen a five-layer chain is added

Load test

Latency on a JSON response

p50, p95 and p99 latencies of seven frameworks in the JSON scenario, in milliseconds
Frameworkp50p95p99
Slim0.25 ms0.43 ms0.53 ms
Yii20.35 ms0.59 ms0.73 ms
Phalcon0.46 ms0.73 ms0.94 ms
Symfony0.58 ms0.89 ms0.96 ms
Laminas0.88 ms1.52 ms2.23 ms
CodeIgniter1.16 ms1.84 ms1.98 ms
Laravel0.75 ms1.97 ms2.59 ms

−63%

Laravel

throughput taken by the default web group

Choosing a framework can open a gap of up to 4×, but a single default middleware group can take away 63%.

Laravel

Web group on and off

Req/s, p50 and p99 of a Laravel route without a middleware group and with the default web group
RouteReq/sp50p99
No group5,8581.32 ms2.88 ms
Default web group2,1761.73 ms71.89 ms

OPcache preload

Cold request: before and after preload

Cold request time for seven frameworks without preload and with the best preload, plus the gain and the php-fpm readiness cost
FrameworkNo preloadBest preloadGainfpm cost
Laravel76.31 ms13.98 ms5.5×+2,340 ms
Symfony35.58 ms2.50 ms14.2×−40 ms
Laminas26.70 ms3.81 ms7.0×−7 ms
CodeIgniter20.75 ms3.13 ms6.6×−12 ms
Yii216.98 ms4.80 ms3.5×+13 ms
Slim7.46 ms1.86 ms4.0×+28 ms
Phalcon2.68 ms1.99 ms1.3×+43 ms

OPcache preload

Preload is not a setting, it is a maintenance job

  • 2/7Official preload fileOnly in Symfony and CodeIgniter
  • 14.2×Symfony's gainFrom 35.58 ms to 2.50 ms
  • 2.3 sLaravel's deploy costIn return for a 62 ms gain per visitor
  • 1.3×PhalconNegative control: 3 files

Laravel preload curve

Cold request as more files are preloaded

cold request, ms

Cold request as more files are preloaded (cold request, ms): 0 files: 68.37, 1,592 files: 38.01, 2,686 files: 28.48, 2,809 files: 12.77, 4,721 files: 10.96.

Median values; the filters are specific to this application.

Laravel preload curve

The sweet spot is at 2,809 files

  • 12.77 msCold request at the sweet spot−81% compared to 68.37 ms without preload
  • +1,132 msfpm readiness costFrom 382 ms to 1,514 ms
  • 15.7 msGain from the critical 123 filesEight times what the 1,912 files deliver
  • 1.8 msGain from the last 1,912 files654 ms of cost per millisecond gained

As you read

The limits of these numbers

  • EnvironmentThe load test ran in a Docker Desktop VM; absolute values do not represent bare metal, and the fast candidates are, if anything, under-reported.
  • ScopeJIT was off, worker mode was not measured. Slim has no data layer or template engine of its own.
  • ColdCold means an empty OPcache. A single shot strays from the median: Symfony takes 76.5 ms in a single shot, against a median of 35.58 ms.
  • ConsistencyZero non-200 responses across 546 load measurements; in 150 samples the worst value is 84% of the best.

Share and download

Search the site

Start typing to search posts, projects and pages.

Escto closePowered by Pagefind