Skip to content

[Dubbo-perf]: Reduce object allocation for ContextFilter.invoke(Invoker, Invo…#5542

Merged
chickenlj merged 2 commits intoapache:masterfrom
LinShunKang:performance/reduce_object_allocation_v4
Feb 1, 2020
Merged

[Dubbo-perf]: Reduce object allocation for ContextFilter.invoke(Invoker, Invo…#5542
chickenlj merged 2 commits intoapache:masterfrom
LinShunKang:performance/reduce_object_allocation_v4

Conversation

@LinShunKang
Copy link
Copy Markdown
Contributor

…cation) and NetUtils.isInvalidLocalHost(String)

What is the purpose of the change

  • Reduce object allocation.
  • Reduce CPU operations.

Brief changelog

  • Reduce Map$Node and Map$Node[] allocation in ContextFilter.
  • Reduce RpcContext.getContext() invoke times in ContextFilter.
  • Use host.startWith("127.") instead of LOCAL_IP_PATTERN.matcher(host).matches() in NetUtils.isInvalidLocalHost(String).

Verifying this change

XXXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue field 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 [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. 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 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 sample in dubbo samples project.
  • Run mvn clean install -DskipTests=false & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

…cation) and NetUtils.isInvalidLocalHost(String)
@LinShunKang
Copy link
Copy Markdown
Contributor Author

@chickenlj PTAL.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Dec 26, 2019

Codecov Report

Merging #5542 into master will increase coverage by 0.02%.
The diff coverage is 87.09%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #5542      +/-   ##
============================================
+ Coverage      61.2%   61.22%   +0.02%     
  Complexity      423      423              
============================================
  Files           922      922              
  Lines         37514    37505       -9     
  Branches       5436     5433       -3     
============================================
+ Hits          22960    22962       +2     
+ Misses        12071    12060      -11     
  Partials       2483     2483
Impacted Files Coverage Δ Complexity Δ
...ache/dubbo/registry/etcd/EtcdServiceDiscovery.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...che/dubbo/common/compiler/support/JdkCompiler.java 63.2% <ø> (-1.34%) 0 <0> (ø)
...apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java 63.77% <ø> (-0.04%) 0 <0> (ø)
...in/java/org/apache/dubbo/rpc/ListenableFilter.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...api/src/main/java/org/apache/dubbo/rpc/Filter.java 100% <ø> (ø) 0 <0> (ø) ⬇️
...n/serialize/kryo/optimized/KryoSerialization2.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...protobuf/support/GenericProtobufSerialization.java 60% <0%> (ø) 0 <0> (ø) ⬇️
...java/org/apache/dubbo/rpc/model/ConsumerModel.java 55.81% <100%> (+4.53%) 0 <0> (ø) ⬇️
...in/java/org/apache/dubbo/common/utils/IOUtils.java 87.8% <100%> (-1.09%) 0 <0> (ø)
...rg/apache/dubbo/rpc/filter/ExecuteLimitFilter.java 65.21% <100%> (ø) 0 <0> (ø) ⬇️
... and 30 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0840150...4b6d892. Read the comment docs.

@chickenlj chickenlj added this to the 2.7.6 milestone Dec 30, 2019
@chickenlj chickenlj self-assigned this Jan 3, 2020
@guohao
Copy link
Copy Markdown
Contributor

guohao commented Jan 9, 2020

+2 @qinliujie

@chickenlj
Copy link
Copy Markdown
Contributor

LGTM.

@chickenlj chickenlj merged commit c355a1a into apache:master Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants