Skip to content

Commit

Permalink
ingest/cdp: Update the default config for BufferedStorageBackend base…
Browse files Browse the repository at this point in the history
…d on the benchmarking results (#5572)
  • Loading branch information
urvisavla authored Jan 15, 2025
1 parent c29e294 commit bd7c1ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
10 changes: 3 additions & 7 deletions ingest/cdp/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 4 additions & 13 deletions ingest/cdp/producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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) {
Expand Down

0 comments on commit bd7c1ad

Please sign in to comment.