Skip to content
Snippets Groups Projects
Commit 2678fd40 authored by Manish R Jain's avatar Manish R Jain
Browse files

Change how many keys we merge. Also, run gentlyMerge in a goroutine, so our...

Change how many keys we merge. Also, run gentlyMerge in a goroutine, so our memory monitor can call aggressivelyEvict in time. Also, with this change, the memory growth is a heck of a lot more controlled.
parent fa631d84
No related branches found
No related tags found
No related merge requests found
......@@ -98,12 +98,12 @@ func aggressivelyEvict(ms runtime.MemStats) {
Info("Memory Usage after calling GC.")
}
func gentlyMerge(ms runtime.MemStats) {
func gentlyMerge() {
ctr := NewCounters()
defer ctr.ticker.Stop()
// Pick 1% of the dirty map or 400 keys, whichever is higher.
pick := int(float64(dirtymap.Size()) * 0.1)
// Pick 5% of the dirty map or 400 keys, whichever is higher.
pick := int(float64(dirtymap.Size()) * 0.05)
if pick < 400 {
pick = 400
}
......@@ -161,7 +161,8 @@ func checkMemoryUsage() {
aggressivelyEvict(ms)
} else {
gentlyMerge(ms)
// gentlyMerge can take a while to finish. So, run it in a goroutine.
go gentlyMerge()
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment