httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: Documentation on mod_slotmem_shm
Date Wed, 06 Feb 2013 17:23:03 GMT
On 06.02.2013 17:28, Micha Lenk wrote:
> On 02/05/2013 08:04 PM CEST +02:00, Rainer Jung wrote:
>> Example code using it: modules/cluster/mod_heartmonitor.c should be
>> simplest, look for slotmem and SLOTMEM in there. That should at least
>> show how to bootstrap and use slotmem.
> Okay, the longer I am reading anything related to mod_slotmem_shm, the
> more I get the impression that it is the wrong tool for my task. If I
> understood it correctly, mod_slotmem_shm organizes data in slots. This
> appears to make it unnecessarily limited to the number of slots I
> initialize it with.
> What I need is a way to transfer information from one long living
> request to another entirely independent request some time later. The
> first request contains a cookie (i.e. a random string), which is also
> contained in the second request. I would like to use this cookie as a
> handle to store some data (fixed size, if needed) generated during
> processing of the first request somewhere (at least for the life time of
> the first request). The second request then needs to be able to use the
> cookie to access the data the first request already generated. Moreover,
> an arbitrary number of such request pairs can happen at the same time.
> Given the requirements above, is the mod_slotmem_shm API still the right
> tool for this purpose?
> I just started looking at mod_socache_shmcb -- is this maybe better
> suited for the purpose described above?
> I could also go for a custom shared memory usage implementation, but I
> thought making use of any already existing API might be a better idea
> (trying avoid implementing things twice). So, any hint is appreciated...

It seems socache is a better choice in your case. slotmem is based on a
fixed max. number of cache entries, each of fixed size and accessed by
an integer key.

For socache you can find some info in


and a probably not to complex example is


It comes with four different implementations (providers), the shmcb one
is probably the one you'd use (or the memcached based one if sharing in
a farm of hosts is needed).



View raw message