4 ms·
Nginx Unit + PHP seems to handedly out-perform Nginx + php-fpm[1][2][3]. Also, Docker environments running PHP via Nginx Unit will no longer need separate cont
by jchook 3y ago
Nginx Unit + PHP seems to handedly out-perform Nginx + php-fpm[1][2][3].
Also, Docker environments running PHP via Nginx Unit will no longer need separate containers for http + fpm, as it works similar to Apache's mod_php.
1. https://habr.com/en/articles/646397/ https://habr.com/en/articles/646397/
2. https://medium.com/@le_moment_it/nginx-unit-discover-and-benchmark-part-3-c38661194cd0 https://medium.com/@le_moment_it/nginx-unit-discover-and-ben...
3. https://github.com/nginx/unit/issues/6#issuecomment-384073628 https://github.com/nginx/unit/issues/6#issuecomment-38407362...
- conradfr 3y agoYou don't need separate containers to run nginx and php-fpm.
- wongarsu 3y agoAre you implying that docker containers don't run a unikernel that can only run one application at a time? /s
- kobalsky 3y agodoes it involve running supervisor inside the container? that’s fine but it’s definitely not kosher. in my experience those are the ones that kick and scream when they don’t start as root.
- martinsnow 3y agoI too would like to see a properly configured php+php-fpm container benchmark. There's a lot of overhead when you link by http instead of a unix socket, in the same container.
- e12e 3y agoTechnically, you should be able to share a domain socket via a shared volume too (between an "app" and "web" container) - as with postgres: https://github.com/sameersbn/docker-postgresql/issues/30#issuecomment-401520497 https://github.com/sameersbn/docker-postgresql/issues/30#iss... Curious about benchmarks and tests of TCP vs Unix domain sockets between docker containers.
- rob-olmos 3y agoAnother example is API Platform's docker setup: Volume config: https://github.com/api-platform/api-platform/blob/main/docker-compose.yml#L41 https://github.com/api-platform/api-platform/blob/main/docke... Caddy config: https://github.com/api-platform/api-platform/blob/main/api/docker/caddy/Caddyfile#L47 https://github.com/api-platform/api-platform/blob/main/api/d... php-fpm config: https://github.com/api-platform/api-platform/blob/main/api/docker/php/php-fpm.d/zz-docker.conf#L6 https://github.com/api-platform/api-platform/blob/main/api/d... I'm also curious on the performance differences between containers.
- e12e 3y agoI found a simple comparison from 2014 - which shows Unix domain sockets to have a 2-3x advantage over localhost TCP: "Unix Domain Sockets vs Loopback TCP Sockets" https://nicisdigital.wordpress.com/2014/03/03/unix-domain-sockets-vs-loopback-tcp-sockets/ https://nicisdigital.wordpress.com/2014/03/03/unix-domain-so... Hn submission: https://news.ycombinator.com/item?id=37466475 https://news.ycombinator.com/item?id=37466475
- ComputerGuru 3y agoThose benchmark outcomes are ridiculously in nginx-unit’s favor over php-fpm, way more than I would have believed was possible. What is php-fpm doing architecturally that is so different to warrant such poor relative performance?
- pbowyer 3y agoYou see similar performance improvements in bencharmarks of Litespeed & PHP LSAPI [1]. Unfortunately said benchmarks are usually done by the software company making said webserver, so have to be taken with a pinch of salt. 1. https://www.litespeedtech.com/open-source/litespeed-sapi/php https://www.litespeedtech.com/open-source/litespeed-sapi/php
- tiffanyh 3y agoTwo questions: 1. Does Unit + PHP doing the typical “initialize & teardown” that PHP is know for? Or is Unit persisting the initialization/setup, hence why it’s achieving the way faster results? 2. How is Unit/PHP architecturally different than NGX-PHP (an event loop)? https://github.com/rryqszq4/ngx-php https://github.com/rryqszq4/ngx-php
- Dachande663 3y agoPHP’s had an opcache and jit for several versions now. Combined with preload options, this means startup time is negligible.