Skip to content

global-sort: reduce number of SST ingested into TiKV #59962

Closed

Description

@D3Hunter

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

currently, global sort always split data into ranges of 96M, but TiKV already increased the default region size to 256M now, so we will ingest 3 SST files per region.
for import-into see

int64(config.SplitRegionSize),
int64(config.SplitRegionKeys),
, for add-index see
int64(config.SplitRegionSize), int64(config.SplitRegionKeys),

and the ingest performance of TiKV slows down when the number of SST files grows too much, say more than 300K

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

v8.1.0

Activity

  1. added
    affects-8.1This bug affects the 8.1.x(LTS) versions.
    affects-8.5This bug affects the 8.5.x(LTS) versions.
    component/ddlThis issue is related to DDL of TiDB.
    type/bugThe issue is confirmed as a bug.
    on Mar 7, 2025
  2. D3Hunter commented on Mar 7, 2025

    @D3Hunter
    ContributorAuthor

    local sort, including lightning, add-index local sort, import-into local sort, all have similar issue

  3. lance6716 commented on Mar 7, 2025

    @lance6716
    Contributor

    int64(config.SplitRegionSize),
    int64(config.SplitRegionKeys),

    This is the size of ingest job. And the reason why it's different with region size is to increase the concurency. In historical feature development TiKV can set ~10GB per region (dynamic region feature), and lightning must choose a smaller value to increase concurrency. At that time I chose the traditional default value 96MB. So if now it's a bottleneck of import performance, the value can be adjusted again. The value should not be too large to keep a proper overall concurrency.

  4. D3Hunter commented on Mar 7, 2025

    @D3Hunter
    ContributorAuthor

    This is the size of ingest job

    actually, the ingest job data size is determined by min(this range size, region split size)

    see the link PR too

  5. kennedy8312 commented on Mar 10, 2025

    @kennedy8312

    Related to issue/feature: tikv/tikv#17309
    Related to PR: tikv/tikv#17311

  6. D3Hunter commented on Mar 18, 2025

    @D3Hunter
    ContributorAuthor

    with region-size=256M, after #60045, the sst-count:region-count after ingest is about 1.6, there is still space to optimize

    Image

  7. added a commit that references this issue on Mar 24, 2025
    d51e00e
  8. added a commit that references this issue on Mar 27, 2025
    851f12f
  9. added a commit that references this issue on Apr 15, 2025
    bb67e87
  10. added a commit that references this issue on May 6, 2025
    214fde5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.component/ddlThis issue is related to DDL of TiDB.severity/majortype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions