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

[Enhancement] Optimize Tablet Report #54848

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

gengjun-git
Copy link
Contributor

@gengjun-git gengjun-git commented Jan 8, 2025

Why I'm doing:

In StarRocks, FE will periodically diff the tablets in BE and the tablets recorded in metadata, and then process the inconsistent tablets. The current implementation is that BE reports the full number of tablets to the FE Leader regularly (default 1 minute), and the Leader maintains a reporting queue, and then retrieves one BE tablet from the queue each time for single-threaded processing. For large-scale clusters, the speed of FE processing usually cannot keep up with the speed of BE reporting, resulting in the existence of all BE tablets in the reporting queue, which causes memory waste. This optimization uses the Leader's active pull mode to control the tablets in the reporting queue within a BE range.

What I'm doing:

image

After optimization, a new TabletController daemon is added to regularly pull the full number of tablets from the Backend. The pull condition is

  1. For a certain BE, it has been more than collect_tablet_inverval_seconds since the last pull.
  2. The processing queue of ReportHandler is empty.

BE still retains the ability to actively report tablets to FE Leader, but only for emergency situations, such as disk corruption and the need to immediately remove replicas from FE metadata.

Test(a cluster with 5 million tablets)

after optimization
image

before optimization
image

We can see the GC time has become smoother.

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.4
    • 3.3
    • 3.2
    • 3.1
    • 3.0

@wanpengfei-git wanpengfei-git requested a review from a team January 8, 2025 11:24
@gengjun-git gengjun-git marked this pull request as ready for review January 10, 2025 01:49
@gengjun-git gengjun-git requested a review from a team as a code owner January 10, 2025 01:49
@HangyuanLiu HangyuanLiu self-assigned this Jan 10, 2025
@gengjun-git gengjun-git force-pushed the opt_tablet_report branch 2 times, most recently from 3aa14d9 to fdc42ae Compare January 14, 2025 12:31
@@ -34,6 +34,7 @@ struct TMasterInfo {
11: optional list<string> disabled_disks
12: optional list<string> decommissioned_disks
13: optional bool encrypted;
14: optional bool stop_regular_tablet_report;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comment to explain what is flag mean, And which version can deprecate this flag

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Signed-off-by: gengjun-git <gengjun@starrocks.com>
Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 71 / 84 (84.52%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/leader/TabletCollector.java 40 53 75.47% [100, 102, 103, 104, 105, 106, 108, 109, 110, 112, 116, 134, 138]
🔵 com/starrocks/common/Config.java 2 2 100.00% []
🔵 com/starrocks/metric/MetricRepo.java 4 4 100.00% []
🔵 com/starrocks/server/GlobalStateMgr.java 5 5 100.00% []
🔵 com/starrocks/system/HeartbeatMgr.java 1 1 100.00% []
🔵 com/starrocks/leader/LeaderImpl.java 1 1 100.00% []
🔵 com/starrocks/leader/ReportHandler.java 17 17 100.00% []
🔵 com/starrocks/memory/MemoryUsageTracker.java 1 1 100.00% []

Copy link

[BE Incremental Coverage Report]

pass : 28 / 30 (93.33%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/service/service_be/backend_service.cpp 9 10 90.00% [76]
🔵 be/src/agent/task_worker_pool.cpp 14 15 93.33% [709]
🔵 be/src/agent/heartbeat_server.cpp 3 3 100.00% []
🔵 be/src/agent/task_worker_pool.h 2 2 100.00% []

@gengjun-git gengjun-git enabled auto-merge (squash) January 23, 2025 06:07
@gengjun-git gengjun-git merged commit 40edf17 into StarRocks:main Jan 23, 2025
48 of 49 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.

5 participants