diff --git a/cmd/prometheus/dashboards/erigon.json b/cmd/prometheus/dashboards/erigon.json index 58591174036863e608fe6ec4977f0347cc1216e7..2dfe84dd4c613abfd2db40ceb0fa0b9c6000b275 100644 --- a/cmd/prometheus/dashboards/erigon.json +++ b/cmd/prometheus/dashboards/erigon.json @@ -22,7 +22,7 @@ "gnetId": null, "graphTooltip": 0, "id": 1, - "iteration": 1631842473201, + "iteration": 1632101487032, "links": [], "panels": [ { @@ -2388,7 +2388,32 @@ }, "unit": "s" }, - "overrides": [] + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "pool_write_to_db: turbogeth16c.weblogix.it:6060" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] }, "gridPos": { "h": 8, @@ -2415,7 +2440,7 @@ "exemplar": true, "expr": "pool_process_remote_txs{quantile=\"$quantile\",instance=~\"$instance\"}", "interval": "", - "legendFormat": "pool_process_remote_txs: {{ instance }}", + "legendFormat": "process_remote_txs: {{ instance }}", "refId": "A" }, { @@ -2423,7 +2448,7 @@ "expr": "pool_add_remote_txs{quantile=\"$quantile\",instance=~\"$instance\"}", "hide": false, "interval": "", - "legendFormat": "pool_add_remote_txs: {{ instance }}", + "legendFormat": "add_remote_txs: {{ instance }}", "refId": "B" }, { @@ -2431,7 +2456,7 @@ "expr": "pool_new_block{quantile=\"$quantile\",instance=~\"$instance\"}", "hide": false, "interval": "", - "legendFormat": "pool_new_block: {{ instance }}", + "legendFormat": "new_block: {{ instance }}", "refId": "C" }, { @@ -2439,8 +2464,24 @@ "expr": "pool_write_to_db{quantile=\"$quantile\",instance=~\"$instance\"}", "hide": false, "interval": "", - "legendFormat": "pool_write_to_db: {{ instance }}", + "legendFormat": "write_to_db: {{ instance }}", "refId": "D" + }, + { + "exemplar": true, + "expr": "pool_propagate_to_new_peer{quantile=\"$quantile\",instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "propagate_to_new_peer: {{ instance }}", + "refId": "E" + }, + { + "exemplar": true, + "expr": "pool_propagate_new_txs{quantile=\"$quantile\",instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "propagate_new_txs: {{ instance }}", + "refId": "F" } ], "title": "Timings", @@ -2498,7 +2539,32 @@ }, "unit": "reqps" }, - "overrides": [] + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "pool_add_remote_txs_count: turbogeth16c.weblogix.it:6060" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] }, "gridPos": { "h": 8, @@ -2693,7 +2759,32 @@ ] } }, - "overrides": [] + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "hit: turbogeth16c.weblogix.it:6060 " + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] }, "gridPos": { "h": 6, @@ -2787,32 +2878,7 @@ }, "unit": "short" }, - "overrides": [ - { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - "keys: turbogeth16c.weblogix.it:6060 " - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [ - { - "id": "custom.hideFrom", - "value": { - "legend": false, - "tooltip": false, - "viz": true - } - } - ] - } - ] + "overrides": [] }, "gridPos": { "h": 6, @@ -2845,10 +2911,10 @@ }, { "exemplar": true, - "expr": "rate(cache_timeout_total{name=\"txpool\",instance=~\"$instance\"}[1m])", + "expr": "cache_list_total{name=\"txpool\",instance=~\"$instance\"}", "hide": false, "interval": "", - "legendFormat": "timeout/sec: {{ instance }} ", + "legendFormat": "list: {{ instance }} ", "refId": "B" } ], @@ -2904,14 +2970,14 @@ } ] }, - "unit": "decbytes" + "unit": "binBps" }, "overrides": [] }, "gridPos": { "h": 6, "w": 8, - "x": 8, + "x": 0, "y": 73 }, "id": 178, @@ -4915,12 +4981,8 @@ "allValue": null, "current": { "selected": false, - "text": [ - "turbogeth16c.weblogix.it:6060" - ], - "value": [ - "turbogeth16c.weblogix.it:6060" - ] + "text": "All", + "value": "$__all" }, "datasource": "Prometheus", "definition": "go_goroutines", @@ -5055,5 +5117,5 @@ "timezone": "", "title": "Erigon Prometheus", "uid": "FPpjH6Hik", - "version": 35 + "version": 40 } \ No newline at end of file diff --git a/eth/backend.go b/eth/backend.go index b990df03efd7a609e2d29d5d200cfb5323e739e7..ff99614c993f50a3db394580c185ee406566e40d 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -476,6 +476,40 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere } }() } + + // start pool on non-mainnet immediately + if backend.chainConfig.ChainID.Uint64() != params.MainnetChainConfig.ChainID.Uint64() && !backend.config.TxPool.Disable { + if err := chainKv.View(ctx, func(tx kv.Tx) error { + execution, _ := stages.GetStageProgress(tx, stages.Execution) + hh := rawdb.ReadCurrentHeader(tx) + tx.Rollback() + if hh == nil { + return nil + } + if backend.config.TxPool.V2 { + if err := backend.txPool2DB.View(context.Background(), func(tx kv.Tx) error { + var baseFee uint64 + if hh.BaseFee != nil { + baseFee = hh.BaseFee.Uint64() + } + return backend.txPool2.OnNewBlock(context.Background(), &remote.StateChangeBatch{ + DatabaseViewID: tx.ViewID(), ChangeBatch: []*remote.StateChange{ + {BlockHeight: hh.Number.Uint64(), BlockHash: gointerfaces.ConvertHashToH256(hh.Hash()), ProtocolBaseFee: baseFee}, + }, + }, txpool2.TxSlots{}, txpool2.TxSlots{}, tx) + }); err != nil { + return err + } + } else { + if err := backend.txPool.Start(hh.GasLimit, execution); err != nil { + return err + } + } + return nil + }); err != nil { + return nil, err + } + } } go func() { defer debug.LogPanic() @@ -635,38 +669,6 @@ func (s *Ethereum) StartMining(ctx context.Context, db kv.RwDB, mining *stagedsy }) } - if s.chainConfig.ChainID.Uint64() != params.MainnetChainConfig.ChainID.Uint64() && !s.config.TxPool.Disable { - tx, err := db.BeginRo(context.Background()) - if err != nil { - return err - } - defer tx.Rollback() - execution, _ := stages.GetStageProgress(tx, stages.Execution) - hh := rawdb.ReadCurrentHeader(tx) - tx.Rollback() - if hh != nil { - if s.config.TxPool.V2 { - if err := s.txPool2DB.View(context.Background(), func(tx kv.Tx) error { - var baseFee uint64 - if hh.BaseFee != nil { - baseFee = hh.BaseFee.Uint64() - } - return s.txPool2.OnNewBlock(context.Background(), &remote.StateChangeBatch{ - DatabaseViewID: tx.ViewID(), ChangeBatch: []*remote.StateChange{ - {BlockHeight: hh.Number.Uint64(), BlockHash: gointerfaces.ConvertHashToH256(hh.Hash()), ProtocolBaseFee: baseFee}, - }, - }, txpool2.TxSlots{}, txpool2.TxSlots{}) - }); err != nil { - return err - } - } else { - if err := s.txPool.Start(hh.GasLimit, execution); err != nil { - return err - } - } - } - } - if s.chainConfig.ChainID.Uint64() > 10 { go func() { skipCycleEvery := time.NewTicker(3 * time.Second) diff --git a/go.mod b/go.mod index 060da76615e50e426bf2dd5c4889e6cba5eb6dc2..a035bd33a0756fd44f21741fa72d1c9baee168c2 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/json-iterator/go v1.1.11 github.com/julienschmidt/httprouter v1.3.0 github.com/kevinburke/go-bindata v3.21.0+incompatible - github.com/ledgerwatch/erigon-lib v0.0.0-20210918130108-95f4ac34fd13 + github.com/ledgerwatch/erigon-lib v0.0.0-20210920034821-ae9197c34bd1 github.com/ledgerwatch/log/v3 v3.3.0 github.com/ledgerwatch/secp256k1 v0.0.0-20210626115225-cd5cd00ed72d github.com/logrusorgru/aurora/v3 v3.0.0 diff --git a/go.sum b/go.sum index f029bbc07bf6e905317e184980dee3ee27ecb52f..9aaaa27b307e0f210766685f71a292af644350fd 100644 --- a/go.sum +++ b/go.sum @@ -492,8 +492,8 @@ github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3P github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/ledgerwatch/erigon-lib v0.0.0-20210918130108-95f4ac34fd13 h1:Pgs2rcuUTLmEIuFAiKSKN16cz36CWLfnGLqOntvi+Hs= -github.com/ledgerwatch/erigon-lib v0.0.0-20210918130108-95f4ac34fd13/go.mod h1:kZsi9wFAOYIkegoiSj10RXOVc0EmDtUxltnNP1f1ZE0= +github.com/ledgerwatch/erigon-lib v0.0.0-20210920034821-ae9197c34bd1 h1:9fOCTX4CpzolyEGJZc3mobTYLL+XTXO2fuzyFW1QWTM= +github.com/ledgerwatch/erigon-lib v0.0.0-20210920034821-ae9197c34bd1/go.mod h1:kZsi9wFAOYIkegoiSj10RXOVc0EmDtUxltnNP1f1ZE0= github.com/ledgerwatch/log/v3 v3.3.0 h1:k8N/3NQLILr8CKCMyza261vLFKU7VA+nMNNb0wVyQSc= github.com/ledgerwatch/log/v3 v3.3.0/go.mod h1:J58eOHHrIYHxl7LKkRsb/0YibKwtLfauUryl5SLRGm0= github.com/ledgerwatch/secp256k1 v0.0.0-20210626115225-cd5cd00ed72d h1:/IKMrJdfRsoYNc36PXqP4xMH3vhW/8IQyBKGQbKZUno=