Skip to content

Conversation

@snaury
Copy link
Member

@snaury snaury commented Nov 28, 2025

Changelog entry

Avoid excessive cpu usage when registering large number of service counters. Fixes #29606.

Changelog category

  • Bugfix

Description for reviewers

Avoid sorting registered actor pages until the next render.

Order of database labels is now fixed (should be synchronized between counters and labels maintainer actor for efficiency) and we try to descend the tree once for each such label when performing service counters lookups. When orders match we perform at most two such lookups with logarithmic complexity in the number of trailing subgroups (12 * O(log N) string comparions for 6 labels), which is still better than linear complexity for a large number of counters (was O(N) where N is the number of subgroups after the last label).

Merges #29667.

snaury and others added 3 commits November 28, 2025 16:58
YDB динамически регистрирует страницы запускающихся акторов в некоторых сервисах, при этом страницы в индексе хочется иметь сортированными. При одновременной регистрации большого кол-ва акторов множественные вызовы SortPages приводят к тому, что их регистрация растёт квадратично. Мне кажется лучше откладывать сортировку страниц до следующего рендера.
commit_hash:22e547b6c8d2ce0c1fabebe985793520ec932f30
YDB использует динамическое дерево счётчиков с множеством опциональных лейблов после идентификатора сервиса, которые могут появляться и меняться. Сервисы при регистрации пытаются найти в каком узле дерева регистрировать счётчики пропуская эти опциональные лейблы, если они уже существуют. Исторически такой пропуск работает через `EnumerateSubgroups`, однако обнаружилось, что если сразу после опциональных лейблов дерево очень сильно ветвится (например по номерам групп в dsproxy), то при регистрации большого кол-ва счётчиков по группам эта регистрация становится квадратичной от количества групп. Хочется добавить новый метод `FindSubgroup(TString)` чтобы искать пропускаемые лейблы за `O(log N)` вместо `O(N)`.
commit_hash:7ce074f58a3a90caf535d8fad24eef7ac6782d06
@snaury snaury self-assigned this Nov 28, 2025
@github-actions
Copy link

github-actions bot commented Nov 28, 2025

2025-11-28 14:00:53 UTC Pre-commit check linux-x86_64-relwithdebinfo for 69d5544 has started.
2025-11-28 14:00:57 UTC Artifacts will be uploaded here
2025-11-28 14:05:31 UTC ya make is running...
🟡 2025-11-28 16:39:53 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
41487 38773 0 9 2679 26

2025-11-28 16:43:18 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-11-28 17:02:19 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1198 (only retried tests) 1180 0 2 1 15

2025-11-28 17:02:31 UTC ya make is running... (failed tests rerun, try 3)
🔴 2025-11-28 17:16:44 UTC Some tests failed, follow the links below.

Ya make output | Test bloat | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
547 (only retried tests) 533 0 2 1 11

🟢 2025-11-28 17:16:53 UTC Build successful.
🟢 2025-11-28 17:17:17 UTC ydbd size 2.3 GiB changed* by -8.5 KiB, which is <= 0 Bytes vs stable-25-3-1: OK

ydbd size dash stable-25-3-1: 1f4c818 merge: 69d5544 diff diff %
ydbd size 2 436 641 440 Bytes 2 436 632 752 Bytes -8.5 KiB -0.000%
ydbd stripped size 521 782 984 Bytes 521 779 080 Bytes -3.8 KiB -0.001%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Nov 28, 2025

2025-11-28 14:01:47 UTC Pre-commit check linux-x86_64-release-asan for 69d5544 has started.
2025-11-28 14:02:06 UTC Artifacts will be uploaded here
2025-11-28 14:06:32 UTC ya make is running...
🟡 2025-11-28 17:04:33 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
18647 18175 0 197 258 17

🟢 2025-11-28 17:06:07 UTC Build successful.
🟢 2025-11-28 17:06:42 UTC ydbd size 3.8 GiB changed* by -1.8 KiB, which is <= 0 Bytes vs stable-25-3-1: OK

ydbd size dash stable-25-3-1: 1f4c818 merge: 69d5544 diff diff %
ydbd size 4 054 470 320 Bytes 4 054 468 528 Bytes -1.8 KiB -0.000%
ydbd stripped size 1 510 974 624 Bytes 1 510 967 232 Bytes -7.2 KiB -0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

🟢 2025-11-28 14:13:17 UTC The validation of the Pull Request description is successful.

@snaury snaury marked this pull request as ready for review November 28, 2025 15:28
@snaury snaury requested a review from a team as a code owner November 28, 2025 15:28
@maximyurchuk maximyurchuk added the rebase-and-check Rebase PR with the current base branch and check label Nov 29, 2025
@github-actions github-actions bot removed the rebase-and-check Rebase PR with the current base branch and check label Nov 29, 2025
@github-actions
Copy link

github-actions bot commented Nov 29, 2025

2025-11-29 13:56:20 UTC Pre-commit check linux-x86_64-release-asan for 702d2c2 has started.
2025-11-29 13:56:35 UTC Artifacts will be uploaded here
2025-11-29 14:00:51 UTC ya make is running...
🟡 2025-11-29 16:09:18 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
18647 18151 0 204 276 16

🟢 2025-11-29 16:10:45 UTC Build successful.
🟢 2025-11-29 16:11:08 UTC ydbd size 3.8 GiB changed* by -7.9 KiB, which is <= 0 Bytes vs stable-25-3-1: OK

ydbd size dash stable-25-3-1: e7c925d merge: 702d2c2 diff diff %
ydbd size 4 054 470 624 Bytes 4 054 462 544 Bytes -7.9 KiB -0.000%
ydbd stripped size 1 510 974 688 Bytes 1 510 964 736 Bytes -9.7 KiB -0.001%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Nov 29, 2025

2025-11-29 13:56:35 UTC Pre-commit check linux-x86_64-relwithdebinfo for 702d2c2 has started.
2025-11-29 13:56:50 UTC Artifacts will be uploaded here
2025-11-29 14:01:12 UTC ya make is running...
🟡 2025-11-29 15:36:21 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
41487 38800 0 14 2652 21

2025-11-29 15:39:39 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-11-29 15:57:55 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1001 (only retried tests) 985 0 1 1 14

2025-11-29 15:58:06 UTC ya make is running... (failed tests rerun, try 3)
🟢 2025-11-29 16:14:31 UTC Tests successful.

Ya make output | Test bloat | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
549 (only retried tests) 532 0 0 1 16

🟢 2025-11-29 16:14:39 UTC Build successful.
🟢 2025-11-29 16:15:02 UTC ydbd size 2.3 GiB changed* by -8.5 KiB, which is <= 0 Bytes vs stable-25-3-1: OK

ydbd size dash stable-25-3-1: 0f9413e merge: 702d2c2 diff diff %
ydbd size 2 436 637 744 Bytes 2 436 629 064 Bytes -8.5 KiB -0.000%
ydbd stripped size 521 781 896 Bytes 521 777 992 Bytes -3.8 KiB -0.001%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@snaury snaury merged commit 8fd50d8 into ydb-platform:stable-25-3-1 Dec 1, 2025
15 of 16 checks passed
@snaury snaury deleted the bugfix-29606-faster-dsproxy-registration-25-3-1-stable branch December 1, 2025 07:45
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.

2 participants