Gary Sewell wrote:
I am interested in the reverse proxy idea. We currently also run a static
image/js/css server and a static php server that runs the static pages we
are able to crate which is very few, 99% of our pages are dynamic and change
every second. Due to the bulk of our code (100Mb @ 32-bit & 200Mb @ 64-bit)
we are only able to set Max Clients to 40. After arriving at a static php
homepage we refer subsequent pages randomly to one of the modperl servers to
share the stress.
Is our php server acting similar to a reverse-proxy or am I missing out on
something, would a reverse-proxy help us with our setup. We are unable to
cache content and hit live databases for every dynamic page we serve.
Images, js and css are all served from a slimmed down apache server so these
aren't a problem.

As Jim says elsewhere it's not just about caching. As you say on your mod_perl server you can only have 40 requests, if you get 40 users all on a dial-up connection, each one doing multiple things and therefore taking 60 seconds to download the HTML, then effectively your mod_perl is serving 40 requests per minute!! So by putting a proxy in mod_perl returns the data to the proxy, which sits there waiting for these slow modem users to download their pages.

We tried the static server/mod_perl server route, and whilst it does work there are still the odd things that end up coming from from the mod_perl servers plus some human error. So we found that using apache as a reverse proxy allows us to map the whole domain except the static folder, which then is served from the front-end proxy.

For reference here's our setup.

On the front-end we run RHEL5 to get apache 2.2. We use the multi-threaded version of apache and have configured it for maximum threads/connections. We've left KeepAlive on, and tuned it to send as much content down the same connection, and keep it for as long as possible. We've disabled CGI and other dynamic stuff. We also do our logging here. We use mod_proxy_balancer to balance across 3 mod_perl servers, although anything in /static is served direct rather than proxied:

   ProxyPass /static !
   ProxyPass / balancer://catalyst/


At the back-end we're still running RHEL4 with a custom build of apache2.2/mod_perl2 running the Catalyst framework. We have KeepAlive off, and don't log within apache.

Now if you have a site where you can cache pages, or it's possible to tweak your more popular pages so that they can be cached even for a very short amount of time. You can also add mod_cache to the front end. If you have a very busy site, caching your front page even for 5 seconds could take a massive load of the servers.

Carl



Reply via email to