You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/10/10 09:40:53 UTC

[GitHub] [rocketmq] shenhui0509 opened a new pull request #1516: [improvement] SYNC_MASTER could be change into pipeline manner #1515

shenhui0509 opened a new pull request #1516: [improvement] SYNC_MASTER could be change into pipeline manner #1515
URL: https://github.com/apache/rocketmq/pull/1516
 
 
   change SYNC_MASTER flushSlave/flushDisk to pipeline manner
   
   ## What is the purpose of the change
   performance improvement:
   - reduce produce latency 
   - improve produce throughput
   
   ## Brief changelog
   1. add an interface *asyncProcessRequest* to remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRequestProcessor.java allow processors can process request in async manner, and by default wrap the result of ProcessRequest with CompletableFuture.
   2. change remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java, let write response to client happen after the future is filled, rather than a blocking call
   3. add and interface *asyncPutMessage* to MessageStore
   4. change the store/src/main/java/org/apache/rocketmq/store/CommitLog.java, the *asyncPutMessage* method returns a CompletableFuture<PutRusult>, this future is filled by the flushSlave/flushDisk thread instead of the processor thread, thus the processor can process the next request just after append to local commitlog, let the flushSlave/flushDisk thread respond to client.
   5. some dup code eliminate
   
   ## Verifying this change
   
   ### Functional
   1. add unit test in store/src/test/java/org/apache/rocketmq/store/HATest.java
   2. shutdown slave while sending message, the producer received the FLUSH_SLAVE_TIMEOUT response code.
   ![image](https://user-images.githubusercontent.com/9401184/66556756-6177e000-eb83-11e9-9e0c-c0a368f19210.png)
   
   ### performance
   benchmark config:
   2 * broker:48C,512G mem,4 * 2T SSD'
   namesrv is hybrid deployed with broker
   3 * client : 40C, 64G mem
   message size : 1024B
   write thread : 64
   
   benchmark result 
   *sync_pipeline* is the optimized version configured with SYNC_MASTER
   *wait* is the origin version configured with SYNC_MASTER
   *async* is the origin version configured with ASYNC_MASTER
   
   TPS
   ![image](https://user-images.githubusercontent.com/9401184/66557313-3e99fb80-eb84-11e9-9d93-16b0b80f13c7.png)
   ![image](https://user-images.githubusercontent.com/9401184/66557320-42c61900-eb84-11e9-98bd-c1de81928abd.png)
   Latency
   ![image](https://user-images.githubusercontent.com/9401184/66557369-55d8e900-eb84-11e9-8a9a-fa6167c50107.png)
   ![image](https://user-images.githubusercontent.com/9401184/66557404-65583200-eb84-11e9-9664-207a3e6fb738.png)
   
   The result shows that the optimized version's performance is close to ASYNC_MASTER.
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services