You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1996/08/24 12:40:23 UTC
Shared memory for all servers?
I've currently fixed a bug in the mapfile support of mod_rewrite and now
discovered a _principle problem_ with in-core caching of looked up values
from such maps.
mod_rewrite has a global cache structure, which gets initialized on the
"init" hook of the API. Then the pre-forked servers acts on this cache, i.e.
they store looked up mapfile values to speed up the external rewritemap
usage. Because of the fork() each server got its own copy of the Apache
server code and data. So, when rewrite occurs which a map-function its value
is stored. I do a reload in my browser and because a different server now
gets the request it _ALSO_ stores this value in its cache. This goes on
unless I reach again the first server. Then the value is the first time
cached and can be taken out of the in-core cache.
While this is a principle problem with fork() I think, it is somewhat silly.
Because if you have 10 pre-forked servers, the caching is done at 10 points.
Each server does it for itself. This is not very useful. It would be a really
better caching if I can implement the cache as shared cache for all servers.
** The question: How can I implement such a in-core pool of data **
** which gets shared by all pre-forked severs? **
Ok, there are a lot of difficult possibilities:
- Shared Memory (which not exists on all Unix derivates as an interface)
- External File (which is silly, because then I get completely forget
caching, because I implemented it to avoid using an external file all
the time)
- etc.pp.
Hmmmm... any hints to do it best and right with minimal overhead?
Ralf S. Engelschall
rse@engelschall.com
http://www.engelschall.com/~rse