John Saylor wrote:
> hi
> 
> i have a problem with initializing perl data structures from the db. i
> have an init routine that does all kinds of stuff and is called from
> startup.pl. one of the things i wanted it to do was to grab some stuff
> from the db and populate a hash with it.

> one way that has been suggested is to tie the data structures to
> subroutines to do the work of getting the data from the db on their
> first call.

That's probably not the best approach, but it really depends on how
often this data is used, how big it is and how often it changes. If it's
used a lot and isn't really large and rarely changes I would preload at
server startup. That way you only need to touch the db once and all of
your apache children will have reduced memory (since they will all share
it until it's changed) because of Copy-On-Write memory (if your system
has that).

-- 
Michael Peters
Developer
Plus Three, LP

Reply via email to