Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE-1316]Enhance share netty handler #635

Merged
merged 5 commits into from Jul 11, 2019

Conversation

@Erik1288
Copy link
Contributor

Erik1288 commented Dec 26, 2018

What is the purpose of the change

According to the network topology of RocketMQ, it’s possible that a broker has hundreds of (even thousands of) netty channels established with members (especially consumers). If each stateless handler can be shared by all of these channels, memory should be saved slightly.

Brief changelog

  1. Annotate stateless netty handlers with @sharable.
    HandshakeHandler
    NettyEncoder
    NettyConnectManageHandler
    NettyServerHandler

  2. Share each single-instanced handler with all the server-side channels, instead of creating a new handler instance whenever a channel comes.

Verifying this change

It functions well and passed all the unit tests after this change.

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.

  • Make sure there is a Github issue 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.
  • 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.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • 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.
  • 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.
@coveralls

This comment has been minimized.

Copy link

coveralls commented Dec 26, 2018

Coverage Status

Coverage increased (+0.05%) to 43.233% when pulling d9dafe4 on Erik1288:enhance_share_netty_handler into 385c695 on apache:develop.

@Erik1288

This comment has been minimized.

Copy link
Contributor Author

Erik1288 commented Dec 26, 2018

The coverage decrease failure was triggered by 85f29ae, which is a pure comment commit.

@zongtanghu

This comment has been minimized.

Copy link
Contributor

zongtanghu commented Dec 26, 2018

Hi,Erik,Please adjust you unit test code to increase the code coverage.

Copy link
Contributor

zongtanghu left a comment

You can simplify you comments.

Copy link
Contributor

zongtanghu left a comment

You can simplify you comments.

Erik1288 added 3 commits Dec 26, 2018
@zongtanghu zongtanghu self-requested a review Mar 20, 2019
@zongtanghu zongtanghu added this to the 4.6.0 milestone Mar 20, 2019
@zongtanghu

This comment has been minimized.

Copy link
Contributor

zongtanghu commented Jun 17, 2019

LGTM

@zongtanghu

This comment has been minimized.

Copy link
Contributor

zongtanghu commented Jun 17, 2019

Please help to review this pr. @ShannonDing @duhenglucky @jonnxu

@ShannonDing ShannonDing requested review from duhenglucky and vongosling Jun 18, 2019
@jonnxu

This comment has been minimized.

Copy link

jonnxu commented Jul 3, 2019

LGTM

1 similar comment
@zongtanghu

This comment has been minimized.

Copy link
Contributor

zongtanghu commented Jul 3, 2019

LGTM

@duhenglucky

This comment has been minimized.

Copy link
Contributor

duhenglucky commented Jul 11, 2019

lgtm

@zongtanghu zongtanghu modified the milestones: 4.6.0, 4.5.2 Jul 11, 2019
@zongtanghu zongtanghu merged commit 9226292 into apache:develop Jul 11, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.05%) to 43.233%
Details
@zongtanghu zongtanghu changed the title Enhance: share netty handler enhance share netty handler Jul 12, 2019
@zongtanghu zongtanghu changed the title enhance share netty handler Enhance share netty handler Jul 12, 2019
@zongtanghu zongtanghu changed the title Enhance share netty handler [ISSUE-1316]Enhance share netty handler Jul 12, 2019
@@ -90,4 +93,18 @@ public void operationComplete(final ResponseFuture responseFuture) {
semaphore.acquire(1);
assertThat(semaphore.availablePermits()).isEqualTo(0);
}

@Test

This comment has been minimized.

Copy link
@vongosling

vongosling Jul 12, 2019

Member

It would be better add share handler test in here, not judge null case but also the same object judgment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.