apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory (Grisha) Trubetskoy" <gri...@apache.org>
Subject RE: Getting a hash table into shared memory
Date Fri, 11 Jul 2003 18:02:34 GMT

On Fri, 11 Jul 2003, Viner, David wrote:

> Must your shared memory be SysV style?  How about mmap() a file?

Either or, doesn't matter.

>
> Outside the Apache world, there is a really cool library called MDBM which
> is owned by Larry McVoy at BitMover.  It is similar to sdbm except that it
> uses mmap() to get (and keep) most or all the hash in memory.

I don't seem to be able to find it, only mentions of it (do you have a
link?) - but it seems it's under GNU license, which would be a problem for
including it with mod_python.

Grisha

>
> dave
>
>
> -----Original Message-----
> From: Gregory (Grisha) Trubetskoy [mailto:grisha@apache.org]
> Sent: Friday, July 11, 2003 9:02 AM
> To: dev@apr.apache.org
> Subject: Getting a hash table into shared memory
>
>
>
> Hi -
>
> I'm in search of some wisdom here.
>
> I am looking at ways to have a hashtable into shared memory. This is for
> mod_python, so maximum reliance on APR and least replication of effort is
> a requirement.
>
> I have seen a couple of examples in httpd code - mod_ssl and mod_auth_ldap
> can use shared memory for caching their internal data. Both of those use
> their own hash table implementation. Actually mod_ssl uses a hash table by
> Gray Watson (with its own license). The reasons are probably historical,
> but from looking at APR, it seems to me that it's not possible to use the
> APR hash table for this purpose. I'm hesitant to borrow from these
> examples because although they work, it seems there should be a more
> elegant way of doing this.
>
> Just to clarify, there are two possible ways to use shared memory. The
> first is when the shared memory segment is allocated prior to forking and
> its base address is reused by children, in which case addresses are all
> the same and there is no need to deal with offsets. The only requirement
> is that a different malloc-like functions are used (both mod_ssl and
> auth_ldap use wrappers around APR rmm funcs).
>
> The second is when a (child) process would be able to allocate a shared
> memory segment and others could attach to it.  This, of course is a lot
> more complicated, because now the base address may differ from process to
> process and the table needs to deal with offsets.  Both examples mentioned
> above do it the first way, and for my pusposes it would be acceptable,
> though the second would be fantastic...
>
> In any event, I'd appreciate some pointers or suggestions. Is it possible
> for example to somehow create a pool that would use rmm_alloc functions?
>
> Grisha
>

Mime
View raw message