reverse proxy vs. stand-alone
Cliff Wells
cliff at develix.com
Fri May 15 20:20:18 MSD 2009
On Fri, 2009-05-15 at 18:55 +0400, Igor Sysoev wrote:
> On Fri, May 15, 2009 at 12:48:28AM -0700, Cliff Wells wrote:
>
> > On Fri, 2009-05-15 at 09:19 +0400, Igor Sysoev wrote:
> > > On Thu, May 14, 2009 at 05:36:15PM -0700, Cliff Wells wrote:
> > >
> > > > On Thu, 2009-05-14 at 20:24 -0400, jemari wrote:
> > > > > Hi everyone,
> > > > >
> > > > > I am setting up a small VPS. My plan is to have nginx as a reverse
> > > > > proxy to apache2 (running with mod-php). All other static files will
> > > > > be served by nginx.
> > > > >
> > > > > Does anyone know if there would be a significant difference in
> > > > > performance and/or stability if I removed apache, and have nginx use
> > > > > fcgi for php?
> > > >
> > > > Yes, you'd save hundreds of megabytes of RAM by not using Apache, which
> > > > will undoubtedly affect performance in a positive fashion.
> > >
> > > Would not these megabytes go to php/FastCGI ?
> >
> > Not really. PHP under FastCGI seems to use a lot less resources than
> > mod_php. I assume this is because the number of threads is a constant
> > with PHP under FCGI.
> >
> > I converted a Joomla site from Apache/mod_php to Nginx/FastCGI and went
> > from constantly consuming the full 256MB (and crashing the VPS) to using
> > only around 20MB of RAM.
>
> Have you tried to set
>
> StartServers 20
> MinSpareServers 20
> MaxSpareServers 20
> MaxClients 20
StartServers 3
MinSpareServers 3
MaxSpareServers 10
ServerLimit 10
MaxClients 10
MaxRequestsPerChild 2000
I tried both prefork and worker MPM.
Apache and PHP would still exhaust the 256MB RAM in the VPS once a week
or so and force a restart of the entire VPS. Someone suggested that
using FastCGI with Apache might help, but I never got around to trying
it before switching the site over to Nginx.
Cliff
More information about the nginx
mailing list