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

Master tracker for snap sync #2874

Open
5 of 9 tasks
scorbajio opened this issue Jul 10, 2023 · 2 comments
Open
5 of 9 tasks

Master tracker for snap sync #2874

scorbajio opened this issue Jul 10, 2023 · 2 comments

Comments

@scorbajio
Copy link
Contributor

scorbajio commented Jul 10, 2023

See #2100 and #1848 for work done up to this point and resources on snap sync.

Starting with a new master tracker ticket for continuing work on snap sync. We currently have the ability to perform a static sync. Next step is to support a moving sync.

cc: @g11tech @jochem-brouwer @holgerd77

@acolytec3
Copy link
Contributor

You should benchmark the differences in this instantation of the trie using leveldb versus just removing that leveldb from the trie constructor (which would then default to using the MapDB from our util library. My suspicion is that the map DB is slightly faster.

@acolytec3
Copy link
Contributor

Okay, so here's some benchmarking for mapdb vs leveldb. Here's my benchmarking script:

import { Trie } from '@ethereumjs/trie'
import { randomBytes } from 'crypto'
//@ts-ignore
import * as bench from 'micro-bmark'

import { LevelDB } from './level'
const { mark, compare, run } = bench // Or, use as such
const trieOps = async (trie: Trie) => {
  const x = new Uint8Array(300)
  for await (const _l of x) {
    await trie.put(randomBytes(32), randomBytes(32))
  }
}
run(async () => {
  await mark('mapdb', 100, async () => trieOps(new Trie()))
  await mark('level', 100, async () => trieOps(new Trie({ db: new LevelDB() })))
})

I'm using micro-bmark as my benchmark tool here so you'll have to install that. But, the results seem reasonably convincing to me for switching from the leveldb to mapdb:

-------
Benchmarking
mapdb x 16 ops/sec @ 60ms/op ± 1.42% (min: 52ms, max: 89ms)
level x 14 ops/sec @ 68ms/op ± 1.48% (min: 61ms, max: 104ms)

-------
Benchmarking
mapdb x 18 ops/sec @ 53ms/op ± 1.38% (min: 49ms, max: 76ms)
level x 15 ops/sec @ 63ms/op ± 1.45% (min: 58ms, max: 95ms)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants