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

split: replace seeded random source #94752

Closed
kvoli opened this issue Jan 5, 2023 · 0 comments · Fixed by #94754
Closed

split: replace seeded random source #94752

kvoli opened this issue Jan 5, 2023 · 0 comments · Fixed by #94754
Assignees
Labels
A-kv-distribution Relating to rebalancing and leasing. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-kv KV Team

Comments

@kvoli
Copy link
Collaborator

kvoli commented Jan 5, 2023

In #93838 we started using a seeded rand for use in the load based +
splitter's reservoir sampling algorithm.

rand.Soure heap allocates on init approximately 4kb. When intialized
per-replica, this is problematic as nodes scale to large replica counts.

The splitter should instead be initialized with the global rand, to reduce
memory overhead per-replica.

xref #94737

Jira issue: CRDB-23121

@kvoli kvoli added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-kv-distribution Relating to rebalancing and leasing. labels Jan 5, 2023
@kvoli kvoli self-assigned this Jan 5, 2023
@blathers-crl blathers-crl bot added the T-kv KV Team label Jan 5, 2023
craig bot pushed a commit that referenced this issue Jan 5, 2023
94644: tenantcapabilities: introduce TenantCapabilities proto r=ecwall a=arulajmani

This commit adds the skeletal structure for a `TenantCapabilities` proto,
which is intended to encapsulate capabilities for a specific tenant.
Capabilities are intended to be stored in the `system.tenants` table,
in its Info column. To that end, we modify `TenantInfo` to contain
capabilities. However, actually populating this field through SQL is
left to a future commit.

Future commits will also add the infrastructure required to check a
tenant's requests against its capabilities for "privileged" operations.
For now, I've only accounted for the `CanAdminSplit` capability -- this
will likely expand to a fuller set as we introduce other capabilities
in the system.

References #94643

Epic: CRDB-18503
Release note: None

94754: split: init replica lb splitter with global rand r=erikgrinaker a=kvoli

In #93838 we started initializing a new seeded rand for use in the load
based splitter's reservoir sampling algorithm. Previously, the splitter
was initialized using the global rand.

`rand.Source` heap allocates on init approximately 4kb. When initialized
per-replica, this is problematic as nodes scale to large replica counts.

This patch replaces initializing a new random source per-replica with
using the global rand instead.

This removes the heap allocation. This is shown below running 
`kv/splits/nodes=3/quiesce=true` (not at identical replica counts in the test,
 the proportions are the important part).

before:

![image](https://user-images.githubusercontent.com/39606633/210825416-a940904f-47c9-4271-9692-11b40be927f4.png)

after:

![image](https://user-images.githubusercontent.com/39606633/210825742-fc62ea6c-2125-44fe-ac07-984c22986089.png)

resolves: #94752
resolves: #94737

Release note: None

Co-authored-by: Arul Ajmani <[email protected]>
Co-authored-by: Austen McClernon <[email protected]>
@craig craig bot closed this as completed in 891e7a0 Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-kv-distribution Relating to rebalancing and leasing. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-kv KV Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant