[Catalyst] Re: memory usage of mod_perl process

Peter Edwards peter at dragonstaff.com
Thu Feb 8 22:37:24 GMT 2007


There are a lot of good tuning tips in the Apache docs, as Perrin says.

I presume you've tried things like using a lightweight front end proxy (to
serve images/static files) and building a custom backend mod_perl Apache
that includes *only* the modules you need. If you use the stock
Fedora/Redhat Apache that's not optimal.
In your Apache config preload everything pre-fork (if you use that model)
including setting up the DB connection. Write code that caches expensive
calculated values/lookup files/SQL values in memory with a cheap
last-modified check before re-doing work.
Don't set MaxRequestsPerChild too high (I use 100) as the mem usage will
climb as Perl switches some shared memory variables to new memory, as the
Apache mod_perl docs describe.

For comparison, I'm using DBIx::Class across 15 tables and a really simple
hand-rolled MVC (not Cat) for a medium volume site. It gives 'top' lines
like:
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
21495 apache    15   0  203m  43m 6188 S  0.0  4.5   0:01.46 httpd
This can handle over 300 requests/sec with 1GB memory on an x86_64 single
processor.

Regards, Peter
www.dragonstaff.com





More information about the Catalyst mailing list