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 #8970] Remove redundant heartbeats #8971

Conversation

weihubeats
Copy link
Member

weihubeats added 19 commits June 8, 2023 11:36
@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 47.60%. Comparing base (9202de3) to head (2bed031).
Report is 20 commits behind head on develop.

Files with missing lines Patch % Lines
...rocketmq/client/impl/factory/MQClientInstance.java 25.00% 3 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #8971      +/-   ##
=============================================
- Coverage      47.73%   47.60%   -0.13%     
+ Complexity     11774    11752      -22     
=============================================
  Files           1304     1304              
  Lines          91118    91199      +81     
  Branches       11692    11716      +24     
=============================================
- Hits           43495    43418      -77     
- Misses         42264    42400     +136     
- Partials        5359     5381      +22     

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

RongtongJin
RongtongJin previously approved these changes Nov 22, 2024
@RongtongJin
Copy link
Contributor

LGTM

@qianye1001
Copy link
Contributor

it is used to make sure any proxy can receive heartbeat request before receive send or pull request when some proxy services share LB

Copy link
Member

@lizhimins lizhimins left a comment

Choose a reason for hiding this comment

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

Please look the previous comment

@weihubeats
Copy link
Member Author

it is used to make sure any proxy can receive heartbeat request before receive send or pull request when some proxy services share LB

Can you give me an example?

@qianye1001
Copy link
Contributor

it is used to make sure any proxy can receive heartbeat request before receive send or pull request when some proxy services share LB

Can you give me an example?

you can see how GO_AWAY works in remoting protocol to make proxy shutdown gracefully
#8599

when client receive GO_AWAY from proxy, client will reconnect proxy and send heartbeat first.

@weihubeats
Copy link
Member Author

weihubeats commented Nov 22, 2024

We can track connections to the broker where the initial connection triggers client-initiated heartbeats, while reconnections due to go away will have their heartbeats triggered by the onChannelActive even

@weihubeats
Copy link
Member Author

@qianye1001 How does this sit with you

@RongtongJin
Copy link
Contributor

LGTM

Sorry, I didn't realize it would affect the lossless release code

@qianye1001
Copy link
Contributor

Heartbeats are sent to the broker during client start, rebalancing, scheduled tasks, and Channel creation. A locking is used to prevent duplicate heartbeat transmissions. This is a reasonable solution. Add more complex logic to ensure no additional heartbeats are sent would lead to difficulties in understanding and increased maintenance costs.

if only need prevent warning log, it is more recommended to ignore locking failure or check lock stats before send Heartbeat when Channel creation.

@weihubeats
Copy link
Member Author

Heartbeats are sent to the broker during client start, rebalancing, scheduled tasks, and Channel creation. A locking is used to prevent duplicate heartbeat transmissions. This is a reasonable solution. Add more complex logic to ensure no additional heartbeats are sent would lead to difficulties in understanding and increased maintenance costs.

if only need prevent warning log, it is more recommended to ignore locking failure or check lock stats before send Heartbeat when Channel creation.

I have added a strictLockMode parameter to the sendHeartbeatToBroker method to control whether to log lock acquisition failures. When strictLockMode is true, the system will log lock acquisition failures; when false, these failures will be silently ignored.

Copy link
Contributor

@qianye1001 qianye1001 left a comment

Choose a reason for hiding this comment

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

LGTM

@qianye1001
Copy link
Contributor

@lizhimins

1 similar comment
@weihubeats
Copy link
Member Author

@lizhimins

@weihubeats
Copy link
Member Author

@lizhimins Can you help me review this merge request

@lizhimins lizhimins merged commit 564e55e into apache:develop Dec 10, 2024
11 checks passed
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.

5 participants