Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

lightning: reduce memory use (#847) #866

Merged
merged 3 commits into from
Mar 18, 2021

Conversation

ti-srebot
Copy link
Contributor

@ti-srebot ti-srebot commented Mar 13, 2021

cherry-pick #847 to release-4.0
You can switch your code base to this Pull Request by using git-extras:

# In br repo:
git pr https://github.com/pingcap/br/pull/866

After apply modifications, you can push your change to this PR via:

git push [email protected]:ti-srebot/br.git pr/866:release-4.0-01adaa0a1ece

What problem does this PR solve?

Lightning's Local Backend may OOM because some cache are too aggressive.

What is changed and how it works?

(Split off from #815).

  1. Make the engine's mem table size configurable (keep default at 512 MiB)
  2. Make the local writer's mem table size configurable (reduce default from 512 MiB to 128 MiB)
  3. Reduced capacity of LocalWriter.kvsChan from 1024 to 16. Originally this will make Lightning retain 1024 × (region-conc) × (encoded-kvs) in the channel buffer, which can hold over 3 GiB.

Check List

Tests

  • Unit test

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch

Release Note

  • Added configurations tikv-importer.engine-mem-cache-size and tikv-importer.local-writer-mem-cache-size to tune between memory usage and performance.

@overvenus
Copy link
Member

/lgtm

@ti-srebot ti-srebot added the status/LGT1 LGTM1 label Mar 16, 2021
@lance6716
Copy link
Contributor

/lgtm

@ti-srebot ti-srebot added status/LGT2 LGTM2 and removed status/LGT1 LGTM1 labels Mar 16, 2021
@kennytm
Copy link
Collaborator

kennytm commented Mar 17, 2021

/merge

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@ti-srebot merge failed.

@kennytm
Copy link
Collaborator

kennytm commented Mar 17, 2021

/merge

[2021-03-17T03:50:10.641Z] + echo 'Failed to start gcs-server'

[2021-03-17T03:50:10.641Z] Failed to start gcs-server

@kennytm
Copy link
Collaborator

kennytm commented Mar 17, 2021

/run-integration-test

@kennytm
Copy link
Collaborator

kennytm commented Mar 17, 2021

/run-integration-test

[2021-03-17T04:14:57.013Z] TEST: [br_full_ddl] fail due to stats are not equal

@ti-srebot ti-srebot added status/LGT3 LGTM3. This PR looks very good to our bot. and removed status/LGT2 LGTM2 labels Mar 18, 2021
@zhouqiang-cl zhouqiang-cl merged commit 2cae5a8 into pingcap:release-4.0 Mar 18, 2021
@overvenus overvenus added this to the v4.0.12 milestone Mar 18, 2021
@lichunzhu lichunzhu deleted the release-4.0-01adaa0a1ece branch January 26, 2022 09:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants