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

kv,sql: improve rebalancing for incrementing indexes #81984

Open
irfansharif opened this issue May 27, 2022 · 1 comment
Open

kv,sql: improve rebalancing for incrementing indexes #81984

irfansharif opened this issue May 27, 2022 · 1 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

Comments

@irfansharif
Copy link
Contributor

irfansharif commented May 27, 2022

Is your feature request related to a problem? Please describe.

Heavy read/write workloads on incrementing indexes (timestamps are a common one) create moving hotspots in KV that are difficult to split+rebalance for better aggregate utilization. With such write patters, we're reading/writing to the right hand side of the last range in the index, and with our current structure of splitting off + rebalancing the RHS as a reaction to increased # of batch requests load, we'd be continuously rebalancing (with network costs/utilization) but still have single-range hostspots.

Describe the solution you'd like

A few ideas to improve here:

  • splitting + rebalancing ahead of the incrementing index
    • detecting such patterns automatically, and/or through heuristics (such as indexes on commonly incrementing types like timestamps) or user-provided hints
  • auto-hashsharding indexes on timestamps, or on sequence-based indexes
  • (bad idea) encoding incrementing keys to sort in decrementing order (would not help with load distribution, but prevents incoming writes from contending with load-based splits and lease transfers

Additional context

Relevant internal issues: https://github.com/cockroachlabs/support/issues/1590, https://github.com/cockroachlabs/support/issues/1533.

Jira issue: CRDB-16157

@irfansharif irfansharif 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. O-postmortem Originated from a Postmortem action item. labels May 27, 2022
@mwang1026 mwang1026 added this to Incoming in KV via automation May 27, 2022
@blathers-crl blathers-crl bot added the T-kv KV Team label May 27, 2022
@mwang1026 mwang1026 moved this from Incoming to Prioritized in KV Jun 1, 2022
@irfansharif
Copy link
Contributor Author

irfansharif commented Jun 2, 2022

For detection of incrementing indexes, short of sophisticated visualizers I wonder if simple heuristics get us most of the way. Strawman: % of requests on an index targeting the last X% of an index’s keyspan sustained over some rolling period of time, surfaced as a warning similar to how we surface the presence of full table scans. +cc @mwang1026.

@exalate-issue-sync exalate-issue-sync bot removed the O-postmortem Originated from a Postmortem action item. label Mar 7, 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
KV
Prioritized
Development

No branches or pull requests

1 participant