Top 10 Ways to Improve mod_perl Performance
Top 10 Ways to Improve mod_perl Performance
Use the Apache::DBI module to pre-connect to databases.
Use the Apache::SizeLimit or Apache::GTopLimit modules to keep your server processes from growing beyond a certain size.
Use the optimized routines in the Apache::Util module. The escape_html and escape_uri functionality are much faster than the pure-perl versions provided by the HTML::Entities and URI::Escape modules
Be lean with your memory usage. Don't allocate huge data structures or read entire files into memory if you can avoid it.
Reduce imported symbol memory usage in your code. Wherever possible add an empty array to the end of each module you "use". For example this code:
use POSIX; becomes: use POSIX ();
Eliminate unused Perl modules from your server. Add Apache::Status to your server to find the list of all used modules. Look for modules that may not be needed. Modify the code that uses these modules.
Find the list of modules you use most often and load them at server start. This code is then shared between the various processes, resulting in drastic memory usage reduction.
Additionally you may want to connect to a database (if you use one) to insure that all dynamically loaded code is shared.
Turn off KeepAlive support in your httpd.conf file:
KeepAlive off
This change keeps your mod_perl processes executing requests instead of waiting for the rare second client requests.
Examine your code for inefficient algorithms. The Apache::Dprof profiling module can help you identify "hot-spots" in your code.
Use a lightweight "reverse proxy" server in front of your mod_perl server. Configure the reverse proxy to handle all static content, and forward any mod_perl requests to the backend mod_perl server.
don't swap.... ever.