Penrose Virtual Directory can configure cache settings on data sources and for individual entries. Both caches can be configured to use persistent or in-memory cache or be disabled. The settings for both the source and entry cache affect the Penrose Server performance.
Penrose Studio uses cache at two levels, for the Penrose Server source and another for the Penrose Server entry. The source cache caches the data read from the data sources. The entry cache caches the LDAP entries generated by the mappings. The cache is invalidated when it expires or an update operation is performed against it.
Each source and entry mapping has its own cache which is configured separately, described in Chapter 5, Managing Partitions and Chapter 5, Managing Partitions, respectively, for the cache size and expiration.
The type of cache, however, is configured globally, and Penrose Virtual Directory can configure its cache in two ways:
In-memory cache. Storing the cache data in local memroy is fast because it does not require initialization and stores only a partial copy of the data from the source. However, there is a risk since all data are lost when the server is restarted. In-memory cache is recommended for databases that are small or rarely change.
No cache (the default). Penrose Server has cache disabled by default, so all operations are run directly against the underlying sources. Disabling cache ensures that the information displayed in Penrose is the same as the data stored in the source. Disabling cach is recommended for using real-time mapping.
There are some performance differences between in-memory cache, persistent cache, and no cache, as shown in Table 14.1, “Performance Measurements for Different Cache Configurations”.
Type of Cache | Number of Database Entries | Cache Hit Times (in seconds) | Cache Miss Times (in seconds) | ||
---|---|---|---|---|---|
First Entry | Last Entry | First Entry | Last Entry | ||
No Cache[a] | 100 | 0s | 2s | ||
1000 | 1s | 6s | |||
5000 | 3s | 27s | |||
10000 | 5s | 55s | |||
In-Memory Cache | 100 | 0s | 2s | 0s | 2s |
1000 | 0s | 6s | 1s | 6s | |
5000 | 1s | 25s | 3s | 27s | |
10000 | 8s | 60s | 8s | 60s | |
[a] If cache is disabled, then there are no entries in the cache. Any search requests, then, appear as a cache miss. |
In-memory cache is configured through a specific module, the CacheModule
. This module must be specified in the modules.xml
file (either in /opt/vd-server-2.0/conf
for the default partition or in
for additional partitions). If the module is not listed in /opt/vd-server-2.0/partitions/
partition_name/DIR-INF
modules.xml
, then Penrose Virtual Directory does not use in-memory cache for virtual entries.
Open the modules.xml
file.
cd /opt/vd-server-2.0/conf vi modules.xml
Configure the cache settings. There are three possible paramters: querySize
, which sets the maximum number of unique queries to the cache; resultSize
, which sets the maximum number of entries which are returned; and expiration
, which sets when the cache expires (in minutes).
<modules> <module name="CacheModule"> <module-class>org.safehaus.penrose.cache.module.CacheModule</module-class> <parameter> <param-name>querySize</param-name> <param-value>250</param-value> </parameter> <parameter> <param-name>resultSize</param-name> <param-value>100</param-value> </parameter> <parameter> <param-name>expiration</param-name> <param-value>3</param-value> </parameter> </module> </modules>
Parameter | Default Value | Value Range |
---|---|---|
querySize | 10 | 0 (unlimited) to any integer |
resultSize | 100 | 0 (unlimited) to any integer |
expiration | 5 | 0 (never expires) to any integer |
As with any module, it is possible to map the CacheModule
to a specific subtree in the virtual directory. Add a module mapping entry, specifying the CacheModule
, to the modules.xml
file. For example:
<module-mapping> <module-name>CacheModule</module-name> <base-dn>ou=people,dc=example,dc=com</base-dn> </module-mapping>
Restart Penrose Server.
service vd-server restart
Always restart Penrose Server after editing the configuration file.
The cache is disabled by setting the enabled=
argument for the entry.
Open the modules.xml
file.
Add the enabled=
argument to the cache's entry, and set its value to false
.
<module name="CacheModule" enabled=false
>
Restart Penrose Server.
service vd-server restart
Always restart Penrose Server after editing the configuration files.