Proxy cache overlay: effect of pcachePersist parameter?

2010-07-16 Thread Jonathan Clarke
Hi,

I've set up an ldap backend, with a pcache overlay to cache binds for PAM.
The config is below, for info.

My question concerns the pcachePersist parameter. From the man page:

pcachePersist { TRUE | FALSE }
Specify  whether  the  cached  queries should be saved across restarts of
the caching proxy, to provide hot startup of the cache.  Only non-expired
queries are reloaded.  The default is FALSE.

As I understand this, given pcachePersist FALSE (or not specified),
cached queries should no longer be in the cache after restarting slapd. Am
I right?

However, once a bind is successfully cached, I take the proxied server
offline and I can restart slapd many times, however my bind is still served
from cache.

Is this a bug in the docs, a bug in the implementation or just me not
getting something?

Thanks,
Jonathan

PS: the simplified config:
8--
databaseldap
suffix  dc=proxy
rootdn  cn=manager,dc=proxy
uri ldap://my.other.ldap.server/
timeout 5

overlay pcache
pcache  hdb  1  1  2 60
pcacheAttrset   0   *
# cache binds for 900 seconds = 15 minutes
pcacheTemplate  (uid=)   0   900
pcacheBind  (uid=)   0   900 sub dc=proxy
pcachePersist   FALSE
pcacheOffline   FALSE
directory   /var/cache/ldap
cachesize   1
index   objectClass,sAMAccountName,pcacheQueryideq
8--



Re: Proxy cache overlay: effect of pcachePersist parameter?

2010-07-16 Thread Howard Chu

Jonathan Clarke wrote:

Hi,

I've set up an ldap backend, with a pcache overlay to cache binds for PAM.
The config is below, for info.

My question concerns the pcachePersist parameter. From the man page:

pcachePersist { TRUE | FALSE }
Specify  whether  the  cached  queries should be saved across restarts of
the caching proxy, to provide hot startup of the cache.  Only non-expired
queries are reloaded.  The default is FALSE.

As I understand this, given pcachePersist FALSE (or not specified),
cached queries should no longer be in the cache after restarting slapd. Am
I right?

However, once a bind is successfully cached, I take the proxied server
offline and I can restart slapd many times, however my bind is still served
from cache.

Is this a bug in the docs, a bug in the implementation or just me not
getting something?


The proxycache writes all cached data into the cache DB. As such, cached 
results are always present after a restart; this has always been the case. 
That can be considered a bug, because it did not save any information about 
the queries to which each cached entry belonged. So on a restart, the cache DB 
contains stuff but the overlay doesn't know about it.


With pcachePersist set TRUE, the query info is also stored in the DB, and 
re-loaded on restart. Thus the overlay will know the complete contents of the 
cache DB.


Thanks,
Jonathan

PS: the simplified config:
8--
databaseldap
suffix  dc=proxy
rootdn  cn=manager,dc=proxy
uri ldap://my.other.ldap.server/
timeout 5

overlay pcache
pcache  hdb  1  1  2 60
pcacheAttrset   0   *
# cache binds for 900 seconds = 15 minutes
pcacheTemplate  (uid=)   0   900
pcacheBind  (uid=)   0   900 sub dc=proxy
pcachePersist   FALSE
pcacheOffline   FALSE
directory   /var/cache/ldap
cachesize   1
index   objectClass,sAMAccountName,pcacheQueryideq
8--





--
  -- Howard Chu
  CTO, Symas Corp.   http://www.symas.com
  Director, Highland Sun http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/