Nginx + php-fpm optimization review

Discussion in 'Server Operation' started by thorewi, Apr 2, 2015.

  1. thorewi

    thorewi New Member

    I asked our hosting provider for nginx + php-fpm optimization on our managed server. I got this answer:

    There isn't much optimisation that can be done within Nginx as it is threaded and doesn't use many resources. I have checked that your php configuration and found that the memory limit is 128M and the pm.max_children in 50. This means that PHP could use up to 6.5G of memory on your 2G server. I have reduced the max_children to 15 so that the server cannot run out memory. Would you like me to do this on your other server?

    First I think there is quite a lot of possible optimisations in nginx, for example I've read this article and check if at least some of these optimisations are applied and basically none of them are.

    Also I think there is a lot of possible php-fpm optimisations (for example in this article http://www.if-not-true-then-false.c...configuration-and-optimizing-tips-and-tricks/). Again, basically none of them are applied.

    Are optimizations mentioned in the articles above useful?

    In the end, I think that their logic that I can use maximally 15 children because of 2gb RAM and 128mb memory_limit is a total nonsense, because normally one php-fpm thread takes (according to htop) about 30mb in our application. So imho max number of children should be computed from average usage, am I right? Also, if I have only a single application on the webserver (and the db is on different one and no other service is running on this machine), I can use static number of php-fpm threads, can I?

    Thank you for your opinions.

    Last edited: Apr 2, 2015

Share This Page