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

Implement boosted catch-up sync with cfx_getLogs #256

Merged
merged 15 commits into from
Jan 14, 2025
Prev Previous commit
Next Next commit
fix benchmark
wanliqun committed Jan 9, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 4991019d2f2dfd699fb3cf149719aa13ab98be9e
38 changes: 20 additions & 18 deletions sync/catchup/benchmark.go
Original file line number Diff line number Diff line change
@@ -28,6 +28,8 @@ type benchmarker struct {
}

func newBenchmarker() *benchmarker {
// Enable Geth metrics for accurate data.
gmetrics.Enabled = true
return &benchmarker{
persistDbRowsMetrics: gmetrics.NewHistogram(gmetrics.NewExpDecaySample(1024, 0.015)),
persistEpochsMetrics: gmetrics.NewHistogram(gmetrics.NewExpDecaySample(1024, 0.015)),
@@ -96,45 +98,45 @@ func (b *benchmarker) report(start, end uint64) {
fmt.Printf(" max batch db rows: %v\n", b.persistDbRowsMetrics.Snapshot().Max())
fmt.Printf(" min batch db rows: %v\n", b.persistDbRowsMetrics.Snapshot().Min())
fmt.Printf("mean batch db rows: %v\n", b.persistDbRowsMetrics.Snapshot().Mean())
fmt.Printf(" p99 batch db rows: %v\n", b.persistDbRowsMetrics.Snapshot().Percentile(99))
fmt.Printf(" p75 batch db rows: %v\n", b.persistDbRowsMetrics.Snapshot().Percentile(75))
fmt.Printf(" p50 batch db rows: %v\n", b.persistDbRowsMetrics.Snapshot().Percentile(50))
fmt.Printf(" p99 batch db rows: %v\n", b.persistDbRowsMetrics.Snapshot().Percentile(0.99))
fmt.Printf(" p75 batch db rows: %v\n", b.persistDbRowsMetrics.Snapshot().Percentile(0.75))
fmt.Printf(" p50 batch db rows: %v\n", b.persistDbRowsMetrics.Snapshot().Percentile(0.50))

fmt.Println("// --------- batch persisted epochs -----------")
fmt.Printf(" total epochs: %v\n", b.persistEpochsMetrics.Snapshot().Sum())
fmt.Printf(" max batch epochs: %v\n", b.persistEpochsMetrics.Snapshot().Max())
fmt.Printf(" min batch epochs: %v\n", b.persistEpochsMetrics.Snapshot().Min())
fmt.Printf("mean batch epochs: %v\n", b.persistEpochsMetrics.Snapshot().Mean())
fmt.Printf(" p99 batch epochs: %v\n", b.persistEpochsMetrics.Snapshot().Percentile(99))
fmt.Printf(" p75 batch epochs: %v\n", b.persistEpochsMetrics.Snapshot().Percentile(75))
fmt.Printf(" p50 batch epochs: %v\n", b.persistEpochsMetrics.Snapshot().Percentile(50))
fmt.Printf(" p99 batch epochs: %v\n", b.persistEpochsMetrics.Snapshot().Percentile(0.99))
fmt.Printf(" p75 batch epochs: %v\n", b.persistEpochsMetrics.Snapshot().Percentile(0.75))
fmt.Printf(" p50 batch epochs: %v\n", b.persistEpochsMetrics.Snapshot().Percentile(0.50))

fmt.Println("// ------ batch persisted db durations --------")
fmt.Printf("total duration: %.2f(ms)\n", float64(b.persistTimer.Snapshot().Sum())/1e6)
fmt.Printf(" max duration: %.2f(ms)\n", float64(b.persistTimer.Snapshot().Max())/1e6)
fmt.Printf(" min duration: %.2f(ms)\n", float64(b.persistTimer.Snapshot().Min())/1e6)
fmt.Printf(" mean duration: %.2f(ms)\n", b.persistTimer.Snapshot().Mean()/1e6)
fmt.Printf(" p99 duration: %.2f(ms)\n", float64(b.persistTimer.Snapshot().Percentile(99))/1e6)
fmt.Printf(" p75 duration: %.2f(ms)\n", float64(b.persistTimer.Snapshot().Percentile(75))/1e6)
fmt.Printf(" p50 duration: %.2f(ms)\n", float64(b.persistTimer.Snapshot().Percentile(50))/1e6)
fmt.Printf(" p99 duration: %.2f(ms)\n", float64(b.persistTimer.Snapshot().Percentile(0.99))/1e6)
fmt.Printf(" p75 duration: %.2f(ms)\n", float64(b.persistTimer.Snapshot().Percentile(0.75))/1e6)
fmt.Printf(" p50 duration: %.2f(ms)\n", float64(b.persistTimer.Snapshot().Percentile(0.50))/1e6)

fmt.Println("// ------ avg persist duration/db row ---------")
fmt.Printf("total duration: %.2f(ms)\n", float64(b.avgPersistDurationPerDbRowMetrics.Snapshot().Sum())/1e6)
fmt.Printf(" max duration: %.2f(ms)\n", float64(b.avgPersistDurationPerDbRowMetrics.Snapshot().Max())/1e6)
fmt.Printf(" min duration: %.2f(ms)\n", float64(b.avgPersistDurationPerDbRowMetrics.Snapshot().Min())/1e6)
fmt.Printf(" mean duration: %.2f(ms)\n", float64(b.avgPersistDurationPerDbRowMetrics.Snapshot().Mean())/1e6)
fmt.Printf(" p99 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerDbRowMetrics.Snapshot().Percentile(99))/1e6)
fmt.Printf(" p75 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerDbRowMetrics.Snapshot().Percentile(75))/1e6)
fmt.Printf(" p50 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerDbRowMetrics.Snapshot().Percentile(50))/1e6)
fmt.Printf(" p99 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerDbRowMetrics.Snapshot().Percentile(0.99))/1e6)
fmt.Printf(" p75 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerDbRowMetrics.Snapshot().Percentile(0.75))/1e6)
fmt.Printf(" p50 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerDbRowMetrics.Snapshot().Percentile(0.50))/1e6)

fmt.Println("// ------ avg persist duration/epoch ----------")
fmt.Printf("total duration: %.2f(ms)\n", float64(b.avgPersistDurationPerEpochMetrics.Snapshot().Sum())/1e6)
fmt.Printf(" max duration: %.2f(ms)\n", float64(b.avgPersistDurationPerEpochMetrics.Snapshot().Max())/1e6)
fmt.Printf(" min duration: %.2f(ms)\n", float64(b.avgPersistDurationPerEpochMetrics.Snapshot().Min())/1e6)
fmt.Printf(" mean duration: %.2f(ms)\n", float64(b.avgPersistDurationPerEpochMetrics.Snapshot().Mean())/1e6)
fmt.Printf(" p99 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerEpochMetrics.Snapshot().Percentile(99))/1e6)
fmt.Printf(" p75 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerEpochMetrics.Snapshot().Percentile(75))/1e6)
fmt.Printf(" p50 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerEpochMetrics.Snapshot().Percentile(50))/1e6)
fmt.Printf(" p99 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerEpochMetrics.Snapshot().Percentile(0.99))/1e6)
fmt.Printf(" p75 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerEpochMetrics.Snapshot().Percentile(0.75))/1e6)
fmt.Printf(" p50 duration: %.2f(ms)\n", float64(b.avgPersistDurationPerEpochMetrics.Snapshot().Percentile(0.50))/1e6)

fmt.Println("// --------- batch persisted db tps -----------")
fmt.Printf("mean tps: %v\n", b.persistTimer.Snapshot().RateMean())
@@ -147,9 +149,9 @@ func (b *benchmarker) report(start, end uint64) {
fmt.Printf(" max duration: %.2f(ms)\n", float64(b.fetchPerEpochTimer.Snapshot().Max())/1e6)
fmt.Printf(" min duration: %.2f(ms)\n", float64(b.fetchPerEpochTimer.Snapshot().Min()/1e6))
fmt.Printf(" mean duration: %.2f(ms)\n", b.fetchPerEpochTimer.Snapshot().Mean()/1e6)
fmt.Printf(" p99 duration: %.2f(ms)\n", float64(b.fetchPerEpochTimer.Snapshot().Percentile(99))/1e6)
fmt.Printf(" p75 duration: %.2f(ms)\n", float64(b.fetchPerEpochTimer.Snapshot().Percentile(75))/1e6)
fmt.Printf(" p50 duration: %.2f(ms)\n", float64(b.fetchPerEpochTimer.Snapshot().Percentile(50))/1e6)
fmt.Printf(" p99 duration: %.2f(ms)\n", float64(b.fetchPerEpochTimer.Snapshot().Percentile(0.99))/1e6)
fmt.Printf(" p75 duration: %.2f(ms)\n", float64(b.fetchPerEpochTimer.Snapshot().Percentile(0.75))/1e6)
fmt.Printf(" p50 duration: %.2f(ms)\n", float64(b.fetchPerEpochTimer.Snapshot().Percentile(0.50))/1e6)

fmt.Println("// ------------- epoch fetch tps --------------")
fmt.Printf("mean tps: %v\n", b.fetchPerEpochTimer.Snapshot().RateMean())