[Neos] General Neos performance experience
cedric at cedric-ziel.com
Fri Sep 26 14:04:46 CEST 2014
You experience a fair mix of both evented I/O with nginx which has a very
low memory footprint itself.
Result: nginx can handle a lot more connections simultaneously. Those are
paused until the backend (fpm) is able to handle them. The combination
nginx+fpm is especially interesting as the php processes are not as heavy
as one request in a apache is. The webserver process is isolated from the
fastcgi. -> Less resources needed while being able to handle more
While Lienhart gave a possible indicator why apache is slower, i gave some
indicators why nginx may be faster.
As always your milage may vary heavily. In standard nginx configuration,
there's no dynamic config possible through .htaccess for example.
On the other hand, if you take a current Apache (which is 2.4 and not 2.2),
your experience will be better. The more modules you turn off in apache,
the faster it will be (apache modules are loaded dynamically on most
In 2.4, apache allows using mpm_event (which is beta in 2.2,
http://httpd.apache.org/docs/2.4/mod/event.html). This should give you a
massive boost when using fpm with Apache (which you should), as no heavy
forking is neccessary compared to mpm_worker or mpm_prefork. In mpm_event,
the very same eventloop concept is used as in nginx.
Using the webserver as a "simple reverse proxy" (to keep it easy) to your
app/fpm results in massive benefits. Apache and nginx are both fantastic
products and while Apache is an old one as well, it's very versatile and
can be used in the same way nginx is. If you therefore know all the
requirements to your webserver, choose the product that serves the requests
based on that requirements. If you only need a PHP interpreter to server
your NEOS, nginx may be the better option as it's a single threaded binary
without dynamic modules. You wont be tempted to load modules you dont need.
Zitat von Lienhart Woitok <Lienhart.Woitok at netlogix.de>:
> Hi Torben,
> you are testing with a concurrency setting of 100. This means, ab makes
> 100 simultaneous requests
> to the web server. While FPM as far as I know is by default configured
> with a sane setting for
> the maximum number of processes, apache is probably not. What therefore
> probably happens is that
> apache starts about 100 PHP processes with up to 128MB of RAM each (of
> which Neos uses quite a bit).
> Therefore, the server probably starts swapping quite heavily, and then
> everything starts to get slow.
> FPM in default configuration starts probably something in the magnitude
> of 10 or 15 processes, which
> is well within the limits of the server. Therefore you get a much better
> result out of it.
> I would have expected nginx+FPM to be slightly faster than
> apache+mod_php, but not by a factor of 4-5,
> more in the magnitude of 0.5 to 2 requests per second.
> If you configure your apache to only accept a manageable amount of
> concurrent clients, you should get
> better results of it. Please be aware that if you do that you also
> restrict the number of requests to
> static resources, which is not desirable. Therefore I tend to discourage
> the use of mod_php in production
> Alternatively you can run ab with a concurrency of 10 or 15 which should
> also not overwhelm your server
> in your current configuration.
> I hope this sheds a bit of light on your experiences.
More information about the Neos