erigon3: agg to use workers for compress and merge (#5561)

This commit is contained in:
Alex Sharov 2022-09-28 13:05:26 +07:00 committed by GitHub
parent 6d07443ca5
commit e4ad73bcb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 7 deletions

View File

@ -32,7 +32,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
var disconnectPeerCh = make(chan peer.ID, 0) var disconnectPeerCh = make(chan peer.ID)
type Sentinel struct { type Sentinel struct {
started bool started bool
@ -120,14 +120,14 @@ func (s *Sentinel) createListener() (*discover.UDPv5, error) {
} }
go func() { go func() {
Loop:
for { for {
select { select {
case <-s.ctx.Done(): case <-s.ctx.Done():
close(disconnectPeerCh) close(disconnectPeerCh)
break break Loop
case pid := <-disconnectPeerCh: case pid := <-disconnectPeerCh:
s.peers.DisconnectPeer(pid) s.peers.DisconnectPeer(pid)
default:
} }
} }
}() }()

View File

@ -246,6 +246,7 @@ func ExecBlock22(s *StageState, u Unwinder, tx kv.RwTx, toBlock uint64, ctx cont
if !initialCycle { if !initialCycle {
workersCount = 1 workersCount = 1
} }
cfg.agg.SetWorkers(cmp.Max(1, runtime.NumCPU()-1))
allSnapshots := cfg.blockReader.(WithSnapshots).Snapshots() allSnapshots := cfg.blockReader.(WithSnapshots).Snapshots()
if initialCycle { if initialCycle {

4
go.mod
View File

@ -4,7 +4,7 @@ go 1.18
require ( require (
github.com/gballet/go-verkle v0.0.0-20220923150140-6c08cd337774 github.com/gballet/go-verkle v0.0.0-20220923150140-6c08cd337774
github.com/ledgerwatch/erigon-lib v0.0.0-20220927105429-e1860348b274 github.com/ledgerwatch/erigon-lib v0.0.0-20220928022226-79a16394b334
github.com/ledgerwatch/erigon-snapshot v1.0.1-0.20220913092204-de54ee30c7b9 github.com/ledgerwatch/erigon-snapshot v1.0.1-0.20220913092204-de54ee30c7b9
github.com/ledgerwatch/log/v3 v3.4.2 github.com/ledgerwatch/log/v3 v3.4.2
github.com/ledgerwatch/secp256k1 v1.0.0 github.com/ledgerwatch/secp256k1 v1.0.0
@ -49,6 +49,7 @@ require (
github.com/kevinburke/go-bindata v3.21.0+incompatible github.com/kevinburke/go-bindata v3.21.0+incompatible
github.com/libp2p/go-libp2p v0.23.2 github.com/libp2p/go-libp2p v0.23.2
github.com/libp2p/go-libp2p-core v0.20.1 github.com/libp2p/go-libp2p-core v0.20.1
github.com/libp2p/go-libp2p-pubsub v0.8.1
github.com/multiformats/go-multiaddr v0.7.0 github.com/multiformats/go-multiaddr v0.7.0
github.com/nxadm/tail v1.4.9-0.20211216163028-4472660a31a6 github.com/nxadm/tail v1.4.9-0.20211216163028-4472660a31a6
github.com/pelletier/go-toml v1.9.5 github.com/pelletier/go-toml v1.9.5
@ -112,7 +113,6 @@ require (
github.com/libp2p/go-cidranger v1.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.1.0 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
github.com/libp2p/go-libp2p-pubsub v0.8.1 // indirect
github.com/libp2p/go-mplex v0.7.0 // indirect github.com/libp2p/go-mplex v0.7.0 // indirect
github.com/libp2p/go-msgio v0.2.0 // indirect github.com/libp2p/go-msgio v0.2.0 // indirect
github.com/libp2p/go-nat v0.1.0 // indirect github.com/libp2p/go-nat v0.1.0 // indirect

4
go.sum
View File

@ -559,8 +559,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3PYPwICLl+/9oulQauOuETfgFvhBDffs0= github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3PYPwICLl+/9oulQauOuETfgFvhBDffs0=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= 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/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/ledgerwatch/erigon-lib v0.0.0-20220927105429-e1860348b274 h1:uxS/Fefrhj/RuiyEhhG36KsTAk+3pzMx3p3+lA8sH5Y= github.com/ledgerwatch/erigon-lib v0.0.0-20220928022226-79a16394b334 h1:ktdhRuhARcRUDuZI+FNeuoceSy6iCXziitUSnay5Vcs=
github.com/ledgerwatch/erigon-lib v0.0.0-20220927105429-e1860348b274/go.mod h1:nMyol2RVCPF0TSR/VU4bK40JB35R/Q+IdodGW8j1kzU= github.com/ledgerwatch/erigon-lib v0.0.0-20220928022226-79a16394b334/go.mod h1:nMyol2RVCPF0TSR/VU4bK40JB35R/Q+IdodGW8j1kzU=
github.com/ledgerwatch/erigon-snapshot v1.0.1-0.20220913092204-de54ee30c7b9 h1:iWjzYLtOsp/Wpo9ZWV/eMIlnFzk8bm7POSzrXAILw24= github.com/ledgerwatch/erigon-snapshot v1.0.1-0.20220913092204-de54ee30c7b9 h1:iWjzYLtOsp/Wpo9ZWV/eMIlnFzk8bm7POSzrXAILw24=
github.com/ledgerwatch/erigon-snapshot v1.0.1-0.20220913092204-de54ee30c7b9/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo= github.com/ledgerwatch/erigon-snapshot v1.0.1-0.20220913092204-de54ee30c7b9/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo=
github.com/ledgerwatch/log/v3 v3.4.2 h1:chvjB7c100rlIFgPv+Col2eerxIrHL88OiZRuPZDkxw= github.com/ledgerwatch/log/v3 v3.4.2 h1:chvjB7c100rlIFgPv+Col2eerxIrHL88OiZRuPZDkxw=