Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark L1 info tree sync #11

Open
Tracked by #31
arnaubennassar opened this issue Dec 11, 2024 · 1 comment
Open
Tracked by #31

Benchmark L1 info tree sync #11

arnaubennassar opened this issue Dec 11, 2024 · 1 comment
Assignees

Comments

@arnaubennassar
Copy link
Collaborator

arnaubennassar commented Dec 11, 2024

Investigate why is this so slow (chekcing against real env such as Bali)

  • Fix the slowness (chekcing against real env such as Bali)
  • Ideally test against multiple providers
  • Add a benchmark using the simulated env, corroborate that the results make sense vs the real env. Or add a test that uses a real env and introduce a GH secret to connect to a real RPC, have a deathline on the test

 

more details here

@vcastellm
Copy link
Contributor

vcastellm commented Jan 9, 2025

l1infotreesync [[Benchmark]] for [[CDK 2.0]]

After initial investigation using cpu profiling with a setting of 2000 block range against Bali network fork RPC in [[Tenderly]] majority of time is spent in the Tree implementation, using SQL as a storage backend for the tree https://flamegraph.com/share/c8814381-b6dd-11ef-8d9a-2e2d4d104be7

go test -timeout 240s -cpuprofile cpu4.out -run ^TestBenchBali$ github.com/0xPolygon/cdk/l1infotreesync -v

Going to try with a higher block range it doesn't work with 500k range

The Flamegraphs reveled that there's a bottleneck in the DB access for the tree and in the JSON decoding of the reponses.

We're gonna tackle both issues, maybe using https://github.com/valyala/fastjson and trying to optimize the DB setup.

I've tried several configs for [[SQLite3]] so far:

We'll use ethgo to try to optimize blockheader query in the evmdownloader.go in the sync package

Using ethgo is showing that it has worst performance than go-ethereum https://flamegraph.com/share/173a1166-bbc9-11ef-9832-26c3e5347170

I'll try another path:

  • Querying every block header is inefficient, let's check only the last one, usually it will just work because the won't be any reorg in normal conditions, when there's a reorg, all the work will be discarded and then re-processed but it should be much more efficient in general case.

@ToniRamirezM ToniRamirezM pinned this issue Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants