Skip to content

Commit

Permalink
Variables: enhance tidb_enable_gc_tuner (#40850)
Browse files Browse the repository at this point in the history
close #40849
  • Loading branch information
TonsnakeLin authored Jan 30, 2023
1 parent 91686a3 commit ee758bc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions util/gctuner/tuner.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,18 @@ func (t *tuner) getGCPercent() uint32 {
// tuning check the memory inuse and tune GC percent dynamically.
// Go runtime ensure that it will be called serially.
func (t *tuner) tuning() {
if !EnableGOGCTuner.Load() {
return
}

inuse := readMemoryInuse()
threshold := t.getThreshold()
// stop gc tuning
if threshold <= 0 {
return
}
if EnableGOGCTuner.Load() {
t.setGCPercent(calcGCPercent(inuse, threshold))
}

t.setGCPercent(calcGCPercent(inuse, threshold))
}

// threshold = inuse + inuse * (gcPercent / 100)
Expand Down

0 comments on commit ee758bc

Please sign in to comment.