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

Move concurrent connection dial limit out of healthcheck. #16378

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

arthurschreiber
Copy link
Contributor

@arthurschreiber arthurschreiber commented Jul 14, 2024

Description

There's a concurrent connection dial limit implemented in the healthcheck code that doesn't semantically or logically belong here.

First, the healthcheck code does neither know nor care about the network protocol used to execute healthchecks. Arguably, there's no other protocol used for this apart from grpc, but it seems wrong to set up grpc connection specific options in the healthcheck code.

Additionally, the dial concurrency limit modifies the global grpc connection options the first time a healthcheck is started. That seems unexpected, and I believe we want the concurrency limit set for all grpc dial operations, irrespective of whether those connections are used for healtchecking or anything else.

This change moves the concurrency limit into the grpcclient package, and sets it on any grpc connection opened via that package.

This introduces a new CLI option called --grpc-dial-concurrency-limit for all binaries except vttablet. For vttablet, we need to deprecate the --healthcheck-dial-concurrency flag and replace it with --grpc-dial-concurrency-limit as well.

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

Copy link
Contributor

vitess-bot bot commented Jul 14, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Jul 14, 2024
@github-actions github-actions bot added this to the v21.0.0 milestone Jul 14, 2024
@arthurschreiber arthurschreiber added Component: CLI and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Jul 14, 2024
Copy link

codecov bot commented Jul 14, 2024

Codecov Report

Attention: Patch coverage is 70.96774% with 9 lines in your changes missing coverage. Please review.

Project coverage is 69.46%. Comparing base (3d36adb) to head (d3b5c0b).
Report is 225 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/grpcclient/client.go 66.66% 8 Missing ⚠️
go/vt/discovery/healthcheck.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16378      +/-   ##
==========================================
+ Coverage   68.66%   69.46%   +0.79%     
==========================================
  Files        1548     1571      +23     
  Lines      199083   203504    +4421     
==========================================
+ Hits       136694   141357    +4663     
+ Misses      62389    62147     -242     

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

There's a concurrent connection dial limit implemented in the healthcheck code that doesn't semantically or logically belong here.

First, the healthcheck code does neither know nor care about the network protocol used to execute healthchecks. Arguably, there's no other protocol used for this apart from `grpc`, but it seems wrong to set up a `grpc` connection specific options in the healthcheck code.

Additionally, the dial concurrency limit modifies the global `grpc` connection options the first time a healthcheck is started. That seems unexpected, and I believe we want the concurrency limit set for all `grpc`` dial operations, irrespective of whether those connections are used for healtchecking or anything else.

This change moves the concurrency limit into the `grpcclient` package, and sets it on any `grpc` connection opened via that package.

Signed-off-by: Arthur Schreiber <arthurschreiber@github.com>
@arthurschreiber arthurschreiber force-pushed the arthur/healthcheck-cleanup branch from df43aa0 to 9d2edb8 Compare July 14, 2024 16:33
@arthurschreiber arthurschreiber marked this pull request as ready for review July 14, 2024 20:40
Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

Not a bad idea. Though I believe it is vtgate where we'd need to deprecate the previous flag, not vttablet.
Let's ask Tim for the first review.

@deepthi deepthi requested a review from timvaillancourt July 18, 2024 19:34
@timvaillancourt
Copy link
Contributor

I pondered this when this was implemented. I think this is a great idea

I imagine the old flag isn't used by most but a smooth depreciation of the old flag probably makes sense

@timvaillancourt
Copy link
Contributor

I believe both vtgate and vttablet have this because txthrottler calls discovery

@timvaillancourt
Copy link
Contributor

Missed some CI problems that should be addressed

Copy link
Contributor

This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:

  • Push additional commits to the associated branch.
  • Remove the stale label.
  • Add a comment indicating why it is not stale.

If no action is taken within 7 days, this PR will be closed.

@github-actions github-actions bot added the Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. label Aug 18, 2024
@timvaillancourt timvaillancourt removed the Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. label Aug 23, 2024
@timvaillancourt timvaillancourt self-requested a review August 30, 2024 18:02
@timvaillancourt
Copy link
Contributor

@arthurschreiber I think this would be good to get into v21

It looks like the only thing preventing CI from passing is some e2e flag tests for the new flag. Can you update the test files? 🙇

Signed-off-by: Arthur Schreiber <arthurschreiber@github.com>
@arthurschreiber
Copy link
Contributor Author

I think I got this right. The existing --healthcheck-dial-concurrency flag is deprecated, but should still work when set, unless --grpc-dial-concurrency-limit is set as well, in which case the value set by --grpc-dial-concurrency-limit will "win".

Copy link
Contributor

@timvaillancourt timvaillancourt left a comment

Choose a reason for hiding this comment

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

Thanks @arthurschreiber! 🙇

Copy link
Member

@harshit-gangal harshit-gangal left a comment

Choose a reason for hiding this comment

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

The 10000 is a configurable limit from go1.2 onwards. This code could be older than this version.
We can probably point to https://pkg.go.dev/runtime/debug#SetMaxThreads in the flag description.

@harshit-gangal
Copy link
Member

The 10000 is a configurable limit from go1.2 onwards. This code could be older than this version. We can probably point to https://pkg.go.dev/runtime/debug#SetMaxThreads in the flag description.

Merging this to unblock release. We can change the wording of the flag in a later PR is seems reasonable.

@harshit-gangal harshit-gangal merged commit 056afc9 into vitessio:main Oct 7, 2024
98 checks passed
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.

4 participants