![]() | |||||||||||||||||||||
|
TUNING A little tuning can go a long way, and can make the difference between a web site that gets by, and a site that screams with speed. With Apache::ASP, you can easily take a poorly tuned site running at 5 hits/second to 25+ hits/second just with the right configuration. Documented below are some simple things you can do to make the most of your site. For more tips & tricks on tuning Apache and mod_perl, please see the tuning documents at: Vivek Khera's modperl performance tuning http://perl.apache.org/tuning/ Stas Beckman's modperl Guide http://perl.apache.org/guide/
$Application & $Session State
Use NoState 1 setting if you don't need the $Application or $Session objects.
State objects such as these tie to files on disk and will incur a performace
penalty.
High MaxRequests
Set your max requests per child thread or process (in httpd.conf) high,
so that ASP scripts have a better chance being cached, which happens after
they are first compiled. You will also avoid the process fork penalty on
UNIX systems. Somewhere between 100 - 1000 is probably pretty good.
Precompile Scripts
Precompile your scripts by using the Apache::ASP->Loader() routine
documented below. This will at least save the first user hitting
a script from suffering compile time lag. On UNIX, precompiling scripts
upon server startup allows this code to be shared with forked child
www servers, so you reduce overall memory usage, and use less CPU
compiling scripts for each separate www server process. These
savings could be significant. On my PII300, it takes a couple seconds
to compile 28 scripts upon server startup, with an average of 50K RAM
per compiled script, and this savings is passed on to the child httpd
servers.
No .htaccess or StatINC
Don't use .htaccess files or the StatINC setting in a production system
as there are many more files touched per request using these features. I've
seen performance slow down by half because of using these. For eliminating
the .htaccess file, move settings into *.conf Apache files.
Turn off Debugging
Turn debugging off by setting Debug to 0. Having the debug config option
on slows things down immensely.
RAM Sparing
If you have a lot of scripts, and limited memory, set NoCache to 1,
so that compiled scripts are not cached in memory. You lose about
10-15% in speed for small scripts, but save at least 10K per cached
script. These numbers are very rough. If you use includes, you
can instead try setting DynamicIncludes to 1, which will share compiled
code for includes between scripts. |
||||||||||||||||||||
Copyright (c) 1998-1999, Joshua Chamas, Chamas Enterprises Inc. |