Difference between FASTCGI and PROXYing
nginx-forum at nginx.us
Wed Jul 13 23:20:17 MSD 2011
I have simple question regarding: what is the difference between these
two load-balanced setups from performance perspective:
SETUP 1 - FASTCGI mode:
Machine 1 - Load Balancer:
NGinx as balancer is installed, Upstreaming is used to connect
to the PHP-FPM servers below, using fastcgi_pass directive;
Machine 2 and 3: AppServers:
PHP-FPM installed. No NGinx installation;
HOW IT WORKS: Client request first comes to the Load balancer, it is
redirected to AppServer using Upstreaming. Response is returned from
AppServer to the LoadBalancer and to the client.
SETUP 2 - PROXY:
NGinx is installed, Upstreaming is used to redirect to the
Machines below, using proxy_pass directive;
NGinx is installed as web-server. It listens to the incoming
calls from LoadBalancer via port 8000 and relays them to the PHP-FPM via
port 9000 using fastcgi_pass directive.
PHP-FPM is installed as FCGI and listens to the local
NGinx-web-server via port 9000. It accepts calls from it and returns the
response to it.
HOW IT WORKS: Client request first comes to LoadBalancer Nginx, and
gets relayed to the NGinx at AppServer via Upstreaming, through port 8000.
NGinx-web-server at AppServer receives the call from LoadBalancer and
passes it via FCGI to its local PHP-FPM. PHP processes the request, and
responds to the local app-server, which in return responds to the
LoadBalancer. LoadBalancer answers the client's request.
Thanks and sorry for long explanations...
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,212360,212360#msg-212360
More information about the nginx