erigontech / erigontech/erigon

inMemoryExecution: don't create new StagedSync for each block

Open
#12,821 0 comments 0 reactions 0 assignees View on GitHub
performance
Dominant language
Go
Stars
3.6k
Forks
1.5k
Avg merge
1d 15h
Merged PRs (30d)
463

Description

in backend.go we have function with:
`stateSync := stages2.NewInMemoryExecution`
this function called on every block
means we re-create `stagedsync.Sync` object on each block - means loosing some caches (like `D_LRU` cache which binded to `ExecuteBlockCfg.applyWorker` object)

We do this way: because `Notifications` object seems passed from outside - but i'm not sure why/where do we need it.
Need somehow simplify it and create `stagedsync.Sync` object once at startup (same as `notification` object dedicated for inMemoryExecution).

Contributor guide

Open the contributing guide

Research direction

Start in backend.go at the function calling stages2.NewInMemoryExecution and trace how it is invoked for each block. Read the stagedsync.Sync construction, ExecuteBlockCfg.applyWorker, and Notifications flow to determine the startup lifetime. Done means the Sync object is created once for inMemoryExecution while preserving the required notification behavior and caches.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.