Here's a tiny performance tweak that I stumbled across that I don't
believe I've seen in any of the other online docs.  (Stas, maybe you
can suck this into the guide if you think it's something new...)

In doing some tweaking on one of our modperl servers earlier this
week, I noticed via 'truss' that a bunch of 'stat's were being done
for non-existent files.

The fact that they are non-existent is cool, because it's a site that
has no document root, its sole purpose is to dynamically generate and
cache date bar images in a bunch of different styles
(http://date.boston.com/, BTW.)

But I didn't like the thought that these stat calls were happening for
each request.

So, my solution was to add the following to the VirtualHost section
for that host:

<VirtualHost 199.95.74.82:80>
    .
    .
  PerlTransHandler      "sub { return OK; }"
    .
    .
</VirtualHost>

This has the effect of short circuiting the normal TransHandler
processing of trying to find a filesystem component that matches the
given URI -- no more 'stat's!

For this vhost, I was able to apply this globally, but I can imagine
cases where others have portions of a document tree that are static
along with portions that are dynamic, and needing to supply a bit more
sophisticated TransHandler routine to only return OK if the requested
URI matches the dynamic portions of the document tree.

If anyone has a better way of handling this, or a pointer to somewhere
in the book or online where this is discussed, I'll be happy to hear
of it.

<Steve>

-=-=-=-=-=-=-=-=-=-  My God!  What have I done?  =-=-=-=-=-=-=-=-=-=
Steve Reppucci                                          617/929-7003
Director of Software Development                 [EMAIL PROTECTED]
Boston.com (Times Company Digital)                           Be Open

Reply via email to