m3 icon indicating copy to clipboard operation
m3 copied to clipboard

Allow non-blocking flushes across writers

Open shaan420 opened this issue 3 years ago • 2 comments

What this PR does / why we need it:

The aggregator client performed locking on a per-writer or per-queue basis. This protects against racy access to the underlying conn and queue but does not protect against re-ordering. ie. in case multiple flushes happen at the same time for a writer any one can win. This possibility instructed the users of the client to synchronize the entire flush call at the writer manager level and made it so that all flushes would be blocked until the ongoing flushes for each writer is completed. This means that a slow writer will block the flush of all other writers. We therefore want the ability to flush writers at their own speeds effectively only blocking themselves in case they are slow. As such this PR makes sure that a writer will only have one active flush by using an "in-progress" flag to bail early if one is already in progress. Now that we make sure we only have one flush active for any given writer we don't need locks to protect the queue. The queue is only read from and written to in the context of a single flush. i.e. No enqueuing in the queue buf happens in the context of the Write() call anymore. Write() will simply push data into the encoders. Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:

No


Does this PR require updating code package or user-facing documentation?:

No


shaan420 avatar Aug 02 '22 16:08 shaan420

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 02 '22 16:08 CLAassistant

Just for reference: defaultInstanceMaxQueueBytes is set to 0 (no limit) defaultInstanceQueueSize is set to 128

shaan420 avatar Sep 21 '22 16:09 shaan420