From f9e65c237ef88fe21b50bf042cc5250da6394b7a Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Fri, 12 Jul 2024 16:13:40 +0800 Subject: [PATCH 01/11] enlarge the buffer size of transactions broadcaster --- eth/protocols/eth/peer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index ffd78b0594..3118f1d4e2 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -39,11 +39,11 @@ const ( // maxQueuedTxs is the maximum number of transactions to queue up before dropping // older broadcasts. - maxQueuedTxs = 4096 + maxQueuedTxs = 8192 // maxQueuedTxAnns is the maximum number of transaction announcements to queue up // before dropping older announcements. - maxQueuedTxAnns = 4096 + maxQueuedTxAnns = 8192 // maxQueuedBlocks is the maximum number of block propagations to queue up before // dropping broadcasts. There's not much point in queueing stale blocks, so a few From 9298d21477548931055c38732e178156d8279b32 Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Thu, 1 Aug 2024 09:58:53 +0800 Subject: [PATCH 02/11] enlarge buffer size --- eth/protocols/eth/peer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index 3118f1d4e2..46eaa02eab 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -39,11 +39,13 @@ const ( // maxQueuedTxs is the maximum number of transactions to queue up before dropping // older broadcasts. - maxQueuedTxs = 8192 + // we need a higher limit to support 10k txs in a block + maxQueuedTxs = 32768 // maxQueuedTxAnns is the maximum number of transaction announcements to queue up // before dropping older announcements. - maxQueuedTxAnns = 8192 + // we need a higher limit to support 10k txs in a block + maxQueuedTxAnns = 32768 // maxQueuedBlocks is the maximum number of block propagations to queue up before // dropping broadcasts. There's not much point in queueing stale blocks, so a few From 55e3eaa6bf6b8467fc6c4076450c40d150375214 Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Fri, 9 Aug 2024 18:26:55 +0800 Subject: [PATCH 03/11] enlarge buffer size to 6w --- eth/protocols/eth/peer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index 46eaa02eab..8cd3ecdfa7 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -40,12 +40,12 @@ const ( // maxQueuedTxs is the maximum number of transactions to queue up before dropping // older broadcasts. // we need a higher limit to support 10k txs in a block - maxQueuedTxs = 32768 + maxQueuedTxs = 65536 // maxQueuedTxAnns is the maximum number of transaction announcements to queue up // before dropping older announcements. // we need a higher limit to support 10k txs in a block - maxQueuedTxAnns = 32768 + maxQueuedTxAnns = 65536 // maxQueuedBlocks is the maximum number of block propagations to queue up before // dropping broadcasts. There's not much point in queueing stale blocks, so a few From 6f2eaca82b661fe69c26275192e266018191f62a Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Mon, 12 Aug 2024 18:08:37 +0800 Subject: [PATCH 04/11] enlarge p2p buffer to x24 --- eth/protocols/eth/peer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index 8cd3ecdfa7..fc7c2a18ea 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -40,12 +40,12 @@ const ( // maxQueuedTxs is the maximum number of transactions to queue up before dropping // older broadcasts. // we need a higher limit to support 10k txs in a block - maxQueuedTxs = 65536 + maxQueuedTxs = 98304 // maxQueuedTxAnns is the maximum number of transaction announcements to queue up // before dropping older announcements. // we need a higher limit to support 10k txs in a block - maxQueuedTxAnns = 65536 + maxQueuedTxAnns = 98304 // maxQueuedBlocks is the maximum number of block propagations to queue up before // dropping broadcasts. There's not much point in queueing stale blocks, so a few From 0950de0b825a597421565f7928027ff113b21713 Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Mon, 15 Jul 2024 14:34:32 +0800 Subject: [PATCH 05/11] add logs for execution,validation and commit --- core/blockchain.go | 4 ++-- miner/worker.go | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 7e4b81b153..2304934deb 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1929,7 +1929,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) innerExecutionTimer.Update(DebugInnerExecutionDuration) - log.Debug("New payload execution and validation metrics", "hash", block.Hash(), "execution", common.PrettyDuration(ptime), "validation", common.PrettyDuration(vtime), "accountReads", common.PrettyDuration(statedb.AccountReads), "storageReads", common.PrettyDuration(statedb.StorageReads), "snapshotAccountReads", common.PrettyDuration(statedb.SnapshotAccountReads), "snapshotStorageReads", common.PrettyDuration(statedb.SnapshotStorageReads), "accountUpdates", common.PrettyDuration(statedb.AccountUpdates), "storageUpdates", common.PrettyDuration(statedb.StorageUpdates), "accountHashes", common.PrettyDuration(statedb.AccountHashes), "storageHashes", common.PrettyDuration(statedb.StorageHashes)) + log.Info("New payload execution and validation metrics (execution, validation)", "hash", block.Hash(), "execution", common.PrettyDuration(ptime), "validation", common.PrettyDuration(vtime), "accountReads", common.PrettyDuration(statedb.AccountReads), "storageReads", common.PrettyDuration(statedb.StorageReads), "snapshotAccountReads", common.PrettyDuration(statedb.SnapshotAccountReads), "snapshotStorageReads", common.PrettyDuration(statedb.SnapshotStorageReads), "accountUpdates", common.PrettyDuration(statedb.AccountUpdates), "storageUpdates", common.PrettyDuration(statedb.StorageUpdates), "accountHashes", common.PrettyDuration(statedb.AccountHashes), "storageHashes", common.PrettyDuration(statedb.StorageHashes)) // Write the block to the chain and get the status. var ( @@ -1957,7 +1957,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) blockWriteTimer.UpdateSince(wstart) blockInsertTimer.UpdateSince(start) - log.Debug("New payload db write metrics", "hash", block.Hash(), "insert", common.PrettyDuration(time.Since(start)), "writeDB", common.PrettyDuration(time.Since(wstart)), "writeBlock", common.PrettyDuration(time.Since(wstart)), "accountCommit", common.PrettyDuration(statedb.AccountCommits), "storageCommit", common.PrettyDuration(statedb.StorageCommits), "snapshotCommits", common.PrettyDuration(statedb.SnapshotCommits), "triedbCommit", common.PrettyDuration(statedb.TrieDBCommits)) + log.Info("New payload db write metrics (commit)", "commit", time.Since(wstart), "hash", block.Hash(), "insert", common.PrettyDuration(time.Since(start)), "writeDB", common.PrettyDuration(time.Since(wstart)), "writeBlock", common.PrettyDuration(time.Since(wstart)), "accountCommit", common.PrettyDuration(statedb.AccountCommits), "storageCommit", common.PrettyDuration(statedb.StorageCommits), "snapshotCommits", common.PrettyDuration(statedb.SnapshotCommits), "triedbCommit", common.PrettyDuration(statedb.TrieDBCommits)) // Report the import stats before returning the various results stats.processed++ diff --git a/miner/worker.go b/miner/worker.go index c5686f4d5d..87d611c848 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -20,12 +20,13 @@ import ( "context" "errors" "fmt" - mapset "github.com/deckarep/golang-set/v2" "math/big" "sync" "sync/atomic" "time" + mapset "github.com/deckarep/golang-set/v2" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus/misc" @@ -1273,7 +1274,7 @@ func (w *worker) generateWork(genParams *generateParams) *newPayloadResult { work.tcount++ } commitDepositTxsTimer.UpdateSince(start) - log.Debug("commitDepositTxsTimer", "duration", common.PrettyDuration(time.Since(start)), "parentHash", genParams.parentHash) + log.Info("commitDepositTxsTimer (execution)(slave)", "duration", common.PrettyDuration(time.Since(start)), "parentHash", genParams.parentHash) // forced transactions done, fill rest of block with transactions if !genParams.noTxs { @@ -1318,6 +1319,7 @@ func (w *worker) generateWork(genParams *generateParams) *newPayloadResult { isBuildBlockInterruptCounter.Inc(1) } } + log.Info("commitDepositTxsTimer (execution)(master)", "duration", common.PrettyDuration(time.Since(start)), "parentHash", genParams.parentHash) } if intr := genParams.interrupt; intr != nil && genParams.isUpdate && intr.Load() != commitInterruptNone { @@ -1334,7 +1336,7 @@ func (w *worker) generateWork(genParams *generateParams) *newPayloadResult { } assembleBlockTimer.UpdateSince(start) - log.Debug("assembleBlockTimer", "duration", common.PrettyDuration(time.Since(start)), "parentHash", genParams.parentHash) + log.Info("assembleBlockTimer (validation)", "duration", common.PrettyDuration(time.Since(start)), "parentHash", genParams.parentHash) accountReadTimer.Update(work.state.AccountReads) // Account reads are complete(in commit txs) storageReadTimer.Update(work.state.StorageReads) // Storage reads are complete(in commit txs) From 91b3b2f266195b151b0d525ec821806ee2500a47 Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Fri, 9 Aug 2024 14:38:37 +0800 Subject: [PATCH 06/11] add gc metrics --- internal/debug/flags.go | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/internal/debug/flags.go b/internal/debug/flags.go index dac878a7b1..1d43175807 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -25,6 +25,7 @@ import ( "os" "path/filepath" "runtime" + "time" "github.com/ethereum/go-ethereum/internal/flags" "github.com/ethereum/go-ethereum/log" @@ -38,6 +39,26 @@ import ( "gopkg.in/natefinch/lumberjack.v2" ) +var ( + // Metrics for the gc + gcNum = metrics.NewRegisteredGauge("gc/num", nil) + gcNumForce = metrics.NewRegisteredGauge("gc/num/force", nil) + gcNextGC = metrics.NewRegisteredGauge("gc/next/gc", nil) + gcPauseTotalNs = metrics.NewRegisteredGauge("gc/pause/total/ns", nil) + gcCPUUsage = metrics.NewRegisteredGauge("gc/cpu/usage", nil) + gcSys = metrics.NewRegisteredGauge("gc/sys", nil) + gcLookup = metrics.NewRegisteredGauge("gc/lookup", nil) + gcMalloc = metrics.NewRegisteredGauge("gc/malloc", nil) + gcFree = metrics.NewRegisteredGauge("gc/free", nil) + + gcTotalAlloc = metrics.NewRegisteredGauge("gc/heap/total/alloc", nil) + gcHeapAlloc = metrics.NewRegisteredGauge("gc/heap/alloc", nil) + gcHeapInuse = metrics.NewRegisteredGauge("gc/heap/inuse", nil) + gcHeapIdle = metrics.NewRegisteredGauge("gc/heap/idle", nil) + gcHeapRelease = metrics.NewRegisteredGauge("gc/heap/release", nil) + gcHeapObjects = metrics.NewRegisteredGauge("gc/heap/objects", nil) +) + var Memsize memsizeui.Handler var ( @@ -292,6 +313,10 @@ func Setup(ctx *cli.Context) error { // pprof server if ctx.Bool(pprofFlag.Name) { + // start a loop to collect gc stats per second + // it need metris.Enabled to be shown + go CollectGCStats() + listenHost := ctx.String(pprofAddrFlag.Name) port := ctx.Int(pprofPortFlag.Name) @@ -307,6 +332,31 @@ func Setup(ctx *cli.Context) error { return nil } +func CollectGCStats() { + var memstat = runtime.MemStats{} + for { + runtime.ReadMemStats(&memstat) + gcNum.Update(int64(memstat.NumGC)) + gcNumForce.Update(int64(memstat.NumForcedGC)) + gcNextGC.Update(int64(memstat.NextGC)) + gcPauseTotalNs.Update(int64(memstat.PauseTotalNs)) + gcCPUUsage.Update(int64(memstat.GCCPUFraction * 100)) + gcSys.Update(int64(memstat.Sys)) + gcLookup.Update(int64(memstat.Lookups)) + gcMalloc.Update(int64(memstat.Mallocs)) + gcFree.Update(int64(memstat.Frees)) + + gcTotalAlloc.Update(int64(memstat.TotalAlloc)) + gcHeapAlloc.Update(int64(memstat.HeapAlloc)) + gcHeapInuse.Update(int64(memstat.HeapInuse)) + gcHeapIdle.Update(int64(memstat.HeapIdle)) + gcHeapObjects.Update(int64(memstat.HeapObjects)) + gcHeapRelease.Update(int64(memstat.HeapReleased)) + + time.Sleep(1 * time.Second) + } +} + func StartPProf(address string, withMetrics bool) { // Hook go-metrics into expvar on any /debug/metrics request, load all vars // from the registry into expvar, and execute regular expvar handler. From 0bf3a442a171a8a5c683fe1b8cdeb55e364b9731 Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Fri, 16 Aug 2024 05:34:43 +0800 Subject: [PATCH 07/11] add logs for txpool reorg --- core/txpool/legacypool/legacypool.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index a539253fa3..ec22a0fa1e 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -1403,6 +1403,9 @@ func (pool *LegacyPool) runReorg(done chan struct{}, reset *txpoolResetRequest, reorgDurationTimer.Update(time.Since(t0)) if reset != nil { reorgresetTimer.UpdateSince(t0) + if reset.newHead != nil { + log.Info("Transaction pool reorged", "from", reset.oldHead.Number.Uint64(), "to", reset.newHead.Number.Uint64()) + } } }(time.Now()) defer close(done) From a61bef10d12d0407768c1bdec4ac93694da0807b Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Mon, 19 Aug 2024 14:32:11 +0800 Subject: [PATCH 08/11] fix latency metrics of txpool.Add() --- core/txpool/legacypool/legacypool.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index ec22a0fa1e..326ef1194c 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -1110,7 +1110,7 @@ func (pool *LegacyPool) addRemoteSync(tx *types.Transaction) error { // to the add is finished. Only use this during tests for determinism! func (pool *LegacyPool) Add(txs []*types.Transaction, local, sync bool) []error { defer func(t0 time.Time) { - addTimer.UpdateSince(t0) + addTimer.Update(time.Since(t0) / time.Duration(len(txs))) }(time.Now()) // Do not treat as local if local transactions have been disabled local = local && !pool.config.NoLocals @@ -1147,7 +1147,7 @@ func (pool *LegacyPool) Add(txs []*types.Transaction, local, sync bool) []error pool.mu.Lock() t0 := time.Now() newErrs, dirtyAddrs := pool.addTxsLocked(news, local) - addWithLockTimer.UpdateSince(t0) + addWithLockTimer.Update(time.Since(t0) / time.Duration(len(news))) pool.mu.Unlock() var nilSlot = 0 From f6b8c5521b62f33bbd526e0dc434b7ba22fcecc4 Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Mon, 19 Aug 2024 17:01:27 +0800 Subject: [PATCH 09/11] fix panic issue when calculating txpool.Add() latency of per transaction --- core/txpool/legacypool/legacypool.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 326ef1194c..094346ba4f 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -1110,7 +1110,9 @@ func (pool *LegacyPool) addRemoteSync(tx *types.Transaction) error { // to the add is finished. Only use this during tests for determinism! func (pool *LegacyPool) Add(txs []*types.Transaction, local, sync bool) []error { defer func(t0 time.Time) { - addTimer.Update(time.Since(t0) / time.Duration(len(txs))) + if len(txs) > 0 { + addTimer.Update(time.Since(t0) / time.Duration(len(txs))) + } }(time.Now()) // Do not treat as local if local transactions have been disabled local = local && !pool.config.NoLocals @@ -1147,7 +1149,9 @@ func (pool *LegacyPool) Add(txs []*types.Transaction, local, sync bool) []error pool.mu.Lock() t0 := time.Now() newErrs, dirtyAddrs := pool.addTxsLocked(news, local) - addWithLockTimer.Update(time.Since(t0) / time.Duration(len(news))) + if len(news) > 0 { + addWithLockTimer.Update(time.Since(t0) / time.Duration(len(news))) + } pool.mu.Unlock() var nilSlot = 0 From e894ba6599d162842ce95e1d2a61ce3a698f601c Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Wed, 9 Oct 2024 09:55:49 +0800 Subject: [PATCH 10/11] rollback the debug info log --- core/blockchain.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 2304934deb..7e4b81b153 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1929,7 +1929,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) innerExecutionTimer.Update(DebugInnerExecutionDuration) - log.Info("New payload execution and validation metrics (execution, validation)", "hash", block.Hash(), "execution", common.PrettyDuration(ptime), "validation", common.PrettyDuration(vtime), "accountReads", common.PrettyDuration(statedb.AccountReads), "storageReads", common.PrettyDuration(statedb.StorageReads), "snapshotAccountReads", common.PrettyDuration(statedb.SnapshotAccountReads), "snapshotStorageReads", common.PrettyDuration(statedb.SnapshotStorageReads), "accountUpdates", common.PrettyDuration(statedb.AccountUpdates), "storageUpdates", common.PrettyDuration(statedb.StorageUpdates), "accountHashes", common.PrettyDuration(statedb.AccountHashes), "storageHashes", common.PrettyDuration(statedb.StorageHashes)) + log.Debug("New payload execution and validation metrics", "hash", block.Hash(), "execution", common.PrettyDuration(ptime), "validation", common.PrettyDuration(vtime), "accountReads", common.PrettyDuration(statedb.AccountReads), "storageReads", common.PrettyDuration(statedb.StorageReads), "snapshotAccountReads", common.PrettyDuration(statedb.SnapshotAccountReads), "snapshotStorageReads", common.PrettyDuration(statedb.SnapshotStorageReads), "accountUpdates", common.PrettyDuration(statedb.AccountUpdates), "storageUpdates", common.PrettyDuration(statedb.StorageUpdates), "accountHashes", common.PrettyDuration(statedb.AccountHashes), "storageHashes", common.PrettyDuration(statedb.StorageHashes)) // Write the block to the chain and get the status. var ( @@ -1957,7 +1957,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) blockWriteTimer.UpdateSince(wstart) blockInsertTimer.UpdateSince(start) - log.Info("New payload db write metrics (commit)", "commit", time.Since(wstart), "hash", block.Hash(), "insert", common.PrettyDuration(time.Since(start)), "writeDB", common.PrettyDuration(time.Since(wstart)), "writeBlock", common.PrettyDuration(time.Since(wstart)), "accountCommit", common.PrettyDuration(statedb.AccountCommits), "storageCommit", common.PrettyDuration(statedb.StorageCommits), "snapshotCommits", common.PrettyDuration(statedb.SnapshotCommits), "triedbCommit", common.PrettyDuration(statedb.TrieDBCommits)) + log.Debug("New payload db write metrics", "hash", block.Hash(), "insert", common.PrettyDuration(time.Since(start)), "writeDB", common.PrettyDuration(time.Since(wstart)), "writeBlock", common.PrettyDuration(time.Since(wstart)), "accountCommit", common.PrettyDuration(statedb.AccountCommits), "storageCommit", common.PrettyDuration(statedb.StorageCommits), "snapshotCommits", common.PrettyDuration(statedb.SnapshotCommits), "triedbCommit", common.PrettyDuration(statedb.TrieDBCommits)) // Report the import stats before returning the various results stats.processed++ From 043ba0a80e148b60ef9ff49a84bca995ccdfadc8 Mon Sep 17 00:00:00 2001 From: andyzhang2023 Date: Wed, 9 Oct 2024 10:26:01 +0800 Subject: [PATCH 11/11] rollback the debug info logs, we don't need to record them at 'INFO' level --- internal/debug/flags.go | 50 ----------------------------------------- miner/worker.go | 5 ++--- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/internal/debug/flags.go b/internal/debug/flags.go index 1d43175807..dac878a7b1 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -25,7 +25,6 @@ import ( "os" "path/filepath" "runtime" - "time" "github.com/ethereum/go-ethereum/internal/flags" "github.com/ethereum/go-ethereum/log" @@ -39,26 +38,6 @@ import ( "gopkg.in/natefinch/lumberjack.v2" ) -var ( - // Metrics for the gc - gcNum = metrics.NewRegisteredGauge("gc/num", nil) - gcNumForce = metrics.NewRegisteredGauge("gc/num/force", nil) - gcNextGC = metrics.NewRegisteredGauge("gc/next/gc", nil) - gcPauseTotalNs = metrics.NewRegisteredGauge("gc/pause/total/ns", nil) - gcCPUUsage = metrics.NewRegisteredGauge("gc/cpu/usage", nil) - gcSys = metrics.NewRegisteredGauge("gc/sys", nil) - gcLookup = metrics.NewRegisteredGauge("gc/lookup", nil) - gcMalloc = metrics.NewRegisteredGauge("gc/malloc", nil) - gcFree = metrics.NewRegisteredGauge("gc/free", nil) - - gcTotalAlloc = metrics.NewRegisteredGauge("gc/heap/total/alloc", nil) - gcHeapAlloc = metrics.NewRegisteredGauge("gc/heap/alloc", nil) - gcHeapInuse = metrics.NewRegisteredGauge("gc/heap/inuse", nil) - gcHeapIdle = metrics.NewRegisteredGauge("gc/heap/idle", nil) - gcHeapRelease = metrics.NewRegisteredGauge("gc/heap/release", nil) - gcHeapObjects = metrics.NewRegisteredGauge("gc/heap/objects", nil) -) - var Memsize memsizeui.Handler var ( @@ -313,10 +292,6 @@ func Setup(ctx *cli.Context) error { // pprof server if ctx.Bool(pprofFlag.Name) { - // start a loop to collect gc stats per second - // it need metris.Enabled to be shown - go CollectGCStats() - listenHost := ctx.String(pprofAddrFlag.Name) port := ctx.Int(pprofPortFlag.Name) @@ -332,31 +307,6 @@ func Setup(ctx *cli.Context) error { return nil } -func CollectGCStats() { - var memstat = runtime.MemStats{} - for { - runtime.ReadMemStats(&memstat) - gcNum.Update(int64(memstat.NumGC)) - gcNumForce.Update(int64(memstat.NumForcedGC)) - gcNextGC.Update(int64(memstat.NextGC)) - gcPauseTotalNs.Update(int64(memstat.PauseTotalNs)) - gcCPUUsage.Update(int64(memstat.GCCPUFraction * 100)) - gcSys.Update(int64(memstat.Sys)) - gcLookup.Update(int64(memstat.Lookups)) - gcMalloc.Update(int64(memstat.Mallocs)) - gcFree.Update(int64(memstat.Frees)) - - gcTotalAlloc.Update(int64(memstat.TotalAlloc)) - gcHeapAlloc.Update(int64(memstat.HeapAlloc)) - gcHeapInuse.Update(int64(memstat.HeapInuse)) - gcHeapIdle.Update(int64(memstat.HeapIdle)) - gcHeapObjects.Update(int64(memstat.HeapObjects)) - gcHeapRelease.Update(int64(memstat.HeapReleased)) - - time.Sleep(1 * time.Second) - } -} - func StartPProf(address string, withMetrics bool) { // Hook go-metrics into expvar on any /debug/metrics request, load all vars // from the registry into expvar, and execute regular expvar handler. diff --git a/miner/worker.go b/miner/worker.go index 87d611c848..2d26a6a7c8 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1274,7 +1274,7 @@ func (w *worker) generateWork(genParams *generateParams) *newPayloadResult { work.tcount++ } commitDepositTxsTimer.UpdateSince(start) - log.Info("commitDepositTxsTimer (execution)(slave)", "duration", common.PrettyDuration(time.Since(start)), "parentHash", genParams.parentHash) + log.Debug("commitDepositTxsTimer", "duration", common.PrettyDuration(time.Since(start)), "parentHash", genParams.parentHash) // forced transactions done, fill rest of block with transactions if !genParams.noTxs { @@ -1319,7 +1319,6 @@ func (w *worker) generateWork(genParams *generateParams) *newPayloadResult { isBuildBlockInterruptCounter.Inc(1) } } - log.Info("commitDepositTxsTimer (execution)(master)", "duration", common.PrettyDuration(time.Since(start)), "parentHash", genParams.parentHash) } if intr := genParams.interrupt; intr != nil && genParams.isUpdate && intr.Load() != commitInterruptNone { @@ -1336,7 +1335,7 @@ func (w *worker) generateWork(genParams *generateParams) *newPayloadResult { } assembleBlockTimer.UpdateSince(start) - log.Info("assembleBlockTimer (validation)", "duration", common.PrettyDuration(time.Since(start)), "parentHash", genParams.parentHash) + log.Debug("assembleBlockTimer", "duration", common.PrettyDuration(time.Since(start)), "parentHash", genParams.parentHash) accountReadTimer.Update(work.state.AccountReads) // Account reads are complete(in commit txs) storageReadTimer.Update(work.state.StorageReads) // Storage reads are complete(in commit txs)