Lightweight π fast β‘ fastcgi php π proxy and static http server.
Because nowaday either you go serverless, or you manage distributed services in containers. httpd-php-fpm focus on containerized php world.
Well known existing solutions are:
- apache + mod-php: the more official & recommended solution. Unfortunately, this automatically imply a debian based docker image, pretty heavy (>=140Mib) π
- nginx + php-fpm: the bad news is that to avoid violating the container's single root process principle... we also need an init to supervise both nginx & php processes, and the resulting base docker image is still heavy, even with an alpine variant (>=90Mib) π
- symfony cli: not recommended for production, not single responsibility (also embed Symfony Cloud utils), closed source and written in Go (hello garbage collector). It also tries to bring the better developer experience so it does some voodoo, trying to make things work whatever your php setup is.
So, here's the budget of this project:
- Lightweight π: base docker image less than 40Mib (compressed). And lowest memory footprint.
- fast β‘:
- at least 2k req/s under 2ms at 95 percentile for static files
- at least 1k req/s under 5ms at 95 percentile for basic php-fpm request
cargo build -j(nproc) --release
# then run it, for example if you have a www dir:
# ./target/release/httpd-php-fpm -d ./www
current benchmarks, done with vegeta on a 8 core intel 10th gen CPU.
β echo "GET http://localhost:3000/" | vegeta attack -duration=10s -rate=2000 | tee results.bin | vegeta report
Requests [total, rate, throughput] 20000, 2000.13, 2000.08
Duration [total, attack, wait] 10s, 9.999s, 287.523Β΅s
Latencies [min, mean, 50, 90, 95, 99, max] 219.856Β΅s, 564.652Β΅s, 312.437Β΅s, 813.232Β΅s, 1.763ms, 5.4ms, 21.491ms
Bytes In [total, mean] 256240000, 12812.00
Bytes Out [total, mean] 0, 0.00
Success [ratio] 100.00%
Status Codes [code:count] 200:20000
Error Set:
stay tuned!