mnapoli / bref-bootstrap-benchmarks

Benchmark of possible solutions for Bref and the new AWS Lambda runtime API
https://github.com/mnapoli/bref/issues/100
22 stars 3 forks source link

[Scenario E] Use php-fpm #15

Closed barryvdh closed 5 years ago

barryvdh commented 5 years ago

Actually use php-fpm now. Setup is similar but requires a config, which could be placed in the layer like the php.ini, but easier to test this way for now. Performance seems similar, perhaps slightly faster. Bootstrap also seems slightly faster (around 180ms or so, but haven't tested extensively). Anyway, this seems as the preferred method, so this might be better to use.

mnapoli commented 5 years ago

Nice, if we don't loose performances then 👍 it's better to stay on the most popular solution.

atrope commented 5 years ago

@barryvdh You should put clear_env = no in php-fpm conf in order for FPM to pass on Lambdas ENV Variables.

barryvdh commented 5 years ago

Do we need those? They aren't used in the other scenarios, right?

atrope commented 5 years ago

If We intend to pass values through ENV Variables yes.. They are not used in other scenarios because FPM is the only one that "Cleans" the environment

; Clear environment in FPM workers
; Prevents arbitrary environment variables from reaching FPM worker processes
; by clearing the environment in workers before env vars specified in this
; pool configuration are added.
; Setting to "no" will make all environment variables available to PHP code
; via getenv(), $_ENV and $_SERVER.
; Default Value: yes
barryvdh commented 5 years ago

There are some more interesting options for this, but it doesn't matter much for benchmarking. But FPM can run in either background or foreground (which might matter for coldstart). And has options to restart workers after x runs etc. But you could make a PR with some nice settings, I'm not really an expert on this :)

mnapoli commented 5 years ago

it doesn't matter much for benchmarking

Agreed, let's not worry about the implementation details here unless they affect performances. This repo is about benchmarking, then in Bref we'll focus on making it perfect (and your help will be most welcome @atrope :)).