apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Querna <c...@force-elite.com>
Subject Re: Are shared memory memory pools possible?
Date Sat, 25 Dec 2004 22:55:26 GMT
Ivan Ristic wrote:
> Paul Querna wrote:
>> Ivan Ristic wrote:
>>> I have a need to share a hash table among several processes. It's for 
>>> an Apache 2 module. Is there a way to get an APR memory pool to use a 
>>> pre-allocated shared memory segment? Or to initialize a pool with a 
>>> custom allocator, one that only allocates data from shared memory?
>> An alternative might be using memcached via apr_memcache:
>> http://www.outoforder.cc/projects/libs/apr_memcache/
>> I plan on trying to get apr_memcache into APR-Util sooner or later.  I 
>> wanted to write up a patch for mod_ssl to use it as a SSL Session 
>> storage backend first.  I am already using it in my mod_gnutls to 
>> store SSL sessions.
>   It does sound like something I could use. I can definitely see the
>   benefit of a cluster of web servers sharing the data. But I don't see
>   a way to inspect the cache or persist the data stored in memcached in
>   some other way. Is that possible?

That is dependent on the memcached server... and the short answer is 
there is zero persistence guarantee.

Memcached is really designed as a pure cache -- it is assumed any 
resource in it could be re-created, and that it is just too expensive to 
create it for every request.

Its not the solution for every problem, but for the problems that it 
does fit, it is blazing fast.

Answering the original question again, the only code that does something 
like this for shared memory is in mod_ssl w/ its Shared Memory Cache for 
SSL Sessions.  It is pretty specialized code, but it might be possible 
to adapt it to your needs:



View raw message