[PATCH] CTDB locking changes

Amitay Isaacs amitay at gmail.com
Sun Jul 27 20:22:56 MDT 2014


On Wed, Jul 23, 2014 at 1:11 PM, Amitay Isaacs <amitay at gmail.com> wrote:

> Hi,
>
> Here are the patches that clean up locking in CTDB.
>
> The major changes include:
>
> 1. Removal of multiple lock requests per context feature.
>
> This was a really bad idea and caused out-of-order scheduling of lock
> requests.  The code was already commented and not in use.
>
> 2. Immediate scheduling of lock request provided there aren't max number
> of requests active.
>
> The scheme to avoid scheduling record lock requests which are already
> active, caused high CPU usage when there were lots of pending requests.
> The implementation of pending and active queues using linked list is a bad
> choice of data structure for this purpose.  In future, it might be possible
> to improve the scheduling using per database queues rather than a single
> queue.
>

> Minor changes include:
>
> 1. Removing unused elements of data structures, unused function
>
> 2. Add a new tunable LockProcessesPerDB.  Default is 200.
>
>  3. Update num_pending statistics when lock is scheduled and not when lock
> is obtained to give the correct picture of how many lock requests are still
> in the pending queue.
>
> Please review and  push if ok.
>
> Amitay.
>

Single queue for pending requests is not good enough.  On a loaded system
there can thousands of lock requests in the pending queue.  In that case,
per database queues definitely improves the cpu utilization for
scheduling.  Here are all the locking changes with additional patch for per
database queues.

I would appreciate review and comments/suggestions.

Amitay.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ctdb.patches
Type: application/octet-stream
Size: 33199 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140728/a0c0defc/attachment.obj>


More information about the samba-technical mailing list