@@ -19,9 +19,7 @@ package main
19
19
20
20
import (
21
21
"fmt"
22
- "math"
23
22
"os"
24
- godebug "runtime/debug"
25
23
"sort"
26
24
"strconv"
27
25
"strings"
@@ -41,7 +39,6 @@ import (
41
39
"github.com/ethereum/go-ethereum/log"
42
40
"github.com/ethereum/go-ethereum/metrics"
43
41
"github.com/ethereum/go-ethereum/node"
44
- gopsutil "github.com/shirou/gopsutil/mem"
45
42
"gopkg.in/urfave/cli.v1"
46
43
)
47
44
@@ -300,25 +297,6 @@ func prepare(ctx *cli.Context) {
300
297
log .Info ("Dropping default light client cache" , "provided" , ctx .GlobalInt (utils .CacheFlag .Name ), "updated" , 128 )
301
298
ctx .GlobalSet (utils .CacheFlag .Name , strconv .Itoa (128 ))
302
299
}
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 ))
322
300
323
301
// Start metrics export if enabled
324
302
utils .SetupMetrics (ctx )
0 commit comments