On 09/29/2014 05:14 PM, Sorin Manolache wrote:
On 2014-09-29 13:39, Rajalakshmi Iyer wrote:
Hello,
I have a requirement whereby my application's configuration information
(comprising a few complex data structures) needs to be shared across the
various Apache child processes.
Currently, the configuration is being individually loaded by each child
process, which makes it hard for configuration changes to propagate.
What is the best way / place to have a common configuration for the
application?
Please advise.
I suppose you want to update the configuration without running
"apache2 -k graceful" (or "apache2ctl graceful").
In this case you could use a segment of memory that is shared across
the apache children. You'll have to create the shared segment memory
before the parent forks its children (for example in post_config). The
shared memory is then inherited by the forked children.
You'll need a method to update the contents of the shared memory
segment and a multiple-readers-single-writer inter-process exclusion
mechanism in order to safely read and write from the shared segment.
Sorin
Hello All,
You can check out mod_cluster approach
(https://github.com/modcluster/mod_cluster/tree/master/native/mod_proxy_cluster)
- it uses shared memory as data storage and additional thread per
process to check updates in storage. This way you'll keep per-process
module config in sync with shared data.
Not perfect solution though, but I doubt that there is any flawless way
to share config structures.
________________
Best regards,
Abdi A.