4min pause before gc
This commit is contained in:
parent
b148be72dc
commit
ba8e5828b8
@ -38,7 +38,8 @@ func main() {
|
||||
// if mem > 3GB and we havent captured a profile this min, capture it
|
||||
// or if its been 2 mins since last profile, capture it
|
||||
t := time.Now().Truncate(time.Minute)
|
||||
if (m.HeapAlloc > uint64(3*1024*1024*1024) && perMinuteMap[t] == 0) || time.Since(timeSinceRefresh) > 2*time.Minute {
|
||||
//if (m.HeapAlloc > uint64(3*1024*1024*1024) && perMinuteMap[t] == 0) || time.Since(timeSinceRefresh) > 2*time.Minute {
|
||||
if time.Since(timeSinceRefresh) > 2*time.Minute {
|
||||
filename := "mem." + strconv.Itoa(profileCounter) + ".pprof"
|
||||
|
||||
f, _ := os.Create(filename)
|
||||
|
||||
@ -463,6 +463,10 @@ func (op *BackupOperation) do(
|
||||
return nil, clues.Wrap(err, "producing backup data collections")
|
||||
}
|
||||
|
||||
// Sleep for 4 mins to let the memory usage settle down so that we have a better
|
||||
// picture. Also allows pprof to run twice during this time.
|
||||
time.Sleep(4 * time.Minute)
|
||||
|
||||
sum := 0
|
||||
numItems := 0
|
||||
mapSum := 0
|
||||
@ -488,10 +492,6 @@ func (op *BackupOperation) do(
|
||||
|
||||
// print total sum
|
||||
logger.Ctx(ctx).Debugf("itemSum %d, map sum %d, total items %d, mem used per item %f mem per item in map %f \n", sum, mapSum, numItems, float64(sum)/float64(numItems), float64(mapSum)/float64(numItems))
|
||||
|
||||
// Sleep for 4 mins to let the memory usage settle down so that we have a better
|
||||
// picture. Also allows pprof to run twice during this time.
|
||||
time.Sleep(3 * time.Minute)
|
||||
}
|
||||
|
||||
return nil, clues.New("failed")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user