s3: locking: Add a memcache based lock cache.
authorJeremy Allison <jra@samba.org>
Wed, 15 Apr 2015 17:36:00 +0000 (10:36 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 17 Apr 2015 20:38:34 +0000 (22:38 +0200)
commit13b6199a2fd47dd96166878f861f2ae56d2b4a45
tree38636a24985e80d1bcf673fbe0428603f2f3b2f3
parentec8ff499a47e0599a296f8b54c26a15e8a2389fa
s3: locking: Add a memcache based lock cache.

Based on an idea by Volker to optimize cpu usage when
parsing struct share_mode_data entries.

Add a 64-bit sequence number to the share mode entry,
and after the entry is stored back in the db, cache
the in-memory version using talloc reparenting into the
memcache. The memcache key used is the same struct file_id
used as the key into the locking db.

On read, check if the locking db version sequence number
matches the in-memory cache, and if so reparent the
memcache version back onto the required memory context.

Saves all the ndr decoding when multiple accesses to the
same lock entry happen in succession.

Design also improved by Metze and Ira.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Apr 17 22:38:34 CEST 2015 on sn-devel-104
source3/librpc/idl/open_files.idl
source3/locking/share_mode_lock.c