From d323f98178d614e10668cc3ba5b631d2c855edc7 Mon Sep 17 00:00:00 2001 From: nogo <110664798+0xnogo@users.noreply.github.com> Date: Thu, 9 Jan 2025 02:19:45 +0400 Subject: [PATCH] Increase token data worker settings and cache duration (#1583) Adjust the number of token data workers and increase the cache duration for token data to improve performance and efficiency. Co-authored-by: dimitris Co-authored-by: Sishir Giri --- core/services/ocr2/plugins/ccip/ccipexec/initializers.go | 6 ++++-- core/services/ocr2/plugins/ccip/tokendata/bgworker.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/services/ocr2/plugins/ccip/ccipexec/initializers.go b/core/services/ocr2/plugins/ccip/ccipexec/initializers.go index d2d3d32ce9..3ad9c94dc7 100644 --- a/core/services/ocr2/plugins/ccip/ccipexec/initializers.go +++ b/core/services/ocr2/plugins/ccip/ccipexec/initializers.go @@ -43,7 +43,9 @@ var ( // 5s for token data worker timeout is a reasonable default. tokenDataWorkerTimeout = 5 * time.Second // tokenDataWorkerNumWorkers is the number of workers that will be processing token data in parallel. - tokenDataWorkerNumWorkers = 5 + tokenDataWorkerNumWorkers = 10 + // expirationDur is the duration for which the token data will be cached. + expirationDurTokenData = 10 * time.Minute ) var defaultNewReportingPluginRetryConfig = ccipdata.RetryConfig{ @@ -169,7 +171,7 @@ func NewExecServices(ctx context.Context, lggr logger.Logger, jb job.Job, srcPro tokenDataProviders, tokenDataWorkerNumWorkers, tokenDataWorkerTimeout, - 2*tokenDataWorkerTimeout, + expirationDurTokenData, ) wrappedPluginFactory := NewExecutionReportingPluginFactory(ExecutionPluginStaticConfig{ diff --git a/core/services/ocr2/plugins/ccip/tokendata/bgworker.go b/core/services/ocr2/plugins/ccip/tokendata/bgworker.go index 1a74ab2305..5f8110b78c 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/bgworker.go +++ b/core/services/ocr2/plugins/ccip/tokendata/bgworker.go @@ -60,7 +60,7 @@ func NewBackgroundWorker( return &BackgroundWorker{ tokenDataReaders: tokenDataReaders, numWorkers: numWorkers, - jobsChan: make(chan cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta, numWorkers*100), + jobsChan: make(chan cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta, numWorkers*200), resultsCache: cache.New(expirationDur, expirationDur/2), timeoutDur: timeoutDur,