You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Mihir Mohan <mi...@gmail.com> on 2005/06/23 19:58:41 UTC

Dynamic Configuration Module using Shared memory

Hi 

I am writing a module in which i am using my own configuration xml
file. I provide the functionality of dynamic configuration. user can
change the XML file and pass it as special request to my module to
update the configuration. It works fine for non prefork module, but
with the prefork MPM i use shared memory to store the DOM tree. The
shared memory makes the traversing of the DOM tree difficult. Is their
any other approach that i should work on ? Is it a good idea to store
in shared memory ? One other issue is that, at the time of
initialization of the module, i parse the xml file and create a shared
memory of the size of the parsed object. Now, when it is updated, the
updated xml configuration file size is larger than the shared memory
allocated. In this case, i destroy the old shm and create a new shm
with larger size and attach all the processes to it. Is it a good idea
to implement it this way ? Please let me know, if  their is a better
way.

Thanks in advance for your help.

Regards
Mihir Mohan 

-- 
There is nothing more difficult to take in hand, more perilous to
conduct, or more uncertain in its success, than to take the lead in
the introduction of a new order of things.
Machiavelli in 'The Prince'

Re: Dynamic Configuration Module using Shared memory

Posted by Nick Kew <ni...@webthing.com>.
On Thursday 23 June 2005 18:58, Mihir Mohan wrote:
> Hi
>
> I am writing a module in which i am using my own configuration xml
> file.

Fine so far, though apache-modules would probably be a better place
to have posted this.

> I provide the functionality of dynamic configuration. user can 
> change the XML file and pass it as special request to my module to
> update the configuration.

That's unusual, and should be very carefully reviewed for security.

> It works fine for non prefork module, but 
> with the prefork MPM i use shared memory to store the DOM tree.

Erm, how extensively have you tested with other MPMs?  I think you
could be in for some surprises there.

As for shared memory, you're up against the usual problem: you store
a pointer (by value), but lose what it points to.  IMO far more trouble
than it's worth - unless you make it your task to do exactly that for a
student project (and don't expect much performance), or something.


> ? Please let me know, if  their is a better
> way.

KISS.  If your config is an XML file, store it on disc, and check the 
timestamp to detect when it wants reloading.

-- 
Nick Kew