Closed bubba-h57 closed 5 years ago
Hi, this is interesting! I'm not sure about the performances of this (this is spawning a PHP process) but it would be definitely worth it to add it in the benchmark! Maybe this could be very useful to run PHP-style apps (Wordpress, etc.) which do not use PSR-7 or any kind of abstraction for HTTP requests/responses.
If you are able to send a pull request for a scenario H (or whatever the next letter is) that would be awesome!
I will make it happen.
We need php-cgi
(and also php-fpm
) compiled into the /opt/bin
directory of the PHP Layer for me to move forward.
That is currently built over in master/bin/php/build.sh does it make sense to move the build script into this benchmark in order to mess around with it? I am very comfortable with making changes to it and providing a pull request, but it as we attempt a variety of things (like if/when we attempt to create a Lambda SAPI) there is a potential for a fairly large quantity of changes to the build script.
What would you prefer me do?
I'll have a layer for you that adds it: arn:aws:lambda:us-east-2:416360873395:layer:php-72:3
I also have a PHP version that starts php-cgi in listening mode, not sure what is faster.
The only changes I did was settings disable-fpm and disable-cgi to enable it, and added cp /tmp/bref/php-src-php-$PHP_VERSION/sapi/cgi/php-cgi /opt/bin/
below the one that copies php itself. I guess fpm is the same?
Basic attempt here: https://github.com/mnapoli/bref-bootstrap-benchmarks/pull/7 But using php and as a listener. But not really happy with it (yet)
Nice! I will try your layer now with my Scenario H attempt :-)
This might be interesting though: https://twitter.com/symfony_en/status/1070611411762581504
Would take away some issues perhaps for the cgi implementation.
@barryvdh it seems this binary is running PHP-FPM though.
When available, otherwise falls back to php-cgi. But I don't think the source is available (yet)
Right so I see no benefit to use that wrapper since we know the environment in which we run PHP. Additionally we are better off running PHP-FPM with one worker only, or even directly with php-cgi in FastCGI mode as discussed.
Yeah was hoping the server would be open source, so we could see some implementation details, that might have some edge cases already worked out, but don't think they're open sourcing it yet.
Anyways, we have 2 implementations using fastcgi, I suppose this can be closed?
:+1:
Solution E currently states that it would be forwarding Lambda events to PHP-FPM via FastCGI. I wrote a nodejs shim last summer that is similar. However, it simply forwards directly to
php-cgi
are you looking for something similar to this nodejs code or is Solution E really about trying to leverage PHP-FPM?