Class DebounceStorageStrategy
DebounceBatchConfig.maxBatchSize().
Oversized submissions are split into batches of at most maxBatchSize points. The timer
and size settings can be changed at runtime through apply(DebounceBatchConfig).
Concurrent flushes: when DebounceBatchConfig.maxConcurrentFlushes() is greater
than 1, up to that many flushes run in parallel, so the downstream engine must tolerate
concurrent calls. Listeners that need flushes to complete in order must keep it at the default of
1. Parallel flushes only occur when a queue holds more than one maxBatchSize
chunk of points.
-
Nested Class Summary
Nested classes/interfaces inherited from class PointStorageStrategy
PointStorageStrategy.Listener -
Field Summary
Fields inherited from class PointStorageStrategy
SHUTDOWN_FAILURE_CODE, UNHANDLED_FAILURE_CODE -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(DebounceBatchConfig next) Replaces the debounce, max-wait and batch-size settings.static DebounceStorageStrategycreate(DebounceBatchConfig config) Creates a strategy with the given configuration.static DebounceStorageStrategycreateDefault(String processorName) Creates a strategy withthe default configuration.voidflushNow()Starts draining the whole backlog now, without waiting for the timers.Reports batch size, queue dwell and engine time over the last 256 flushes.metrics()Reports the queued-point count and oldest dwell time as one consistent snapshot.longReturns how long the oldest queued batch has been waiting, without draining anything.Returns the timer and size configuration currently in effect.voidSuspends forwarding, e.g.processAtomic(List<AtomicPoint<?>> atomicPoints) Processes atomic points asynchronously.<C extends ChangePoint<?>>
CompletionStage<StorageResult<C>> processChanges(List<C> changePoints) Processes change points asynchronously.<C extends ComplexPoint<?>>
CompletionStage<StorageResult<C>> processComplex(List<C> complexPoints) Processes complex points asynchronously.intReturns the number of points queued across all point types, awaiting flush.voidResumes processing afterPointStorageStrategy.pauseProcessing()orPointStorageStrategy.stopProcessing().voidRejects new points, waits for in-flight flushes, then forwards everything still queued.Methods inherited from class PointStorageStrategy
completeAsFailure, failureWithError, forwardPoints, joinSubBatchResults, onPointsReady
-
Method Details
-
create
Creates a strategy with the given configuration.- Parameters:
config- the initial timer, batch-size and concurrency settings.- Returns:
- a new strategy.
-
createDefault
Creates a strategy withthe default configuration.- Parameters:
processorName- the name that identifies this strategy in logs and thread names.- Returns:
- a new strategy.
-
operatingPoint
Returns the timer and size configuration currently in effect.- Returns:
- the live operating point.
-
apply
Replaces the debounce, max-wait and batch-size settings. Flushes already under way finish with the previous settings.Not synchronized against concurrent callers; an ingest tuner is expected to be the only writer.
- Parameters:
next- the replacement point, validated byDebounceBatchConfigitself.- Throws:
IllegalArgumentException- if itskeyormaxConcurrentFlushesdiffers from the configuration this strategy was constructed with.
-
processAtomic
public CompletionStage<StorageResult<AtomicPoint<?>>> processAtomic(List<AtomicPoint<?>> atomicPoints) Description copied from class:PointStorageStrategyProcesses atomic points asynchronously.- Specified by:
processAtomicin classPointStorageStrategy- Parameters:
atomicPoints- the points to process.- Returns:
- a stage completing with the storage result.
-
processComplex
public <C extends ComplexPoint<?>> CompletionStage<StorageResult<C>> processComplex(List<C> complexPoints) Description copied from class:PointStorageStrategyProcesses complex points asynchronously.- Specified by:
processComplexin classPointStorageStrategy- Type Parameters:
C- the complex point type.- Parameters:
complexPoints- the points to process.- Returns:
- a stage completing with the storage result.
-
processChanges
public <C extends ChangePoint<?>> CompletionStage<StorageResult<C>> processChanges(List<C> changePoints) Description copied from class:PointStorageStrategyProcesses change points asynchronously.- Specified by:
processChangesin classPointStorageStrategy- Type Parameters:
C- the change point type.- Parameters:
changePoints- the points to process.- Returns:
- a stage completing with the storage result.
-
metrics
Reports the queued-point count and oldest dwell time as one consistent snapshot.- Overrides:
metricsin classPointStorageStrategy- Returns:
- the metrics; always present for this strategy.
-
flushTelemetry
Reports batch size, queue dwell and engine time over the last 256 flushes.- Overrides:
flushTelemetryin classPointStorageStrategy- Returns:
- the telemetry; always present for this strategy, with zeroed percentiles until the first flush completes.
-
queuedPointCount
public int queuedPointCount()Returns the number of points queued across all point types, awaiting flush.- Returns:
- the queued-point count, or
0when every queue is empty.
-
oldestDwellMillis
public long oldestDwellMillis()Returns how long the oldest queued batch has been waiting, without draining anything.- Returns:
- the age of the oldest queued batch in milliseconds, or
0when every queue is empty.
-
flushNow
public void flushNow()Starts draining the whole backlog now, without waiting for the timers.Returns once the flush is scheduled, not when it completes. If every flush permit is busy the drain starts when one frees up. No-op when the queues are empty or after
stopProcessing().- Overrides:
flushNowin classPointStorageStrategy
-
resumeProcessing
public void resumeProcessing()Description copied from class:PointStorageStrategyResumes processing afterPointStorageStrategy.pauseProcessing()orPointStorageStrategy.stopProcessing().- Specified by:
resumeProcessingin classPointStorageStrategy
-
pauseProcessing
public void pauseProcessing()Suspends forwarding, e.g. for an engine restart, while still accepting and buffering points. Buffered points are forwarded afterresumeProcessing(). UnlikestopProcessing(), nothing is rejected or drained.Blocks until flushes already in flight finish (up to 30 seconds), so call it before the engine is marked unavailable and without holding a lock those flushes need. No-op once stopped.
- Overrides:
pauseProcessingin classPointStorageStrategy
-
stopProcessing
public void stopProcessing()Rejects new points, waits for in-flight flushes, then forwards everything still queued.Every queued batch is completed: batches no listener accepts resolve with
PointStorageStrategy.SHUTDOWN_FAILURE_CODE.Blocks for up to 30 seconds waiting on in-flight flushes.
- Specified by:
stopProcessingin classPointStorageStrategy
-