sliding window
The most recent k items of a sequence or stream, which moves forward one item at a time as new data arrives.
In more detail
A deque with a length cap or a ring buffer holds a sliding window in memory proportional to k. Moving averages, per-window maximums and rate limits over recent requests are all computed this way.
Examples
The course computes a moving average over a ring buffer and a window maximum with a deque.A threshold rule keeps recent event times for each source in a queue, drops those older than the window, and alerts when the queue reaches the limit.Related terms
- maxlen — An optional deque setting that caps its length; once full, adding at one end silently drops an item from the other end.
- ring buffer — A fixed-size array used as a loop: when writes reach the end they wrap to the start, overwriting the oldest data.
- moving average — The average of only the last k values in a stream, updated as each new value arrives.
- rate limiting — Capping how many requests a client may make in a period of time, and rejecting or delaying the rest.
- fixed window — A rate-limiting method that counts requests in fixed blocks of time, such as two per second, resetting the count when each block ends.
- threshold — A chosen limit that a value is compared against to decide whether something should happen, such as an alert firing.
- lookback window — How far back in time a rule looks for earlier related events when a new one arrives.
- alert grouping — Combining related alerts into one case, for example all alerts from the same source address within an hour.
Taught in
- Arrays: Contiguous Memory And Constant-Time Access — Algorithms & Data Structures for Working Engineers
- Deques And Ring Buffers — Algorithms & Data Structures for Working Engineers
- Choosing The Right Sequence — Algorithms & Data Structures for Working Engineers
- Searching With Hashes Versus Trees — Algorithms & Data Structures for Working Engineers
- Built-in Rate Limiting Middleware — Modern .NET Core, C# & Enterprise Microservices
- Alert Triage, False Positive Reduction & Fatigue Mitigation — Security Operations & Threat Hunting (SOC)
- SIEM Architecture: Ingestion Pipelines & Indexing — Security Operations & Threat Hunting (SOC)
- Event Correlation Rules, Thresholds & Anomaly Pipelines — Security Operations & Threat Hunting (SOC)