You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Jay Shrauner (JIRA)" <ji...@apache.org> on 2012/07/06 01:31:34 UTC

[jira] [Created] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Jay Shrauner created ZOOKEEPER-1505:
---------------------------------------

             Summary: Multi-thread CommitProcessor
                 Key: ZOOKEEPER-1505
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
             Project: ZooKeeper
          Issue Type: Improvement
          Components: server
            Reporter: Jay Shrauner
            Assignee: Jay Shrauner
         Attachments: ZOOKEEPER-1505.patch

CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints

  - each session must see its requests responded to in order
  - all committed transactions must be handled in zxid order, across all sessions

I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:

  - it does not matter if the read request in one session happens before or after the write request in another session

With these constraints, I propose the following threads

  - 1    primary queue servicing/work dispatching thread
  - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread

By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint--requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.

On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).

New classes introduced in this patch are:

    WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jay Shrauner updated ZOOKEEPER-1505:
------------------------------------

    Description: 
CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints

  - each session must see its requests responded to in order
  - all committed transactions must be handled in zxid order, across all sessions

I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:

  - it does not matter if the read request in one session happens before or after the write request in another session

With these constraints, I propose the following threads

  - 1    primary queue servicing/work dispatching thread
  - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread

By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.

On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).

New classes introduced in this patch are:

    WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).


  was:
CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints

  - each session must see its requests responded to in order
  - all committed transactions must be handled in zxid order, across all sessions

I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:

  - it does not matter if the read request in one session happens before or after the write request in another session

With these constraints, I propose the following threads

  - 1    primary queue servicing/work dispatching thread
  - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread

By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint--requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.

On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).

New classes introduced in this patch are:

    WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).


    
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>         Attachments: ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13475444#comment-13475444 ] 

Jay Shrauner commented on ZOOKEEPER-1505:
-----------------------------------------

Findbug warning ("naked notify") is bogus; this is a helper routine to wakeup the main thread with the state change happening in the routines that call it.

>From the blurb in findbug: "This bug does not necessarily indicate an error, since the change to mutable object state may have taken place in a method which then called the method containing the notification."
                
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch, ZOOKEEPER-1505.patch, ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13409637#comment-13409637 ] 

Hadoop QA commented on ZOOKEEPER-1505:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12535689/ZOOKEEPER-1505.patch
  against trunk revision 1357711.

    +1 @author.  The patch does not contain any @author tags.

    -1 tests included.  The patch doesn't appear to include any new or modified tests.
                        Please justify why no new tests are needed for this patch.
                        Also please list what manual steps were performed to verify this patch.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    -1 findbugs.  The patch appears to introduce 1 new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1128//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1128//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1128//console

This message is automatically generated.
                
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jay Shrauner updated ZOOKEEPER-1505:
------------------------------------

    Attachment:     (was: ZOOKEEPER-1505.patch)
    
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439981#comment-13439981 ] 

Jay Shrauner commented on ZOOKEEPER-1505:
-----------------------------------------

javadoc warning is spurious and unrelated:

     [exec]   [javadoc] javadoc: warning - Error fetching URL: http://docs.oracle.com/javase/6/docs/api/package-list
                
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch, ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jay Shrauner updated ZOOKEEPER-1505:
------------------------------------

    Attachment: ZOOKEEPER-1505.patch

- Addressed reviewboard comments.
- Added unit test.
- Bugfix for issue Thawan found with watch resets on read requests in one session racing a write request affecting that watch in another session. Solution taken here is to prevent any read requests at all from running concurrently with a write request. There is room for further improvement, by parsing the request earlier in the pipeline and identifying read requests with watch resets.
                
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch, ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13410458#comment-13410458 ] 

Jay Shrauner commented on ZOOKEEPER-1505:
-----------------------------------------

FindBug warning is "Naked notify in org.apache.zookeeper.server.quorum.CommitProcessor.wakeup()". Explanation of warning states "This bug does not necessarily indicate an error, since the change to mutable object state may have taken place in a method which then called the method containing the notification." which is exactly the situation here.

Testing: I haven't found the unit tests always to be the best way to find multi-threading issues (even the hammer ones, although they're helpful). Tested and debugged by running on an ensemble and driving test load, and then by running on our production system.
                
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13426170#comment-13426170 ] 

Jay Shrauner commented on ZOOKEEPER-1505:
-----------------------------------------

Posted to reviewboard

https://reviews.apache.org/r/6260/
                
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jay Shrauner updated ZOOKEEPER-1505:
------------------------------------

    Attachment: ZOOKEEPER-1505.patch
    
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13475336#comment-13475336 ] 

Hadoop QA commented on ZOOKEEPER-1505:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12548952/ZOOKEEPER-1505.patch
  against trunk revision 1391526.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    -1 findbugs.  The patch appears to introduce 1 new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1219//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1219//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1219//console

This message is automatically generated.
                
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch, ZOOKEEPER-1505.patch, ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423683#comment-13423683 ] 

Patrick Hunt commented on ZOOKEEPER-1505:
-----------------------------------------

Jay could you put this up for review on apache's reviewboard? https://reviews.apache.org/dashboard/  Thanks!
                
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jay Shrauner updated ZOOKEEPER-1505:
------------------------------------

    Attachment: ZOOKEEPER-1505.patch

Address feedback from review--shutdown CommitProcessor if downstream processor throws an exception (preserves previous behavior)
                
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch, ZOOKEEPER-1505.patch, ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439903#comment-13439903 ] 

Hadoop QA commented on ZOOKEEPER-1505:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12542037/ZOOKEEPER-1505.patch
  against trunk revision 1373156.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    -1 javadoc.  The javadoc tool appears to have generated 1 warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    -1 findbugs.  The patch appears to introduce 1 new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1167//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1167//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1167//console

This message is automatically generated.
                
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch, ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jay Shrauner updated ZOOKEEPER-1505:
------------------------------------

    Fix Version/s: 3.5.0
    
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.4.3, 3.4.4, 3.5.0
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint-- requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1505) Multi-thread CommitProcessor

Posted by "Jay Shrauner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jay Shrauner updated ZOOKEEPER-1505:
------------------------------------

    Attachment: ZOOKEEPER-1505.patch
    
> Multi-thread CommitProcessor
> ----------------------------
>
>                 Key: ZOOKEEPER-1505
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1505
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>            Reporter: Jay Shrauner
>            Assignee: Jay Shrauner
>              Labels: performance, scaling
>         Attachments: ZOOKEEPER-1505.patch
>
>
> CommitProcessor has a single thread that both pulls requests off its queues and runs all downstream processors. This is noticeably inefficient for read-intensive workloads, which could be run concurrently. The trick is handling write transactions. I propose multi-threading this code according to the following two constraints
>   - each session must see its requests responded to in order
>   - all committed transactions must be handled in zxid order, across all sessions
> I believe these cover the only constraints we need to honor. In particular, I believe we can relax the following:
>   - it does not matter if the read request in one session happens before or after the write request in another session
> With these constraints, I propose the following threads
>   - 1    primary queue servicing/work dispatching thread
>   - 0-N  assignable worker threads, where a given session is always assigned to the same worker thread
> By assigning sessions always to the same worker thread (using a simple sessionId mod number of worker threads), we guarantee the first constraint--requests we push onto the thread queue are processed in order. The way we guarantee the second constraint is we only allow a single commit transaction to be in flight at a time--the queue servicing thread blocks while a commit transaction is in flight, and when the transaction completes it clears the flag.
> On a 32 core machine running Linux 2.6.38, achieved best performance with 32 worker threads for a 56% +/- 5% improvement in throughput (this improvement was measured on top of that for ZOOKEEPER-1504, not in isolation).
> New classes introduced in this patch are:
>     WorkerService (also in ZOOKEEPER-1504): ExecutorService wrapper that makes worker threads daemon threads and names then in an easily debuggable manner. Supports assignable threads (as used here) and non-assignable threads (as used by NIOServerCnxnFactory).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira