Index of /~chrisd/projects/shared_map
Name Last modified Size Description
Parent Directory -
deprecated/ 13-May-2009 17:37 -
mod_shmap.c 13-May-2009 20:34 29K
mod_slotmem_zk.c 13-May-2009 20:34 8.2K
mod_socache_zk.c 13-May-2009 04:12 8.1K
Note:
The mod_shmap module provides a simple HTTP interface
to the "slotmem" (fixed-length record) and "socache" (small object cache)
data storage providers available in httpd trunk circa
r773977.
Clients access data using GET, PUT, and DELETE methods. When using
a slotmem provider, the final component of the URI must be a numeric
record index. For example (using the sample configurations shown below):
PUT /mem/123 HTTP/1.0
Content-Length: 5
hello
PUT /map/abc/def HTTP/1.0
Content-Length: 5
world
GET /mem/123 HTTP/1.0
==> hello
GET /map/abc/def HTTP/1.0
==> world
DELETE /mem/123 HTTP/1.0
DELETE /map/abc/def HTTP/1.0
Any portion of the URI namespace may be assigned for use with
mod_shmap by enabling the module's handler and
specifying the data storage provider to be used. For example:
LoadModule shmap_module modules/mod_shmap.so
LoadModule sharedmem_module modules/mod_sharedmem.so
LoadModule socache_dbm_module modules/mod_socache_dbm.so
<Location /mem>
SetHandler shmap-handler
SharedMapProvider slotmem:shared :shmap(1024:500:p) /mem
</Location>
<Location /map>
SetHandler shmap-handler
SharedMapProvider socache:dbm /path/to/dbm/file.db /map
</Location>
The first parameter of the SharedMapProvider directive
specifies the type and name of the provider, e.g., socache:dbm
for the mod_socache_dbm module and slotmem:shared
for the mod_sharedmem module. Note that the provider
module must also be loaded with the LoadModule directive
in order for it to be available to mod_shmap.
The second parameter defines the particular data store to be used
by the provider. For socache providers, this parameter's format is
specific to the provider.
For slotmem providers, the parameter should be of the form
[name][([item_size][:[item_num][:p]])]
where the arguments correspond to those passed to the provider's
slotmem_create() method. All arguments are optional
and if not defined, default values will be used. The :p
flag argument may be defined to specify persistence between invocations
of the httpd server.
The third parameter, if present, defines a URI path which must match
the leading portion of the URI in each HTTP request, and which will
be removed before the remainder of the URI is used to index the
provider's data store.
Note:
The mod_slotmem_zk and mod_socache_zk modules
are slotmem and socache API providers, respectively, which utilize
the mod_zk module to access an Apache
ZooKeeper cluster
for their data storage. The mod_zk module is included
in my zookeeper projects.
The zookeeper_mt multi-threaded ZooKeeper C client library
is required when compiling, along with the mod_zk.h C header
file; for example:
apxs -c -I/path/to/mod_zk/include -I/path/to/zk/include \
-L/path/to/zk/lib -lzookeeper_mt mod_socache_zk.c
ZooKeeper clusters are identified by their mod_zk alias
in the string arguments passed to the slotmem_create()
and socache create() methods. The following example
demonstrates usage of both modules in combination with mod_zk
and mod_shmap:
LoadModule shmap_module modules/mod_shmap.so
LoadModule zk_module modules/mod_zk.so
LoadModule slotmem_zk_module modules/mod_slotmem_zk.so
LoadModule socache_zk_module modules/mod_socache_zk.so
SetHandler shmap-handler
ZKCluster zk1 host1:7000,host2:7000,host3:9000
<Location /zk/mem>
SharedMapProvider slotmem:zookeeper zk1 /zk/mem
</Location>
<Location /zk/map>
SharedMapProvider socache:zookeeper zk1 /zk/map
</Location>
Note:
The mod_socache_zookeeper module is deprecated;
use mod_zk and mod_socache_zk instead.