├── .gitignore ├── 001_symfony7_wo_db ├── Makefile ├── project │ ├── .env │ ├── .env.example │ ├── .gitignore │ ├── .rr.dev.yaml │ ├── .rr.fcgi.yaml │ ├── .rr.production.yaml │ ├── .rr.yaml │ ├── bin │ │ └── console │ ├── composer.json │ ├── composer.lock │ ├── config │ │ ├── bundles.php │ │ ├── packages │ │ │ ├── baldinof_road_runner.yaml │ │ │ ├── cache.yaml │ │ │ ├── framework.yaml │ │ │ ├── routing.yaml │ │ │ ├── twig.yaml │ │ │ └── web_profiler.yaml │ │ ├── preload.php │ │ ├── routes.yaml │ │ ├── routes │ │ │ ├── framework.yaml │ │ │ └── web_profiler.yaml │ │ └── services.yaml │ ├── public │ │ ├── index.php │ │ └── index.swoole.php │ ├── server.php │ ├── src │ │ ├── Controller │ │ │ ├── .gitignore │ │ │ └── FrontpageController.php │ │ └── Kernel.php │ ├── start.php │ ├── symfony.lock │ └── templates │ │ ├── base.html.twig │ │ └── frontpage.html.twig ├── runtimes │ ├── 001_apache_modphp │ │ ├── apache.Dockerfile │ │ ├── docker-compose-dev.yaml │ │ ├── docker-compose.yaml │ │ ├── mods-available │ │ │ ├── mpm_prefork.conf │ │ │ └── status.conf │ │ ├── php.ini │ │ └── sites-enabled │ │ │ └── symfony7site.conf │ ├── 002_apache_phpfpm │ │ ├── apache │ │ │ ├── apache.Dockerfile │ │ │ ├── mods-available │ │ │ │ ├── mpm_event.conf │ │ │ │ └── status.conf │ │ │ └── sites-available │ │ │ │ └── symfony7site.conf │ │ ├── docker-compose.yaml │ │ └── fpm │ │ │ ├── php.ini │ │ │ ├── phpfpm.Dockerfile │ │ │ └── www.conf │ ├── 003_nginx_phpfpm │ │ ├── docker-compose.yaml │ │ ├── fpm │ │ │ ├── php.ini │ │ │ ├── phpfpm.Dockerfile │ │ │ └── www.conf │ │ └── nginx │ │ │ ├── conf.d │ │ │ └── symfony7site.conf │ │ │ ├── nginx.Dockerfile │ │ │ └── nginx.conf │ ├── 004_nginx_unit │ │ ├── docker-compose.yaml │ │ └── unit │ │ │ ├── config │ │ │ └── symfony7site.config.json │ │ │ └── unit.Dockerfile │ ├── 005_roadrunner │ │ ├── docker-compose.yaml │ │ └── roadrunner │ │ │ ├── php.ini │ │ │ └── roadrunner.Dockerfile │ ├── 006_nginx_roadrunner │ │ ├── docker-compose.yaml │ │ ├── nginx │ │ │ ├── conf.d │ │ │ │ └── symfony7site.conf │ │ │ ├── nginx.Dockerfile │ │ │ └── nginx.conf │ │ └── roadrunner │ │ │ ├── php.ini │ │ │ └── roadrunner.Dockerfile │ ├── 007_frankenphp │ │ ├── docker-compose.yaml │ │ └── frankenphp │ │ │ ├── Caddyfile │ │ │ ├── conf.d │ │ │ └── php.ini │ │ │ └── frankenphp.Dockerfile │ ├── 008_frankenphp_workermode │ │ ├── docker-compose.yaml │ │ └── frankenphp │ │ │ ├── Caddyfile │ │ │ ├── conf.d │ │ │ └── php.ini │ │ │ └── frankenphp.Dockerfile │ ├── 009_swoole │ │ ├── docker-compose.yaml │ │ └── swoole │ │ │ ├── php.ini │ │ │ └── swoole.Dockerfile │ ├── 010_adapterman │ │ ├── adapterman │ │ │ ├── adapterman.Dockerfile │ │ │ └── php.ini │ │ └── docker-compose.yaml │ └── 011_caddy_phpfpm │ │ ├── caddy │ │ ├── Caddyfile │ │ └── caddy.Dockerfile │ │ ├── docker-compose.yaml │ │ └── fpm │ │ ├── php.ini │ │ ├── phpfpm.Dockerfile │ │ └── www.conf └── testing-tools │ ├── bombardier │ └── k6 │ ├── script_vus10000_dur30s.js │ ├── script_vus1000_dur30s.js │ ├── script_vus100_dur30s.js │ ├── script_vus10_dur30s.js │ ├── script_vus5_dur10s.js │ └── script_vus5_dur30s.js ├── 002_symfony6_wo_db └── runtimes │ └── 010_reactphp │ ├── docker-compose.yaml │ └── reactphp │ ├── php.ini │ └── reactphp.Dockerfile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | results 3 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/Makefile: -------------------------------------------------------------------------------- 1 | ## help : Print commands help. 2 | help : Makefile 3 | @sed -n 's/^##//p' $< 4 | 5 | ## 6 | #################### 001 APACHE + mod_php #################### 7 | ## 8 | ## start/runtime/001-apache-modphp : Start 001 Runtime: Apache(prefork mode) + mod_php. 9 | start/runtime/001-apache-modphp: 10 | cd runtimes/001_apache_modphp && docker compose up -d --force-recreate 11 | 12 | ## stop/runtime/001-apache-modphp : Stop 001 Runtime: Apache(prefork mode) + mod_php. 13 | stop/runtime/001-apache-modphp: 14 | cd runtimes/001_apache_modphp && docker compose stop 15 | 16 | ## rebuild/runtime/001-apache-modphp : Rebuild&Start 001 Runtime: Apache(prefork mode) + mod_php. 17 | rebuild/runtime/001-apache-modphp: 18 | cd runtimes/001_apache_modphp && docker compose up -d --force-recreate --build 19 | 20 | ## down/runtime/001-apache-modphp : Remove all related to 001 Runtime. 21 | down/runtime/001-apache-modphp: 22 | cd runtimes/001_apache_modphp && docker compose down 23 | 24 | ## shell/runtime/001-apache-modphp : Login to 001 Runtime: Apache(prefork mode) + mod_php. 25 | shell/runtime/001-apache-modphp: 26 | @docker container exec -it 001_apache_modphp bash 27 | 28 | ## 29 | #################### 002 APACHE + PHP-FPM #################### 30 | ## 31 | ## start/runtime/002-apache-phpfpm : Start 002 Runtime: Apache + PHP-FPM. 32 | start/runtime/002-apache-phpfpm: 33 | cd runtimes/002_apache_phpfpm && docker compose up -d --force-recreate 34 | 35 | ## stop/runtime/002-apache-phpfpm : Stop 002 Runtime: Apache + PHP-FPM. 36 | stop/runtime/002-apache-phpfpm: 37 | cd runtimes/002_apache_phpfpm && docker compose stop 38 | 39 | ## rebuild/runtime/002-apache-phpfpm : Rebuild&Start 002 Runtime: Apache + PHP-FPM. 40 | rebuild/runtime/002-apache-phpfpm: 41 | cd runtimes/002_apache_phpfpm && docker compose up -d --force-recreate --build 42 | 43 | ## down/runtime/002-apache-phpfpm : Remove all related to 002 Runtime. 44 | down/runtime/002-apache-phpfpm: 45 | cd runtimes/002_apache_phpfpm && docker compose down 46 | 47 | ## shell/runtime/002-apache : Login to 002 Runtime: Apache. 48 | shell/runtime/002-apache: 49 | @docker container exec -it 002_apache bash 50 | 51 | ## shell/runtime/002-phpfpm : Login to 002 Runtime: PHP-FPM. 52 | shell/runtime/002-phpfpm: 53 | @docker container exec -it 002_phpfpm bash 54 | 55 | ## 56 | #################### 003 NGINX + PHP-FPM #################### 57 | ## 58 | ## start/runtime/003-nginx-phpfpm : Start 003 Runtime: Nginx + PHP-FPM. 59 | start/runtime/003-nginx-phpfpm: 60 | cd runtimes/003_nginx_phpfpm && docker compose up -d --force-recreate 61 | 62 | ## stop/runtime/003-nginx-phpfpm : Stop 003 Runtime: Nginx + PHP-FPM. 63 | stop/runtime/003-nginx-phpfpm: 64 | cd runtimes/003_nginx_phpfpm && docker compose stop 65 | 66 | ## rebuild/runtime/003-nginx-phpfpm : Rebuild&Start 003 Runtime: Nginx + PHP-FPM. 67 | rebuild/runtime/003-nginx-phpfpm: 68 | cd runtimes/003_nginx_phpfpm && docker compose up -d --force-recreate --build 69 | 70 | ## down/runtime/003-nginx-phpfpm : Remove all related to 003 Runtime. 71 | down/runtime/003-nginx-phpfpm: 72 | cd runtimes/003_nginx_phpfpm && docker compose down 73 | 74 | ## shell/runtime/003-nginx : Login to 003 Runtime: Nginx. 75 | shell/runtime/003-nginx: 76 | @docker container exec -it 003_nginx bash 77 | 78 | ## shell/runtime/003-phpfpm : Login to 003 Runtime: PHP-FPM. 79 | shell/runtime/003-phpfpm: 80 | @docker container exec -it 003_phpfpm bash 81 | 82 | ## 83 | #################### 004 NGINX Unit #################### 84 | ## 85 | ## start/runtime/004-nginx-unit : Start 004 Runtime: Nginx Unit. 86 | start/runtime/004-nginx-unit: 87 | cd runtimes/004_nginx_unit && docker compose up -d --force-recreate 88 | 89 | ## stop/runtime/004-nginx-unit : Stop 004 Runtime: Nginx Unit. 90 | stop/runtime/004-nginx-unit: 91 | cd runtimes/004_nginx_unit && docker compose stop 92 | 93 | ## rebuild/runtime/004-nginx-unit : Rebuild&Start 004 Runtime: Nginx Unit. 94 | rebuild/runtime/004-nginx-unit: 95 | cd runtimes/004_nginx_unit && docker compose up -d --force-recreate --build 96 | 97 | ## down/runtime/004-nginx-unit : Remove all related to 004 Runtime. 98 | down/runtime/004-nginx-unit: 99 | cd runtimes/004_nginx_unit && docker compose down 100 | 101 | ## shell/runtime/004-nginx : Login to 004 Runtime: Nginx Unit. 102 | shell/runtime/004-nginx-unit: 103 | @docker container exec -it 004_nginx_unit bash 104 | 105 | 106 | ## 107 | #################### 005 Roadrunner #################### 108 | ## 109 | ## start/runtime/005-roadrunner : Start 005 Runtime: Roadrunner. 110 | start/runtime/005-roadrunner: 111 | cd runtimes/005_roadrunner && docker compose up -d --force-recreate 112 | 113 | ## stop/runtime/005-roadrunner : Stop 005 Runtime: Roadrunner. 114 | stop/runtime/005-roadrunner: 115 | cd runtimes/005_roadrunner && docker compose stop 116 | 117 | ## rebuild/runtime/005-roadrunner : Rebuild&Start 005 Runtime: Roadrunner. 118 | rebuild/runtime/005-roadrunner: 119 | cd runtimes/005_roadrunner && docker compose up -d --force-recreate --build 120 | 121 | ## down/runtime/005-roadrunner : Remove all related to 005 Runtime. 122 | down/runtime/005-roadrunner: 123 | cd runtimes/005_roadrunner && docker compose down 124 | 125 | ## shell/runtime/005-roadrunner : Login to 005 Runtime: Roadrunner. 126 | shell/runtime/005-roadrunner: 127 | @docker container exec -it 005_roadrunner bash 128 | 129 | ## 130 | #################### 006 Nginx + Roadrunner #################### 131 | ## 132 | ## start/runtime/006-nginx-roadrunner : Start 006 Runtime: Nginx + Roadrunner. 133 | start/runtime/006-nginx-roadrunner: 134 | cd runtimes/006_nginx_roadrunner && docker compose up -d --force-recreate 135 | 136 | ## stop/runtime/006-nginx-roadrunner : Stop 006 Runtime: Nginx + Roadrunner. 137 | stop/runtime/006-nginx-roadrunner: 138 | cd runtimes/006_nginx_roadrunner && docker compose stop 139 | 140 | ## rebuild/runtime/006-nginx-roadrunner : Rebuild&Start 006 Runtime: Nginx + Roadrunner. 141 | rebuild/runtime/006-nginx-roadrunner: 142 | cd runtimes/006_nginx_roadrunner && docker compose up -d --force-recreate --build 143 | 144 | ## down/runtime/006-nginx-roadrunner : Remove all related to 006 Nginx + Runtime. 145 | down/runtime/006-nginx-roadrunner: 146 | cd runtimes/006_nginx_roadrunner && docker compose down 147 | 148 | ## shell/runtime/006-nginx : Login to 006 Nginx 149 | shell/runtime/006-nginx: 150 | @docker container exec -it 006_nginx bash 151 | 152 | ## shell/runtime/006-roadrunner : Login to 006 Roadrunner. 153 | shell/runtime/006-roadrunner: 154 | @docker container exec -it 006_roadrunner bash 155 | 156 | ## 157 | #################### 007 Frankenphp #################### 158 | ## 159 | ## start/runtime/007-frankenphp : Start 007 Runtime: Frankenphp. 160 | start/runtime/007-frankenphp: 161 | cd runtimes/007_frankenphp && docker compose up -d --force-recreate 162 | 163 | ## stop/runtime/007-frankenphp : Stop 007 Runtime: Frankenphp. 164 | stop/runtime/007-frankenphp: 165 | cd runtimes/007_frankenphp && docker compose stop 166 | 167 | ## rebuild/runtime/007-frankenphp : Rebuild&Start 007 Runtime: Frankenphp. 168 | rebuild/runtime/007-frankenphp: 169 | cd runtimes/007_frankenphp && docker compose up -d --force-recreate --build 170 | 171 | ## down/runtime/007-frankenphp : Remove all related to 007 Runtime. 172 | down/runtime/007-frankenphp: 173 | cd runtimes/007_frankenphp && docker compose down 174 | 175 | ## shell/runtime/007-frankenphp : Login to 007 Runtime: Frankenphp. 176 | shell/runtime/007-frankenphp: 177 | @docker container exec -it 007_frankenphp bash 178 | 179 | ## 180 | #################### 008 Frankenphp (workermode) #################### 181 | ## 182 | ## start/runtime/008-frankenphp-workermode : Start 008 Runtime: Frankenphp (workermode). 183 | start/runtime/008-frankenphp-workermode: 184 | cd runtimes/008_frankenphp_workermode && docker compose up -d --force-recreate 185 | 186 | ## stop/runtime/008-frankenphp-workermode : Stop 008 Runtime: Frankenphp (workermode). 187 | stop/runtime/008-frankenphp-workermode: 188 | cd runtimes/008_frankenphp_workermode && docker compose stop 189 | 190 | ## rebuild/runtime/008-frankenphp-workermode : Rebuild&Start 008 Runtime: Frankenphp (workermode). 191 | rebuild/runtime/008-frankenphp-workermode: 192 | cd runtimes/008_frankenphp_workermode && docker compose up -d --force-recreate --build 193 | 194 | ## down/runtime/008-frankenphp-workermode : Remove all related to 008 Runtime: Frankenphp (workermode). 195 | down/runtime/008-frankenphp-workermode: 196 | cd runtimes/008_frankenphp_workermode && docker compose down 197 | 198 | ## shell/runtime/008-frankenphp-workermode : Login to 008 Runtime: Frankenphp (workermode). 199 | shell/runtime/008-frankenphp-workermode: 200 | @docker container exec -it 008_frankenphp_workermode bash 201 | 202 | ## 203 | #################### 009 Swoole #################### 204 | ## 205 | ## start/runtime/009-swoole : Start 009 Runtime: Swoole. 206 | start/runtime/009-swoole: 207 | cd runtimes/009_swoole && docker compose up -d --force-recreate 208 | 209 | ## stop/runtime/009-swoole : Stop 009 Runtime: Swoole. 210 | stop/runtime/009-swoole: 211 | cd runtimes/009_swoole && docker compose stop 212 | 213 | ## rebuild/runtime/009-swoole : Rebuild&Start 009 Runtime: Swoole 214 | rebuild/runtime/009-swoole: 215 | cd runtimes/009_swoole && docker compose up -d --force-recreate --build 216 | 217 | ## down/runtime/009-swoole : Remove all related to 009 Runtime Swoole. 218 | down/runtime/009-swoole: 219 | cd runtimes/009_swoole && docker compose down 220 | 221 | ## shell/runtime/009-swoole : Login to 009 Runtime: Swoole. 222 | shell/runtime/009-swoole: 223 | @docker container exec -it 009_swoole bash 224 | 225 | ## 226 | 227 | #################### 011 Caddy + PHP-FPM #################### 228 | ## 229 | ## start/runtime/011-caddy-phpfpm : Start 011 Runtime: Caddy + PHP-FPM. 230 | start/runtime/011-caddy-phpfpm: 231 | cd runtimes/011_caddy_phpfpm && docker compose up -d --force-recreate 232 | 233 | ## stop/runtime/011-caddy-phpfpm : Stop 011 Runtime: Caddy + PHP-FPM. 234 | stop/runtime/011-caddy-phpfpm: 235 | cd runtimes/011_caddy_phpfpm && docker compose stop 236 | 237 | ## rebuild/runtime/011-caddy-phpfpm : Rebuild&Start 011 Runtime: Caddy + PHP-FPM. 238 | rebuild/runtime/011-caddy-phpfpm: 239 | cd runtimes/011_caddy_phpfpm && docker compose up -d --force-recreate --build 240 | 241 | ## down/runtime/011-caddy-phpfpm : Remove all related to 011 Runtime Caddy + PHP-FPM.. 242 | down/runtime/011-caddy-phpfpm: 243 | cd runtimes/011_caddy_phpfpm && docker compose down 244 | 245 | ## shell/runtime/011-caddy-phpfpm : Login to 011 Runtime: Caddy + PHP-FPM.. 246 | shell/runtime/011-caddy-phpfpm: 247 | @docker container exec -it 011_caddy_phpfpm bash 248 | 249 | #################### 010 Adapterman #################### 250 | ## 251 | ## start/runtime/010-adapterman : Start 010 Runtime: Adapterman. 252 | start/runtime/010-adapterman: 253 | cd runtimes/010_adapterman && docker compose up -d --force-recreate 254 | 255 | ## stop/runtime/010-adapterman : Stop 010 Runtime: Adapterman. 256 | stop/runtime/010-adapterman: 257 | cd runtimes/010_adapterman && docker compose stop 258 | 259 | ## rebuild/runtime/010-adapterman : Rebuild&Start 010 Runtime: Adapterman 260 | rebuild/runtime/010-adapterman: 261 | cd runtimes/010_adapterman && docker compose up -d --force-recreate --build 262 | 263 | ## down/runtime/010-adapterman : Remove all related to 010 Runtime Adapterman. 264 | down/runtime/010-adapterman: 265 | cd runtimes/010_adapterman && docker compose down 266 | 267 | ## shell/runtime/010-adapterman : Login to 010 Runtime: Adapterman. 268 | shell/runtime/010-adapterman: 269 | @docker container exec -it 010_adapterman bash 270 | 271 | ## 272 | #################### Load Testing #################### 273 | ## 274 | 275 | ## run/loadtest/ab-n1000-c5 : Run "ab -n 1000 -c 5 URL" 276 | run/loadtest/ab-n1000-c5: 277 | docker run --rm --name ab-loadttest --network php-benchmarks httpd:2.4.58-bookworm ab -n 1000 -c 5 "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 278 | 279 | ## run/loadtest/ab-n1000-c10 : Run "ab -n 1000 -c 10 URL" 280 | run/loadtest/ab-n1000-c10: 281 | docker run --rm --name ab-loadttest --network php-benchmarks httpd:2.4.58-bookworm ab -n 1000 -c 10 "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 282 | 283 | ## run/loadtest/ab-n1000-c100 : Run "ab -n 1000 -c 100 URL" 284 | run/loadtest/ab-n1000-c100: 285 | docker run --rm --name ab-loadttest --network php-benchmarks httpd:2.4.58-bookworm ab -n 1000 -c 100 "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 286 | 287 | ## run/loadtest/ab-n10000-c1000 : Run "ab -n 10000 -c 1000 URL" 288 | run/loadtest/ab-n10000-c1000: 289 | docker run --rm --name ab-loadttest --network php-benchmarks httpd:2.4.58-bookworm ab -n 10000 -c 1000 "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 290 | 291 | ## run/loadtest/k6-vus5-dur10s : Run k6 vus:5 duration: 10s 292 | run/loadtest/k6-vus5-dur30s: 293 | docker run --rm --net php-benchmarks -i grafana/k6 run - <./testing-tools/k6/script_vus5_dur30s.js 294 | 295 | ## run/loadtest/k6-vus10-dur30s : Run k6 vus:10 duration: 30s 296 | run/loadtest/k6-vus10-dur30s: 297 | docker run --rm --net php-benchmarks -i grafana/k6 run - <./testing-tools/k6/script_vus10_dur30s.js 298 | 299 | ## run/loadtest/k6-vus100-dur30s : Run k6 vus:100 duration: 30s 300 | run/loadtest/k6-vus100-dur30s: 301 | docker run --rm --net php-benchmarks -i grafana/k6 run - <./testing-tools/k6/script_vus100_dur30s.js 302 | 303 | ## run/loadtest/k6-vus1000-dur30s : Run k6 vus:1000 duration: 30s 304 | run/loadtest/k6-vus1000-dur30s: 305 | docker run --rm --net php-benchmarks -i grafana/k6 run - <./testing-tools/k6/script_vus1000_dur30s.js 306 | 307 | ## run/loadtest/k6-vus10000-dur30s : Run k6 vus:10000 duration: 30s 308 | run/loadtest/k6-vus10000-dur30s: 309 | docker run --rm --net php-benchmarks -i grafana/k6 run - <./testing-tools/k6/script_vus10000_dur30s.js 310 | 311 | ## run/loadtest/bombardier-c5-d30s : Run bombardier concurrent connections: 5, duration: 30s 312 | run/loadtest/bombardier-c5-d30s: 313 | docker run --rm --name bombardier-loadttest --network php-benchmarks alpine/bombardier:1.2.6 -c 5 -d 30s "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 314 | 315 | ## run/loadtest/bombardier-c10-d30s : Run bombardier concurrent connections: 10, duration: 30s 316 | run/loadtest/bombardier-c10-d30s: 317 | docker run --rm --name bombardier-loadttest --network php-benchmarks alpine/bombardier:1.2.6 -c 10 -d 30s "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 318 | 319 | ## run/loadtest/bombardier-c100-d30s : Run bombardier concurrent connections: 100, duration: 30s 320 | run/loadtest/bombardier-c100-d30s: 321 | docker run --rm --name bombardier-loadttest --network php-benchmarks alpine/bombardier:1.2.6 -c 100 -d 30s "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 322 | 323 | ## run/loadtest/bombardier-c1000-d30s : Run bombardier concurrent connections: 1000, duration: 30s 324 | run/loadtest/bombardier-c1000-d30s: 325 | docker run --rm --name bombardier-loadttest --network php-benchmarks alpine/bombardier:1.2.6 -c 1000 -d 30s "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 326 | 327 | ## run/loadtest/bombardier-c10000-d30s : Run bombardier concurrent connections: 10000, duration: 30s 328 | run/loadtest/bombardier-c10000-d30s: 329 | docker run --rm --name bombardier-loadttest --network php-benchmarks alpine/bombardier:1.2.6 -c 10000 -d 30s "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 330 | 331 | ## run/loadtest/wrk-c5-d30s : Run wrk, concurrent connections: 5, duration: 30s 332 | run/loadtest/wrk-c5-d30s: 333 | docker run --rm --name wrk-loadtest --network php-benchmarks williamyeh/wrk:4.0.2 -c 5 -d 30s "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 334 | 335 | 336 | ## run/loadtest/wrk-c10-d30s : Run wrk, concurrent connections: 10, duration: 30s 337 | run/loadtest/wrk-c10-d30s: 338 | docker run --rm --name wrk-loadtest --network php-benchmarks williamyeh/wrk:4.0.2 -c 10 -d 30s "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 339 | 340 | ## run/loadtest/wrk-c100-d30s : Run wrk, concurrent connections: 100, duration: 30s 341 | run/loadtest/wrk-c100-d30s: 342 | docker run --rm --name wrk-loadtest --network php-benchmarks williamyeh/wrk:4.0.2 -c 100 -d 30s "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" 343 | 344 | ## run/loadtest/wrk-c1000-d30s : Run wrk, concurrent connections: 1000, duration: 30s 345 | run/loadtest/wrk-c1000-d30s: 346 | docker run --rm --name wrk-loadtest --network php-benchmarks williamyeh/wrk:4.0.2 -t 1 -c 1000 -d 30s "http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname" -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/.env: -------------------------------------------------------------------------------- 1 | APP_ENV=prod -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/.env.example: -------------------------------------------------------------------------------- 1 | APP_ENV=prod -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/.gitignore: -------------------------------------------------------------------------------- 1 | ###> symfony/framework-bundle ### 2 | /.env.local 3 | /.env.local.php 4 | /.env.*.local 5 | /config/secrets/prod/prod.decrypt.private.php 6 | /public/bundles/ 7 | /var/ 8 | /vendor/ 9 | ###< symfony/framework-bundle ### 10 | 11 | ###> baldinof/roadrunner-bundle ### 12 | /bin/rr 13 | ###< baldinof/roadrunner-bundle ### 14 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/.rr.dev.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | server: 4 | command: "php public/index.php" 5 | env: 6 | - APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime 7 | 8 | http: 9 | address: 0.0.0.0:8080 10 | middleware: [ "static", "gzip" ] 11 | pool: 12 | debug: true 13 | uploads: 14 | forbid: [ ".php", ".exe", ".bat" ] 15 | static: 16 | dir: "public" 17 | forbid: [ ".php", ".htaccess" ] 18 | 19 | logs: 20 | mode: development 21 | channels: 22 | http: 23 | level: debug # Log all http requests, set to info to disable 24 | server: 25 | level: info # Everything written to worker stderr is logged 26 | mode: raw 27 | metrics: 28 | level: debug 29 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/.rr.fcgi.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | server: 4 | command: "php public/index.php" 5 | env: 6 | - APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime 7 | 8 | http: 9 | fcgi: 10 | address: tcp://0.0.0.0:9000 11 | pool: 12 | debug: false 13 | middleware: [ "static", "gzip" ] 14 | uploads: 15 | forbid: [ ".php", ".exe", ".bat" ] 16 | static: 17 | dir: "public" 18 | forbid: [ ".php", ".htaccess" ] 19 | 20 | logs: 21 | mode: production 22 | channels: 23 | http: 24 | level: debug # Log all http requests, set to info to disable 25 | server: 26 | level: info # Everything written to worker stderr is logged 27 | mode: raw 28 | metrics: 29 | level: error 30 | 31 | # Uncomment to use metrics integration 32 | # rpc: 33 | # listen: tcp://127.0.0.1:6001 34 | 35 | # Uncomment to use metrics integration 36 | # metrics: 37 | # # prometheus client address (path /metrics added automatically) 38 | # address: "0.0.0.0:9180" 39 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/.rr.production.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | server: 4 | command: "php public/index.php" 5 | env: 6 | - APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime 7 | # Workers pool settings. 8 | 9 | 10 | http: 11 | address: 0.0.0.0:80 12 | pool: 13 | # Debug mode for the pool. In this mode, pool will not pre-allocate the worker. Worker (only 1, num_workers ignored) will be allocated right after the request arrived. 14 | # 15 | # Default: false 16 | debug: false 17 | 18 | # Override server's command 19 | # 20 | # Default: empty 21 | command: "php public/index.php" 22 | 23 | # How many worker processes will be started. Zero (or nothing) means the number of logical CPUs. 24 | # 25 | # Default: 0 26 | num_workers: 2 27 | 28 | # Maximal count of worker executions. Zero (or nothing) means no limit. 29 | # 30 | # Default: 0 31 | max_jobs: 0 32 | 33 | # [2023.3.10] 34 | # Maximum size of the internal requests queue. After reaching the limit, all additional requests would be rejected with error. 35 | # 36 | # Default: 0 (no limit) 37 | max_queue_size: 0 38 | 39 | # Timeout for worker allocation. Zero means 60s. 40 | # 41 | # Default: 60s 42 | allocate_timeout: 60s 43 | 44 | # Timeout for the reset timeout. Zero means 60s. 45 | # 46 | # Default: 60s 47 | reset_timeout: 60s 48 | 49 | # Timeout for the stream cancellation. Zero means 60s. 50 | # 51 | # Default: 60s 52 | stream_timeout: 60s 53 | 54 | # Timeout for worker destroying before process killing. Zero means 60s. 55 | # 56 | # Default: 60s 57 | destroy_timeout: 60s 58 | 59 | # Supervisor is used to control http workers (previous name was "limit", video: https://www.youtube.com/watch?v=NdrlZhyFqyQ). 60 | # "Soft" limits will not interrupt current request processing. "Hard" 61 | # limit on the contrary - interrupts the execution of the request. 62 | supervisor: 63 | # How often to check the state of the workers. 64 | # 65 | # Default: 1s 66 | watch_tick: 1s 67 | 68 | # How long worker can live (soft limit). Zero means no limit. 69 | # 70 | # Default: 0s 71 | ttl: 0s 72 | 73 | # How long worker can spend in IDLE mode after first using (soft limit). Zero means no limit. 74 | # 75 | # Default: 0s 76 | idle_ttl: 10s 77 | 78 | # Maximal worker memory usage in megabytes (soft limit). Zero means no limit. 79 | # 80 | # Default: 0 81 | max_worker_memory: 128 82 | 83 | # Maximal job lifetime (hard limit). Zero means no limit. 84 | # 85 | # Default: 0s 86 | exec_ttl: 60s 87 | 88 | logs: 89 | mode: production 90 | level: error 91 | 92 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/.rr.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | server: 4 | command: "php public/index.php" 5 | env: 6 | - APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime 7 | # Workers pool settings. 8 | 9 | 10 | http: 11 | address: 0.0.0.0:8080 12 | pool: 13 | # Debug mode for the pool. In this mode, pool will not pre-allocate the worker. Worker (only 1, num_workers ignored) will be allocated right after the request arrived. 14 | # 15 | # Default: false 16 | debug: false 17 | 18 | # Override server's command 19 | # 20 | # Default: empty 21 | command: "php public/index.php" 22 | 23 | # How many worker processes will be started. Zero (or nothing) means the number of logical CPUs. 24 | # 25 | # Default: 0 26 | num_workers: 2 27 | 28 | # Maximal count of worker executions. Zero (or nothing) means no limit. 29 | # 30 | # Default: 0 31 | max_jobs: 0 32 | 33 | # [2023.3.10] 34 | # Maximum size of the internal requests queue. After reaching the limit, all additional requests would be rejected with error. 35 | # 36 | # Default: 0 (no limit) 37 | max_queue_size: 0 38 | 39 | # Timeout for worker allocation. Zero means 60s. 40 | # 41 | # Default: 60s 42 | allocate_timeout: 60s 43 | 44 | # Timeout for the reset timeout. Zero means 60s. 45 | # 46 | # Default: 60s 47 | reset_timeout: 60s 48 | 49 | # Timeout for the stream cancellation. Zero means 60s. 50 | # 51 | # Default: 60s 52 | stream_timeout: 60s 53 | 54 | # Timeout for worker destroying before process killing. Zero means 60s. 55 | # 56 | # Default: 60s 57 | destroy_timeout: 60s 58 | 59 | # Supervisor is used to control http workers (previous name was "limit", video: https://www.youtube.com/watch?v=NdrlZhyFqyQ). 60 | # "Soft" limits will not interrupt current request processing. "Hard" 61 | # limit on the contrary - interrupts the execution of the request. 62 | supervisor: 63 | # How often to check the state of the workers. 64 | # 65 | # Default: 1s 66 | watch_tick: 1s 67 | 68 | # How long worker can live (soft limit). Zero means no limit. 69 | # 70 | # Default: 0s 71 | ttl: 0s 72 | 73 | # How long worker can spend in IDLE mode after first using (soft limit). Zero means no limit. 74 | # 75 | # Default: 0s 76 | idle_ttl: 10s 77 | 78 | # Maximal worker memory usage in megabytes (soft limit). Zero means no limit. 79 | # 80 | # Default: 0 81 | max_worker_memory: 128 82 | 83 | # Maximal job lifetime (hard limit). Zero means no limit. 84 | # 85 | # Default: 0s 86 | exec_ttl: 60s 87 | 88 | logs: 89 | mode: production 90 | level: error 91 | 92 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | =8.2", 8 | "ext-ctype": "*", 9 | "ext-iconv": "*", 10 | "baldinof/roadrunner-bundle": "^3.1", 11 | "joanhey/adapterman": "^0.6.1", 12 | "runtime/frankenphp-symfony": "^0.2.0", 13 | "runtime/swoole": "^0.4.0", 14 | "symfony/console": "7.0.*", 15 | "symfony/dotenv": "7.0.*", 16 | "symfony/flex": "^2", 17 | "symfony/framework-bundle": "7.0.*", 18 | "symfony/runtime": "7.0.*", 19 | "symfony/twig-bundle": "7.0.*", 20 | "symfony/yaml": "7.0.*", 21 | "twig/extra-bundle": "^2.12|^3.0", 22 | "twig/twig": "^2.12|^3.0" 23 | }, 24 | "require-dev": { 25 | "spiral/roadrunner-cli": "^2.6", 26 | "symfony/maker-bundle": "^1.52", 27 | "symfony/stopwatch": "7.0.*", 28 | "symfony/web-profiler-bundle": "7.0.*" 29 | }, 30 | "config": { 31 | "allow-plugins": { 32 | "php-http/discovery": true, 33 | "symfony/flex": true, 34 | "symfony/runtime": true 35 | }, 36 | "sort-packages": true 37 | }, 38 | "autoload": { 39 | "psr-4": { 40 | "App\\": "src/" 41 | } 42 | }, 43 | "autoload-dev": { 44 | "psr-4": { 45 | "App\\Tests\\": "tests/" 46 | } 47 | }, 48 | "replace": { 49 | "symfony/polyfill-ctype": "*", 50 | "symfony/polyfill-iconv": "*", 51 | "symfony/polyfill-php72": "*", 52 | "symfony/polyfill-php73": "*", 53 | "symfony/polyfill-php74": "*", 54 | "symfony/polyfill-php80": "*", 55 | "symfony/polyfill-php81": "*", 56 | "symfony/polyfill-php82": "*" 57 | }, 58 | "scripts": { 59 | "auto-scripts": { 60 | "cache:clear": "symfony-cmd", 61 | "assets:install %PUBLIC_DIR%": "symfony-cmd" 62 | }, 63 | "post-install-cmd": [ 64 | "@auto-scripts" 65 | ], 66 | "post-update-cmd": [ 67 | "@auto-scripts" 68 | ] 69 | }, 70 | "conflict": { 71 | "symfony/symfony": "*" 72 | }, 73 | "extra": { 74 | "symfony": { 75 | "allow-contrib": false, 76 | "require": "7.0.*" 77 | }, 78 | "runtime": { 79 | "class": "Runtime\\FrankenPhpSymfony\\Runtime" 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/config/bundles.php: -------------------------------------------------------------------------------- 1 | ['all' => true], 5 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], 6 | Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], 7 | Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], 8 | Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], 9 | Baldinof\RoadRunnerBundle\BaldinofRoadRunnerBundle::class => ['all' => true], 10 | ]; 11 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/config/packages/baldinof_road_runner.yaml: -------------------------------------------------------------------------------- 1 | baldinof_road_runner: 2 | # When the kernel should be rebooted. 3 | # See https://github.com/baldinof/roadrunner-bundle#kernel-reboots 4 | kernel_reboot: 5 | # if you want to use a fresh container on each request, use the `always` strategy 6 | strategy: on_exception 7 | # Exceptions you KNOW that do not put your app in an unrecoverable state 8 | allowed_exceptions: 9 | - Symfony\Component\HttpKernel\Exception\HttpExceptionInterface 10 | - Symfony\Component\Serializer\Exception\ExceptionInterface 11 | - Symfony\Contracts\HttpClient\Exception\ExceptionInterface 12 | 13 | # Allow to send prometheus metrics to the main RoadRunner process, 14 | # via a `Spiral\RoadRunner\MetricsInterface` service. 15 | # See https://github.com/baldinof/roadrunner-bundle#metrics 16 | metrics: 17 | enabled: false 18 | # collect: 19 | # my_counter: 20 | # type: counter 21 | # help: Some help 22 | 23 | 24 | # You can use middlewares to manipulate Symfony requests & responses. 25 | # See https://github.com/baldinof/roadrunner-bundle#middlewares 26 | # middlewares: 27 | # - App\Middleware\YourMiddleware 28 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/config/packages/cache.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | cache: 3 | # Unique name of your app: used to compute stable namespaces for cache keys. 4 | #prefix_seed: your_vendor_name/app_name 5 | 6 | # The "app" cache stores to the filesystem by default. 7 | # The data in this cache should persist between deploys. 8 | # Other options include: 9 | 10 | # Redis 11 | #app: cache.adapter.redis 12 | #default_redis_provider: redis://localhost 13 | 14 | # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues) 15 | #app: cache.adapter.apcu 16 | 17 | # Namespaced pools use the above "app" backend by default 18 | #pools: 19 | #my.dedicated.cache: null 20 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/config/packages/framework.yaml: -------------------------------------------------------------------------------- 1 | # see https://symfony.com/doc/current/reference/configuration/framework.html 2 | framework: 3 | secret: '%env(APP_SECRET)%' 4 | #csrf_protection: true 5 | handle_all_throwables: true 6 | 7 | # Enables session support. Note that the session will ONLY be started if you read or write from it. 8 | # Remove or comment this section to explicitly disable session support. 9 | session: 10 | handler_id: null 11 | cookie_secure: auto 12 | cookie_samesite: lax 13 | 14 | #esi: true 15 | #fragments: true 16 | php_errors: 17 | log: true 18 | 19 | when@test: 20 | framework: 21 | test: true 22 | session: 23 | storage_factory_id: session.storage.factory.mock_file 24 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | utf8: true 4 | 5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. 6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands 7 | #default_uri: http://localhost 8 | 9 | when@prod: 10 | framework: 11 | router: 12 | strict_requirements: null 13 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/config/packages/twig.yaml: -------------------------------------------------------------------------------- 1 | twig: 2 | default_path: '%kernel.project_dir%/templates' 3 | 4 | when@test: 5 | twig: 6 | strict_variables: true 7 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/config/packages/web_profiler.yaml: -------------------------------------------------------------------------------- 1 | when@dev: 2 | web_profiler: 3 | toolbar: true 4 | intercept_redirects: false 5 | 6 | framework: 7 | profiler: 8 | only_exceptions: false 9 | collect_serializer_data: true 10 | 11 | when@test: 12 | web_profiler: 13 | toolbar: false 14 | intercept_redirects: false 15 | 16 | framework: 17 | profiler: { collect: false } 18 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/config/preload.php: -------------------------------------------------------------------------------- 1 | '0.0.0.0', 9 | 'port' => 80, 10 | 'mode' => SWOOLE_BASE, 11 | 'settings' => [ 12 | \Swoole\Constant::OPTION_WORKER_NUM => 2, 13 | \Swoole\Constant::OPTION_ENABLE_STATIC_HANDLER => true, 14 | \Swoole\Constant::OPTION_DOCUMENT_ROOT => dirname(__DIR__).'/public' 15 | ], 16 | ]; 17 | 18 | 19 | require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; 20 | 21 | return function (array $context) { 22 | return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); 23 | }; 24 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/server.php: -------------------------------------------------------------------------------- 1 | count = 1; // Only 1 worker 12 | $http_worker->name = 'AdapterMan'; 13 | 14 | $http_worker->onWorkerStart = static function () { 15 | 16 | require __DIR__.'/start.php'; 17 | }; 18 | 19 | $http_worker->onMessage = static function ($connection, $request) { 20 | 21 | $connection->send(run()); 22 | }; 23 | 24 | Worker::runAll(); 25 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/src/Controller/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DimDev/php-runtimes-benchmark/901796f378afbdc113a8247fba0309c29ee77441/001_symfony7_wo_db/project/src/Controller/.gitignore -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/src/Controller/FrontpageController.php: -------------------------------------------------------------------------------- 1 | render( 19 | 'frontpage.html.twig', 20 | [ 21 | 'first_name' => $firstName, 22 | 'last_name' => $lastName, 23 | 'hrtime' => hrtime(true), 24 | ] 25 | ); 26 | } 27 | 28 | #[Route('/phpinfo', name: 'phpinfo')] 29 | public function phpinfo(): Response 30 | { 31 | ob_start(); 32 | phpinfo(); 33 | $phpinfo = ob_get_contents(); 34 | ob_clean(); 35 | if(php_sapi_name() === 'cli') { 36 | return new Response("
{$phpinfo}
"); 37 | } 38 | return new Response($phpinfo); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/src/Kernel.php: -------------------------------------------------------------------------------- 1 | bootEnv(__DIR__.'/.env'); 11 | 12 | if ($_SERVER['APP_DEBUG']) { 13 | umask(0000); 14 | 15 | Debug::enable(); 16 | } 17 | 18 | if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { 19 | Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); 20 | } 21 | 22 | if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { 23 | Request::setTrustedHosts([$trustedHosts]); 24 | } 25 | 26 | global $kernel; 27 | 28 | $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); 29 | 30 | function run() 31 | { 32 | global $kernel; 33 | 34 | ob_start(); 35 | 36 | $request = Request::createFromGlobals(); 37 | $response = $kernel->handle($request); 38 | $response->send(); 39 | 40 | $kernel->terminate($request, $response); 41 | 42 | return ob_get_clean(); 43 | } 44 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/symfony.lock: -------------------------------------------------------------------------------- 1 | { 2 | "baldinof/roadrunner-bundle": { 3 | "version": "3.1", 4 | "recipe": { 5 | "repo": "github.com/symfony/recipes-contrib", 6 | "branch": "main", 7 | "version": "3.0", 8 | "ref": "0da69c96650460102ed0a2a0004e5b347f7220c9" 9 | }, 10 | "files": [ 11 | "config/packages/baldinof_road_runner.yaml" 12 | ] 13 | }, 14 | "symfony/console": { 15 | "version": "7.0", 16 | "recipe": { 17 | "repo": "github.com/symfony/recipes", 18 | "branch": "main", 19 | "version": "5.3", 20 | "ref": "da0c8be8157600ad34f10ff0c9cc91232522e047" 21 | }, 22 | "files": [ 23 | "bin/console" 24 | ] 25 | }, 26 | "symfony/flex": { 27 | "version": "2.4", 28 | "recipe": { 29 | "repo": "github.com/symfony/recipes", 30 | "branch": "main", 31 | "version": "1.0", 32 | "ref": "146251ae39e06a95be0fe3d13c807bcf3938b172" 33 | }, 34 | "files": [ 35 | ".env" 36 | ] 37 | }, 38 | "symfony/framework-bundle": { 39 | "version": "7.0", 40 | "recipe": { 41 | "repo": "github.com/symfony/recipes", 42 | "branch": "main", 43 | "version": "7.0", 44 | "ref": "de6e1b3e2bbbe69e36262d72c3f3db858b1ab391" 45 | }, 46 | "files": [ 47 | "config/packages/cache.yaml", 48 | "config/packages/framework.yaml", 49 | "config/preload.php", 50 | "config/routes/framework.yaml", 51 | "config/services.yaml", 52 | "public/index.php", 53 | "src/Controller/.gitignore", 54 | "src/Kernel.php" 55 | ] 56 | }, 57 | "symfony/maker-bundle": { 58 | "version": "1.52", 59 | "recipe": { 60 | "repo": "github.com/symfony/recipes", 61 | "branch": "main", 62 | "version": "1.0", 63 | "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" 64 | } 65 | }, 66 | "symfony/routing": { 67 | "version": "7.0", 68 | "recipe": { 69 | "repo": "github.com/symfony/recipes", 70 | "branch": "main", 71 | "version": "6.2", 72 | "ref": "e0a11b4ccb8c9e70b574ff5ad3dfdcd41dec5aa6" 73 | }, 74 | "files": [ 75 | "config/packages/routing.yaml", 76 | "config/routes.yaml" 77 | ] 78 | }, 79 | "symfony/twig-bundle": { 80 | "version": "7.0", 81 | "recipe": { 82 | "repo": "github.com/symfony/recipes", 83 | "branch": "main", 84 | "version": "6.3", 85 | "ref": "b7772eb20e92f3fb4d4fe756e7505b4ba2ca1a2c" 86 | }, 87 | "files": [ 88 | "config/packages/twig.yaml", 89 | "templates/base.html.twig" 90 | ] 91 | }, 92 | "symfony/web-profiler-bundle": { 93 | "version": "7.0", 94 | "recipe": { 95 | "repo": "github.com/symfony/recipes", 96 | "branch": "main", 97 | "version": "6.1", 98 | "ref": "e42b3f0177df239add25373083a564e5ead4e13a" 99 | }, 100 | "files": [ 101 | "config/packages/web_profiler.yaml", 102 | "config/routes/web_profiler.yaml" 103 | ] 104 | }, 105 | "twig/extra-bundle": { 106 | "version": "v3.8.0" 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/templates/base.html.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% block title %}{% endblock %} 6 | 8 | {% block stylesheets %} 9 | {% endblock %} 10 | 11 | {% block javascripts %} 12 | {% endblock %} 13 | 14 | 15 | {% block body %}{% endblock %} 16 | 17 | 18 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/project/templates/frontpage.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Frontpage{% endblock %} 4 | 5 | {% block body %} 6 |

Frontpage

7 |
8 | 13 |
14 | {% endblock %} -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/001_apache_modphp/apache.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-apache 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ 8 | 9 | RUN chmod +x /usr/local/bin/install-php-extensions && \ 10 | install-php-extensions \ 11 | exif \ 12 | intl \ 13 | opcache \ 14 | pdo_pgsql \ 15 | tidy \ 16 | gd \ 17 | bcmath \ 18 | sockets \ 19 | zip && \ 20 | install-php-extensions @composer; 21 | 22 | COPY ./runtimes/001_apache_modphp/sites-enabled/symfony7site.conf /etc/apache2/sites-available/symfony7site.conf 23 | RUN a2ensite symfony7site 24 | 25 | COPY ./runtimes/001_apache_modphp/mods-available/mpm_prefork.conf /etc/apache2/mods-available/mpm_prefork.conf 26 | COPY ./runtimes/001_apache_modphp/mods-available/status.conf /etc/apache2/mods-available/status.conf 27 | 28 | COPY "./project" "/var/www/symfony" 29 | 30 | RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini; 31 | COPY ./runtimes/001_apache_modphp/php.ini /usr/local/etc/php/conf.d/custom-php.ini 32 | 33 | WORKDIR /var/www/symfony 34 | 35 | RUN rm -rf vendor && \ 36 | cp .env.example .env.local && \ 37 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 38 | composer dump-autoload --no-dev --classmap-authoritative && \ 39 | composer check-platform-reqs && \ 40 | php bin/console cache:clear && \ 41 | php bin/console cache:warmup 42 | 43 | 44 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/001_apache_modphp/docker-compose-dev.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | apache_modphp_prefork: 3 | image: php:8.3-apache 4 | container_name: apache_modphp_prefork_dev 5 | hostname: symfony7site.dev 6 | volumes: 7 | - ./sites-enabled:/etc/apache2/sites-enabled 8 | - ./mods-available/status.conf:/etc/apache2/mods-available/status.conf 9 | - ./mods-available/mpm_prefork.conf:/etc/apache2/mods-available/mpm_prefork.conf 10 | - ../../projects/symfony-7:/var/www/symfony 11 | ports: 12 | - "80:80" 13 | networks: 14 | - php-benchmarks 15 | deploy: 16 | resources: 17 | limits: 18 | cpus: '1' 19 | memory: '1gb' 20 | 21 | 22 | networks: 23 | php-benchmarks: 24 | 25 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/001_apache_modphp/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 001_apache_modphp: 3 | build: 4 | context: ../../ 5 | dockerfile: ./runtimes/001_apache_modphp/apache.Dockerfile 6 | image: 001_apache_modphp 7 | container_name: 001_apache_modphp 8 | hostname: symfony7site 9 | ports: 10 | - "80:80" 11 | networks: 12 | - php-benchmarks 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | networks: 22 | php-benchmarks: 23 | name: php-benchmarks -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/001_apache_modphp/mods-available/mpm_prefork.conf: -------------------------------------------------------------------------------- 1 | # prefork MPM 2 | # StartServers: number of server processes to start 3 | # MinSpareServers: minimum number of server processes which are kept spare 4 | # MaxSpareServers: maximum number of server processes which are kept spare 5 | # MaxRequestWorkers: maximum number of server processes allowed to start 6 | # MaxConnectionsPerChild: maximum number of requests a server process serves 7 | 8 | StartServers 5 9 | MinSpareServers 5 10 | MaxSpareServers 10 11 | MaxRequestWorkers 512 12 | MaxConnectionsPerChild 0 13 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/001_apache_modphp/mods-available/status.conf: -------------------------------------------------------------------------------- 1 | # Allow server status reports generated by mod_status, 2 | # with the URL of http://servername/server-status 3 | # Uncomment and change the "192.0.2.0/24" to allow access from other hosts. 4 | 5 | # 6 | # SetHandler server-status 7 | # Require local 8 | # #Require ip 192.0.2.0/24 9 | # 10 | 11 | # CUSTOM 12 | 13 | SetHandler server-status 14 | Require all granted 15 | 16 | # /CUSTOM 17 | 18 | # Keep track of extended status information for each request 19 | ExtendedStatus On 20 | 21 | # Determine if mod_status displays the first 63 characters of a request or 22 | # the last 63, assuming the request itself is greater than 63 chars. 23 | # Default: Off 24 | #SeeRequestTail On 25 | 26 | 27 | 28 | # Show Proxy LoadBalancer status in mod_status 29 | ProxyStatus On 30 | 31 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/001_apache_modphp/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | 6 | memory_limit = 128M 7 | 8 | realpath_cache_size=4096K 9 | realpath_cache_ttl=600 10 | 11 | [opcache] 12 | opcache.enable=1 13 | opcache.jit_buffer_size=256M 14 | opcache.jit=tracing 15 | opcache.preload=/var/www/symfony/config/preload.php 16 | opcache.preload_user=www-data 17 | opcache.validate_timestamps=0 18 | opcache.memory_consumption=256 19 | opcache.max_accelerated_files=20000 20 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/001_apache_modphp/sites-enabled/symfony7site.conf: -------------------------------------------------------------------------------- 1 | 2 | ServerName localhost 3 | ServerAlias symfony7site 4 | 5 | DocumentRoot /var/www/symfony/public 6 | 7 | AllowOverride None 8 | Require all granted 9 | FallbackResource /index.php 10 | 11 | 12 | # ErrorLog /var/log/apache2/project_error.log 13 | # CustomLog /var/log/apache2/project_access.log combined 14 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/002_apache_phpfpm/apache/apache.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu/apache2 2 | 3 | COPY ./runtimes/002_apache_phpfpm/apache/sites-available/symfony7site.conf /etc/apache2/sites-available/symfony7site.conf 4 | #COPY ./runtimes/002_apache_phpfpm/apache/mods-available/mpm_event.conf /etc/apache2/mods-available/mpm_event.conf 5 | COPY ./runtimes/002_apache_phpfpm/apache/mods-available/status.conf /etc/apache2/mods-available/status.conf 6 | 7 | COPY "./project" "/var/www/symfony" 8 | 9 | RUN a2enmod proxy_fcgi && \ 10 | a2enmod rewrite && \ 11 | a2ensite symfony7site 12 | 13 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/002_apache_phpfpm/apache/mods-available/mpm_event.conf: -------------------------------------------------------------------------------- 1 | # event MPM 2 | # StartServers: initial number of server processes to start 3 | # MinSpareThreads: minimum number of worker threads which are kept spare 4 | # MaxSpareThreads: maximum number of worker threads which are kept spare 5 | # ThreadsPerChild: constant number of worker threads in each server process 6 | # MaxRequestWorkers: maximum number of worker threads 7 | # MaxConnectionsPerChild: maximum number of requests a server process serves 8 | StartServers 2 9 | MinSpareThreads 25 10 | MaxSpareThreads 75 11 | ThreadLimit 64 12 | ThreadsPerChild 25 13 | MaxRequestWorkers 512 14 | MaxConnectionsPerChild 0 15 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/002_apache_phpfpm/apache/mods-available/status.conf: -------------------------------------------------------------------------------- 1 | # CUSTOM 2 | 3 | SetHandler server-status 4 | Require all granted 5 | 6 | # /CUSTOM 7 | 8 | ExtendedStatus On 9 | 10 | 11 | ProxyStatus On 12 | 13 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/002_apache_phpfpm/apache/sites-available/symfony7site.conf: -------------------------------------------------------------------------------- 1 | LoadModule proxy_module modules/mod_proxy.so 2 | LoadModule rewrite_module modules/mod_rewrite.so 3 | LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so 4 | 5 | 6 | ServerName localhost 7 | ServerAlias symfony7site 8 | 9 | 10 | SetHandler proxy:fcgi://002_phpfpm:9000 11 | 12 | 13 | DocumentRoot /var/www/symfony/public 14 | 15 | AllowOverride None 16 | Require all granted 17 | FallbackResource /index.php 18 | 19 | 20 | 21 | Require all granted 22 | ProxyPass "fcgi://002_phpfpm:9001/fpm-status" 23 | 24 | 25 | # ErrorLog /var/log/apache2/project_error.log 26 | # CustomLog /var/log/apache2/project_access.log combined 27 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/002_apache_phpfpm/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 002_apache: 3 | build: 4 | context: ../../ 5 | dockerfile: ./runtimes/002_apache_phpfpm/apache/apache.Dockerfile 6 | image: 002_apache 7 | container_name: 002_apache 8 | hostname: symfony7site 9 | ports: 10 | - "80:80" 11 | networks: 12 | - php-benchmarks 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | 002_phpfpm: 22 | build: 23 | context: ../../ 24 | dockerfile: ./runtimes/002_apache_phpfpm/fpm/phpfpm.Dockerfile 25 | image: 002_phpfpm 26 | container_name: 002_phpfpm 27 | ports: 28 | - "9001:9001" 29 | networks: 30 | - php-benchmarks 31 | deploy: 32 | resources: 33 | limits: 34 | cpus: '1' 35 | memory: '1gb' 36 | reservations: 37 | cpus: '1' 38 | memory: '1gb' 39 | 40 | networks: 41 | php-benchmarks: 42 | name: php-benchmarks 43 | 44 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/002_apache_phpfpm/fpm/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | 6 | memory_limit = 128M 7 | 8 | realpath_cache_size=4096K 9 | realpath_cache_ttl=600 10 | 11 | [opcache] 12 | opcache.enable=1 13 | opcache.jit_buffer_size=256M 14 | opcache.jit=tracing 15 | opcache.preload=/var/www/symfony/config/preload.php 16 | opcache.preload_user=www-data 17 | opcache.validate_timestamps=0 18 | opcache.memory_consumption=256 19 | opcache.max_accelerated_files=20000 20 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/002_apache_phpfpm/fpm/phpfpm.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-fpm 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ 8 | 9 | RUN chmod +x /usr/local/bin/install-php-extensions && \ 10 | install-php-extensions \ 11 | exif \ 12 | intl \ 13 | opcache \ 14 | pdo_pgsql \ 15 | tidy \ 16 | gd \ 17 | bcmath \ 18 | sockets \ 19 | zip && \ 20 | install-php-extensions @composer; 21 | 22 | COPY "./project" "/var/www/symfony" 23 | 24 | RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini; 25 | COPY ./runtimes/002_apache_phpfpm/fpm/php.ini /usr/local/etc/php/conf.d/custom-php.ini 26 | COPY ./runtimes/002_apache_phpfpm/fpm/www.conf /usr/local/etc/php-fpm.d/www.conf 27 | 28 | WORKDIR /var/www/symfony 29 | 30 | RUN cp .env.example .env.local 31 | 32 | RUN rm -rf vendor && \ 33 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 34 | composer dump-autoload --no-dev --classmap-authoritative && \ 35 | composer check-platform-reqs && \ 36 | php bin/console cache:clear && \ 37 | php bin/console cache:warmup -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/002_apache_phpfpm/fpm/www.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'www'. 2 | ; the variable $pool can be used in any directive and will be replaced by the 3 | ; pool name ('www' here) 4 | [www] 5 | 6 | ; Per pool prefix 7 | ; It only applies on the following directives: 8 | ; - 'access.log' 9 | ; - 'slowlog' 10 | ; - 'listen' (unixsocket) 11 | ; - 'chroot' 12 | ; - 'chdir' 13 | ; - 'php_values' 14 | ; - 'php_admin_values' 15 | ; When not set, the global prefix (or NONE) applies instead. 16 | ; Note: This directive can also be relative to the global prefix. 17 | ; Default Value: none 18 | ;prefix = /path/to/pools/$pool 19 | 20 | ; Unix user/group of the child processes. This can be used only if the master 21 | ; process running user is root. It is set after the child process is created. 22 | ; The user and group can be specified either by their name or by their numeric 23 | ; IDs. 24 | ; Note: If the user is root, the executable needs to be started with 25 | ; --allow-to-run-as-root option to work. 26 | ; Default Values: The user is set to master process running user by default. 27 | ; If the group is not set, the user's group is used. 28 | user = www-data 29 | group = www-data 30 | 31 | ; The address on which to accept FastCGI requests. 32 | ; Valid syntaxes are: 33 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on 34 | ; a specific port; 35 | ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on 36 | ; a specific port; 37 | ; 'port' - to listen on a TCP socket to all addresses 38 | ; (IPv6 and IPv4-mapped) on a specific port; 39 | ; '/path/to/unix/socket' - to listen on a unix socket. 40 | ; Note: This value is mandatory. 41 | listen = 127.0.0.1:9000 42 | 43 | ; Set listen(2) backlog. 44 | ; Default Value: 511 (-1 on Linux, FreeBSD and OpenBSD) 45 | ;listen.backlog = 511 46 | 47 | ; Set permissions for unix socket, if one is used. In Linux, read/write 48 | ; permissions must be set in order to allow connections from a web server. Many 49 | ; BSD-derived systems allow connections regardless of permissions. The owner 50 | ; and group can be specified either by name or by their numeric IDs. 51 | ; Default Values: Owner is set to the master process running user. If the group 52 | ; is not set, the owner's group is used. Mode is set to 0660. 53 | ;listen.owner = www-data 54 | ;listen.group = www-data 55 | ;listen.mode = 0660 56 | 57 | ; When POSIX Access Control Lists are supported you can set them using 58 | ; these options, value is a comma separated list of user/group names. 59 | ; When set, listen.owner and listen.group are ignored 60 | ;listen.acl_users = 61 | ;listen.acl_groups = 62 | 63 | ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. 64 | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original 65 | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address 66 | ; must be separated by a comma. If this value is left blank, connections will be 67 | ; accepted from any ip address. 68 | ; Default Value: any 69 | ;listen.allowed_clients = 127.0.0.1 70 | 71 | ; Set the associated the route table (FIB). FreeBSD only 72 | ; Default Value: -1 73 | ;listen.setfib = 1 74 | 75 | ; Specify the nice(2) priority to apply to the pool processes (only if set) 76 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 77 | ; Note: - It will only work if the FPM master process is launched as root 78 | ; - The pool processes will inherit the master process priority 79 | ; unless it specified otherwise 80 | ; Default Value: no set 81 | ; process.priority = -19 82 | 83 | ; Set the process dumpable flag (PR_SET_DUMPABLE prctl for Linux or 84 | ; PROC_TRACE_CTL procctl for FreeBSD) even if the process user 85 | ; or group is different than the master process user. It allows to create process 86 | ; core dump and ptrace the process for the pool user. 87 | ; Default Value: no 88 | ; process.dumpable = yes 89 | 90 | ; Choose how the process manager will control the number of child processes. 91 | ; Possible Values: 92 | ; static - a fixed number (pm.max_children) of child processes; 93 | ; dynamic - the number of child processes are set dynamically based on the 94 | ; following directives. With this process management, there will be 95 | ; always at least 1 children. 96 | ; pm.max_children - the maximum number of children that can 97 | ; be alive at the same time. 98 | ; pm.start_servers - the number of children created on startup. 99 | ; pm.min_spare_servers - the minimum number of children in 'idle' 100 | ; state (waiting to process). If the number 101 | ; of 'idle' processes is less than this 102 | ; number then some children will be created. 103 | ; pm.max_spare_servers - the maximum number of children in 'idle' 104 | ; state (waiting to process). If the number 105 | ; of 'idle' processes is greater than this 106 | ; number then some children will be killed. 107 | ; pm.max_spawn_rate - the maximum number of rate to spawn child 108 | ; processes at once. 109 | ; ondemand - no children are created at startup. Children will be forked when 110 | ; new requests will connect. The following parameter are used: 111 | ; pm.max_children - the maximum number of children that 112 | ; can be alive at the same time. 113 | ; pm.process_idle_timeout - The number of seconds after which 114 | ; an idle process will be killed. 115 | ; Note: This value is mandatory. 116 | pm = dynamic 117 | 118 | ; The number of child processes to be created when pm is set to 'static' and the 119 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 120 | ; This value sets the limit on the number of simultaneous requests that will be 121 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 122 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 123 | ; CGI. The below defaults are based on a server without much resources. Don't 124 | ; forget to tweak pm.* to fit your needs. 125 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 126 | ; Note: This value is mandatory. 127 | ; pm.max_children = 5 128 | pm.max_children = 33 129 | 130 | ; The number of child processes created on startup. 131 | ; Note: Used only when pm is set to 'dynamic' 132 | ; Default Value: (min_spare_servers + max_spare_servers) / 2 133 | pm.start_servers = 10 134 | 135 | ; The desired minimum number of idle server processes. 136 | ; Note: Used only when pm is set to 'dynamic' 137 | ; Note: Mandatory when pm is set to 'dynamic' 138 | ; pm.min_spare_servers = 1 139 | pm.min_spare_servers = 10 140 | 141 | ; The desired maximum number of idle server processes. 142 | ; Note: Used only when pm is set to 'dynamic' 143 | ; Note: Mandatory when pm is set to 'dynamic' 144 | ;pm.max_spare_servers = 3 145 | pm.max_spare_servers = 30 146 | 147 | ; The number of rate to spawn child processes at once. 148 | ; Note: Used only when pm is set to 'dynamic' 149 | ; Note: Mandatory when pm is set to 'dynamic' 150 | ; Default Value: 32 151 | ;pm.max_spawn_rate = 32 152 | 153 | ; The number of seconds after which an idle process will be killed. 154 | ; Note: Used only when pm is set to 'ondemand' 155 | ; Default Value: 10s 156 | ;pm.process_idle_timeout = 10s; 157 | 158 | ; The number of requests each child process should execute before respawning. 159 | ; This can be useful to work around memory leaks in 3rd party libraries. For 160 | ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. 161 | ; Default Value: 0 162 | pm.max_requests = 500 163 | 164 | ; The URI to view the FPM status page. If this value is not set, no URI will be 165 | ; recognized as a status page. It shows the following information: 166 | ; pool - the name of the pool; 167 | ; process manager - static, dynamic or ondemand; 168 | ; start time - the date and time FPM has started; 169 | ; start since - number of seconds since FPM has started; 170 | ; accepted conn - the number of request accepted by the pool; 171 | ; listen queue - the number of request in the queue of pending 172 | ; connections (see backlog in listen(2)); 173 | ; max listen queue - the maximum number of requests in the queue 174 | ; of pending connections since FPM has started; 175 | ; listen queue len - the size of the socket queue of pending connections; 176 | ; idle processes - the number of idle processes; 177 | ; active processes - the number of active processes; 178 | ; total processes - the number of idle + active processes; 179 | ; max active processes - the maximum number of active processes since FPM 180 | ; has started; 181 | ; max children reached - number of times, the process limit has been reached, 182 | ; when pm tries to start more children (works only for 183 | ; pm 'dynamic' and 'ondemand'); 184 | ; Value are updated in real time. 185 | ; Example output: 186 | ; pool: www 187 | ; process manager: static 188 | ; start time: 01/Jul/2011:17:53:49 +0200 189 | ; start since: 62636 190 | ; accepted conn: 190460 191 | ; listen queue: 0 192 | ; max listen queue: 1 193 | ; listen queue len: 42 194 | ; idle processes: 4 195 | ; active processes: 11 196 | ; total processes: 15 197 | ; max active processes: 12 198 | ; max children reached: 0 199 | ; 200 | ; By default the status page output is formatted as text/plain. Passing either 201 | ; 'html', 'xml' or 'json' in the query string will return the corresponding 202 | ; output syntax. Example: 203 | ; http://www.foo.bar/status 204 | ; http://www.foo.bar/status?json 205 | ; http://www.foo.bar/status?html 206 | ; http://www.foo.bar/status?xml 207 | ; 208 | ; By default the status page only outputs short status. Passing 'full' in the 209 | ; query string will also return status for each pool process. 210 | ; Example: 211 | ; http://www.foo.bar/status?full 212 | ; http://www.foo.bar/status?json&full 213 | ; http://www.foo.bar/status?html&full 214 | ; http://www.foo.bar/status?xml&full 215 | ; The Full status returns for each process: 216 | ; pid - the PID of the process; 217 | ; state - the state of the process (Idle, Running, ...); 218 | ; start time - the date and time the process has started; 219 | ; start since - the number of seconds since the process has started; 220 | ; requests - the number of requests the process has served; 221 | ; request duration - the duration in µs of the requests; 222 | ; request method - the request method (GET, POST, ...); 223 | ; request URI - the request URI with the query string; 224 | ; content length - the content length of the request (only with POST); 225 | ; user - the user (PHP_AUTH_USER) (or '-' if not set); 226 | ; script - the main script called (or '-' if not set); 227 | ; last request cpu - the %cpu the last request consumed 228 | ; it's always 0 if the process is not in Idle state 229 | ; because CPU calculation is done when the request 230 | ; processing has terminated; 231 | ; last request memory - the max amount of memory the last request consumed 232 | ; it's always 0 if the process is not in Idle state 233 | ; because memory calculation is done when the request 234 | ; processing has terminated; 235 | ; If the process is in Idle state, then informations are related to the 236 | ; last request the process has served. Otherwise informations are related to 237 | ; the current request being served. 238 | ; Example output: 239 | ; ************************ 240 | ; pid: 31330 241 | ; state: Running 242 | ; start time: 01/Jul/2011:17:53:49 +0200 243 | ; start since: 63087 244 | ; requests: 12808 245 | ; request duration: 1250261 246 | ; request method: GET 247 | ; request URI: /test_mem.php?N=10000 248 | ; content length: 0 249 | ; user: - 250 | ; script: /home/fat/web/docs/php/test_mem.php 251 | ; last request cpu: 0.00 252 | ; last request memory: 0 253 | ; 254 | ; Note: There is a real-time FPM status monitoring sample web page available 255 | ; It's available in: /usr/local/share/php/fpm/status.html 256 | ; 257 | ; Note: The value must start with a leading slash (/). The value can be 258 | ; anything, but it may not be a good idea to use the .php extension or it 259 | ; may conflict with a real PHP file. 260 | ; Default Value: not set 261 | pm.status_path = /fpm-status 262 | 263 | ; The address on which to accept FastCGI status request. This creates a new 264 | ; invisible pool that can handle requests independently. This is useful 265 | ; if the main pool is busy with long running requests because it is still possible 266 | ; to get the status before finishing the long running requests. 267 | ; 268 | ; Valid syntaxes are: 269 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on 270 | ; a specific port; 271 | ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on 272 | ; a specific port; 273 | ; 'port' - to listen on a TCP socket to all addresses 274 | ; (IPv6 and IPv4-mapped) on a specific port; 275 | ; '/path/to/unix/socket' - to listen on a unix socket. 276 | ; Default Value: value of the listen option 277 | pm.status_listen = 9001 278 | 279 | ; The ping URI to call the monitoring page of FPM. If this value is not set, no 280 | ; URI will be recognized as a ping page. This could be used to test from outside 281 | ; that FPM is alive and responding, or to 282 | ; - create a graph of FPM availability (rrd or such); 283 | ; - remove a server from a group if it is not responding (load balancing); 284 | ; - trigger alerts for the operating team (24/7). 285 | ; Note: The value must start with a leading slash (/). The value can be 286 | ; anything, but it may not be a good idea to use the .php extension or it 287 | ; may conflict with a real PHP file. 288 | ; Default Value: not set 289 | ;ping.path = /ping 290 | 291 | ; This directive may be used to customize the response of a ping request. The 292 | ; response is formatted as text/plain with a 200 response code. 293 | ; Default Value: pong 294 | ;ping.response = pong 295 | 296 | ; The access log file 297 | ; Default: not set 298 | ;access.log = log/$pool.access.log 299 | 300 | ; The access log format. 301 | ; The following syntax is allowed 302 | ; %%: the '%' character 303 | ; %C: %CPU used by the request 304 | ; it can accept the following format: 305 | ; - %{user}C for user CPU only 306 | ; - %{system}C for system CPU only 307 | ; - %{total}C for user + system CPU (default) 308 | ; %d: time taken to serve the request 309 | ; it can accept the following format: 310 | ; - %{seconds}d (default) 311 | ; - %{milliseconds}d 312 | ; - %{milli}d 313 | ; - %{microseconds}d 314 | ; - %{micro}d 315 | ; %e: an environment variable (same as $_ENV or $_SERVER) 316 | ; it must be associated with embraces to specify the name of the env 317 | ; variable. Some examples: 318 | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 319 | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 320 | ; %f: script filename 321 | ; %l: content-length of the request (for POST request only) 322 | ; %m: request method 323 | ; %M: peak of memory allocated by PHP 324 | ; it can accept the following format: 325 | ; - %{bytes}M (default) 326 | ; - %{kilobytes}M 327 | ; - %{kilo}M 328 | ; - %{megabytes}M 329 | ; - %{mega}M 330 | ; %n: pool name 331 | ; %o: output header 332 | ; it must be associated with embraces to specify the name of the header: 333 | ; - %{Content-Type}o 334 | ; - %{X-Powered-By}o 335 | ; - %{Transfert-Encoding}o 336 | ; - .... 337 | ; %p: PID of the child that serviced the request 338 | ; %P: PID of the parent of the child that serviced the request 339 | ; %q: the query string 340 | ; %Q: the '?' character if query string exists 341 | ; %r: the request URI (without the query string, see %q and %Q) 342 | ; %R: remote IP address 343 | ; %s: status (response code) 344 | ; %t: server time the request was received 345 | ; it can accept a strftime(3) format: 346 | ; %d/%b/%Y:%H:%M:%S %z (default) 347 | ; The strftime(3) format must be encapsulated in a %{}t tag 348 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 349 | ; %T: time the log has been written (the request has finished) 350 | ; it can accept a strftime(3) format: 351 | ; %d/%b/%Y:%H:%M:%S %z (default) 352 | ; The strftime(3) format must be encapsulated in a %{}t tag 353 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 354 | ; %u: remote user 355 | ; 356 | ; Default: "%R - %u %t \"%m %r\" %s" 357 | ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{milli}d %{kilo}M %C%%" 358 | 359 | ; A list of request_uri values which should be filtered from the access log. 360 | ; 361 | ; As a security precuation, this setting will be ignored if: 362 | ; - the request method is not GET or HEAD; or 363 | ; - there is a request body; or 364 | ; - there are query parameters; or 365 | ; - the response code is outwith the successful range of 200 to 299 366 | ; 367 | ; Note: The paths are matched against the output of the access.format tag "%r". 368 | ; On common configurations, this may look more like SCRIPT_NAME than the 369 | ; expected pre-rewrite URI. 370 | ; 371 | ; Default Value: not set 372 | ;access.suppress_path[] = /ping 373 | ;access.suppress_path[] = /health_check.php 374 | 375 | ; The log file for slow requests 376 | ; Default Value: not set 377 | ; Note: slowlog is mandatory if request_slowlog_timeout is set 378 | ;slowlog = log/$pool.log.slow 379 | 380 | ; The timeout for serving a single request after which a PHP backtrace will be 381 | ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 382 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 383 | ; Default Value: 0 384 | ;request_slowlog_timeout = 0 385 | 386 | ; Depth of slow log stack trace. 387 | ; Default Value: 20 388 | ;request_slowlog_trace_depth = 20 389 | 390 | ; The timeout for serving a single request after which the worker process will 391 | ; be killed. This option should be used when the 'max_execution_time' ini option 392 | ; does not stop script execution for some reason. A value of '0' means 'off'. 393 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 394 | ; Default Value: 0 395 | ;request_terminate_timeout = 0 396 | 397 | ; The timeout set by 'request_terminate_timeout' ini option is not engaged after 398 | ; application calls 'fastcgi_finish_request' or when application has finished and 399 | ; shutdown functions are being called (registered via register_shutdown_function). 400 | ; This option will enable timeout limit to be applied unconditionally 401 | ; even in such cases. 402 | ; Default Value: no 403 | ;request_terminate_timeout_track_finished = no 404 | 405 | ; Set open file descriptor rlimit. 406 | ; Default Value: system defined value 407 | ;rlimit_files = 1024 408 | 409 | ; Set max core size rlimit. 410 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 411 | ; Default Value: system defined value 412 | ;rlimit_core = 0 413 | 414 | ; Chroot to this directory at the start. This value must be defined as an 415 | ; absolute path. When this value is not set, chroot is not used. 416 | ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 417 | ; of its subdirectories. If the pool prefix is not set, the global prefix 418 | ; will be used instead. 419 | ; Note: chrooting is a great security feature and should be used whenever 420 | ; possible. However, all PHP paths will be relative to the chroot 421 | ; (error_log, sessions.save_path, ...). 422 | ; Default Value: not set 423 | ;chroot = 424 | 425 | ; Chdir to this directory at the start. 426 | ; Note: relative path can be used. 427 | ; Default Value: current directory or / when chroot 428 | ;chdir = /var/www 429 | 430 | ; Redirect worker stdout and stderr into main error log. If not set, stdout and 431 | ; stderr will be redirected to /dev/null according to FastCGI specs. 432 | ; Note: on highloaded environment, this can cause some delay in the page 433 | ; process time (several ms). 434 | ; Default Value: no 435 | ;catch_workers_output = yes 436 | 437 | ; Decorate worker output with prefix and suffix containing information about 438 | ; the child that writes to the log and if stdout or stderr is used as well as 439 | ; log level and time. This options is used only if catch_workers_output is yes. 440 | ; Settings to "no" will output data as written to the stdout or stderr. 441 | ; Default value: yes 442 | ;decorate_workers_output = no 443 | 444 | ; Clear environment in FPM workers 445 | ; Prevents arbitrary environment variables from reaching FPM worker processes 446 | ; by clearing the environment in workers before env vars specified in this 447 | ; pool configuration are added. 448 | ; Setting to "no" will make all environment variables available to PHP code 449 | ; via getenv(), $_ENV and $_SERVER. 450 | ; Default Value: yes 451 | ;clear_env = no 452 | 453 | ; Limits the extensions of the main script FPM will allow to parse. This can 454 | ; prevent configuration mistakes on the web server side. You should only limit 455 | ; FPM to .php extensions to prevent malicious users to use other extensions to 456 | ; execute php code. 457 | ; Note: set an empty value to allow all extensions. 458 | ; Default Value: .php 459 | ;security.limit_extensions = .php .php3 .php4 .php5 .php7 460 | 461 | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 462 | ; the current environment. 463 | ; Default Value: clean env 464 | ;env[HOSTNAME] = $HOSTNAME 465 | ;env[PATH] = /usr/local/bin:/usr/bin:/bin 466 | ;env[TMP] = /tmp 467 | ;env[TMPDIR] = /tmp 468 | ;env[TEMP] = /tmp 469 | 470 | ; Additional php.ini defines, specific to this pool of workers. These settings 471 | ; overwrite the values previously defined in the php.ini. The directives are the 472 | ; same as the PHP SAPI: 473 | ; php_value/php_flag - you can set classic ini defines which can 474 | ; be overwritten from PHP call 'ini_set'. 475 | ; php_admin_value/php_admin_flag - these directives won't be overwritten by 476 | ; PHP call 'ini_set' 477 | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 478 | 479 | ; Defining 'extension' will load the corresponding shared extension from 480 | ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not 481 | ; overwrite previously defined php.ini values, but will append the new value 482 | ; instead. 483 | 484 | ; Note: path INI options can be relative and will be expanded with the prefix 485 | ; (pool, global or /usr/local) 486 | 487 | ; Default Value: nothing is defined by default except the values in php.ini and 488 | ; specified at startup with the -d argument 489 | ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 490 | ;php_flag[display_errors] = off 491 | ;php_admin_value[error_log] = /var/log/fpm-php.www.log 492 | ;php_admin_flag[log_errors] = on 493 | ;php_admin_value[memory_limit] = 32M 494 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/003_nginx_phpfpm/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 003_nginx: 3 | build: 4 | context: ../../ 5 | dockerfile: ./runtimes/003_nginx_phpfpm/nginx/nginx.Dockerfile 6 | image: 003_nginx 7 | container_name: "003_nginx" 8 | hostname: symfony7site 9 | ports: 10 | - '80:80' 11 | networks: 12 | - php-benchmarks 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | 22 | 003_phpfpm: 23 | build: 24 | context: ../../ 25 | dockerfile: ./runtimes/003_nginx_phpfpm/fpm/phpfpm.Dockerfile 26 | image: 003_phpfpm 27 | container_name: "003_phpfpm" 28 | ports: 29 | - "9001:9001" 30 | networks: 31 | - php-benchmarks 32 | deploy: 33 | resources: 34 | limits: 35 | cpus: '1' 36 | memory: '1gb' 37 | reservations: 38 | cpus: '1' 39 | memory: '1gb' 40 | 41 | networks: 42 | php-benchmarks: 43 | name: php-benchmarks 44 | 45 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/003_nginx_phpfpm/fpm/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | 6 | memory_limit = 128M 7 | 8 | realpath_cache_size=4096K 9 | realpath_cache_ttl=600 10 | 11 | [opcache] 12 | opcache.enable=1 13 | opcache.jit_buffer_size=256M 14 | opcache.jit=tracing 15 | opcache.preload=/var/www/symfony/config/preload.php 16 | opcache.preload_user=www-data 17 | opcache.validate_timestamps=0 18 | opcache.memory_consumption=256 19 | opcache.max_accelerated_files=20000 20 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/003_nginx_phpfpm/fpm/phpfpm.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-fpm 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ 8 | 9 | RUN chmod +x /usr/local/bin/install-php-extensions && \ 10 | install-php-extensions \ 11 | exif \ 12 | intl \ 13 | opcache \ 14 | pdo_pgsql \ 15 | tidy \ 16 | gd \ 17 | bcmath \ 18 | sockets \ 19 | zip && \ 20 | install-php-extensions @composer; 21 | 22 | COPY "./project" "/var/www/symfony" 23 | 24 | RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini; 25 | COPY ./runtimes/003_nginx_phpfpm/fpm/php.ini /usr/local/etc/php/conf.d/custom-php.ini 26 | COPY ./runtimes/003_nginx_phpfpm/fpm/www.conf /usr/local/etc/php-fpm.d/www.conf 27 | 28 | WORKDIR /var/www/symfony 29 | 30 | RUN cp .env.example .env.local 31 | 32 | RUN rm -rf vendor && \ 33 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 34 | composer dump-autoload --no-dev --classmap-authoritative && \ 35 | composer check-platform-reqs && \ 36 | php bin/console cache:clear && \ 37 | php bin/console cache:warmup -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/003_nginx_phpfpm/fpm/www.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'www'. 2 | ; the variable $pool can be used in any directive and will be replaced by the 3 | ; pool name ('www' here) 4 | [www] 5 | 6 | ; Per pool prefix 7 | ; It only applies on the following directives: 8 | ; - 'access.log' 9 | ; - 'slowlog' 10 | ; - 'listen' (unixsocket) 11 | ; - 'chroot' 12 | ; - 'chdir' 13 | ; - 'php_values' 14 | ; - 'php_admin_values' 15 | ; When not set, the global prefix (or NONE) applies instead. 16 | ; Note: This directive can also be relative to the global prefix. 17 | ; Default Value: none 18 | ;prefix = /path/to/pools/$pool 19 | 20 | ; Unix user/group of the child processes. This can be used only if the master 21 | ; process running user is root. It is set after the child process is created. 22 | ; The user and group can be specified either by their name or by their numeric 23 | ; IDs. 24 | ; Note: If the user is root, the executable needs to be started with 25 | ; --allow-to-run-as-root option to work. 26 | ; Default Values: The user is set to master process running user by default. 27 | ; If the group is not set, the user's group is used. 28 | user = www-data 29 | group = www-data 30 | 31 | ; The address on which to accept FastCGI requests. 32 | ; Valid syntaxes are: 33 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on 34 | ; a specific port; 35 | ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on 36 | ; a specific port; 37 | ; 'port' - to listen on a TCP socket to all addresses 38 | ; (IPv6 and IPv4-mapped) on a specific port; 39 | ; '/path/to/unix/socket' - to listen on a unix socket. 40 | ; Note: This value is mandatory. 41 | listen = 127.0.0.1:9000 42 | 43 | ; Set listen(2) backlog. 44 | ; Default Value: 511 (-1 on Linux, FreeBSD and OpenBSD) 45 | ;listen.backlog = 511 46 | 47 | ; Set permissions for unix socket, if one is used. In Linux, read/write 48 | ; permissions must be set in order to allow connections from a web server. Many 49 | ; BSD-derived systems allow connections regardless of permissions. The owner 50 | ; and group can be specified either by name or by their numeric IDs. 51 | ; Default Values: Owner is set to the master process running user. If the group 52 | ; is not set, the owner's group is used. Mode is set to 0660. 53 | ;listen.owner = www-data 54 | ;listen.group = www-data 55 | ;listen.mode = 0660 56 | 57 | ; When POSIX Access Control Lists are supported you can set them using 58 | ; these options, value is a comma separated list of user/group names. 59 | ; When set, listen.owner and listen.group are ignored 60 | ;listen.acl_users = 61 | ;listen.acl_groups = 62 | 63 | ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. 64 | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original 65 | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address 66 | ; must be separated by a comma. If this value is left blank, connections will be 67 | ; accepted from any ip address. 68 | ; Default Value: any 69 | ;listen.allowed_clients = 127.0.0.1 70 | 71 | ; Set the associated the route table (FIB). FreeBSD only 72 | ; Default Value: -1 73 | ;listen.setfib = 1 74 | 75 | ; Specify the nice(2) priority to apply to the pool processes (only if set) 76 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 77 | ; Note: - It will only work if the FPM master process is launched as root 78 | ; - The pool processes will inherit the master process priority 79 | ; unless it specified otherwise 80 | ; Default Value: no set 81 | ; process.priority = -19 82 | 83 | ; Set the process dumpable flag (PR_SET_DUMPABLE prctl for Linux or 84 | ; PROC_TRACE_CTL procctl for FreeBSD) even if the process user 85 | ; or group is different than the master process user. It allows to create process 86 | ; core dump and ptrace the process for the pool user. 87 | ; Default Value: no 88 | ; process.dumpable = yes 89 | 90 | ; Choose how the process manager will control the number of child processes. 91 | ; Possible Values: 92 | ; static - a fixed number (pm.max_children) of child processes; 93 | ; dynamic - the number of child processes are set dynamically based on the 94 | ; following directives. With this process management, there will be 95 | ; always at least 1 children. 96 | ; pm.max_children - the maximum number of children that can 97 | ; be alive at the same time. 98 | ; pm.start_servers - the number of children created on startup. 99 | ; pm.min_spare_servers - the minimum number of children in 'idle' 100 | ; state (waiting to process). If the number 101 | ; of 'idle' processes is less than this 102 | ; number then some children will be created. 103 | ; pm.max_spare_servers - the maximum number of children in 'idle' 104 | ; state (waiting to process). If the number 105 | ; of 'idle' processes is greater than this 106 | ; number then some children will be killed. 107 | ; pm.max_spawn_rate - the maximum number of rate to spawn child 108 | ; processes at once. 109 | ; ondemand - no children are created at startup. Children will be forked when 110 | ; new requests will connect. The following parameter are used: 111 | ; pm.max_children - the maximum number of children that 112 | ; can be alive at the same time. 113 | ; pm.process_idle_timeout - The number of seconds after which 114 | ; an idle process will be killed. 115 | ; Note: This value is mandatory. 116 | pm = dynamic 117 | 118 | ; The number of child processes to be created when pm is set to 'static' and the 119 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 120 | ; This value sets the limit on the number of simultaneous requests that will be 121 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 122 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 123 | ; CGI. The below defaults are based on a server without much resources. Don't 124 | ; forget to tweak pm.* to fit your needs. 125 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 126 | ; Note: This value is mandatory. 127 | ; pm.max_children = 5 128 | pm.max_children = 33 129 | 130 | ; The number of child processes created on startup. 131 | ; Note: Used only when pm is set to 'dynamic' 132 | ; Default Value: (min_spare_servers + max_spare_servers) / 2 133 | pm.start_servers = 10 134 | 135 | ; The desired minimum number of idle server processes. 136 | ; Note: Used only when pm is set to 'dynamic' 137 | ; Note: Mandatory when pm is set to 'dynamic' 138 | ; pm.min_spare_servers = 1 139 | pm.min_spare_servers = 10 140 | 141 | ; The desired maximum number of idle server processes. 142 | ; Note: Used only when pm is set to 'dynamic' 143 | ; Note: Mandatory when pm is set to 'dynamic' 144 | ;pm.max_spare_servers = 3 145 | pm.max_spare_servers = 30 146 | 147 | ; The number of rate to spawn child processes at once. 148 | ; Note: Used only when pm is set to 'dynamic' 149 | ; Note: Mandatory when pm is set to 'dynamic' 150 | ; Default Value: 32 151 | ;pm.max_spawn_rate = 32 152 | 153 | ; The number of seconds after which an idle process will be killed. 154 | ; Note: Used only when pm is set to 'ondemand' 155 | ; Default Value: 10s 156 | ;pm.process_idle_timeout = 10s; 157 | 158 | ; The number of requests each child process should execute before respawning. 159 | ; This can be useful to work around memory leaks in 3rd party libraries. For 160 | ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. 161 | ; Default Value: 0 162 | pm.max_requests = 500 163 | 164 | ; The URI to view the FPM status page. If this value is not set, no URI will be 165 | ; recognized as a status page. It shows the following information: 166 | ; pool - the name of the pool; 167 | ; process manager - static, dynamic or ondemand; 168 | ; start time - the date and time FPM has started; 169 | ; start since - number of seconds since FPM has started; 170 | ; accepted conn - the number of request accepted by the pool; 171 | ; listen queue - the number of request in the queue of pending 172 | ; connections (see backlog in listen(2)); 173 | ; max listen queue - the maximum number of requests in the queue 174 | ; of pending connections since FPM has started; 175 | ; listen queue len - the size of the socket queue of pending connections; 176 | ; idle processes - the number of idle processes; 177 | ; active processes - the number of active processes; 178 | ; total processes - the number of idle + active processes; 179 | ; max active processes - the maximum number of active processes since FPM 180 | ; has started; 181 | ; max children reached - number of times, the process limit has been reached, 182 | ; when pm tries to start more children (works only for 183 | ; pm 'dynamic' and 'ondemand'); 184 | ; Value are updated in real time. 185 | ; Example output: 186 | ; pool: www 187 | ; process manager: static 188 | ; start time: 01/Jul/2011:17:53:49 +0200 189 | ; start since: 62636 190 | ; accepted conn: 190460 191 | ; listen queue: 0 192 | ; max listen queue: 1 193 | ; listen queue len: 42 194 | ; idle processes: 4 195 | ; active processes: 11 196 | ; total processes: 15 197 | ; max active processes: 12 198 | ; max children reached: 0 199 | ; 200 | ; By default the status page output is formatted as text/plain. Passing either 201 | ; 'html', 'xml' or 'json' in the query string will return the corresponding 202 | ; output syntax. Example: 203 | ; http://www.foo.bar/status 204 | ; http://www.foo.bar/status?json 205 | ; http://www.foo.bar/status?html 206 | ; http://www.foo.bar/status?xml 207 | ; 208 | ; By default the status page only outputs short status. Passing 'full' in the 209 | ; query string will also return status for each pool process. 210 | ; Example: 211 | ; http://www.foo.bar/status?full 212 | ; http://www.foo.bar/status?json&full 213 | ; http://www.foo.bar/status?html&full 214 | ; http://www.foo.bar/status?xml&full 215 | ; The Full status returns for each process: 216 | ; pid - the PID of the process; 217 | ; state - the state of the process (Idle, Running, ...); 218 | ; start time - the date and time the process has started; 219 | ; start since - the number of seconds since the process has started; 220 | ; requests - the number of requests the process has served; 221 | ; request duration - the duration in µs of the requests; 222 | ; request method - the request method (GET, POST, ...); 223 | ; request URI - the request URI with the query string; 224 | ; content length - the content length of the request (only with POST); 225 | ; user - the user (PHP_AUTH_USER) (or '-' if not set); 226 | ; script - the main script called (or '-' if not set); 227 | ; last request cpu - the %cpu the last request consumed 228 | ; it's always 0 if the process is not in Idle state 229 | ; because CPU calculation is done when the request 230 | ; processing has terminated; 231 | ; last request memory - the max amount of memory the last request consumed 232 | ; it's always 0 if the process is not in Idle state 233 | ; because memory calculation is done when the request 234 | ; processing has terminated; 235 | ; If the process is in Idle state, then informations are related to the 236 | ; last request the process has served. Otherwise informations are related to 237 | ; the current request being served. 238 | ; Example output: 239 | ; ************************ 240 | ; pid: 31330 241 | ; state: Running 242 | ; start time: 01/Jul/2011:17:53:49 +0200 243 | ; start since: 63087 244 | ; requests: 12808 245 | ; request duration: 1250261 246 | ; request method: GET 247 | ; request URI: /test_mem.php?N=10000 248 | ; content length: 0 249 | ; user: - 250 | ; script: /home/fat/web/docs/php/test_mem.php 251 | ; last request cpu: 0.00 252 | ; last request memory: 0 253 | ; 254 | ; Note: There is a real-time FPM status monitoring sample web page available 255 | ; It's available in: /usr/local/share/php/fpm/status.html 256 | ; 257 | ; Note: The value must start with a leading slash (/). The value can be 258 | ; anything, but it may not be a good idea to use the .php extension or it 259 | ; may conflict with a real PHP file. 260 | ; Default Value: not set 261 | pm.status_path = /fpm-status 262 | 263 | ; The address on which to accept FastCGI status request. This creates a new 264 | ; invisible pool that can handle requests independently. This is useful 265 | ; if the main pool is busy with long running requests because it is still possible 266 | ; to get the status before finishing the long running requests. 267 | ; 268 | ; Valid syntaxes are: 269 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on 270 | ; a specific port; 271 | ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on 272 | ; a specific port; 273 | ; 'port' - to listen on a TCP socket to all addresses 274 | ; (IPv6 and IPv4-mapped) on a specific port; 275 | ; '/path/to/unix/socket' - to listen on a unix socket. 276 | ; Default Value: value of the listen option 277 | pm.status_listen = 9001 278 | 279 | ; The ping URI to call the monitoring page of FPM. If this value is not set, no 280 | ; URI will be recognized as a ping page. This could be used to test from outside 281 | ; that FPM is alive and responding, or to 282 | ; - create a graph of FPM availability (rrd or such); 283 | ; - remove a server from a group if it is not responding (load balancing); 284 | ; - trigger alerts for the operating team (24/7). 285 | ; Note: The value must start with a leading slash (/). The value can be 286 | ; anything, but it may not be a good idea to use the .php extension or it 287 | ; may conflict with a real PHP file. 288 | ; Default Value: not set 289 | ;ping.path = /ping 290 | 291 | ; This directive may be used to customize the response of a ping request. The 292 | ; response is formatted as text/plain with a 200 response code. 293 | ; Default Value: pong 294 | ;ping.response = pong 295 | 296 | ; The access log file 297 | ; Default: not set 298 | ;access.log = log/$pool.access.log 299 | 300 | ; The access log format. 301 | ; The following syntax is allowed 302 | ; %%: the '%' character 303 | ; %C: %CPU used by the request 304 | ; it can accept the following format: 305 | ; - %{user}C for user CPU only 306 | ; - %{system}C for system CPU only 307 | ; - %{total}C for user + system CPU (default) 308 | ; %d: time taken to serve the request 309 | ; it can accept the following format: 310 | ; - %{seconds}d (default) 311 | ; - %{milliseconds}d 312 | ; - %{milli}d 313 | ; - %{microseconds}d 314 | ; - %{micro}d 315 | ; %e: an environment variable (same as $_ENV or $_SERVER) 316 | ; it must be associated with embraces to specify the name of the env 317 | ; variable. Some examples: 318 | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 319 | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 320 | ; %f: script filename 321 | ; %l: content-length of the request (for POST request only) 322 | ; %m: request method 323 | ; %M: peak of memory allocated by PHP 324 | ; it can accept the following format: 325 | ; - %{bytes}M (default) 326 | ; - %{kilobytes}M 327 | ; - %{kilo}M 328 | ; - %{megabytes}M 329 | ; - %{mega}M 330 | ; %n: pool name 331 | ; %o: output header 332 | ; it must be associated with embraces to specify the name of the header: 333 | ; - %{Content-Type}o 334 | ; - %{X-Powered-By}o 335 | ; - %{Transfert-Encoding}o 336 | ; - .... 337 | ; %p: PID of the child that serviced the request 338 | ; %P: PID of the parent of the child that serviced the request 339 | ; %q: the query string 340 | ; %Q: the '?' character if query string exists 341 | ; %r: the request URI (without the query string, see %q and %Q) 342 | ; %R: remote IP address 343 | ; %s: status (response code) 344 | ; %t: server time the request was received 345 | ; it can accept a strftime(3) format: 346 | ; %d/%b/%Y:%H:%M:%S %z (default) 347 | ; The strftime(3) format must be encapsulated in a %{}t tag 348 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 349 | ; %T: time the log has been written (the request has finished) 350 | ; it can accept a strftime(3) format: 351 | ; %d/%b/%Y:%H:%M:%S %z (default) 352 | ; The strftime(3) format must be encapsulated in a %{}t tag 353 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 354 | ; %u: remote user 355 | ; 356 | ; Default: "%R - %u %t \"%m %r\" %s" 357 | ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{milli}d %{kilo}M %C%%" 358 | 359 | ; A list of request_uri values which should be filtered from the access log. 360 | ; 361 | ; As a security precuation, this setting will be ignored if: 362 | ; - the request method is not GET or HEAD; or 363 | ; - there is a request body; or 364 | ; - there are query parameters; or 365 | ; - the response code is outwith the successful range of 200 to 299 366 | ; 367 | ; Note: The paths are matched against the output of the access.format tag "%r". 368 | ; On common configurations, this may look more like SCRIPT_NAME than the 369 | ; expected pre-rewrite URI. 370 | ; 371 | ; Default Value: not set 372 | ;access.suppress_path[] = /ping 373 | ;access.suppress_path[] = /health_check.php 374 | 375 | ; The log file for slow requests 376 | ; Default Value: not set 377 | ; Note: slowlog is mandatory if request_slowlog_timeout is set 378 | ;slowlog = log/$pool.log.slow 379 | 380 | ; The timeout for serving a single request after which a PHP backtrace will be 381 | ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 382 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 383 | ; Default Value: 0 384 | ;request_slowlog_timeout = 0 385 | 386 | ; Depth of slow log stack trace. 387 | ; Default Value: 20 388 | ;request_slowlog_trace_depth = 20 389 | 390 | ; The timeout for serving a single request after which the worker process will 391 | ; be killed. This option should be used when the 'max_execution_time' ini option 392 | ; does not stop script execution for some reason. A value of '0' means 'off'. 393 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 394 | ; Default Value: 0 395 | ;request_terminate_timeout = 0 396 | 397 | ; The timeout set by 'request_terminate_timeout' ini option is not engaged after 398 | ; application calls 'fastcgi_finish_request' or when application has finished and 399 | ; shutdown functions are being called (registered via register_shutdown_function). 400 | ; This option will enable timeout limit to be applied unconditionally 401 | ; even in such cases. 402 | ; Default Value: no 403 | ;request_terminate_timeout_track_finished = no 404 | 405 | ; Set open file descriptor rlimit. 406 | ; Default Value: system defined value 407 | ;rlimit_files = 1024 408 | 409 | ; Set max core size rlimit. 410 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 411 | ; Default Value: system defined value 412 | ;rlimit_core = 0 413 | 414 | ; Chroot to this directory at the start. This value must be defined as an 415 | ; absolute path. When this value is not set, chroot is not used. 416 | ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 417 | ; of its subdirectories. If the pool prefix is not set, the global prefix 418 | ; will be used instead. 419 | ; Note: chrooting is a great security feature and should be used whenever 420 | ; possible. However, all PHP paths will be relative to the chroot 421 | ; (error_log, sessions.save_path, ...). 422 | ; Default Value: not set 423 | ;chroot = 424 | 425 | ; Chdir to this directory at the start. 426 | ; Note: relative path can be used. 427 | ; Default Value: current directory or / when chroot 428 | ;chdir = /var/www 429 | 430 | ; Redirect worker stdout and stderr into main error log. If not set, stdout and 431 | ; stderr will be redirected to /dev/null according to FastCGI specs. 432 | ; Note: on highloaded environment, this can cause some delay in the page 433 | ; process time (several ms). 434 | ; Default Value: no 435 | ;catch_workers_output = yes 436 | 437 | ; Decorate worker output with prefix and suffix containing information about 438 | ; the child that writes to the log and if stdout or stderr is used as well as 439 | ; log level and time. This options is used only if catch_workers_output is yes. 440 | ; Settings to "no" will output data as written to the stdout or stderr. 441 | ; Default value: yes 442 | ;decorate_workers_output = no 443 | 444 | ; Clear environment in FPM workers 445 | ; Prevents arbitrary environment variables from reaching FPM worker processes 446 | ; by clearing the environment in workers before env vars specified in this 447 | ; pool configuration are added. 448 | ; Setting to "no" will make all environment variables available to PHP code 449 | ; via getenv(), $_ENV and $_SERVER. 450 | ; Default Value: yes 451 | ;clear_env = no 452 | 453 | ; Limits the extensions of the main script FPM will allow to parse. This can 454 | ; prevent configuration mistakes on the web server side. You should only limit 455 | ; FPM to .php extensions to prevent malicious users to use other extensions to 456 | ; execute php code. 457 | ; Note: set an empty value to allow all extensions. 458 | ; Default Value: .php 459 | ;security.limit_extensions = .php .php3 .php4 .php5 .php7 460 | 461 | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 462 | ; the current environment. 463 | ; Default Value: clean env 464 | ;env[HOSTNAME] = $HOSTNAME 465 | ;env[PATH] = /usr/local/bin:/usr/bin:/bin 466 | ;env[TMP] = /tmp 467 | ;env[TMPDIR] = /tmp 468 | ;env[TEMP] = /tmp 469 | 470 | ; Additional php.ini defines, specific to this pool of workers. These settings 471 | ; overwrite the values previously defined in the php.ini. The directives are the 472 | ; same as the PHP SAPI: 473 | ; php_value/php_flag - you can set classic ini defines which can 474 | ; be overwritten from PHP call 'ini_set'. 475 | ; php_admin_value/php_admin_flag - these directives won't be overwritten by 476 | ; PHP call 'ini_set' 477 | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 478 | 479 | ; Defining 'extension' will load the corresponding shared extension from 480 | ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not 481 | ; overwrite previously defined php.ini values, but will append the new value 482 | ; instead. 483 | 484 | ; Note: path INI options can be relative and will be expanded with the prefix 485 | ; (pool, global or /usr/local) 486 | 487 | ; Default Value: nothing is defined by default except the values in php.ini and 488 | ; specified at startup with the -d argument 489 | ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 490 | ;php_flag[display_errors] = off 491 | ;php_admin_value[error_log] = /var/log/fpm-php.www.log 492 | ;php_admin_flag[log_errors] = on 493 | ;php_admin_value[memory_limit] = 32M 494 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/003_nginx_phpfpm/nginx/conf.d/symfony7site.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name symfony7site localhost; 3 | root /var/www/symfony/public; 4 | 5 | location = /fpm-status { 6 | fastcgi_pass 003_phpfpm:9000; 7 | include fastcgi_params; 8 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; 9 | fastcgi_param DOCUMENT_ROOT $realpath_root; 10 | } 11 | location / { 12 | # try to serve file directly, fallback to index.php 13 | try_files $uri /index.php$is_args$args; 14 | } 15 | location ~ ^/index\.php(/|$) { 16 | # when PHP-FPM is configured to use TCP 17 | fastcgi_pass 003_phpfpm:9000; 18 | fastcgi_keep_conn on; 19 | 20 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 21 | include fastcgi_params; 22 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; 23 | fastcgi_param DOCUMENT_ROOT $realpath_root; 24 | internal; 25 | } 26 | 27 | # return 404 for all other php files not matching the front controller 28 | # this prevents access to other php files you don't want to be accessible. 29 | location ~ \.php$ { 30 | return 404; 31 | } 32 | #error_log /var/log/nginx/project_error.log; 33 | #access_log /var/log/nginx/project_access.log; 34 | } -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/003_nginx_phpfpm/nginx/nginx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.25.3 2 | COPY ./runtimes/006_nginx_roadrunner/nginx/nginx.conf /etc/nginx/nginx.conf 3 | COPY ./runtimes/003_nginx_phpfpm/nginx/conf.d/symfony7site.conf /etc/nginx/conf.d/symfony7site.conf 4 | COPY "./project" "/var/www/symfony" 5 | 6 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/003_nginx_phpfpm/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | user nginx; 3 | worker_processes auto; 4 | 5 | error_log stderr error; 6 | pid /var/run/nginx.pid; 7 | 8 | 9 | events { 10 | worker_connections 10024; 11 | } 12 | 13 | 14 | http { 15 | include /etc/nginx/mime.types; 16 | default_type application/octet-stream; 17 | 18 | access_log off; 19 | 20 | sendfile on; 21 | #tcp_nopush on; 22 | 23 | keepalive_timeout 65; 24 | 25 | #gzip on; 26 | 27 | include /etc/nginx/conf.d/*.conf; 28 | } 29 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/004_nginx_unit/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 004_nginx_unit: 3 | build: 4 | context: ../../ 5 | dockerfile: "./runtimes/004_nginx_unit/unit/unit.Dockerfile" 6 | image: 004_nginx_unit 7 | container_name: "004_nginx_unit" 8 | hostname: symfony7site 9 | ports: 10 | - '80:80' 11 | networks: 12 | - php-benchmarks 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | networks: 22 | php-benchmarks: 23 | name: php-benchmarks -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/004_nginx_unit/unit/config/symfony7site.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "listeners": { 3 | "*:80": { 4 | "pass": "routes" 5 | } 6 | }, 7 | "routes": [ 8 | { 9 | "match": { 10 | "host": "symfony7site" 11 | }, 12 | "action": { 13 | "pass": "applications/symfony/index" 14 | } 15 | }, 16 | { 17 | "match": { 18 | "host": "localhost" 19 | }, 20 | "action": { 21 | "pass": "applications/symfony/index" 22 | } 23 | } 24 | ], 25 | "applications": { 26 | "symfony": { 27 | "type": "php", 28 | "processes": { 29 | "spare": 1, 30 | "idle_timeout": 20 31 | }, 32 | "targets": { 33 | "direct": { 34 | "root": "/var/www/symfony/public/" 35 | }, 36 | "index": { 37 | "root": "/var/www/symfony/public/", 38 | "script": "index.php" 39 | } 40 | }, 41 | "options": { 42 | "file": "/usr/local/etc/php/php.ini", 43 | "admin": { 44 | "date.timezone": "Europe/Warsaw", 45 | "short_open_tag": "off", 46 | "expose_php": "off", 47 | "allow_url_fopen": "off", 48 | "memory_limit": "128M", 49 | "variables_order": "EGPCS", 50 | "realpath_cache_size": "4096K", 51 | "realpath_cache_ttl": "600", 52 | "opcache.enable": "1", 53 | "opcache.jit_buffer_size": "256M", 54 | "opcache.jit": "tracing", 55 | "opcache.preload": "/var/www/symfony/config/preload.php", 56 | "opcache.preload_user": "root", 57 | "opcache.validate_timestamps": "0", 58 | "opcache.memory_consumption": "256", 59 | "opcache.max_accelerated_files": "20000" 60 | } 61 | } 62 | } 63 | }, 64 | "settings": { 65 | "http": { 66 | "server_version": false 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/004_nginx_unit/unit/unit.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM unit:php8.3 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini; 8 | ADD ./runtimes/004_nginx_unit/unit/config /docker-entrypoint.d/config 9 | 10 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ 11 | 12 | RUN chmod +x /usr/local/bin/install-php-extensions && \ 13 | install-php-extensions \ 14 | exif \ 15 | intl \ 16 | opcache \ 17 | pdo_pgsql \ 18 | tidy \ 19 | gd \ 20 | bcmath \ 21 | sockets \ 22 | zip && \ 23 | install-php-extensions @composer; 24 | 25 | COPY "./project" "/var/www/symfony" 26 | 27 | 28 | WORKDIR /var/www/symfony 29 | 30 | RUN cp .env.example .env.local 31 | 32 | RUN rm -rf vendor && \ 33 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 34 | composer dump-autoload --no-dev --classmap-authoritative && \ 35 | composer check-platform-reqs && \ 36 | php bin/console cache:clear && \ 37 | php bin/console cache:warmup 38 | 39 | EXPOSE 80 40 | EXPOSE 9090 41 | CMD ["unitd", "--no-daemon", "--control", "*:9090"] -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/005_roadrunner/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 005_roadrunner: 3 | build: 4 | context: ../../ 5 | dockerfile: "./runtimes/005_roadrunner/roadrunner/roadrunner.Dockerfile" 6 | image: "005_roadrunner" 7 | container_name: "005_roadrunner" 8 | hostname: symfony7site 9 | ports: 10 | - '80:80' 11 | networks: 12 | - php-benchmarks 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | networks: 22 | php-benchmarks: 23 | name: php-benchmarks -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/005_roadrunner/roadrunner/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | 6 | memory_limit = 128M 7 | 8 | realpath_cache_size=4096K 9 | realpath_cache_ttl=600 10 | 11 | [opcache] 12 | opcache.enable=1 13 | opcache.enable_cli=1 14 | opcache.jit_buffer_size=256M 15 | opcache.jit=tracing 16 | opcache.preload_user=root 17 | opcache.preload=/var/www/symfony/config/preload.php 18 | opcache.validate_timestamps=0 19 | opcache.memory_consumption=256 20 | opcache.max_accelerated_files=20000 21 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/005_roadrunner/roadrunner/roadrunner.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ghcr.io/roadrunner-server/roadrunner:2023.3.12 AS roadrunner 2 | FROM php:8.3-cli 3 | 4 | RUN set -xe; \ 5 | apt update; \ 6 | apt install unzip 7 | 8 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ 9 | 10 | RUN chmod +x /usr/local/bin/install-php-extensions && \ 11 | install-php-extensions \ 12 | exif \ 13 | intl \ 14 | opcache \ 15 | pdo_pgsql \ 16 | tidy \ 17 | gd \ 18 | bcmath \ 19 | sockets \ 20 | zip && \ 21 | install-php-extensions @composer-2.6.6; 22 | 23 | RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini 24 | COPY ./runtimes/005_roadrunner/roadrunner/php.ini /usr/local/etc/php/conf.d/custom-php.ini 25 | 26 | COPY "./project" "/var/www/symfony" 27 | 28 | WORKDIR /var/www/symfony 29 | 30 | RUN cp .env.example .env.local && \ 31 | cp .rr.production.yaml .rr.yaml 32 | 33 | RUN rm -rf vendor && \ 34 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 35 | composer dump-autoload --no-dev --classmap-authoritative && \ 36 | composer check-platform-reqs && \ 37 | php bin/console cache:clear && \ 38 | php bin/console cache:warmup 39 | 40 | COPY --from=roadrunner /usr/bin/rr /usr/local/bin/rr 41 | 42 | EXPOSE 80 43 | 44 | CMD ["rr", "serve", "-c", ".rr.yaml"] 45 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/006_nginx_roadrunner/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 006_nginx: 3 | build: 4 | context: ../../ 5 | dockerfile: "./runtimes/006_nginx_roadrunner/nginx/nginx.Dockerfile" 6 | image: 006_nginx 7 | container_name: "006_nginx" 8 | hostname: symfony7site 9 | ports: 10 | - '80:80' 11 | networks: 12 | - php-benchmarks 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | 22 | 006_roadrunner: 23 | build: 24 | context: ../../ 25 | dockerfile: "./runtimes/006_nginx_roadrunner/roadrunner/roadrunner.Dockerfile" 26 | image: "006_roadrunner" 27 | container_name: "006_roadrunner" 28 | networks: 29 | - php-benchmarks 30 | deploy: 31 | resources: 32 | limits: 33 | cpus: '1' 34 | memory: '1gb' 35 | reservations: 36 | cpus: '1' 37 | memory: '1gb' 38 | networks: 39 | php-benchmarks: 40 | name: php-benchmarks -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/006_nginx_roadrunner/nginx/conf.d/symfony7site.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name symfony7site localhost; 3 | root /var/www/symfony/public; 4 | location / { 5 | # try to serve file directly, fallback to index.php 6 | try_files $uri /index.php$is_args$args; 7 | } 8 | location ~ ^/index\.php(/|$) { 9 | # when PHP-FPM is configured to use TCP 10 | fastcgi_pass 006_roadrunner:9000; 11 | fastcgi_keep_conn on; 12 | 13 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 14 | include fastcgi_params; 15 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; 16 | fastcgi_param DOCUMENT_ROOT $realpath_root; 17 | internal; 18 | } 19 | 20 | # return 404 for all other php files not matching the front controller 21 | # this prevents access to other php files you don't want to be accessible. 22 | location ~ \.php$ { 23 | return 404; 24 | } 25 | #error_log /var/log/nginx/project_error.log; 26 | #access_log /var/log/nginx/project_access.log; 27 | } -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/006_nginx_roadrunner/nginx/nginx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.25.3 2 | COPY ./runtimes/006_nginx_roadrunner/nginx/nginx.conf /etc/nginx/nginx.conf 3 | COPY ./runtimes/006_nginx_roadrunner/nginx/conf.d/symfony7site.conf /etc/nginx/conf.d/symfony7site.conf 4 | COPY "./project" "/var/www/symfony" 5 | 6 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/006_nginx_roadrunner/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | user nginx; 3 | worker_processes auto; 4 | 5 | error_log stderr error; 6 | pid /var/run/nginx.pid; 7 | 8 | 9 | events { 10 | worker_connections 10024; 11 | } 12 | 13 | 14 | http { 15 | include /etc/nginx/mime.types; 16 | default_type application/octet-stream; 17 | 18 | access_log off; 19 | 20 | sendfile on; 21 | #tcp_nopush on; 22 | 23 | keepalive_timeout 65; 24 | 25 | #gzip on; 26 | 27 | include /etc/nginx/conf.d/*.conf; 28 | } 29 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/006_nginx_roadrunner/roadrunner/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | 6 | memory_limit = 128M 7 | 8 | realpath_cache_size=4096K 9 | realpath_cache_ttl=600 10 | 11 | [opcache] 12 | opcache.enable=1 13 | opcache.enable_cli=1 14 | opcache.jit_buffer_size=256M 15 | opcache.jit=tracing 16 | opcache.preload_user=root 17 | opcache.preload=/var/www/symfony/config/preload.php 18 | opcache.validate_timestamps=0 19 | opcache.memory_consumption=256 20 | opcache.max_accelerated_files=20000 21 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/006_nginx_roadrunner/roadrunner/roadrunner.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-cli 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ 8 | 9 | RUN chmod +x /usr/local/bin/install-php-extensions && \ 10 | install-php-extensions \ 11 | exif \ 12 | intl \ 13 | opcache \ 14 | pdo_pgsql \ 15 | tidy \ 16 | gd \ 17 | bcmath \ 18 | sockets \ 19 | zip && \ 20 | install-php-extensions @composer; 21 | 22 | RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini 23 | COPY ./runtimes/006_nginx_roadrunner/roadrunner/php.ini /usr/local/etc/php/conf.d/custom-php.ini 24 | 25 | COPY "./project" "/var/www/symfony" 26 | 27 | WORKDIR /var/www/symfony 28 | 29 | RUN cp .env.example .env.local && \ 30 | cp .rr.fcgi.yaml .rr.yaml 31 | 32 | RUN rm -rf vendor && \ 33 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 34 | composer dump-autoload --no-dev --classmap-authoritative && \ 35 | composer check-platform-reqs && \ 36 | php bin/console cache:clear && \ 37 | php bin/console cache:warmup 38 | 39 | COPY --from=ghcr.io/roadrunner-server/roadrunner:2023.3.8 /usr/bin/rr /usr/bin/rr 40 | 41 | EXPOSE 9000 42 | 43 | CMD ["rr", "serve"] 44 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/007_frankenphp/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 007_frankenphp: 3 | build: 4 | context: ../../ 5 | dockerfile: "./runtimes/007_frankenphp/frankenphp/frankenphp.Dockerfile" 6 | image: "007_frankenphp" 7 | container_name: "007_frankenphp" 8 | hostname: symfony7site 9 | networks: 10 | - php-benchmarks 11 | ports: 12 | - '80:80' 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | networks: 22 | php-benchmarks: 23 | name: php-benchmarks -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/007_frankenphp/frankenphp/Caddyfile: -------------------------------------------------------------------------------- 1 | { 2 | {$CADDY_GLOBAL_OPTIONS} 3 | 4 | frankenphp { 5 | #worker /path/to/your/worker.php 6 | {$FRANKENPHP_CONFIG} 7 | } 8 | 9 | # https://caddyserver.com/docs/caddyfile/directives#sorting-algorithm 10 | order mercure after encode 11 | order vulcain after reverse_proxy 12 | order php_server before file_server 13 | order php before file_server 14 | } 15 | 16 | {$CADDY_EXTRA_CONFIG} 17 | 18 | # {$SERVER_NAME:localhost} { 19 | http://localhost http://symfony7site { 20 | log { 21 | # Redact the authorization query parameter that can be set by Mercure 22 | format filter { 23 | wrap console 24 | fields { 25 | uri query { 26 | replace authorization REDACTED 27 | } 28 | } 29 | } 30 | } 31 | 32 | root * public/ 33 | #encode zstd gzip 34 | 35 | # Uncomment the following lines to enable Mercure and Vulcain modules 36 | #mercure { 37 | # # Transport to use (default to Bolt) 38 | # transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db} 39 | # # Publisher JWT key 40 | # publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG} 41 | # # Subscriber JWT key 42 | # subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG} 43 | # # Allow anonymous subscribers (double-check that it's what you want) 44 | # anonymous 45 | # # Enable the subscription API (double-check that it's what you want) 46 | # subscriptions 47 | # # Extra directives 48 | # {$MERCURE_EXTRA_DIRECTIVES} 49 | #} 50 | #vulcain 51 | 52 | {$CADDY_SERVER_EXTRA_DIRECTIVES} 53 | 54 | php_server 55 | } 56 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/007_frankenphp/frankenphp/conf.d/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | 6 | memory_limit = 128M 7 | 8 | realpath_cache_size=4096K 9 | realpath_cache_ttl=600 10 | 11 | 12 | [opcache] 13 | opcache.enable=1 14 | opcache.enable_cli=1 15 | opcache.preload_user=root 16 | opcache.jit_buffer_size=256M 17 | opcache.jit=tracing 18 | opcache.preload=/app/config/preload.php 19 | opcache.validate_timestamps=0 20 | opcache.memory_consumption=256 21 | opcache.max_accelerated_files=20000 22 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/007_frankenphp/frankenphp/frankenphp.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM dunglas/frankenphp:latest-php8.3.1 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | RUN install-php-extensions \ 8 | exif \ 9 | intl \ 10 | opcache \ 11 | pdo_pgsql \ 12 | tidy \ 13 | gd \ 14 | bcmath \ 15 | sockets \ 16 | zip && \ 17 | install-php-extensions @composer; 18 | 19 | COPY ./runtimes/007_frankenphp/frankenphp/Caddyfile /etc/caddy/Caddyfile 20 | 21 | RUN cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini 22 | COPY ./runtimes/007_frankenphp/frankenphp/conf.d/php.ini $PHP_INI_DIR/conf.d/custom-php.ini 23 | 24 | COPY "./project" "/app" 25 | 26 | RUN cd /app && \ 27 | cp .env.example .env.local && \ 28 | rm -rf vendor && \ 29 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 30 | composer dump-autoload --no-dev --classmap-authoritative && \ 31 | composer check-platform-reqs && \ 32 | php bin/console cache:clear && \ 33 | php bin/console cache:warmup -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/008_frankenphp_workermode/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 008_frankenphp_workermode: 3 | build: 4 | context: ../../ 5 | dockerfile: "./runtimes/008_frankenphp_workermode/frankenphp/frankenphp.Dockerfile" 6 | image: "008_frankenphp_workermode" 7 | container_name: "008_frankenphp_workermode" 8 | hostname: symfony7site 9 | networks: 10 | - php-benchmarks 11 | ports: 12 | - '80:80' 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | networks: 22 | php-benchmarks: 23 | name: php-benchmarks -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/008_frankenphp_workermode/frankenphp/Caddyfile: -------------------------------------------------------------------------------- 1 | { 2 | {$CADDY_GLOBAL_OPTIONS} 3 | 4 | frankenphp { 5 | #worker /path/to/your/worker.php 6 | {$FRANKENPHP_CONFIG} 7 | } 8 | 9 | # https://caddyserver.com/docs/caddyfile/directives#sorting-algorithm 10 | order mercure after encode 11 | order vulcain after reverse_proxy 12 | order php_server before file_server 13 | order php before file_server 14 | } 15 | 16 | {$CADDY_EXTRA_CONFIG} 17 | 18 | # {$SERVER_NAME:localhost} { 19 | http://localhost http://symfony7site { 20 | log { 21 | # Redact the authorization query parameter that can be set by Mercure 22 | format filter { 23 | wrap console 24 | fields { 25 | uri query { 26 | replace authorization REDACTED 27 | } 28 | } 29 | } 30 | } 31 | 32 | root * public/ 33 | #encode zstd gzip 34 | 35 | # Uncomment the following lines to enable Mercure and Vulcain modules 36 | #mercure { 37 | # # Transport to use (default to Bolt) 38 | # transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db} 39 | # # Publisher JWT key 40 | # publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG} 41 | # # Subscriber JWT key 42 | # subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG} 43 | # # Allow anonymous subscribers (double-check that it's what you want) 44 | # anonymous 45 | # # Enable the subscription API (double-check that it's what you want) 46 | # subscriptions 47 | # # Extra directives 48 | # {$MERCURE_EXTRA_DIRECTIVES} 49 | #} 50 | #vulcain 51 | 52 | {$CADDY_SERVER_EXTRA_DIRECTIVES} 53 | 54 | php_server 55 | } 56 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/008_frankenphp_workermode/frankenphp/conf.d/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | memory_limit = 128M 6 | 7 | realpath_cache_size=4096K 8 | realpath_cache_ttl=600 9 | 10 | [opcache] 11 | opcache.enable=1 12 | opcache.enable_cli=1 13 | opcache.preload_user=root 14 | opcache.jit_buffer_size=256M 15 | opcache.jit=tracing 16 | opcache.preload=/app/config/preload.php 17 | opcache.validate_timestamps=0 18 | opcache.memory_consumption=256 19 | opcache.max_accelerated_files=20000 20 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/008_frankenphp_workermode/frankenphp/frankenphp.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM dunglas/frankenphp:latest-php8.3.1 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | RUN install-php-extensions \ 8 | exif \ 9 | intl \ 10 | opcache \ 11 | pdo_pgsql \ 12 | tidy \ 13 | gd \ 14 | bcmath \ 15 | sockets \ 16 | zip && \ 17 | install-php-extensions @composer; 18 | 19 | COPY ./runtimes/008_frankenphp_workermode/frankenphp/Caddyfile /etc/caddy/Caddyfile 20 | 21 | # Issue with php.ini-production, worker can't start. 22 | #RUN cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini 23 | COPY ./runtimes/008_frankenphp_workermode/frankenphp/conf.d/php.ini $PHP_INI_DIR/conf.d/custom-php.ini 24 | 25 | ENV FRANKENPHP_CONFIG="worker ./public/index.php" 26 | ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime" 27 | 28 | COPY "./project" "/app" 29 | 30 | RUN cd /app && \ 31 | cp .env.example .env.local && \ 32 | rm -rf vendor && \ 33 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 34 | composer dump-autoload --no-dev --classmap-authoritative && \ 35 | composer check-platform-reqs && \ 36 | php bin/console cache:clear && \ 37 | php bin/console cache:warmup -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/009_swoole/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 009_swoole: 3 | build: 4 | context: ../../ 5 | dockerfile: "./runtimes/009_swoole/swoole/swoole.Dockerfile" 6 | image: "009_swoole" 7 | container_name: "009_swoole" 8 | hostname: symfony7site 9 | ports: 10 | - '80:80' 11 | networks: 12 | - php-benchmarks 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | 22 | networks: 23 | php-benchmarks: 24 | name: php-benchmarks -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/009_swoole/swoole/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | memory_limit = 128M 6 | 7 | realpath_cache_size=4096K 8 | realpath_cache_ttl=600 9 | 10 | [opcache] 11 | opcache.enable=1 12 | opcache.enable_cli=1 13 | opcache.preload_user=root 14 | opcache.jit_buffer_size=256M 15 | opcache.jit=tracing 16 | opcache.preload=/var/www/symfony/config/preload.php 17 | opcache.validate_timestamps=0 18 | opcache.memory_consumption=256 19 | opcache.max_accelerated_files=20000 20 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/009_swoole/swoole/swoole.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM phpswoole/swoole:php8.3 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ 8 | 9 | RUN chmod +x /usr/local/bin/install-php-extensions && \ 10 | install-php-extensions \ 11 | exif \ 12 | intl \ 13 | opcache \ 14 | pdo_pgsql \ 15 | tidy \ 16 | gd \ 17 | bcmath \ 18 | sockets \ 19 | zip && \ 20 | install-php-extensions @composer; 21 | 22 | RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini 23 | COPY ./runtimes/009_swoole/swoole/php.ini /usr/local/etc/php/conf.d/custom-php.ini 24 | 25 | COPY "./project" "/var/www/symfony" 26 | 27 | WORKDIR /var/www/symfony 28 | 29 | RUN cp .env.example .env.local 30 | 31 | RUN rm -rf vendor && \ 32 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 33 | composer dump-autoload --no-dev --classmap-authoritative && \ 34 | composer check-platform-reqs && \ 35 | php bin/console cache:clear && \ 36 | php bin/console cache:warmup 37 | 38 | ENV APP_RUNTIME="Runtime\\Swoole\\Runtime" 39 | 40 | EXPOSE 80 41 | 42 | CMD ["php", "./public/index.swoole.php"] -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/010_adapterman/adapterman/adapterman.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-cli 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ 8 | 9 | RUN chmod +x /usr/local/bin/install-php-extensions && \ 10 | install-php-extensions \ 11 | exif \ 12 | event \ 13 | intl \ 14 | opcache \ 15 | pcntl \ 16 | pdo_pgsql \ 17 | tidy \ 18 | gd \ 19 | bcmath \ 20 | sockets \ 21 | zip && \ 22 | install-php-extensions @composer; 23 | 24 | RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini 25 | 26 | 27 | COPY "./project" "/var/www/symfony" 28 | 29 | WORKDIR /var/www/symfony 30 | 31 | RUN cp .env.example .env.local 32 | RUN rm -rf vendor && \ 33 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 34 | composer dump-autoload --no-dev --classmap-authoritative && \ 35 | composer check-platform-reqs && \ 36 | php bin/console cache:clear && \ 37 | php bin/console cache:warmup 38 | 39 | #ENV APP_RUNTIME="" 40 | COPY ./runtimes/010_adapterman/adapterman/php.ini /usr/local/etc/php/conf.d/custom-php.ini 41 | 42 | EXPOSE 80 43 | 44 | CMD ["php", "server.php", "start"] -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/010_adapterman/adapterman/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | memory_limit = 128M 6 | 7 | realpath_cache_size=4096K 8 | realpath_cache_ttl=600 9 | 10 | [opcache] 11 | opcache.enable=1 12 | opcache.enable_cli=1 13 | opcache.preload_user=root 14 | opcache.jit_buffer_size=256M 15 | opcache.jit=tracing 16 | opcache.preload=/var/www/symfony/config/preload.php 17 | opcache.validate_timestamps=0 18 | opcache.memory_consumption=256 19 | opcache.max_accelerated_files=20000 20 | 21 | disable_functions=header,header_remove,headers_sent,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,session_regenerate_id,set_time_limit 22 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/010_adapterman/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 010_adapterman: 3 | build: 4 | context: ../../ 5 | dockerfile: "./runtimes/010_adapterman/adapterman/adapterman.Dockerfile" 6 | image: "010_adapterman" 7 | container_name: "010_adapterman" 8 | hostname: symfony7site 9 | ports: 10 | - '8000:80' 11 | networks: 12 | - php-benchmarks 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | 22 | networks: 23 | php-benchmarks: 24 | name: php-benchmarks -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/011_caddy_phpfpm/caddy/Caddyfile: -------------------------------------------------------------------------------- 1 | # {$SERVER_NAME:localhost} { 2 | http://localhost http://symfony7site { 3 | root * /var/www/symfony/public 4 | php_fastcgi 011_phpfpm:9000 5 | } -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/011_caddy_phpfpm/caddy/caddy.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM caddy:2.7.6 2 | 3 | COPY ./runtimes/011_caddy_phpfpm/caddy/Caddyfile /etc/caddy/Caddyfile 4 | 5 | COPY "./project" "/var/www/symfony" 6 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/011_caddy_phpfpm/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 003_nginx: 3 | build: 4 | context: ../../ 5 | dockerfile: ./runtimes/011_caddy_phpfpm/caddy/caddy.Dockerfile 6 | image: 011_caddy 7 | container_name: "011_caddy" 8 | hostname: symfony7site 9 | ports: 10 | - '8000:80' 11 | networks: 12 | - php-benchmarks 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | 22 | 003_phpfpm: 23 | build: 24 | context: ../../ 25 | dockerfile: ./runtimes/011_caddy_phpfpm/fpm/phpfpm.Dockerfile 26 | image: 011_phpfpm 27 | container_name: "011_phpfpm" 28 | ports: 29 | - "9000:9000" 30 | networks: 31 | - php-benchmarks 32 | deploy: 33 | resources: 34 | limits: 35 | cpus: '1' 36 | memory: '1gb' 37 | reservations: 38 | cpus: '1' 39 | memory: '1gb' 40 | 41 | networks: 42 | php-benchmarks: 43 | name: php-benchmarks 44 | 45 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/011_caddy_phpfpm/fpm/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | 6 | memory_limit = 128M 7 | 8 | realpath_cache_size=4096K 9 | realpath_cache_ttl=600 10 | 11 | [opcache] 12 | opcache.enable=1 13 | opcache.jit_buffer_size=256M 14 | opcache.jit=tracing 15 | opcache.preload=/var/www/symfony/config/preload.php 16 | opcache.preload_user=www-data 17 | opcache.validate_timestamps=0 18 | opcache.memory_consumption=256 19 | opcache.max_accelerated_files=20000 20 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/011_caddy_phpfpm/fpm/phpfpm.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-fpm 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ 8 | 9 | RUN chmod +x /usr/local/bin/install-php-extensions && \ 10 | install-php-extensions \ 11 | exif \ 12 | intl \ 13 | opcache \ 14 | pdo_pgsql \ 15 | tidy \ 16 | gd \ 17 | bcmath \ 18 | sockets \ 19 | zip && \ 20 | install-php-extensions @composer; 21 | 22 | COPY "./project" "/var/www/symfony" 23 | 24 | RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini; 25 | COPY ./runtimes/003_nginx_phpfpm/fpm/php.ini /usr/local/etc/php/conf.d/custom-php.ini 26 | COPY ./runtimes/003_nginx_phpfpm/fpm/www.conf /usr/local/etc/php-fpm.d/www.conf 27 | 28 | WORKDIR /var/www/symfony 29 | 30 | RUN cp .env.example .env.local 31 | ENV COMPOSER_ALLOW_SUPERUSER=1 32 | 33 | RUN rm -rf vendor && \ 34 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 35 | composer dump-autoload --no-dev --classmap-authoritative && \ 36 | composer check-platform-reqs && \ 37 | php bin/console cache:clear && \ 38 | php bin/console cache:warmup -------------------------------------------------------------------------------- /001_symfony7_wo_db/runtimes/011_caddy_phpfpm/fpm/www.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'www'. 2 | ; the variable $pool can be used in any directive and will be replaced by the 3 | ; pool name ('www' here) 4 | [www] 5 | 6 | ; Per pool prefix 7 | ; It only applies on the following directives: 8 | ; - 'access.log' 9 | ; - 'slowlog' 10 | ; - 'listen' (unixsocket) 11 | ; - 'chroot' 12 | ; - 'chdir' 13 | ; - 'php_values' 14 | ; - 'php_admin_values' 15 | ; When not set, the global prefix (or NONE) applies instead. 16 | ; Note: This directive can also be relative to the global prefix. 17 | ; Default Value: none 18 | ;prefix = /path/to/pools/$pool 19 | 20 | ; Unix user/group of the child processes. This can be used only if the master 21 | ; process running user is root. It is set after the child process is created. 22 | ; The user and group can be specified either by their name or by their numeric 23 | ; IDs. 24 | ; Note: If the user is root, the executable needs to be started with 25 | ; --allow-to-run-as-root option to work. 26 | ; Default Values: The user is set to master process running user by default. 27 | ; If the group is not set, the user's group is used. 28 | user = www-data 29 | group = www-data 30 | 31 | ; The address on which to accept FastCGI requests. 32 | ; Valid syntaxes are: 33 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on 34 | ; a specific port; 35 | ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on 36 | ; a specific port; 37 | ; 'port' - to listen on a TCP socket to all addresses 38 | ; (IPv6 and IPv4-mapped) on a specific port; 39 | ; '/path/to/unix/socket' - to listen on a unix socket. 40 | ; Note: This value is mandatory. 41 | listen = 127.0.0.1:9000 42 | 43 | ; Set listen(2) backlog. 44 | ; Default Value: 511 (-1 on Linux, FreeBSD and OpenBSD) 45 | ;listen.backlog = 511 46 | 47 | ; Set permissions for unix socket, if one is used. In Linux, read/write 48 | ; permissions must be set in order to allow connections from a web server. Many 49 | ; BSD-derived systems allow connections regardless of permissions. The owner 50 | ; and group can be specified either by name or by their numeric IDs. 51 | ; Default Values: Owner is set to the master process running user. If the group 52 | ; is not set, the owner's group is used. Mode is set to 0660. 53 | ;listen.owner = www-data 54 | ;listen.group = www-data 55 | ;listen.mode = 0660 56 | 57 | ; When POSIX Access Control Lists are supported you can set them using 58 | ; these options, value is a comma separated list of user/group names. 59 | ; When set, listen.owner and listen.group are ignored 60 | ;listen.acl_users = 61 | ;listen.acl_groups = 62 | 63 | ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. 64 | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original 65 | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address 66 | ; must be separated by a comma. If this value is left blank, connections will be 67 | ; accepted from any ip address. 68 | ; Default Value: any 69 | ;listen.allowed_clients = 127.0.0.1 70 | 71 | ; Set the associated the route table (FIB). FreeBSD only 72 | ; Default Value: -1 73 | ;listen.setfib = 1 74 | 75 | ; Specify the nice(2) priority to apply to the pool processes (only if set) 76 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 77 | ; Note: - It will only work if the FPM master process is launched as root 78 | ; - The pool processes will inherit the master process priority 79 | ; unless it specified otherwise 80 | ; Default Value: no set 81 | ; process.priority = -19 82 | 83 | ; Set the process dumpable flag (PR_SET_DUMPABLE prctl for Linux or 84 | ; PROC_TRACE_CTL procctl for FreeBSD) even if the process user 85 | ; or group is different than the master process user. It allows to create process 86 | ; core dump and ptrace the process for the pool user. 87 | ; Default Value: no 88 | ; process.dumpable = yes 89 | 90 | ; Choose how the process manager will control the number of child processes. 91 | ; Possible Values: 92 | ; static - a fixed number (pm.max_children) of child processes; 93 | ; dynamic - the number of child processes are set dynamically based on the 94 | ; following directives. With this process management, there will be 95 | ; always at least 1 children. 96 | ; pm.max_children - the maximum number of children that can 97 | ; be alive at the same time. 98 | ; pm.start_servers - the number of children created on startup. 99 | ; pm.min_spare_servers - the minimum number of children in 'idle' 100 | ; state (waiting to process). If the number 101 | ; of 'idle' processes is less than this 102 | ; number then some children will be created. 103 | ; pm.max_spare_servers - the maximum number of children in 'idle' 104 | ; state (waiting to process). If the number 105 | ; of 'idle' processes is greater than this 106 | ; number then some children will be killed. 107 | ; pm.max_spawn_rate - the maximum number of rate to spawn child 108 | ; processes at once. 109 | ; ondemand - no children are created at startup. Children will be forked when 110 | ; new requests will connect. The following parameter are used: 111 | ; pm.max_children - the maximum number of children that 112 | ; can be alive at the same time. 113 | ; pm.process_idle_timeout - The number of seconds after which 114 | ; an idle process will be killed. 115 | ; Note: This value is mandatory. 116 | pm = dynamic 117 | 118 | ; The number of child processes to be created when pm is set to 'static' and the 119 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 120 | ; This value sets the limit on the number of simultaneous requests that will be 121 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 122 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 123 | ; CGI. The below defaults are based on a server without much resources. Don't 124 | ; forget to tweak pm.* to fit your needs. 125 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 126 | ; Note: This value is mandatory. 127 | ; pm.max_children = 5 128 | pm.max_children = 33 129 | 130 | ; The number of child processes created on startup. 131 | ; Note: Used only when pm is set to 'dynamic' 132 | ; Default Value: (min_spare_servers + max_spare_servers) / 2 133 | pm.start_servers = 10 134 | 135 | ; The desired minimum number of idle server processes. 136 | ; Note: Used only when pm is set to 'dynamic' 137 | ; Note: Mandatory when pm is set to 'dynamic' 138 | ; pm.min_spare_servers = 1 139 | pm.min_spare_servers = 10 140 | 141 | ; The desired maximum number of idle server processes. 142 | ; Note: Used only when pm is set to 'dynamic' 143 | ; Note: Mandatory when pm is set to 'dynamic' 144 | ;pm.max_spare_servers = 3 145 | pm.max_spare_servers = 30 146 | 147 | ; The number of rate to spawn child processes at once. 148 | ; Note: Used only when pm is set to 'dynamic' 149 | ; Note: Mandatory when pm is set to 'dynamic' 150 | ; Default Value: 32 151 | ;pm.max_spawn_rate = 32 152 | 153 | ; The number of seconds after which an idle process will be killed. 154 | ; Note: Used only when pm is set to 'ondemand' 155 | ; Default Value: 10s 156 | ;pm.process_idle_timeout = 10s; 157 | 158 | ; The number of requests each child process should execute before respawning. 159 | ; This can be useful to work around memory leaks in 3rd party libraries. For 160 | ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. 161 | ; Default Value: 0 162 | pm.max_requests = 500 163 | 164 | ; The URI to view the FPM status page. If this value is not set, no URI will be 165 | ; recognized as a status page. It shows the following information: 166 | ; pool - the name of the pool; 167 | ; process manager - static, dynamic or ondemand; 168 | ; start time - the date and time FPM has started; 169 | ; start since - number of seconds since FPM has started; 170 | ; accepted conn - the number of request accepted by the pool; 171 | ; listen queue - the number of request in the queue of pending 172 | ; connections (see backlog in listen(2)); 173 | ; max listen queue - the maximum number of requests in the queue 174 | ; of pending connections since FPM has started; 175 | ; listen queue len - the size of the socket queue of pending connections; 176 | ; idle processes - the number of idle processes; 177 | ; active processes - the number of active processes; 178 | ; total processes - the number of idle + active processes; 179 | ; max active processes - the maximum number of active processes since FPM 180 | ; has started; 181 | ; max children reached - number of times, the process limit has been reached, 182 | ; when pm tries to start more children (works only for 183 | ; pm 'dynamic' and 'ondemand'); 184 | ; Value are updated in real time. 185 | ; Example output: 186 | ; pool: www 187 | ; process manager: static 188 | ; start time: 01/Jul/2011:17:53:49 +0200 189 | ; start since: 62636 190 | ; accepted conn: 190460 191 | ; listen queue: 0 192 | ; max listen queue: 1 193 | ; listen queue len: 42 194 | ; idle processes: 4 195 | ; active processes: 11 196 | ; total processes: 15 197 | ; max active processes: 12 198 | ; max children reached: 0 199 | ; 200 | ; By default the status page output is formatted as text/plain. Passing either 201 | ; 'html', 'xml' or 'json' in the query string will return the corresponding 202 | ; output syntax. Example: 203 | ; http://www.foo.bar/status 204 | ; http://www.foo.bar/status?json 205 | ; http://www.foo.bar/status?html 206 | ; http://www.foo.bar/status?xml 207 | ; 208 | ; By default the status page only outputs short status. Passing 'full' in the 209 | ; query string will also return status for each pool process. 210 | ; Example: 211 | ; http://www.foo.bar/status?full 212 | ; http://www.foo.bar/status?json&full 213 | ; http://www.foo.bar/status?html&full 214 | ; http://www.foo.bar/status?xml&full 215 | ; The Full status returns for each process: 216 | ; pid - the PID of the process; 217 | ; state - the state of the process (Idle, Running, ...); 218 | ; start time - the date and time the process has started; 219 | ; start since - the number of seconds since the process has started; 220 | ; requests - the number of requests the process has served; 221 | ; request duration - the duration in µs of the requests; 222 | ; request method - the request method (GET, POST, ...); 223 | ; request URI - the request URI with the query string; 224 | ; content length - the content length of the request (only with POST); 225 | ; user - the user (PHP_AUTH_USER) (or '-' if not set); 226 | ; script - the main script called (or '-' if not set); 227 | ; last request cpu - the %cpu the last request consumed 228 | ; it's always 0 if the process is not in Idle state 229 | ; because CPU calculation is done when the request 230 | ; processing has terminated; 231 | ; last request memory - the max amount of memory the last request consumed 232 | ; it's always 0 if the process is not in Idle state 233 | ; because memory calculation is done when the request 234 | ; processing has terminated; 235 | ; If the process is in Idle state, then informations are related to the 236 | ; last request the process has served. Otherwise informations are related to 237 | ; the current request being served. 238 | ; Example output: 239 | ; ************************ 240 | ; pid: 31330 241 | ; state: Running 242 | ; start time: 01/Jul/2011:17:53:49 +0200 243 | ; start since: 63087 244 | ; requests: 12808 245 | ; request duration: 1250261 246 | ; request method: GET 247 | ; request URI: /test_mem.php?N=10000 248 | ; content length: 0 249 | ; user: - 250 | ; script: /home/fat/web/docs/php/test_mem.php 251 | ; last request cpu: 0.00 252 | ; last request memory: 0 253 | ; 254 | ; Note: There is a real-time FPM status monitoring sample web page available 255 | ; It's available in: /usr/local/share/php/fpm/status.html 256 | ; 257 | ; Note: The value must start with a leading slash (/). The value can be 258 | ; anything, but it may not be a good idea to use the .php extension or it 259 | ; may conflict with a real PHP file. 260 | ; Default Value: not set 261 | pm.status_path = /fpm-status 262 | 263 | ; The address on which to accept FastCGI status request. This creates a new 264 | ; invisible pool that can handle requests independently. This is useful 265 | ; if the main pool is busy with long running requests because it is still possible 266 | ; to get the status before finishing the long running requests. 267 | ; 268 | ; Valid syntaxes are: 269 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on 270 | ; a specific port; 271 | ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on 272 | ; a specific port; 273 | ; 'port' - to listen on a TCP socket to all addresses 274 | ; (IPv6 and IPv4-mapped) on a specific port; 275 | ; '/path/to/unix/socket' - to listen on a unix socket. 276 | ; Default Value: value of the listen option 277 | pm.status_listen = 9001 278 | 279 | ; The ping URI to call the monitoring page of FPM. If this value is not set, no 280 | ; URI will be recognized as a ping page. This could be used to test from outside 281 | ; that FPM is alive and responding, or to 282 | ; - create a graph of FPM availability (rrd or such); 283 | ; - remove a server from a group if it is not responding (load balancing); 284 | ; - trigger alerts for the operating team (24/7). 285 | ; Note: The value must start with a leading slash (/). The value can be 286 | ; anything, but it may not be a good idea to use the .php extension or it 287 | ; may conflict with a real PHP file. 288 | ; Default Value: not set 289 | ;ping.path = /ping 290 | 291 | ; This directive may be used to customize the response of a ping request. The 292 | ; response is formatted as text/plain with a 200 response code. 293 | ; Default Value: pong 294 | ;ping.response = pong 295 | 296 | ; The access log file 297 | ; Default: not set 298 | ;access.log = log/$pool.access.log 299 | 300 | ; The access log format. 301 | ; The following syntax is allowed 302 | ; %%: the '%' character 303 | ; %C: %CPU used by the request 304 | ; it can accept the following format: 305 | ; - %{user}C for user CPU only 306 | ; - %{system}C for system CPU only 307 | ; - %{total}C for user + system CPU (default) 308 | ; %d: time taken to serve the request 309 | ; it can accept the following format: 310 | ; - %{seconds}d (default) 311 | ; - %{milliseconds}d 312 | ; - %{milli}d 313 | ; - %{microseconds}d 314 | ; - %{micro}d 315 | ; %e: an environment variable (same as $_ENV or $_SERVER) 316 | ; it must be associated with embraces to specify the name of the env 317 | ; variable. Some examples: 318 | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 319 | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 320 | ; %f: script filename 321 | ; %l: content-length of the request (for POST request only) 322 | ; %m: request method 323 | ; %M: peak of memory allocated by PHP 324 | ; it can accept the following format: 325 | ; - %{bytes}M (default) 326 | ; - %{kilobytes}M 327 | ; - %{kilo}M 328 | ; - %{megabytes}M 329 | ; - %{mega}M 330 | ; %n: pool name 331 | ; %o: output header 332 | ; it must be associated with embraces to specify the name of the header: 333 | ; - %{Content-Type}o 334 | ; - %{X-Powered-By}o 335 | ; - %{Transfert-Encoding}o 336 | ; - .... 337 | ; %p: PID of the child that serviced the request 338 | ; %P: PID of the parent of the child that serviced the request 339 | ; %q: the query string 340 | ; %Q: the '?' character if query string exists 341 | ; %r: the request URI (without the query string, see %q and %Q) 342 | ; %R: remote IP address 343 | ; %s: status (response code) 344 | ; %t: server time the request was received 345 | ; it can accept a strftime(3) format: 346 | ; %d/%b/%Y:%H:%M:%S %z (default) 347 | ; The strftime(3) format must be encapsulated in a %{}t tag 348 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 349 | ; %T: time the log has been written (the request has finished) 350 | ; it can accept a strftime(3) format: 351 | ; %d/%b/%Y:%H:%M:%S %z (default) 352 | ; The strftime(3) format must be encapsulated in a %{}t tag 353 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 354 | ; %u: remote user 355 | ; 356 | ; Default: "%R - %u %t \"%m %r\" %s" 357 | ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{milli}d %{kilo}M %C%%" 358 | 359 | ; A list of request_uri values which should be filtered from the access log. 360 | ; 361 | ; As a security precuation, this setting will be ignored if: 362 | ; - the request method is not GET or HEAD; or 363 | ; - there is a request body; or 364 | ; - there are query parameters; or 365 | ; - the response code is outwith the successful range of 200 to 299 366 | ; 367 | ; Note: The paths are matched against the output of the access.format tag "%r". 368 | ; On common configurations, this may look more like SCRIPT_NAME than the 369 | ; expected pre-rewrite URI. 370 | ; 371 | ; Default Value: not set 372 | ;access.suppress_path[] = /ping 373 | ;access.suppress_path[] = /health_check.php 374 | 375 | ; The log file for slow requests 376 | ; Default Value: not set 377 | ; Note: slowlog is mandatory if request_slowlog_timeout is set 378 | ;slowlog = log/$pool.log.slow 379 | 380 | ; The timeout for serving a single request after which a PHP backtrace will be 381 | ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 382 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 383 | ; Default Value: 0 384 | ;request_slowlog_timeout = 0 385 | 386 | ; Depth of slow log stack trace. 387 | ; Default Value: 20 388 | ;request_slowlog_trace_depth = 20 389 | 390 | ; The timeout for serving a single request after which the worker process will 391 | ; be killed. This option should be used when the 'max_execution_time' ini option 392 | ; does not stop script execution for some reason. A value of '0' means 'off'. 393 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 394 | ; Default Value: 0 395 | ;request_terminate_timeout = 0 396 | 397 | ; The timeout set by 'request_terminate_timeout' ini option is not engaged after 398 | ; application calls 'fastcgi_finish_request' or when application has finished and 399 | ; shutdown functions are being called (registered via register_shutdown_function). 400 | ; This option will enable timeout limit to be applied unconditionally 401 | ; even in such cases. 402 | ; Default Value: no 403 | ;request_terminate_timeout_track_finished = no 404 | 405 | ; Set open file descriptor rlimit. 406 | ; Default Value: system defined value 407 | ;rlimit_files = 1024 408 | 409 | ; Set max core size rlimit. 410 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 411 | ; Default Value: system defined value 412 | ;rlimit_core = 0 413 | 414 | ; Chroot to this directory at the start. This value must be defined as an 415 | ; absolute path. When this value is not set, chroot is not used. 416 | ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 417 | ; of its subdirectories. If the pool prefix is not set, the global prefix 418 | ; will be used instead. 419 | ; Note: chrooting is a great security feature and should be used whenever 420 | ; possible. However, all PHP paths will be relative to the chroot 421 | ; (error_log, sessions.save_path, ...). 422 | ; Default Value: not set 423 | ;chroot = 424 | 425 | ; Chdir to this directory at the start. 426 | ; Note: relative path can be used. 427 | ; Default Value: current directory or / when chroot 428 | ;chdir = /var/www 429 | 430 | ; Redirect worker stdout and stderr into main error log. If not set, stdout and 431 | ; stderr will be redirected to /dev/null according to FastCGI specs. 432 | ; Note: on highloaded environment, this can cause some delay in the page 433 | ; process time (several ms). 434 | ; Default Value: no 435 | ;catch_workers_output = yes 436 | 437 | ; Decorate worker output with prefix and suffix containing information about 438 | ; the child that writes to the log and if stdout or stderr is used as well as 439 | ; log level and time. This options is used only if catch_workers_output is yes. 440 | ; Settings to "no" will output data as written to the stdout or stderr. 441 | ; Default value: yes 442 | ;decorate_workers_output = no 443 | 444 | ; Clear environment in FPM workers 445 | ; Prevents arbitrary environment variables from reaching FPM worker processes 446 | ; by clearing the environment in workers before env vars specified in this 447 | ; pool configuration are added. 448 | ; Setting to "no" will make all environment variables available to PHP code 449 | ; via getenv(), $_ENV and $_SERVER. 450 | ; Default Value: yes 451 | ;clear_env = no 452 | 453 | ; Limits the extensions of the main script FPM will allow to parse. This can 454 | ; prevent configuration mistakes on the web server side. You should only limit 455 | ; FPM to .php extensions to prevent malicious users to use other extensions to 456 | ; execute php code. 457 | ; Note: set an empty value to allow all extensions. 458 | ; Default Value: .php 459 | ;security.limit_extensions = .php .php3 .php4 .php5 .php7 460 | 461 | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 462 | ; the current environment. 463 | ; Default Value: clean env 464 | ;env[HOSTNAME] = $HOSTNAME 465 | ;env[PATH] = /usr/local/bin:/usr/bin:/bin 466 | ;env[TMP] = /tmp 467 | ;env[TMPDIR] = /tmp 468 | ;env[TEMP] = /tmp 469 | 470 | ; Additional php.ini defines, specific to this pool of workers. These settings 471 | ; overwrite the values previously defined in the php.ini. The directives are the 472 | ; same as the PHP SAPI: 473 | ; php_value/php_flag - you can set classic ini defines which can 474 | ; be overwritten from PHP call 'ini_set'. 475 | ; php_admin_value/php_admin_flag - these directives won't be overwritten by 476 | ; PHP call 'ini_set' 477 | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 478 | 479 | ; Defining 'extension' will load the corresponding shared extension from 480 | ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not 481 | ; overwrite previously defined php.ini values, but will append the new value 482 | ; instead. 483 | 484 | ; Note: path INI options can be relative and will be expanded with the prefix 485 | ; (pool, global or /usr/local) 486 | 487 | ; Default Value: nothing is defined by default except the values in php.ini and 488 | ; specified at startup with the -d argument 489 | ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 490 | ;php_flag[display_errors] = off 491 | ;php_admin_value[error_log] = /var/log/fpm-php.www.log 492 | ;php_admin_flag[log_errors] = on 493 | ;php_admin_value[memory_limit] = 32M 494 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/testing-tools/bombardier: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DimDev/php-runtimes-benchmark/901796f378afbdc113a8247fba0309c29ee77441/001_symfony7_wo_db/testing-tools/bombardier -------------------------------------------------------------------------------- /001_symfony7_wo_db/testing-tools/k6/script_vus10000_dur30s.js: -------------------------------------------------------------------------------- 1 | import http from 'k6/http'; 2 | import { sleep } from 'k6'; 3 | 4 | export const options = { 5 | // A number specifying the number of VUs to run concurrently. 6 | vus: 10000, 7 | // A string specifying the total duration of the test run. 8 | duration: '30s', 9 | }; 10 | 11 | // The function that defines VU logic. 12 | // 13 | // See https://grafana.com/docs/k6/latest/examples/get-started-with-k6/ to learn more 14 | // about authoring k6 scripts. 15 | // 16 | export default function() { 17 | http.get('http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname'); 18 | } 19 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/testing-tools/k6/script_vus1000_dur30s.js: -------------------------------------------------------------------------------- 1 | import http from 'k6/http'; 2 | import { sleep } from 'k6'; 3 | 4 | export const options = { 5 | // A number specifying the number of VUs to run concurrently. 6 | vus: 1000, 7 | // A string specifying the total duration of the test run. 8 | duration: '30s', 9 | }; 10 | 11 | // The function that defines VU logic. 12 | // 13 | // See https://grafana.com/docs/k6/latest/examples/get-started-with-k6/ to learn more 14 | // about authoring k6 scripts. 15 | // 16 | export default function() { 17 | http.get('http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname'); 18 | } 19 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/testing-tools/k6/script_vus100_dur30s.js: -------------------------------------------------------------------------------- 1 | import http from 'k6/http'; 2 | import { sleep } from 'k6'; 3 | 4 | export const options = { 5 | // A number specifying the number of VUs to run concurrently. 6 | vus: 100, 7 | // A string specifying the total duration of the test run. 8 | duration: '30s', 9 | }; 10 | 11 | // The function that defines VU logic. 12 | // 13 | // See https://grafana.com/docs/k6/latest/examples/get-started-with-k6/ to learn more 14 | // about authoring k6 scripts. 15 | // 16 | export default function() { 17 | http.get('http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname'); 18 | } 19 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/testing-tools/k6/script_vus10_dur30s.js: -------------------------------------------------------------------------------- 1 | import http from 'k6/http'; 2 | import { sleep } from 'k6'; 3 | 4 | export const options = { 5 | // A number specifying the number of VUs to run concurrently. 6 | vus: 10, 7 | // A string specifying the total duration of the test run. 8 | duration: '30s', 9 | }; 10 | 11 | // The function that defines VU logic. 12 | // 13 | // See https://grafana.com/docs/k6/latest/examples/get-started-with-k6/ to learn more 14 | // about authoring k6 scripts. 15 | // 16 | export default function() { 17 | http.get('http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname'); 18 | } 19 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/testing-tools/k6/script_vus5_dur10s.js: -------------------------------------------------------------------------------- 1 | import http from 'k6/http'; 2 | import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.2/index.js'; 3 | 4 | export const options = { 5 | // A number specifying the number of VUs to run concurrently. 6 | vus: 5, 7 | // A string specifying the total duration of the test run. 8 | duration: '5s', 9 | }; 10 | 11 | // The function that defines VU logic. 12 | // 13 | // See https://grafana.com/docs/k6/latest/examples/get-started-with-k6/ to learn more 14 | // about authoring k6 scripts. 15 | // 16 | export default function() { 17 | http.get('http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname'); 18 | } 19 | export function handleSummary(data) { 20 | /*return { 21 | 'summary.json': JSON.stringify(data), //the default data object 22 | };*/ 23 | const customizedData = { 24 | http_reqs: data.metrics.http_reqs.values.count, 25 | 26 | rate: data.metrics.http_reqs.values.rate, 27 | avg_response_time: data.metrics['http_req_duration{expected_response:true}'].values.avg 28 | } 29 | return { 30 | 'stdout': textSummary(data, { indent: ' ', enableColors: true }), // Show the text summary to stdout... 31 | 'summary_full.json': JSON.stringify(data), // and a JSON with all the details... 32 | 'summary_short.json': JSON.stringify(customizedData), // and a JSON with all the details... 33 | }; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /001_symfony7_wo_db/testing-tools/k6/script_vus5_dur30s.js: -------------------------------------------------------------------------------- 1 | import http from 'k6/http'; 2 | import { sleep } from 'k6'; 3 | 4 | export const options = { 5 | // A number specifying the number of VUs to run concurrently. 6 | vus: 5, 7 | // A string specifying the total duration of the test run. 8 | duration: '30s', 9 | }; 10 | 11 | // The function that defines VU logic. 12 | // 13 | // See https://grafana.com/docs/k6/latest/examples/get-started-with-k6/ to learn more 14 | // about authoring k6 scripts. 15 | // 16 | export default function() { 17 | http.get('http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname'); 18 | } 19 | -------------------------------------------------------------------------------- /002_symfony6_wo_db/runtimes/010_reactphp/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 009_openswoole: 3 | build: 4 | context: ../../ 5 | dockerfile: "./runtimes/009_openswoole/openswoole/openswoole.Dockerfile" 6 | image: "009_openswoole" 7 | container_name: "009_openswoole" 8 | hostname: symfony7site 9 | ports: 10 | - '80:80' 11 | networks: 12 | - php-benchmarks 13 | deploy: 14 | resources: 15 | limits: 16 | cpus: '1' 17 | memory: '1gb' 18 | reservations: 19 | cpus: '1' 20 | memory: '1gb' 21 | 22 | networks: 23 | php-benchmarks: 24 | name: php-benchmarks -------------------------------------------------------------------------------- /002_symfony6_wo_db/runtimes/010_reactphp/reactphp/php.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Europe/Warsaw" 2 | short_open_tag = Off 3 | expose_php = Off 4 | allow_url_fopen = Off 5 | memory_limit = 128M 6 | 7 | realpath_cache_size=4096K 8 | realpath_cache_ttl=600 9 | 10 | [opcache] 11 | opcache.enable=1 12 | opcache.enable_cli=1 13 | opcache.preload_user=root 14 | opcache.jit_buffer_size=256M 15 | opcache.jit=tracing 16 | opcache.preload=/var/www/symfony/config/preload.php 17 | opcache.validate_timestamps=0 18 | opcache.memory_consumption=256 19 | opcache.max_accelerated_files=20000 20 | -------------------------------------------------------------------------------- /002_symfony6_wo_db/runtimes/010_reactphp/reactphp/reactphp.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openswoole/swoole:php8.3 2 | 3 | RUN set -xe; \ 4 | apt update; \ 5 | apt install unzip 6 | 7 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ 8 | 9 | RUN chmod +x /usr/local/bin/install-php-extensions && \ 10 | install-php-extensions \ 11 | exif \ 12 | intl \ 13 | opcache \ 14 | pdo_pgsql \ 15 | tidy \ 16 | gd \ 17 | bcmath \ 18 | sockets \ 19 | zip && \ 20 | install-php-extensions @composer; 21 | 22 | RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini 23 | COPY ./runtimes/009_openswoole/openswoole/php.ini /usr/local/etc/php/conf.d/custom-php.ini 24 | 25 | COPY "./project" "/var/www/symfony" 26 | 27 | WORKDIR /var/www/symfony 28 | 29 | RUN cp .env.example .env.local 30 | 31 | RUN rm -rf vendor && \ 32 | composer install --no-dev --no-scripts --prefer-dist --no-interaction && \ 33 | composer dump-autoload --no-dev --classmap-authoritative && \ 34 | composer check-platform-reqs && \ 35 | php bin/console cache:clear && \ 36 | php bin/console cache:warmup 37 | 38 | ENV APP_RUNTIME="Runtime\\Swoole\\Runtime" 39 | 40 | EXPOSE 80 41 | 42 | CMD ["php", "./public/index.openswoole.php"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP runtimes benchmark 2 | 3 | The repo contains the Symfony 7 application skeleton to be run in different runtimes: 4 | 5 | - Apache(prefork mode) + mod_php 6 | - Apache + PHP-FPM 7 | - Nginx + PHP-FPM 8 | - Nginx Unit 9 | - Roadrunner 10 | - Nginx + Roadrunner 11 | - FrankenPHP 12 | - FrankenPHP (worker mode) 13 | - Swoole 14 | 15 | ## URLs 16 | 17 | - http://localhost/ 18 | - http://localhost/?firstName=Randomlfirstname&lastName=Randomlastname 19 | - http://localhost/phpinfo 20 | - http://symfony7site/ 21 | - http://symfony7site/?firstName=Randomlfirstname&lastName=Randomlastname 22 | - http://symfony7site/phpinfo 23 | 24 | ## Run load tests 25 | 26 | Load tests are run inside docker container, which is in the same network as the runtime. 27 | 28 | ### Bombardier 29 | 30 | - https://pkg.go.dev/github.com/codesenberg/bombardier 31 | - https://hub.docker.com/r/alpine/bombardier 32 | 33 | ```shell 34 | make run/loadtest/bombardier-c5-d30s # Run bombardier concurrent connections: 5, duration: 30s 35 | make run/loadtest/bombardier-c10-d30s # Run bombardier concurrent connections: 10, duration: 30s 36 | make run/loadtest/bombardier-c100-d30s # Run bombardier concurrent connections: 100, duration: 30s 37 | make run/loadtest/bombardier-c1000-d30s # Run bombardier concurrent connections: 1000, duration: 30s 38 | make run/loadtest/bombardier-c10000-d30s # Run bombardier concurrent connections: 10000, duration: 30s 39 | ``` 40 | 41 | ### Apache HTTP server benchmarking tool 42 | 43 | - https://httpd.apache.org/docs/2.4/programs/ab.html 44 | 45 | ```shell 46 | make run/loadtest/ab-n100-c5 47 | make run/loadtest/ab-n1000-c100 48 | make run/loadtest/ab-n10000-c1000 49 | ``` 50 | 51 | ### K6 (by Grafana Labs) 52 | 53 | - https://k6.io/docs/ 54 | - https://k6.io/docs/using-k6/metrics/reference/ 55 | 56 | See js scripts in 001_symfony7_wo_db/testing-tools/k6 57 | 58 | ```shell 59 | make run/loadtest/k6-vus5-dur30s 60 | make run/loadtest/k6-vus10-dur30s 61 | make run/loadtest/k6-vus100-dur30s 62 | make run/loadtest/k6-vus1000-dur30s 63 | make run/loadtest/k6-vus10000-dur30s 64 | ``` 65 | 66 | ## 001: Apache(prefork mode) + mod_php 67 | 68 | - http://localhost/server-status 69 | 70 | 71 | ```shell 72 | make start/runtime/001-apache-modphp 73 | make stop/runtime/001-apache-modphp 74 | make rebuild/runtime/001-apache-modphp 75 | make down/runtime/001-apache-modphp 76 | make shell/runtime/001-apache-modphp 77 | ``` 78 | 79 | ## 002: Apache + PHP-FPM 80 | 81 | - http://localhost/apache-status 82 | - http://localhost/fpm-status?html&full 83 | 84 | 85 | ```shell 86 | make start/runtime/002-apache-phpfpm 87 | make stop/runtime/002-apache-phpfpm 88 | make rebuild/runtime/002-apache-phpfpm 89 | make down/runtime/002-apache-phpfpm 90 | make shell/runtime/002-apache 91 | make shell/runtime/002-phpfpm 92 | ``` 93 | 94 | ## 003: Nginx + PHP-FPM 95 | 96 | - http://localhost/fpm-status?html&full 97 | 98 | To calculate PHP-FPM pm.max_children, the following formula was used: 99 | ``` 100 | pm.max_children = Memory available to container / Memory consumed by 1 process 101 | ``` 102 | 103 | Memory consumed by 1 process: 104 | ```shell 105 | ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"Mb") }' 106 | ``` 107 | 108 | ```shell 109 | make start/runtime/003-nginx-phpfpm 110 | make stop/runtime/003-nginx-phpfpm 111 | make rebuild/runtime/003-nginx-phpfpm 112 | make down/runtime/003-nginx-phpfpm 113 | make shell/runtime/003-nginx 114 | make shell/runtime/003-phpfpm 115 | ``` 116 | 117 | ## 004: Nginx Unit + PHP Language module 118 | 119 | - https://unit.nginx.org/configuration/#php 120 | 121 | ```shell 122 | make start/runtime/004-nginx-unit 123 | make stop/runtime/004-nginx-unit 124 | make rebuild/runtime/004-nginx-unit 125 | make down/runtime/004-nginx-unit 126 | make shell/runtime/004-unit 127 | ``` 128 | 129 | ## 005: Roadrunner 130 | 131 | The symfony/runtime component is used 132 | 133 | - https://roadrunner.dev/ 134 | - https://github.com/baldinof/roadrunner-bundle 135 | 136 | ```shell 137 | make start/runtime/005-roadrunner 138 | make stop/runtime/005-roadrunner 139 | make rebuild/runtime/005-roadrunner 140 | make down/runtime/005-roadrunner 141 | make shell/runtime/005-roadrunner 142 | ``` 143 | 144 | ## 006: Nginx + Roadrunner(fcgi mode) 145 | 146 | The symfony/runtime component is used 147 | 148 | - https://roadrunner.dev/docs/app-server-nginx-with-rr/current/en 149 | - https://github.com/baldinof/roadrunner-bundle 150 | 151 | ```shell 152 | make start/runtime/006-nginx-roadrunner 153 | make stop/runtime/006-nginx-roadrunner 154 | make rebuild/runtime/006-nginx-roadrunner 155 | make down/runtime/006-nginx-roadrunner 156 | make shell/runtime/006-nginx 157 | make shell/runtime/006-roadrunner 158 | ``` 159 | 160 | ## 007: Frankenphp 161 | 162 | The symfony/runtime component is used 163 | 164 | - https://frankenphp.dev/docs/ 165 | 166 | ```shell 167 | make start/runtime/007-frankenphp 168 | make stop/runtime/007-frankenphp 169 | make rebuild/runtime/007-frankenphp 170 | make down/runtime/007-frankenphp 171 | make shell/runtime/007-frankenphp 172 | ``` 173 | 174 | ## 008: Frankenphp (workermode) 175 | 176 | The symfony/runtime component is used 177 | 178 | - https://frankenphp.dev/docs/worker/ 179 | 180 | ```shell 181 | make start/runtime/008-frankenphp-workermode 182 | make stop/runtime/008-frankenphp-workermode 183 | make rebuild/runtime/008-frankenphp-workermode 184 | make down/runtime/008-frankenphp-workermode 185 | make shell/runtime/008-frankenphp-workermode 186 | ``` 187 | 188 | ### Issues 189 | - FrankenPHP can't start with production version of php.ini, which is provided with official PHP image 190 | 191 | 192 | ## 009: Swoole 193 | 194 | The symfony/runtime component is used 195 | 196 | - https://github.com/php-runtime/swoole 197 | - https://swoole.com/docs 198 | 199 | ```shell 200 | make start/runtime/009-swoole 201 | make stop/runtime/009-swoole 202 | make rebuild/runtime/009-swoole 203 | make down/runtime/009-swoole 204 | make shell/runtime/009-swoole 205 | ``` 206 | --------------------------------------------------------------------------------