From 06bbd6fd493fcac4a6db0e4850a92bcf932fafed Mon Sep 17 00:00:00 2001 From: ahrav Date: Thu, 29 Aug 2024 13:40:26 -0700 Subject: [PATCH] Update buffer (#3255) --- pkg/engine/engine.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index b19b0054dfaa..dfc5f4d88a66 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -457,6 +457,7 @@ func (e *Engine) initialize(ctx context.Context) error { // This reflects the anticipated lower volume of data that needs re-verification. // The buffer size is a trade-off between memory usage and the need to prevent blocking. verificationOverlapChunksChanMultiplier = 25 + resultsChanMultiplier = detectableChunksChanMultiplier ) // Channels are used for communication between different parts of the engine, @@ -467,7 +468,7 @@ func (e *Engine) initialize(ctx context.Context) error { e.verificationOverlapChunksChan = make( chan verificationOverlapChunk, defaultChannelBuffer*verificationOverlapChunksChanMultiplier, ) - e.results = make(chan detectors.ResultWithMetadata, defaultChannelBuffer) + e.results = make(chan detectors.ResultWithMetadata, defaultChannelBuffer*resultsChanMultiplier) e.dedupeCache = cache ctx.Logger().V(4).Info("engine initialized") @@ -651,7 +652,7 @@ func (e *Engine) startVerificationOverlapWorkers(ctx context.Context) { } func (e *Engine) startNotifierWorkers(ctx context.Context) { - const notifierWorkerRatio = 4 + const notifierWorkerRatio = 2 maxNotifierWorkers := 1 if numWorkers := e.concurrency / notifierWorkerRatio; numWorkers > 0 { maxNotifierWorkers = numWorkers