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

release-22.2: kv,rangefeed: integrate catchup scans with elastic cpu #92439

Merged
merged 5 commits into from
Nov 28, 2022

Commits on Nov 24, 2022

  1. kvadmission: carve out package for AC<->KV integration

    Pure code movement/renaming. We also renamed a cluster setting
    kv.store.admission.provisioned_bandwidth to
    kvadmission.store.provisioned_bandwidth.
    
    Release note (general note): We renamed a cluster setting
    kv.store.admission.provisioned_bandwidth to
    kvadmission.store.provisioned_bandwidth.
    irfansharif committed Nov 24, 2022
    Configuration menu
    Copy the full SHA
    3c01ccc View commit details
    Browse the repository at this point in the history
  2. roachprod: simplify grafana-url computation

    There's only ever one URL.
    
    Release note: None
    irfansharif committed Nov 24, 2022
    Configuration menu
    Copy the full SHA
    25b3a8f View commit details
    Browse the repository at this point in the history
  3. kv,rangefeed: integrate catchup scans with elastic cpu

    Part of cockroachdb#65957.
    
    Changefeed backfills, given their scan-heavy nature, can be fairly
    CPU-intensive. In cockroachdb#89656 we introduced a roachtest demonstrating the
    latency impact backfills can have on a moderately CPU-saturated cluster.
    Similar to what we saw for backups, this CPU heavy nature can elevate Go
    scheduling latencies which in turn translates to foreground latency
    impact. This commit integrates rangefeed catchup scan with the elastic
    CPU limiter we introduced in cockroachdb#86638; this is one of two optional halves
    of changefeed backfills. The second half is the initial scan -- scan
    requests issued over some keyspan as of some timestamp. For that we
    simply rely on the existing slots mechanism but now setting a lower
    priority bit (BulkNormalPri) -- cockroachdb#88733. Experimentally we observed that
    during initial scans the encoding routines in changefeedccl are the most
    impactful CPU-wise, something cockroachdb#89589 can help with. We leave admission
    integration of parallel worker goroutines to future work (cockroachdb#90089).
    
    Unlike export requests rangefeed catchup scans are non-premptible. The
    rangefeed RPC is a streaming one, and the catchup scan is done during
    stream setup. So we don't have resumption tokens to propagate up to the
    caller like we did for backups. We still want CPU-bound work going
    through admission control to only use 100ms of CPU time, to exercise
    better control over scheduling latencies. To that end, we introduce the
    following component used within the rangefeed catchup iterator.
    
        // Pacer is used in tight loops (CPU-bound) for non-premptible
        // elastic work. Callers are expected to invoke Pace() every loop
        // iteration and Close() once done. Internally this type integrates
        // with elastic CPU work queue, acquiring tokens for the CPU work
        // being done, and blocking if tokens are unavailable. This allows
        // for a form of cooperative scheduling with elastic CPU granters.
        type Pacer struct
        func (p *Pacer) Pace(ctx context.Context) error { ... }
        func (p *Pacer) Close() { ... }
    
    Release note: None
    irfansharif committed Nov 24, 2022
    Configuration menu
    Copy the full SHA
    1753e54 View commit details
    Browse the repository at this point in the history
  4. kvclient: use NormalPri for system-table rangefeed ..

    .. catch-up scans, introduce a private cluster setting
    (kvadmission.rangefeed_catchup_scan_elastic_control.enabled) to
    selectively switch off catch-up scan integration if needed, and plumb
    kvadmission.Pacer in explicitly to rangefeed catchup scan loop instead
    of opaquely through the surrounding context.
    
    Release note: None
    irfansharif committed Nov 24, 2022
    Configuration menu
    Copy the full SHA
    69e2447 View commit details
    Browse the repository at this point in the history
  5. kvadmission: disable AC-integration of rangefeed catch-up scans

    We want this to be disabled by default in 22.2, used only selectively.
    
    Release note: None
    irfansharif committed Nov 24, 2022
    Configuration menu
    Copy the full SHA
    03b2bbd View commit details
    Browse the repository at this point in the history