On 26 June 2015 at 06:39, Rasmus Lerdorf <ras...@lerdorf.com> wrote:
> On 06/25/2015 01:31 PM, S.A.N wrote: > > New versions Nginx, implement thread pools, > > http://nginx.com/blog/thread-pools-boost-performance-9x/ > > > > I think this is a good opportunity to write a Nginx module (PHP SAPI) > > which is to process requests for PHP scripts in processes Nginx. > > > > Quality advantages, as compared with the FPM, no network overhead, > > less memory consumption, may be implemented mode ZTS (Zend Thread > > Safety). > > Putting an entire PHP request in one of these nginx threads seems like a > bad idea to me. Tons of things in PHP or in libraries called by PHP are > blocking, plus ZTS mode is slower, uses more memory than non-ZTS mode > and is in general just more complex to work with, especially when it > comes to process-wide things like env, locale and signals. Having a > clear separation between PHP and the web server makes many things much > simpler and more robust. You can also already do nginx to php-fpm > without any network overhead by using a unix domain socket. > > I too would be very surprised if there's anything to be gained by turning PHP into a full module for nginx, I suspect that at best it just "won't be any slower" than fpm. I feel that any time spent on doing something like this would have been better spent improving fpm, which is a generic interface to an arbitrary web server, rather than creating an entirely new codebase to maintain which serves a much more niche purpose.