[ 
https://issues.apache.org/jira/browse/HBASE-10156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13854583#comment-13854583
 ] 

stack commented on HBASE-10156:
-------------------------------

After thinking on this for a while, here is a suggestion.

+ Handlers pass edits and sync calls across a ring buffer.
+ After handling off its edits and after it calls sync, the Handler goes into a 
holding pattern blocked waiting on its sync to complete (When the Handler 
passed its sync across the ringbuffer, it included a reference to an object 
that the Handler is currently blocked on for the syncer thread to pull on when 
sync completes).
+ A single appender/writer/consumer thread pulls from the ringbuffer and 
batches up the appends and syncs.
+ We have multiple threads running syncs as committed by 8755 (only in this 
case, I'll try and let them grow and shrink w/ demand rather than hardcode a 
number -- we'll see)
+ When one of the sync threads completes, it calls notify on all the sync 
objects it was called with thereby freeing up the blocked Handlers that are on 
their other end.

The above would at least remove the notifier thread.  There should also be less 
contention since we are doing explicit notifications rather than notifyAll and 
the use of the distruptor as the ringbuffer should make the edit+sync hand-off 
less contending as it goes out of its way to minimize locking and instances of 
volatile read/writes.

Now let me prove the above is better than what we have.

Elliott helped out on the above.  In particular he came up w/ the nice 
simplification that has us passing the object-the-handler-is-waiting-on off to 
the sync thread so it can do selective notifications.  It allowed for doing 
away w/ an ugly backchannel and notification thread I had up in an earlier 
incarnation.

> Fix up the HBASE-8755 slowdown when low contention
> --------------------------------------------------
>
>                 Key: HBASE-10156
>                 URL: https://issues.apache.org/jira/browse/HBASE-10156
>             Project: HBase
>          Issue Type: Sub-task
>          Components: wal
>            Reporter: stack
>            Assignee: stack
>         Attachments: Disrupting.java
>
>
> HBASE-8755 slows our writes when only a few clients.  Fix.



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to