Re: Is it safe to share a read-only dbm file opened in parent modperl?

[prev] [thread] [next] [Date index for 2005/02/15]

From: Gedanken
Subject: Re: Is it safe to share a read-only dbm file opened in parent modperl?
Date: 21:47 on 15 Feb 2005
On Tue, 15 Feb 2005, Richard Chen wrote:

Im a big fan of reading read-only data files, config files, etc at server 
start up in startup.pl and sharing between children.  There could easily 
be problems with my approach and i welcome the criticism =)

The only time I have been burned with parent-child sharing is with 
database handles in forked processes.  you have to jump through hoops with 
mysql/dbi or else all kinds of corruption occurs when the child uses the 
handle created in the parent.

mfp


 Hi,
  
         I recall that in general it is not a good idea to open
 a file in the parent modperl process and then share it
 among the child modperl processes. One should open the
 file separately in each of the child processes. But what
 if the file is used just for read-only access? Is it still
 necessary to open the file separately in the child
 processes? It seems to be more efficient to share if it
 can be done reliably. 
  
 The practical-modperl book gives an example showing
 how to open a read-only dbm file from child init handler
 in each of the child process. But there is no rational given.
  
 For the few tests I have done using MLDBM, opening the
 file in the parent process and then sharing that among
 the child processes seems to work fine. But I would like to know
 if there are any potential problems associated with this practice.
  
 Thanks for any info.
  
 Richard Chen
 
 
 		
 ---------------------------------
 Do you Yahoo!?
  Yahoo! Search presents - Jib Jab's 'Second Term'

        -- 
        gedanken

Re: Is it safe to share a read-only dbm file opened in parent modperl?
Gedanken 21:47 on 15 Feb 2005

Generated at 11:21 on 20 Feb 2005 by mariachi v0.52