Forum

Load Balancing PHP-FPM

RaGe10940
3 February 2013, 17:37
Hiawatha version: 8.7
Operating System: Ubuntu 12.04 LTS

Well I have Php working hiawatha is smooth as butter and what not. But now I am playing with Hiawatha to learn more about it. Well I am kind of confused about how to set up the Load Balancing on the pfp-fpm.

This is what I have now :
FastCGIserver {
FastCGIid = PHP5
ConnectTo = 127.0.0.1:9000
Extension = php, php5
SessionTimeout = 15
}

Well what it says on the HOWTO, it says to include more Ip's so what i did is this :
FastCGIserver {
FastCGIid = PHP5
ConnectTo = 127.0.0.1:9000, 127.0.0.1:9001, 127.0.0.1:9002
Extension = php, php5
SessionTimeout = 15
}

127.0.0.1 to my knowledge is the link local.

this is my /etc/php5/fpm/pool.d www.conf file :
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = www-data
group = www-data


; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000

listen.owner = www-data
listen.group = www-data
listen.mode = 0666

; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1


Now do I have to add each of the 127.0.0.1:xxxx to the pool.d/www.conf? This part is confusing me.


RaGe10940
3 February 2013, 17:40
More info :

It states : to configure pools it is recommended to have one. conf file per pool in the following directory :

include = /ect/php5/fpm/pool.d/*.conf

so does it mean for this to work i need to make another 2 pools for 127.0.0.1:9001, and 127.0.0.1:9002? since the www.conf is using 127.0.0.1:9000
Hugo Leisink
3 February 2013, 20:31
Load balancing only makes sense if you have multiple servers which can function as a PHP application server. Having multiple pools on one server for the same task is pointless.

To do it properly, have multiple servers, say 10.0.0.2, 10.0.0.3 and 10.0.0.4, with each having its own PHP FastCGI daemon running. You should then configure Hiawatha like this:
FastCGIserver {
FastCGIid = PHP5
ConnectTo = 10.0.0.2:9000, 10.0.0.3:9000, 10.0.0.4:9000
Extension = php, php5
SessionTimeout = 15
}
RaGe10940
3 February 2013, 20:48
Yea that actually makes a crap load of sense. *face palm*
This topic has been closed.