Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_py-memory-gc-and-profiling

Python memory, GC and profiling

7 COMPONENTS · 6 FLOWS · UPDATED 2026-11-23
GITHUB README / PR PREVIEW CARD
[![Python memory, GC and profiling — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_py-memory-gc-and-profiling/opengraph-image)](https://archos.sageideas.dev/d/dgm_py-memory-gc-and-profiling)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_py-memory-gc-and-profiling)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_py-memory-gc-and-profiling" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Python memory, GC and profiling — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0[("Client application")]
  stream_1["Container runtime"]
  gc_2["Container runtime"]
  batch_3["Fanout workers"]
  store_4[("PostgreSQL")]
  prof_5[("Continuous profiling")]
  sink_6[("Client application")]
  client_0 -->|"1. Streams file · HTTPS"| stream_1
  stream_1 -->|"2. O(1) RAM iter · TCP"| gc_2
  gc_2 -->|"3. Batches 5k · TCP"| batch_3
  batch_3 -->|"4. Streams COPY · SQL"| store_4
  store_4 -->|"5. O(1) peak RSS · HTTPS"| sink_6
  gc_2 -->|"Flamegraphs · HTTP"| prof_5

COMPONENT STACK (7)

  • Client applicationSTATEFUL
    10M-row payload
  • Container runtimeSTATELESS
    yield lazy generator
  • Container runtimeSTATELESS
    Refcount + Gen0-2 GC
  • Fanout workersSTATELESS
    Bounded 5k chunks
  • PostgreSQLSTATEFUL
    COPY FROM STDIN
  • Continuous profilingSTATEFUL
    tracemalloc & py-spy
  • Client applicationSTATEFUL
    Flat RSS (0 OOM)

REQUEST & DATA FLOW (6)

  1. Client application → Container runtime (Streams file)[HTTPS]
  2. Container runtime → Container runtime (O(1) RAM iter)[TCP]
  3. Container runtime → Fanout workers (Batches 5k)[TCP]
  4. Fanout workers → PostgreSQL (Streams COPY)[SQL]
  5. PostgreSQL → Client application (O(1) peak RSS)[HTTPS]
  6. Container runtime → Continuous profiling (Flamegraphs)[HTTP]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →