[Samba] Re: TDB locking overhead and performance...
jra at samba.org
Mon Apr 24 14:05:02 GMT 2006
On Sun, Apr 23, 2006 at 01:22:07PM +0100, Daniel J Blueman wrote:
> > > 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.
All of these are a nasty hack, with no atomicity for processes
that terminate. You simply can't do this reliably in userspace.
More information about the samba