Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_llm-attention-and-kv-cache

Attention and the KV cache (LLM serving memory)

10 COMPONENTS · 13 FLOWS · UPDATED 2026-11-21
GITHUB README / PR PREVIEW CARD
[![Attention and the KV cache (LLM serving memory) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_llm-attention-and-kv-cache/opengraph-image)](https://archos.sageideas.dev/d/dgm_llm-attention-and-kv-cache)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_llm-attention-and-kv-cache)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_llm-attention-and-kv-cache" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Attention and the KV cache (LLM serving memory) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0[("API Client")]
  lb_1["Layer 7 load balancer"]
  gw_2["API gateway"]
  engine_3["Inference server"]
  paged_4["PagedAttention"]
  kv_5[("KV cache")]
  secrets_6[("Secrets manager")]
  tsdb_7[("Time-series database (TSDB)")]
  alerting_8[("Alerting")]
  capacity_9["Capacity Estimate"]
  client_0 -->|"1. Calls with a JWT · HTTPS"| lb_1
  lb_1 -->|"2. Forwards (mTLS) · HTTP/2"| gw_2
  gw_2 -->|"3. Sends prompt (mTLS) · HTTP/2"| engine_3
  engine_3 -->|"4. Plans KV blocks · method call"| paged_4
  paged_4 -->|"5. Writes keys, values · method call"| kv_5
  kv_5 -->|"6. Returns keys, values · method call"| paged_4
  paged_4 -->|"7. Returns next token · method call"| engine_3
  engine_3 -->|"8. Streams tokens (mTLS) · HTTP/2"| gw_2
  gw_2 -->|"9. Replies or 429 · HTTP/2"| lb_1
  lb_1 -->|"10. Relays reply · HTTPS"| client_0
  secrets_6 -->|"Supplies certificates · HTTPS"| engine_3
  tsdb_7 -->|"Scrapes signals · HTTP"| engine_3
  tsdb_7 -->|"Notifies · HTTP"| alerting_8

COMPONENT STACK (9)

  • API ClientSTATEFUL
    Calls the model API from an untrusted network
  • Layer 7 load balancerSTATELESS
    Ends TLS, stamps a trace id, spreads requests
  • API gatewaySTATELESS
    Checks the JWT; answers HTTP 429 over its cap
  • Inference serverSTATELESS
    Continuous batching; admits by free KV blocks
  • PagedAttentionSTATELESS
    Attends over KV blocks found by a block table
  • KV cacheSTATEFUL
    Keys and values per token, in GPU memory blocks
  • Secrets managerSTATEFUL
    Holds the server TLS certificates
  • Time-series database (TSDB)STATEFUL
    Stores KV cache usage, queue depth, first-token time
  • AlertingSTATEFUL
    Pages on-call when KV cache fills or requests wait

REQUEST & DATA FLOW (13)

  1. API Client → Layer 7 load balancer (Calls with a JWT)[HTTPS]
  2. Layer 7 load balancer → API gateway (Forwards (mTLS))[HTTP/2]
  3. API gateway → Inference server (Sends prompt (mTLS))[HTTP/2]
  4. Inference server → PagedAttention (Plans KV blocks)[method call]
  5. PagedAttention → KV cache (Writes keys, values)[method call]
  6. KV cache → PagedAttention (Returns keys, values)[method call]
  7. PagedAttention → Inference server (Returns next token)[method call]
  8. Inference server → API gateway (Streams tokens (mTLS))[HTTP/2]
  9. API gateway → Layer 7 load balancer (Replies or 429)[HTTP/2]
  10. Layer 7 load balancer → API Client (Relays reply)[HTTPS]
  11. Secrets manager → Inference server (Supplies certificates)[HTTPS]
  12. Time-series database (TSDB) → Inference server (Scrapes signals)[HTTP]
  13. Time-series database (TSDB) → Alerting (Notifies)[HTTP]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →