From 393cd94ac43fbc6b47f1077e94e8e453c913e2a3 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Thu, 21 Nov 2024 11:40:35 +0700 Subject: [PATCH 1/3] save --- erigon-lib/state/cache.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/erigon-lib/state/cache.go b/erigon-lib/state/cache.go index 0c16e2c41e6..e3efef88227 100644 --- a/erigon-lib/state/cache.go +++ b/erigon-lib/state/cache.go @@ -30,7 +30,7 @@ type domainGetFromFileCacheItem struct { } var ( - domainGetFromFileCacheLimit = uint32(dbg.EnvInt("D_LRU", 1_000)) + domainGetFromFileCacheLimit = uint32(dbg.EnvInt("D_LRU", 10_000)) domainGetFromFileCacheTrace = dbg.EnvBool("D_LRU_TRACE", false) domainGetFromFileCacheEnabled = dbg.EnvBool("D_LRU_ENABLED", true) ) @@ -59,19 +59,8 @@ func newDomainVisible(name kv.Domain, files []visibleFile) *domainVisible { files: files, caches: &sync.Pool{New: NewDomainGetFromFileCacheAny}, } - // Not on hot-path: better pre-alloc here - d.preAlloc() return d } -func (v *domainVisible) preAlloc() { - var preAlloc [10]any - for i := 0; i < len(preAlloc); i++ { - preAlloc[i] = v.caches.Get() - } - for i := 0; i < len(preAlloc); i++ { - v.caches.Put(preAlloc[i]) - } -} func (v *domainVisible) newGetFromFileCache() *DomainGetFromFileCache { if !domainGetFromFileCacheEnabled { From d23dff371ad5668c4593b77dadb517f4abf2f083 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Thu, 21 Nov 2024 11:45:52 +0700 Subject: [PATCH 2/3] save --- erigon-lib/state/domain.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erigon-lib/state/domain.go b/erigon-lib/state/domain.go index 3f5d049c3a5..44c6fcbd301 100644 --- a/erigon-lib/state/domain.go +++ b/erigon-lib/state/domain.go @@ -1531,6 +1531,9 @@ func (dt *DomainRoTx) getFromFiles(filekey []byte, maxTxNum uint64) (v []byte, f dt.getFromFileCache = dt.visible.newGetFromFileCache() } if dt.getFromFileCache != nil && maxTxNum == math.MaxUint64 { + if dt.d.name == kv.CommitmentDomain { + log.Warn(fmt.Sprintf("[dbg] key: %x\n", filekey)) + } cv, ok := dt.getFromFileCache.Get(hi) if ok { if !cv.exists { From ccd99b620053c397b53037f0a79895534779a57d Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Thu, 21 Nov 2024 11:46:24 +0700 Subject: [PATCH 3/3] save --- erigon-lib/state/domain.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/erigon-lib/state/domain.go b/erigon-lib/state/domain.go index 44c6fcbd301..3f5d049c3a5 100644 --- a/erigon-lib/state/domain.go +++ b/erigon-lib/state/domain.go @@ -1531,9 +1531,6 @@ func (dt *DomainRoTx) getFromFiles(filekey []byte, maxTxNum uint64) (v []byte, f dt.getFromFileCache = dt.visible.newGetFromFileCache() } if dt.getFromFileCache != nil && maxTxNum == math.MaxUint64 { - if dt.d.name == kv.CommitmentDomain { - log.Warn(fmt.Sprintf("[dbg] key: %x\n", filekey)) - } cv, ok := dt.getFromFileCache.Get(hi) if ok { if !cv.exists {