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

ingest/cdp: Update the default config for BufferedStorageBackend. #5572

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ingest/cdp: Update the default config for BufferedStorageBackend base…
…d on the benchmarking results
  • Loading branch information
urvisavla committed Jan 14, 2025
commit 9460257449464850d6c65ae9de28806daad356c7
10 changes: 3 additions & 7 deletions ingest/cdp/producer.go
Original file line number Diff line number Diff line change
@@ -34,13 +34,9 @@ func DefaultBufferedStorageBackendConfig(ledgersPerFile uint32) ledgerbackend.Bu
}

switch {
case ledgersPerFile < 2:
config.BufferSize = 500
config.NumWorkers = 5
return config
case ledgersPerFile < 101:
config.BufferSize = 10
config.NumWorkers = 5
case ledgersPerFile < 64:
config.BufferSize = 100
config.NumWorkers = 10
return config
default:
config.BufferSize = 10
17 changes: 4 additions & 13 deletions ingest/cdp/producer_test.go
Original file line number Diff line number Diff line change
@@ -24,15 +24,8 @@ func TestDefaultBSBConfigs(t *testing.T) {
smallConfig := ledgerbackend.BufferedStorageBackendConfig{
RetryLimit: 5,
RetryWait: 30 * time.Second,
BufferSize: 500,
NumWorkers: 5,
}

mediumConfig := ledgerbackend.BufferedStorageBackendConfig{
RetryLimit: 5,
RetryWait: 30 * time.Second,
BufferSize: 10,
NumWorkers: 5,
BufferSize: 100,
NumWorkers: 10,
}

largeConfig := ledgerbackend.BufferedStorageBackendConfig{
@@ -43,10 +36,8 @@ func TestDefaultBSBConfigs(t *testing.T) {
}

assert.Equal(t, DefaultBufferedStorageBackendConfig(1), smallConfig)
assert.Equal(t, DefaultBufferedStorageBackendConfig(2), mediumConfig)
assert.Equal(t, DefaultBufferedStorageBackendConfig(100), mediumConfig)
assert.Equal(t, DefaultBufferedStorageBackendConfig(101), largeConfig)
assert.Equal(t, DefaultBufferedStorageBackendConfig(1000), largeConfig)
assert.Equal(t, DefaultBufferedStorageBackendConfig(64), largeConfig)
assert.Equal(t, DefaultBufferedStorageBackendConfig(512), largeConfig)
}

func TestBSBProducerFn(t *testing.T) {
Loading