Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_code-sliding-window-maximum

Sliding-Window Maximum with a Monotonic Deque

6 COMPONENTS · 6 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[![Sliding-Window Maximum with a Monotonic Deque — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_code-sliding-window-maximum/opengraph-image)](https://archos.sageideas.dev/d/dgm_code-sliding-window-maximum)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_code-sliding-window-maximum)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_code-sliding-window-maximum" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Sliding-Window Maximum with a Monotonic Deque — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0["Stream of Values"]
  n1_1["Window Expire Check"]
  n2a_2[("Monotonic Deque")]
  n2b_3["Push Current Index"]
  n3_4["Rolling Window Max"]
  downstream_5["Downstream & OTel"]
  client_0 -->|"1. Evict old · O1"| n1_1
  n1_1 -->|"2a. Pop = cur · Deque"| n2a_2
  n1_1 -->|"2b. Push back · Amort O1"| n2b_3
  n2a_2 -->|"3a. Peek front · O1"| n3_4
  n2b_3 -->|"3b. Merge · RAM"| n3_4
  n3_4 -.->|"4. Emit / · OTLP/API"| downstream_5

COMPONENT STACK (6)

  • Stream of ValuesSTATELESS
    Latency / Price Tick Series
  • Window Expire CheckSTATELESS
    Pop front if idx <= i - K
  • Monotonic DequeSTATEFUL
    Maintains strictly decreasing idx
  • Push Current IndexSTATELESS
    Each element pushed/popped <= 1x
  • Rolling Window MaxSTATELESS
    Front of deque is instant max
  • Downstream & OTelSTATELESS
    Consumers, metrics & SLOs

REQUEST & DATA FLOW (6)

  1. Stream of Values → Window Expire Check (Evict old)[O1]
  2. Window Expire Check → Monotonic Deque (Pop <= cur)[Deque]
  3. Window Expire Check → Push Current Index (Push back)[Amort O1]
  4. Monotonic Deque → Rolling Window Max (Peek front)[O1]
  5. Push Current Index → Rolling Window Max (Merge)[RAM]
  6. Rolling Window Max → Downstream & OTel (Emit /)[OTLP/API]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →