@@ -19,9 +19,7 @@ package main
1919
2020import (
2121 "fmt"
22- "math"
2322 "os"
24- godebug "runtime/debug"
2523 "sort"
2624 "strconv"
2725 "strings"
@@ -41,7 +39,6 @@ import (
4139 "github.com/ethereum/go-ethereum/log"
4240 "github.com/ethereum/go-ethereum/metrics"
4341 "github.com/ethereum/go-ethereum/node"
44- gopsutil "github.com/shirou/gopsutil/mem"
4542 "gopkg.in/urfave/cli.v1"
4643)
4744
@@ -300,25 +297,6 @@ func prepare(ctx *cli.Context) {
300297 log .Info ("Dropping default light client cache" , "provided" , ctx .GlobalInt (utils .CacheFlag .Name ), "updated" , 128 )
301298 ctx .GlobalSet (utils .CacheFlag .Name , strconv .Itoa (128 ))
302299 }
303- // Cap the cache allowance and tune the garbage collector
304- mem , err := gopsutil .VirtualMemory ()
305- if err == nil {
306- if 32 << (^ uintptr (0 )>> 63 ) == 32 && mem .Total > 2 * 1024 * 1024 * 1024 {
307- log .Warn ("Lowering memory allowance on 32bit arch" , "available" , mem .Total / 1024 / 1024 , "addressable" , 2 * 1024 )
308- mem .Total = 2 * 1024 * 1024 * 1024
309- }
310- allowance := int (mem .Total / 1024 / 1024 / 3 )
311- if cache := ctx .GlobalInt (utils .CacheFlag .Name ); cache > allowance {
312- log .Warn ("Sanitizing cache to Go's GC limits" , "provided" , cache , "updated" , allowance )
313- ctx .GlobalSet (utils .CacheFlag .Name , strconv .Itoa (allowance ))
314- }
315- }
316- // Ensure Go's GC ignores the database cache for trigger percentage
317- cache := ctx .GlobalInt (utils .CacheFlag .Name )
318- gogc := math .Max (20 , math .Min (100 , 100 / (float64 (cache )/ 1024 )))
319-
320- log .Debug ("Sanitizing Go's GC trigger" , "percent" , int (gogc ))
321- godebug .SetGCPercent (int (gogc ))
322300
323301 // Start metrics export if enabled
324302 utils .SetupMetrics (ctx )
0 commit comments