On 5/20/08, André Warnier <[EMAIL PROTECTED]> wrote:
>
>
>  william wrote:
>
> > On 5/20/08, william <[EMAIL PROTECTED]> wrote:
> >
> > > Hello, I just know that I can't have a startup script, but how can I
> > >  create an object in the startup script and then used that variable
> > >  object in child modperl script ? Thanks.
> > >
> > >
> >
> > Sorry I mean I CAN have a startup script.
> >
> >
>
>  Hi.
>
>  Take this as a not really qualified answer, but until one of the gurus here
> jumps in, it may be a start.
>
>  The simple question you are asking above is in fact very complicated.
>  If the idea of your question is to create some variable once at the server
> start, and then be able to share that variable through multiple invocations
> of a script or module, then you will probably not be able to do that, or at
> least not in a simple way.
>  The first thing that happens, is that there are multiple Apache children
> processes started and running at the same time, and that you never know
> which one is going to execute your script.  And each one of these children
> processes, will have its own independent copy (or instance) of your "common"
> variable (or object).  So the variable will not really be common.
>
>  There are some ways around that, involving shared memory.  But it is
> probably anyway more complicated that what your simple question above seems
> to indicate of what you expect.
>
>  Let me make a prediction : I can see a quite long and interesting thread
> starting here..
>
>  André
>
>


Thanks for the prompt reply, you said that every child process have a
 copy of the common object variable. I think that shouldn't be a
 problem in my case, because it's an object that only gives data, in
 contrast we would not modify anything about the object. Specifically,
 I want to achieve this because the problem of this module
 WordNet::QueryData
 http://search.cpan.org/~jrennie/WordNet-QueryData-1.47/QueryData.pm .
 This initialization step is slow (appx. 10-15 seconds), but queries
 are very fast thereafter---thousands of queries can be completed every
 second. In my hardware it only takes 2 seconds, but that still quite a
 lot of time to wait if every child process need to take 2 seconds.
 Unless I can have a permanent in startup script and used by the child
 process. Thanks

Reply via email to