nginx load balancer help
Shri @ DevLib.Org
shri at devlib.org
Thu Apr 2 13:17:49 MSD 2009
Here's what we have (simplified as there are some sections like mysql
slaves, squid proxies which have been leftout....)
1) 1 x Storage and DB server. Storage is on 10K RPM RAID 5. DB is on 15K RPM
2) 2 x PHP-FPM servers which are connected to the DB (mysql) and Storage
(NFS). Lots of memory running xcache and pretty much everything can be
served out of memory.
3) 2 x FrontEnd Nginx servers which are connected to the PHP-FPM servers and
the Storage Server (NFS). In reality we're running squids (manage ACLs
etc...) + Nginx (URL rewriting etc) in front of these servers which are in a
4) 1 x Backup server which runs a dedicated mysql slave and does rsync
DNS load balancing (and failover) takes care of where the request goes ....
one of the two front end Nginx.
Nginx loadbalancing takes care of where the PHP request goes. Static files
are sent out directly.
For further scaling consider loading mysql on the FPM servers and treating
them as slaves for read queries. This will add to the hardware requirements.
Once you've split out your delivery, application and database, you can then
scale the bottle neck areas (i.e. add more DB servers, or more php servers
or more front ends or caching in front of the front ends).
We've probably overcomplicated the setup, but since we're running fairly OLD
hardware.. I think its ok to be over cautious. Would love to see this all
scaled down into one nice blade server setup. :)
----- Original Message -----
From: "Floren Munteanu" <nginx at yqed.com>
To: <nginx at sysoev.ru>
Sent: Thursday, April 02, 2009 4:42 PM
Subject: nginx load balancer help
> Hi all,
> I need your help to setup nginx as load balancer.
> This is the hardware I plan to have: 3 web servers and 1 db server.
> Now I have 1 web server (nginx + php-fpm with php and static files to
> server) and 1 db server (mysql). The web server load is high, because to
> many online users. The db server is fine. So my goal is to add 2 extra
> web servers to lower the load. What setup do you recommend me to use? Do
> you have a tutorial for a load balancer setup with nginx?
> Thanks a lot for your help.
More information about the nginx