Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: CgiProxy And Heavy Visitors

by tilly (Archbishop)
on Apr 10, 2005 at 07:58 UTC ( #446359=note: print w/replies, xml ) Need Help??

in reply to CgiProxy And Heavy Visitors

You should read the mod_perl strategy guide and pay very careful attention to the section titled Adding a Proxy Server in http Accelerator Mode. If you follow the recommendations there, your problems should be much improved.

The problem is that mod_perl processes which take up a lot of RAM are having to spoonfeed data over a very thin pipe to client browsers. When you use a proxy server in that configuration, the mod_perl processes spew data to lightweight proxies and move on, and then the slow browsers tie up the lightweight proxies. Therefore you can use fewer mod_perl processes, saving RAM.

When you get beyond what that will scale to on your hardware, the next obvious move is to add more memory. These days 1 GB of RAM is not that much, have 2-4 GB. Most acceleration techniques, such as caching, use RAM. After that runs out of steam, you'll need a load balancer in front of multiple webservers. (You probably want that well before you get to that load, just to have redundancy and failover.)

As for shared memory, perrin did a number of benchmarks a while ago and found that shared memory modules are not that fast. He found that BerkeleyDB and MySQL were the two fastest ways of sharing data between Perl processes on a single machine. This may have changed (SQLite version 3 is supposed to be much improved). However I wouldn't recommend playing around with caching and sharing data for performance increases until you've done the obvious use of proxies for http acceleration.

Aside from raw performance, two other problems with shared memory are that locking hotspots in RAM can become a bottleneck on your webserver, and you make it harder to later choose to load-balance several machines. Trust me, if volume continues to increase, you really want to be able to load-balance several machines.

Replies are listed 'Best First'.
Re^2: CgiProxy And Heavy Visitors
by Anonymous Monk on Apr 10, 2005 at 09:08 UTC
    So 1-i should use mod_perl 2-install Apache2 + prefork MPM 3-setup squid cache server 4-add more ram 5-setup load balancing right ?
      There is no need to go to mod_perl 2. The rest is right. Step 5 is generally good advice for failover, but depending on your situation the previous steps may be enough.

      If they are not then you probably have a memory leak somewhere, and it would behoove you to track it down. (It is probably also a good idea to configure Apache so that kids will kill themselves after they get too big.)

      now i orderd 3gb extra ram
      so 4gb will be enough ? right ? ;)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://446359]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2021-06-20 17:59 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (95 votes). Check out past polls.