TDB locking overhead and performance...

Daniel J Blueman daniel.blueman at gmail.com
Sun Apr 23 12:22:07 GMT 2006


> > As a test, I changed the opening of the locking.tdb and brlock.tdb
> > files to use the TDB_INTERNAL flag, avoiding use of the fcntl(F_SETLK)
> > syscall for locking individual database records. Performance was a lot
> > snappier, with quite a bit less system time used.
> >
> > What is the scope of implementing shared memory TDBs, where locking
> > could be done simply on structures?
>
> How would you implement cross-process locking without
> any syscalls? Maybe Linux has some fancy stuff here, but for
> most unixes we need to coordinate the mmap'ed area for the
> tdbs fcntl locks.

Locking via a 'volatile int count' in a shared file-backed or
anonymous mapping, or via sys V shm is what I had in mind.

This would be quite clean to implement, but I just can't find any
user-space atomic operations exported by glibc. There are clever
tricks to use the kernel ones in /usr/include/asm/atomic.h, but that
is an ugly hack.

Any ideas?
--
Daniel J Blueman


More information about the samba-technical mailing list