Skip to content

[ISSUE 3585] [Part B] Improve encode/decode performance #3588

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

Merged
merged 4 commits into from
Apr 27, 2022

Conversation

areyouok
Copy link
Contributor

@areyouok areyouok commented Dec 6, 2021

  1. [Part B] Improve header encode/decode performance
  2. [Part B] Improve RocketMQSerializable performance with zero-copy

@areyouok areyouok linked an issue Dec 6, 2021 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Dec 7, 2021

Coverage Status

Coverage increased (+0.1%) to 52.114% when pulling 37c87c8 on areyouok:492_PartB into 9de7be4 on apache:develop.

@codecov-commenter
Copy link

codecov-commenter commented Dec 30, 2021

Codecov Report

Attention: Patch coverage is 57.78689% with 103 lines in your changes missing coverage. Please review.

Project coverage is 48.06%. Comparing base (9de7be4) to head (37c87c8).
Report is 6630 commits behind head on develop.

Files with missing lines Patch % Lines
...on/protocol/header/SendMessageRequestHeaderV2.java 50.90% 14 Missing and 13 partials ⚠️
...mmon/protocol/header/PullMessageRequestHeader.java 51.06% 12 Missing and 11 partials ⚠️
...he/rocketmq/remoting/protocol/RemotingCommand.java 61.76% 9 Missing and 4 partials ⚠️
...cketmq/remoting/protocol/RocketMQSerializable.java 80.00% 4 Missing and 7 partials ⚠️
...mon/protocol/header/PullMessageResponseHeader.java 52.63% 5 Missing and 4 partials ⚠️
...mon/protocol/header/SendMessageResponseHeader.java 52.63% 5 Missing and 4 partials ⚠️
...he/rocketmq/remoting/protocol/FastCodesHeader.java 0.00% 9 Missing ⚠️
...broker/processor/AbstractSendMessageProcessor.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3588      +/-   ##
=============================================
- Coverage      48.18%   48.06%   -0.12%     
+ Complexity      5048     5047       -1     
=============================================
  Files            636      637       +1     
  Lines          42506    42637     +131     
  Branches        5568     5605      +37     
=============================================
+ Hits           20483    20495      +12     
- Misses         19545    19627      +82     
- Partials        2478     2515      +37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@areyouok areyouok added this to the 4.9.3 milestone Jan 10, 2022
Copy link
Contributor

@caigy caigy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In request or response header, some Integer fields(queueId, sysFlag, etc) are assigned by java.lang.Integer#parseInt(java.lang.String). Is it more appropriate to use java.lang.Integer#valueOf(java.lang.String) to prevent auto-boxing? valueOf() will use IntegerCache, but the behavior of auto-boxing depends on the implementation of compiler.

@areyouok
Copy link
Contributor Author

In request or response header, some Integer fields(queueId, sysFlag, etc) are assigned by java.lang.Integer#parseInt(java.lang.String). Is it more appropriate to use java.lang.Integer#valueOf(java.lang.String) to prevent auto-boxing? valueOf() will use IntegerCache, but the behavior of auto-boxing depends on the implementation of compiler.

The java 8 compiler use Integer.valueOf(Integer) for auto-boxing, frequently requested values is caching.

By the way, the rocketmq header objects should use primitive types, but I do not change this time.

@vongosling
Copy link
Member

Support go ahead.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@yuz10 yuz10 merged commit 3cbb3b8 into apache:develop Apr 27, 2022
GenerousMan pushed a commit to GenerousMan/rocketmq that referenced this pull request Aug 12, 2022
* [ISSUE 3585] [Part B] Improve header encode/decode performance

* [ISSUE 3585] [Part B] Improve RocketMQSerializable performance with zero-copy; fix securtiy problems.

* [ISSUE 3585] [Part B] Fix unit test

Co-authored-by: yuz10 <845238369@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve performance for 4.9.2
10 participants