Caching & Packaging

2008-01-09 Thread brett lee

Hello -

Am executing several CGI scripts under mod_perl using Apache::Registry (I hope 
that terminology is correct).  As I understand it, the scripts get cached in 
each httpd thread the first time that thread executes them.  Is this correct?

So when I change a script, do I need to restart Apache, flush the cache 
somehow, or does each thread automagically replace the cached copy with the 
updated one from disk?

Basic stuff, but I'm curious...

The main focus of my writing today is to get some guidance on the proper 
direction to take for this project.  Currently, each of the CGI scripts I have 
"sources" the same set of files (one for the header, another for the footer, 
etc).  Per the above questions, I don't how the mod_perl processes work to keep 
everything in sync but I can only imagine that having each of my CGI scripts 
source the same files from disk has to be grossly inefficient.

Am thinking that all these external scripts should be packaged up together into 
mod_perl somehow, but I don't know where I should be looking.  Can someone shed 
some light?  In doing so, one possible constraint is that I'm also executing 
the same external scripts from several SHTML files.  The CGI scripts call the 
filesystem based subroutines after initially sourcing them with 'do 
./header.pl' whereas the SHTML files pass in a "go" argument to 'header.pl' to 
actually fire up the subroutine.  This allows me to execute them immediately 
using SHTML 'exec' calls and 'on demand' from the CGI scripts.

Thanks in advance for your guidance / direction.  
-Brett





  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


Re: Caching & Packaging

2008-01-09 Thread Foo JH
If you're running your scripts in Apache2::Registry, your scripts are 
compiled on first go, and remain in memory subsequently.


When your script changes, the change should be detected, and 
recompilation is automatic. IMHO this is a real time saver as 
development goes.


do() is bad for speed optimisation as it's treated as a system call. 
What you want instead is to modify your header.pl into a package, and 
have your scripts call functions in the package. Minimise exec() calls 
as well (ideally you should not use it at all).



brett lee wrote:

Hello -

Am executing several CGI scripts under mod_perl using Apache::Registry (I hope 
that terminology is correct).  As I understand it, the scripts get cached in 
each httpd thread the first time that thread executes them.  Is this correct?

So when I change a script, do I need to restart Apache, flush the cache 
somehow, or does each thread automagically replace the cached copy with the 
updated one from disk?

Basic stuff, but I'm curious...

The main focus of my writing today is to get some guidance on the proper direction to 
take for this project.  Currently, each of the CGI scripts I have "sources" the 
same set of files (one for the header, another for the footer, etc).  Per the above 
questions, I don't how the mod_perl processes work to keep everything in sync but I can 
only imagine that having each of my CGI scripts source the same files from disk has to be 
grossly inefficient.

Am thinking that all these external scripts should be packaged up together into mod_perl 
somehow, but I don't know where I should be looking.  Can someone shed some light?  In 
doing so, one possible constraint is that I'm also executing the same external scripts 
from several SHTML files.  The CGI scripts call the filesystem based subroutines after 
initially sourcing them with 'do ./header.pl' whereas the SHTML files pass in a 
"go" argument to 'header.pl' to actually fire up the subroutine.  This allows 
me to execute them immediately using SHTML 'exec' calls and 'on demand' from the CGI 
scripts.

Thanks in advance for your guidance / direction.  
-Brett






  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs