You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 2011/08/01 19:10:28 UTC

Re: Sharing information between threads and processes.

Check out mod_slotmem in trunk

On Jul 31, 2011, at 3:50 PM, Zaid Amireh wrote:

> On Jul 22, 2011, at 12:40 PM, Ignaz Birnstingl wrote:
> 
>> I implemented something very similar for my module: Dynamic
>> configuration data is retrieved from a remote server and should be
>> shared among all worker processes. Fortunately the configuration
>> changes only sporadically so I implemented it using
>> serialization/deserialization to/from the shared memory segment. Of
>> course inter-process locking must be considered - for example using
>> apr_proc_mutex_* or a spinlock inside the shared memory segment.
>> 
>> -- Ignaz
> 
> Thank you all for your suggestions, it turns out that implementing a shared dynamic memory storage across all the threads and process is quite a complex process, I ended up doing it in a stand alone daemon that uses libevent, each apache process or thread has its own storage for the duration of its life and all the cache misses are looked up in the said daemon using TCP sockets, the daemon usually replies in 0.004 seconds which is an acceptable performance hit since mutex locking across all apache instances might have ended up with a larger overhead anyway on busy servers.
> 
> virtually yours
> 
> Zaid