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

feat: skip proxy health check if connection is not active #1595

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BruceAko
Copy link
Contributor

@BruceAko BruceAko commented Jul 3, 2024

Relevant Issue (if applicable)

Fixes #1588

Details

  1. Add last_active field for Connection. When Connection.call() is called, last_active is updated to current timestamp.
  2. Add check_pause_elapsed field for ProxyConfig and MirrorConfig. Connection is considered to be inactive if the current time to the last_active time exceeds check_pause_elapsed.
  3. In proxy and mirror's health checking thread's loop, if the connection is not active (exceeds check_pause_elapsed), this round of health check is skipped.
  4. Update the document.

Types of changes

What types of changes does your PullRequest introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@BruceAko BruceAko requested a review from a team as a code owner July 3, 2024 06:01
@BruceAko BruceAko requested review from changweige, adamqqqplay and hsiangkao and removed request for a team July 3, 2024 06:01
@BruceAko BruceAko force-pushed the master branch 4 times, most recently from 74bdd96 to ac5aedf Compare July 3, 2024 10:52
storage/src/backend/connection.rs Outdated Show resolved Hide resolved
storage/src/backend/connection.rs Outdated Show resolved Hide resolved
api/src/config.rs Outdated Show resolved Hide resolved
@imeoer
Copy link
Collaborator

imeoer commented Jul 4, 2024

Also need to handle the start_mirrors_health_thread func.

@imeoer
Copy link
Collaborator

imeoer commented Jul 4, 2024

Please also update the doc for these sections:

  • Enable Mirrors for Storage Backend
  • Enable P2P Proxy for Storage Backend

@BruceAko BruceAko force-pushed the master branch 6 times, most recently from 11454b5 to ed40f0a Compare July 9, 2024 08:41
1. Add last_active field for Connection. When Connection.call() is called, last_active is updated to current timestamp.
2. Add check_pause_elapsed field for ProxyConfig and MirrorConfig. Connection is considered to be inactive if the current time to the last_active time exceeds check_pause_elapsed.
3. In proxy and mirror's health checking thread's loop, if the connection is not active (exceeds check_pause_elapsed), this round of health check is skipped.
4. Update the document.

Signed-off-by: BruceAko <[email protected]>
@BruceAko
Copy link
Contributor Author

BruceAko commented Jul 9, 2024

The above has been revised, PTAL, thanks. @imeoer

Copy link
Collaborator

@imeoer imeoer left a comment

Choose a reason for hiding this comment

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

others LGTM, thanks!

@@ -938,6 +942,9 @@ pub struct MirrorConfig {
/// Maximum number of failures before marking a mirror as unusable.
#[serde(default = "default_failure_limit")]
pub failure_limit: u8,
/// Elapsed time to pause mirror health check when the request is inactive, in seconds.
#[serde(default = "default_check_pause_elapsed")]
pub check_pause_elapsed: u64,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have health_check_interval, so maybe name it health_check_pause_elapsed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, PTAL :) @imeoer

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.

should close health check connection after image data request done
2 participants