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

Ensure all topo read calls consider --topo_read_concurrency #17276

Merged

Conversation

timvaillancourt
Copy link
Contributor

@timvaillancourt timvaillancourt commented Nov 23, 2024

Description

This PR implements the feature request #17275 by ensuring that all topo read calls respect the --topo_read_concurrency flag, specifically Get, GetVersion, List, ListDir operations

As discussed in #17275, there is a separate semaphore/limit for "global" and "cell" reads, ie: by default there can be up to 32 concurrent "global" topo reads and 32 concurrent reads per "local" cell

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

@timvaillancourt timvaillancourt added Type: Enhancement Logical improvement (somewhere between a bug and feature) Type: Performance Component: VTorc Vitess Orchestrator integration Component: VTCombo Component: VTTablet Component: VTGate labels Nov 23, 2024
Copy link
Contributor

vitess-bot bot commented Nov 23, 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 Nov 23, 2024
@timvaillancourt timvaillancourt removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work 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 Nov 23, 2024
@github-actions github-actions bot added this to the v22.0.0 milestone Nov 23, 2024
Copy link

codecov bot commented Nov 23, 2024

Codecov Report

Attention: Patch coverage is 73.17073% with 11 lines in your changes missing coverage. Please review.

Project coverage is 67.53%. Comparing base (63dfb9e) to head (91e9640).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/topo/stats_conn.go 61.53% 10 Missing ⚠️
go/vt/vtorc/logic/tablet_discovery.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17276      +/-   ##
==========================================
+ Coverage   67.51%   67.53%   +0.02%     
==========================================
  Files        1580     1581       +1     
  Lines      253805   253945     +140     
==========================================
+ Hits       171358   171506     +148     
+ Misses      82447    82439       -8     

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

@@ -181,6 +186,9 @@ var (

FlagBinaries = []string{"vttablet", "vtctl", "vtctld", "vtcombo", "vtgate",
"vtorc", "vtbackup"}

// Default read concurrency to use in order to avoid overhwelming the topo server.
DefaultReadConcurrency int64 = 32
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved + renamed from DefaultConcurrency from keyspace.go

DefaultReadConcurrency seems more accurate as this only applies to reads

@timvaillancourt timvaillancourt changed the title Ensure topo read calls consider --topo_read_concurrency Ensure all topo read calls consider --topo_read_concurrency Dec 3, 2024
@timvaillancourt timvaillancourt force-pushed the topo_read_concurrency-refactor branch from 10ad8a6 to 7d318cf Compare December 4, 2024 13:11
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.

The only concern I have is what I said on the linked issue #17275 (comment)
Otherwise the implementation looks fine to me.

@timvaillancourt
Copy link
Contributor Author

The only concern I have is what I said on the linked issue #17275 (comment) Otherwise the implementation looks fine to me.

@deepthi 👋, makes sense

I'll re-work this so all cells (global or local) get a limit equal to --topo_read_concurrency, no sharing of limits. I think the single flag will mean the global cell with have a limit that is much higher than required, but maybe that's ok for now

@timvaillancourt
Copy link
Contributor Author

@deepthi updated to use a limit per global and local cell. I also added this a minor change to the v22 changelog 👍

@timvaillancourt timvaillancourt force-pushed the topo_read_concurrency-refactor branch from df7655d to 2f1e599 Compare December 10, 2024 22:05
Signed-off-by: Tim Vaillancourt <[email protected]>
@timvaillancourt
Copy link
Contributor Author

timvaillancourt commented Dec 10, 2024

👋 @deepthi I think I'm done tweaking this PR now

We've backported this to our v19 branch and tested it in a low-volume environment - no issues noticed. Testing on a prod-like environment is to come if we'd like to wait for that

Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

Nice work on this @timvaillancourt !

The only non-nit that I had was related to the function timing stats. Let me know what you think. I can come back to this quickly and we can get it merged.

Thanks!

go/vt/topo/stats_conn.go Show resolved Hide resolved
go/vt/topo/stats_conn.go Show resolved Hide resolved
go/vt/topo/tablet.go Show resolved Hide resolved
Copy link
Member

@GuptaManan100 GuptaManan100 left a comment

Choose a reason for hiding this comment

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

LGTM apart from the outstanding comments

go/vt/discovery/topology_watcher.go Outdated Show resolved Hide resolved
@timvaillancourt
Copy link
Contributor Author

@mattlord thanks for the review. Responded to some comments and addressed @GuptaManan100's point

I think the outstanding topic is which approach to the operation vs. semaphore-wait stats timings. Thoughts appreciated 🙇

Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

Using request changes just to be sure that we resolve the stats questions before merging.

go/vt/topo/stats_conn.go Show resolved Hide resolved
go/vt/topo/stats_conn.go Show resolved Hide resolved
Signed-off-by: Tim Vaillancourt <[email protected]>
@timvaillancourt
Copy link
Contributor Author

I still think it's probably worth adding something to an existing unit test to confirm the new stats, but it looks good to me! Thanks again!

@mattlord no problem!

Yeah with all those defers crammed together it's easy to mis-read. I usually would add empty lines to separate "concepts" like this, but on big codebases I tend to be a chameleon and copy the existing style like I did here

I still think it's probably worth adding something to an existing unit test to confirm the new stats, but it looks good to me! Thanks again!

I agree, this is some important code. Adding some tests

Signed-off-by: Tim Vaillancourt <[email protected]>
@timvaillancourt timvaillancourt merged commit c48d761 into vitessio:main Dec 16, 2024
101 checks passed
@timvaillancourt timvaillancourt deleted the topo_read_concurrency-refactor branch December 16, 2024 19:01
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.

Feature Request: ensure topo calls use --topo_read_concurrency
4 participants