Skip to content

Commit

Permalink
* Replaced the fair algorithm for load balancing algorithm by least c…
Browse files Browse the repository at this point in the history
…onnection.
  • Loading branch information
António P. P. Almeida committed Dec 15, 2013
1 parent c372185 commit 3425d09
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
13 changes: 8 additions & 5 deletions upstream_phpapache.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
## version with the fair load balancer.

upstream phpapache {
## If your version of Nginx doesn't have the fair load balancer:
## https://github.com/gnosek/nginx-upstream-fair comment out the
## following line.
fair;
## Use the least connection algorithm for load balancing. This
## algorithm was introduced in versions 1.3.1 and 1.2.2.
least_conn;

server 127.0.0.1:8080;
server 127.0.0.1:8081;
## Create a backend connection cache. Note that this requires
Expand All @@ -22,7 +22,9 @@ upstream phpapache {
keepalive 5;
}

## Add a third pool as a fallback.
## Add a third pool as a fallback. Note that this requires php-cgi
## side by side php-fpm. If you don't have it installed comment it
## out.
upstream phpapache_backup {
server 127.0.0.1:8082;
## Create a backend connection cache. Note that this requires
Expand All @@ -31,3 +33,4 @@ upstream phpapache_backup {
## following line if that's not the case.
keepalive 1;
}

13 changes: 8 additions & 5 deletions upstream_phpcgi_tcp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

## Add as many servers as needed. Cf. http://wiki.nginx.org/HttpUpstreamModule.
upstream phpcgi {
## If your version of Nginx doesn't have the fair load balancer:
## https://github.com/gnosek/nginx-upstream-fair comment out the
## following line.
fair;
## Use the least connection algorithm for load balancing. This
## algorithm was introduced in versions 1.3.1 and 1.2.2.
least_conn;

server 127.0.0.1:9001;
server 127.0.0.1:9002;
## Create a backend connection cache. Note that this requires
Expand All @@ -23,7 +23,9 @@ upstream phpcgi {
keepalive 5;
}

## Add a third pool as a fallback.
## Add a third pool as a fallback. Note that this requires php-cgi
## side by side php-fpm. If you don't have it installed comment it
## out.
upstream phpcgi_backup {
server 127.0.0.1:9003;
## Create a backend connection cache. Note that this requires
Expand All @@ -32,3 +34,4 @@ upstream phpcgi_backup {
## following line if that's not the case.
keepalive 1;
}

15 changes: 9 additions & 6 deletions upstream_phpcgi_unix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

## Add as many servers as needed. Cf. http://wiki.nginx.org/HttpUpstreamModule.
upstream phpcgi {
## If your version of Nginx doesn't have the fair load balancer:
## https://github.com/gnosek/nginx-upstream-fair comment out the
## following line.
fair;
## Use the least connection algorithm for load balancing. This
## algorithm was introduced in versions 1.3.1 and 1.2.2.
least_conn;

server unix:/var/run/php-fpm.sock;
server unix:/var/run/php-fpm-zwei.sock;
## Create a backend connection cache. Note that this requires
Expand All @@ -23,12 +23,15 @@ upstream phpcgi {
keepalive 5;
}

## Add a third pool as a fallback.
## Add a third pool as a fallback. Note that this requires php-cgi
## side by side php-fpm. If you don't have it installed comment it
## out.e
upstream phpcgi_backup {
server unix:/var/run/php-fpm-bkp.sock;
## Create a backend connection cache. Note that this requires
## Nginx version greater or equal to 1.1.4.
## Cf. http://nginx.org/en/CHANGES. Comment out the
## following line if that's not the case.
keepalive 1;
}
}

0 comments on commit 3425d09

Please sign in to comment.