httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Javier Belén" <lbe...@afip.gov.ar>
Subject Re: How Do I Create A Per-Worker Pool?
Date Wed, 25 Sep 2002 19:08:34 GMT
Thanks for the tip, but is this actually Ok if I try to use it on Apache 1.3
Leo.
----- Original Message -----
From: "Ian Holsman" <ianh@apache.org>
To: <dev@httpd.apache.org>
Sent: Wednesday, September 25, 2002 4:06 PM
Subject: Re: How Do I Create A Per-Worker Pool?


Leonardo Javier Belىn wrote:
> I think I have a question to ask associated to this thread: How can I
> implement a "global pool" of objects. Let me say it better, I want a
global
> pool of database connection, first because I have a limited number of
> connections and second, because I want to be able to dominate the dbms
> accesses. All developed as an "ansi C" apache module, but I thing is
the
> same. I'm running Apache 1.3. Is this the same thing? Leonardo Javier
Belen.
> AFIP-AR

Have a look at apr_reslist.c in the apr-util/misc directory.

>
> ----- Original Message -----
> From: <rbb@apache.org>
> To: <dev@httpd.apache.org>
> Sent: Wednesday, September 25, 2002 3:29 PM
> Subject: Re: How Do I Create A Per-Worker Pool?
>
>
>
>>On Wed, 25 Sep 2002, Charles Reitzel wrote:
>>
>>
>>>Hi All,
>>>
>>>This is a thorny (to me) module development question.  I have asked
on
>>
>>the
>>
>>>module list and searched the archives, but have found only a partial
>>>answer.  Any pointers will be appreciated.
>>>
>>>Objective: to create a mutex-free pool per worker in non-MPM-specific
>>
>>way.
>>
>>>I found this exchange in a June posting:
>>>
>>>>>Another change we made, as I mentioned in a previous
>>>>>Email, was using non-mutexing per-thread memory
>>>>>pools (HeapCreate(HEAP_NO_SERIALIZE, ...)). > To get
>>>>>best performance with Apache 2 we would really need
>>>>>such a memory pool.
>>>>
>>>>And we already have it! Just do:
>>>>
>>>>    apr_allocator_t *allocator;
>>>>    apr_allocator_create(&allocator);
>>>>    apr_pool_create_ex(&pool, parent_pool, abort_fn, allocator);
>>>>    apr_allocator_owner_set(allocator, pool);
>>>>
>>>>Now you have a mutexless allocator associated with a pool. All child
>>
>>pools
>>
>>>>of this pool will use the same allocator and will therefor also have
>>
>>no mutex.
>>
>>>Looks good.  But I have questions.  What is the correct place to put
>>
>>this
>>
>>>code and where do keep the pool pointer afterwards.  I.e. how do you
>>
>>find
>>
>>>the pool from within a module handler?
>>>
>>><comment>
>>>To my mind, the Apache module API is missing an important data
>>
>>structure:
>>
>>>worker_rec.   It is obviously redundant (but does no harm) in the
>>
>>prefork
>>
>>>MPM, but is a necessary ingredient in _any_ threaded MPM.  Such a
>>
>>structure
>>
>>>would allow modules to be written as thread-safe - independent of the
>>
>>MPM
>>
>>>currently configured by the user.  The request record could and
should
>>
>>>contain a pointer to the current worker for easy access.  In the
>>
>>absence of
>>
>>>a worker_rec, however, some guidance on the above would be helpful.
>>></comment>
>>
>>The structures in Apache are designed around an HTTP request, not the
>>entity that is running the request.  Every threaded MPM has a pool for
>>each thread, which does allow for thread-safe programming.
>>
>>Why exactly would you want a worker_rec?  What problem are you having?
>>
>>Ryan
>>
>>______________________________________________________________________
__
>>_______
>>Ryan Bloom                        rbb@apache.org
>>550 Jean St
>>Oakland CA 94610
>>----------------------------------------------------------------------
--
>>-------
>
>



Mime
View raw message