Jump to content

Recommended Posts

Posted

I’m trying to squeeze every ounce of performance out of my new server, and ran into this article. It suggest load balancing php-fpm by creating a second .sock / instance. 
 

Has anyone done this or does anyone have an opinion on this?

performance tuning nginx and php-fpm


“We created a second .sock2 file, /run/php/php7.2-fpm.sock2, which does not exist by default.

We added the upstream parameter and referenced the .sock files in the site’s Nginx config:

upstream backend {
        server unix:/var/run/php/php7.2-fpm.sock1 weight=100 max_fails=5 fail_timeout=5;
        server unix:/var/run/php/php7.2-fpm.sock2 weight=100 max_fails=5 fail_timeout=5;

We then changed the existing fastcgi_pass value to reference backend.

fastcgi_pass backend;

Next we added a second pool to /etc/php/7.2/fpm/pool.d replacing [www] with:

[www1]
listen = /run/php/php7.2-fpm.sock1

and

[www2]
listen = /run/php/php7.2-fpm.sock2
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...