s3: locking: Add a memcache based lock cache

Enterprise / Samba - Jeremy Allison [samba.org] - 17 April 2015 15:38 UTC

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.

13b6199 s3: locking: Add a memcache based lock cache.
source3/librpc/idl/open_files.idl | 2 +
source3/locking/share_mode_lock.c | 208 +++++++++++++++++++++++++++++++++++--
2 files changed, 201 insertions(+), 9 deletions(-)

Upstream: gitweb.samba.org


  • Share