Andy Lester wrote:
We're doing this, and it's working marvelously.  Now, what else can I do
to speed things up?  Heck, I'd settle for rudimentary profiling to see
which of the templates is dragging our server down the most.

We've left CACHE_SIZE at its default setting to let everything get
cached.  There are only ~125 files on the entire site, including
subcomponents, so I doubt the cache is getting bogged down?

Our web server is pinned on all both CPUs, so anything we can do to
reduce the load will be a help.  I'm not seeing anything in the Badger
or the docs that is a help.


I am probably teaching you to suck eggs but here are some quick notes:
Not really TT related performance boosts though. These are things I would try and make sure I had done before I started profiling, I have found that there is not much point in profiling until you have tuned the server to at least some modicum of operability.


I am assuming everything is running under mod_perl (or at least only
those things that need to be are). I always use a startup.pl file and pre-load all the main modules with it as follows:


use Apache::DBI ();
use DBI ();
use BAR ();
use POSIX ();
use FOO ();
use Template ();
use ....... ();

The brackets are very important since we don't want to export hundreds of symbols we might not actually use. A good example is POSIX. There is a significant saving in importing the empty list on just this module:

use POSIX (); # 240006 bytes
use POSIX; # 387200 bytes

Even on smaller modules the saving can be significant ie

use Fcntl (); # 43102 bytes
use Fcntl; # 68551 bytes

Replacing CGI with CGI::Simple saves just over 200k. As you can see this soon adds up.

If you are using a database Apache::DBI makes a really big difference. You can also get more out of the DBI by connecting to the database from within your startup.pl script then disconnecting, this way you drag things into the shared memory of the parent process so each child doesn't need it to have it. This can be done with other modules ie CGI. For instance from within startup.pl:

CGI->compile(qw(:standard h1 h3 h4 ));

my $dbh = DBI->connect("DSN", "USER", "PASSWORD", "ATTR")
    || die "Error: Failed to connect in startup.pl $DBI::errstr\n";
$dbh->disconnect() if($dbh);


If you use a module but rarely its probably not worth taking the memory hit. To see what modules are using lots of memory you might consider having a look at.


<Location /perl-status>
http://perl.apache.org/docs/1.0/guide/debug.html#Looking_inside_the_server
</Location>

This is an eye opener and its where I noticed POSIX using all that memory

Other notes/questions.

Are you able to run a lightweight apache for serving static pages?
Have you thought about using squid?

I have also found that the default of

MaxRequestsPerChild 100

although ok for most small low traffic sites it's not ideal if you are trying to squeeze as much as you can out of the server.

Harry

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to