<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Fabricio Amorim</title>
    <description>The latest articles on DEV Community by Fabricio Amorim (@bricio-sr).</description>
    <link>https://dev.to/bricio-sr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3818766%2F11c3c61b-0944-4dfc-8909-fd5c5142b56f.jpeg</url>
      <title>DEV Community: Fabricio Amorim</title>
      <link>https://dev.to/bricio-sr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bricio-sr"/>
    <language>en</language>
    <item>
      <title>Your server is already dead. Your monitoring just doesn't know it yet.</title>
      <dc:creator>Fabricio Amorim</dc:creator>
      <pubDate>Wed, 25 Mar 2026 19:24:05 +0000</pubDate>
      <link>https://dev.to/bricio-sr/your-server-is-already-dead-your-monitoring-just-doesnt-know-it-yet-25ek</link>
      <guid>https://dev.to/bricio-sr/your-server-is-already-dead-your-monitoring-just-doesnt-know-it-yet-25ek</guid>
      <description>&lt;p&gt;Your server starts dying at &lt;strong&gt;T=0&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Prometheus detects it at &lt;strong&gt;T=100s&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In between, you're blind. That gap — I call it the &lt;strong&gt;Lethal Interval&lt;/strong&gt; — is where OOM kills happen, where memory leaks spiral, where a payment service crashes while your dashboard still shows green.&lt;/p&gt;

&lt;p&gt;This isn't a criticism of Prometheus or Datadog. They're excellent at what they do. The problem is structural: every centralized monitoring system works the same way.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;collect metrics on node
  → transmit over network
    → store in TSDB
      → evaluate rules (cpu &amp;gt; 90% for 1m)
        → fire alert
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every step adds latency. By the time the alert fires, your node is already dead.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://github.com/bricio-sr/hosa" rel="noopener noreferrer"&gt;HOSA&lt;/a&gt; to fix this.&lt;/p&gt;




&lt;h2&gt;
  
  
  The biological insight
&lt;/h2&gt;

&lt;p&gt;When you touch something hot, your spinal cord pulls your hand back in milliseconds. Your brain is notified &lt;em&gt;after&lt;/em&gt; the reflex — not before.&lt;/p&gt;

&lt;p&gt;Your brain is excellent at planning, learning, and making complex decisions. But it's structurally too slow to protect your hand in real time. Evolution solved this by putting a local reflex arc in the spinal cord, completely independent of the brain.&lt;/p&gt;

&lt;p&gt;Your servers have the same problem. The "brain" — your Prometheus/Alertmanager/PagerDuty stack — is excellent. But it's structurally too slow for local collapses. HOSA is the spinal cord.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the Lethal Interval looks like in practice
&lt;/h2&gt;

&lt;p&gt;Here's a concrete scenario: a memory leak at 50MB/s.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Time  │ Node State          │ HOSA (on-node)          │ Prometheus (central)
──────┼─────────────────────┼─────────────────────────┼──────────────────────
t=0   │ Leak starts         │ D_M=1.1 (homeostasis)   │ Last scrape was 8s ago
      │ mem: 61%            │ Level 0                 │ Shows: "healthy"
      │                     │                         │
t=1   │ mem: 64%            │ ⚡ D_M=2.8 — DETECTS    │ (no scrape)
      │ PSI rising          │ Sampling: 10s → 10ms    │
      │                     │                         │
t=2   │ mem: 68%            │ ⚡ D_M=4.7 — CONTAINS   │ (no scrape)
      │ swap activating     │ memory.high throttled   │
      │                     │ Webhook fired           │
      │                     │                         │
t=8   │ mem: 74%            │ ✓ STABILIZED            │ (no scrape)
      │ (contained)         │ System degraded         │
      │                     │ but functional          │
      │                     │                         │
t=100 │ ✓ Recovering        │ ✓ Rollback complete     │ ⚠ ALERT FIRED
      │ (with HOSA)         │                         │ (100x too late)
──────┴─────────────────────┴─────────────────────────┴──────────────────────
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without HOSA, the counterfactual: OOM-kill at t=40, CrashLoopBackOff at t=80, 502s for users from t=40 to t=100. Prometheus fires its first alert at t=100, one minute after the first crash.&lt;/p&gt;




&lt;h2&gt;
  
  
  How HOSA detects anomalies
&lt;/h2&gt;

&lt;p&gt;The core insight is that static thresholds are fundamentally broken for correlated systems.&lt;/p&gt;

&lt;p&gt;CPU at 85% with stable memory, low I/O, and normal network is probably a legitimate video transcode job. CPU at 85% with &lt;em&gt;rising memory pressure, I/O stalls, and network latency spikes&lt;/em&gt; is a collapse in progress.&lt;/p&gt;

&lt;p&gt;These are the same CPU reading. A static threshold can't tell them apart.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mahalanobis Distance can.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of monitoring individual metrics, HOSA learns the &lt;strong&gt;normal behavioral profile&lt;/strong&gt; of your node — the covariance structure across CPU, memory, I/O, network, and scheduler metrics simultaneously. Anomaly detection becomes: how far is this moment's system state from the node's learned normal profile, accounting for the correlations between dimensions?&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;x&lt;/code&gt; is the current metric vector&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;μ&lt;/code&gt; is the learned mean vector (updated incrementally via Welford)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Σ&lt;/code&gt; is the learned covariance matrix (captures inter-metric correlations)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But magnitude alone isn't enough. HOSA also tracks the &lt;strong&gt;first and second derivatives&lt;/strong&gt; of the anomaly score using EWMA smoothing. It detects that you're &lt;em&gt;heading toward&lt;/em&gt; collapse, not just that you've arrived.&lt;/p&gt;

&lt;p&gt;This is the difference between "CPU is high" and "the anomaly score is accelerating."&lt;/p&gt;




&lt;h2&gt;
  
  
  Collection: eBPF in kernel space
&lt;/h2&gt;

&lt;p&gt;Metrics are collected via eBPF probes attached to kernel tracepoints — no polling, no scraping, no userland agents reading &lt;code&gt;/proc&lt;/code&gt; every N seconds.&lt;/p&gt;

&lt;p&gt;Four probes currently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;sched_wakeup&lt;/code&gt; — scheduler pressure&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sys_brk&lt;/code&gt; — memory allocation events
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;page_fault&lt;/code&gt; — memory pressure&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;block_rq_issue&lt;/code&gt; — I/O activity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Data flows from kernel space to userland via a lock-free &lt;code&gt;BPF_MAP_TYPE_RINGBUF&lt;/code&gt; with 1–10μs latency. The full decision cycle — collection through actuation — targets under 1ms.&lt;/p&gt;

&lt;p&gt;I wrote a custom eBPF loader (&lt;code&gt;internal/sysbpf&lt;/code&gt;) without third-party dependencies: direct &lt;code&gt;SYS_BPF&lt;/code&gt; syscalls, ELF parsing with BPF relocation resolution. No libbpf. This keeps the binary self-contained and eliminates runtime dependency issues across kernel versions.&lt;/p&gt;




&lt;h2&gt;
  
  
  Actuation: graduated response, not binary kill
&lt;/h2&gt;

&lt;p&gt;When HOSA detects accelerating anomaly, it doesn't kill processes. It throttles them — through the same kernel mechanisms your orchestrator uses, but 100x faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Positive semi-axis (over-demand):&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Level&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;+1&lt;/td&gt;
&lt;td&gt;Plateau Shift&lt;/td&gt;
&lt;td&gt;Sampling frequency increases, baseline refinement pauses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;+2&lt;/td&gt;
&lt;td&gt;Seasonality&lt;/td&gt;
&lt;td&gt;Moderate cpu/memory containment via cgroups v2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;+3&lt;/td&gt;
&lt;td&gt;Adversarial&lt;/td&gt;
&lt;td&gt;Aggressive containment, XDP packet filtering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;+4&lt;/td&gt;
&lt;td&gt;Local Failure&lt;/td&gt;
&lt;td&gt;Hard limits, webhook to orchestrator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;+5&lt;/td&gt;
&lt;td&gt;Viral Propagation&lt;/td&gt;
&lt;td&gt;Full quarantine, SIGSTOP non-critical processes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Negative semi-axis (under-demand) — this is the part most people don't expect:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Level&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Trigger&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;-1&lt;/td&gt;
&lt;td&gt;Legitimate Idleness&lt;/td&gt;
&lt;td&gt;Below-baseline activity coherent with time window&lt;/td&gt;
&lt;td&gt;GreenOps: reduce CPU frequency, increase sampling interval&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-2&lt;/td&gt;
&lt;td&gt;Structural Idleness&lt;/td&gt;
&lt;td&gt;Node permanently oversized&lt;/td&gt;
&lt;td&gt;FinOps report: EPI calculation, right-sizing suggestion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-3&lt;/td&gt;
&lt;td&gt;Anomalous Silence&lt;/td&gt;
&lt;td&gt;Traffic drop &lt;em&gt;incoherent&lt;/em&gt; with temporal context&lt;/td&gt;
&lt;td&gt;Vigilance → Active Containment&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Level -3 is a security scenario.&lt;/strong&gt; Traditional monitoring says "all healthy" when a server stops receiving traffic (CPU low, memory free, no errors). HOSA detects that the &lt;em&gt;silence itself&lt;/em&gt; is the anomaly — possible DNS hijack, silent failure, upstream attack.&lt;/p&gt;




&lt;h2&gt;
  
  
  Design decisions I'm happy to defend
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why Mahalanobis and not an ML model?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;O(n²) constant memory. No GPU. No training pipeline. No data windows stored. Sub-millisecond inference. Interpretable output — every decision comes with the complete mathematical justification: the D_M value, the derivative, the threshold crossed, and the contributing dimensions.&lt;/p&gt;

&lt;p&gt;It runs on a Raspberry Pi.&lt;/p&gt;

&lt;p&gt;Autoencoders were considered and rejected: opaque, large footprint, require training infrastructure. Isolation Forest: requires data windows, not incremental.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Welford incremental covariance?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;O(n²) per sample with O(1) allocation. The mean vector and covariance matrix update with each new sample — no data windows stored, no unbounded memory growth. Predictable footprint regardless of uptime.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Go and not Rust or C?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pragmatic. This is a research project — faster iteration matters more than zero-cost abstractions right now. The hot path uses zero-allocation patterns (&lt;code&gt;sync.Pool&lt;/code&gt;, pre-allocated slices). GC pauses are sub-millisecond on Go 1.22+. If benchmarks show GC impact on detection latency under adversarial allocation pressure, hot-path migration to Rust or C via CGo is planned.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why complement monitoring instead of replacing it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Different timescales, different problems. HOSA solves the Lethal Interval — the milliseconds between collapse onset and external system awareness. Prometheus/Datadog solve capacity planning, trend analysis, cross-service correlation, dashboards. These are genuinely different problems. Trying to do both from one system would compromise both.&lt;/p&gt;




&lt;h2&gt;
  
  
  What HOSA is not
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;❌ &lt;strong&gt;Not a monitoring system.&lt;/strong&gt; It doesn't replace Prometheus or Datadog.&lt;/li&gt;
&lt;li&gt;❌ &lt;strong&gt;Not a HIDS.&lt;/strong&gt; It doesn't detect intrusions by signature.&lt;/li&gt;
&lt;li&gt;❌ &lt;strong&gt;Not an orchestrator.&lt;/strong&gt; It doesn't schedule pods or manage clusters.&lt;/li&gt;
&lt;li&gt;❌ &lt;strong&gt;Not magic.&lt;/strong&gt; It has a cold start window (default 5 minutes). A sophisticated attacker who understands the architecture can execute a low-and-slow evasion. Throttling has side effects.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Where it is now
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Early alpha.&lt;/strong&gt; Phase 1 is complete:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;eBPF probes for memory, CPU, I/O, scheduler&lt;/li&gt;
&lt;li&gt;Welford incremental covariance matrix&lt;/li&gt;
&lt;li&gt;Mahalanobis Distance calculation&lt;/li&gt;
&lt;li&gt;Hardware proprioception (automatic topology discovery via sysfs — CPU cores, NUMA nodes, L3 cache, VM detection)&lt;/li&gt;
&lt;li&gt;EWMA smoothing + first and second temporal derivatives&lt;/li&gt;
&lt;li&gt;Graduated response system (Levels -3 to +5)&lt;/li&gt;
&lt;li&gt;Thalamic Filter (telemetry suppression during homeostasis — no noise at steady state)&lt;/li&gt;
&lt;li&gt;Benchmark suite: detection latency (p50/p99/p999), false positive rate, memory footprint and allocs per cycle&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Requires: Linux ≥ 5.8, x86_64 or arm64.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 2&lt;/strong&gt; (in progress): webhooks for K8s HPA/KEDA, Prometheus-compatible metrics endpoint, Kubernetes DaemonSet deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 3&lt;/strong&gt; (planned): local SLM for post-containment root cause analysis, Bloom Filter in eBPF for known-pattern fast-path blocking, federated baseline sharing across fleet.&lt;/p&gt;




&lt;h2&gt;
  
  
  Academic context
&lt;/h2&gt;

&lt;p&gt;This comes out of a Master's research project at &lt;strong&gt;IMECC/Unicamp&lt;/strong&gt; (University of Campinas, Brazil). The full theoretical foundation — including the mathematical formulation, the adversarial model, and the formal definition of the Lethal Interval — is in the whitepaper in the repo.&lt;/p&gt;

&lt;p&gt;The core concept is what I call &lt;strong&gt;Endogenous Resilience&lt;/strong&gt;: the idea that each node should possess autonomous detection and mitigation capability, independent of network connectivity and external control planes. The dominant model today is Exogenous Telemetry — ship data out, receive instructions back. HOSA proposes a complementary layer that operates entirely locally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Contribute
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/bricio-sr/hosa" rel="noopener noreferrer"&gt;github.com/bricio-sr/hosa&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Areas where contributions are especially welcome:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;eBPF expertise&lt;/strong&gt;: CO-RE compatibility testing across kernel versions, probe overhead optimization&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Statistical validation&lt;/strong&gt;: Testing Mahalanobis robustness under non-Gaussian workload distributions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chaos engineering&lt;/strong&gt;: Fault injection scenarios for benchmark coverage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to go deep before touching code, read the whitepaper first — it explains &lt;em&gt;why&lt;/em&gt; before &lt;em&gt;how&lt;/em&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;"Orchestrators and centralized monitoring are essential for capacity planning and long-term governance. But they are structurally — not accidentally — too slow to guarantee a node's survival in real time. If collapse happens in the interval between perception and exogenous action, the capacity for immediate decision must reside in the node itself."&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>go</category>
      <category>architecture</category>
      <category>linux</category>
    </item>
    <item>
      <title>Your Monitoring Stack Has a Blind Spot. Here's the 2-Second Window Where Servers Die</title>
      <dc:creator>Fabricio Amorim</dc:creator>
      <pubDate>Wed, 11 Mar 2026 19:18:28 +0000</pubDate>
      <link>https://dev.to/bricio-sr/your-monitoring-stack-has-a-blind-spot-heres-the-2-second-window-where-servers-die-5fg1</link>
      <guid>https://dev.to/bricio-sr/your-monitoring-stack-has-a-blind-spot-heres-the-2-second-window-where-servers-die-5fg1</guid>
      <description>&lt;h3&gt;
  
  
  Why I Replaced Static Thresholds with Mahalanobis Distance to Detect Server Failures in Milliseconds
&lt;/h3&gt;




&lt;p&gt;It's 2am. Your payment service is dying.&lt;/p&gt;

&lt;p&gt;Not slowly — right now, at 50MB/s, memory is leaking into the void. But your dashboards? Green. Every single one. Prometheus scraped 8 seconds ago. It saw nothing unusual. Your alerting rule says &lt;code&gt;container_memory_usage &amp;gt; 1.8GB for 1m&lt;/code&gt; — and you're not there yet. So every on-call rotation sleeps peacefully while three hundred transactions start walking toward a cliff.&lt;/p&gt;

&lt;p&gt;At t=40 seconds, the Linux OOM-Killer makes the decision you were too slow to make. The process is gone. The transactions are corrupted. The alert fires at t=100 seconds — a full minute and forty seconds after the point where something &lt;em&gt;could&lt;/em&gt; have acted.&lt;/p&gt;

&lt;p&gt;This is not a story about a bad alerting threshold. You can tune thresholds forever and still lose this race.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if the problem was never the alerting threshold — but the model of detection itself?&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  How the monitoring stack actually works (and where it breaks)
&lt;/h2&gt;

&lt;p&gt;The standard observability loop is deceptively simple: a local agent collects metrics, sends them over the network, a time-series database stores them, a rules engine evaluates them, and if a threshold is crossed, an alert fires. You know this stack. Prometheus, Alertmanager, Grafana — you've probably set it up more than once.&lt;/p&gt;

&lt;p&gt;The problem isn't any of those tools. They're excellent at what they do. The problem is structural, and it lives in two places.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Latency of Awareness.&lt;/strong&gt; Every scrape interval is a gap in your knowledge. At 15–60 seconds per cycle, you're always making decisions based on a photograph of the past. The evaluation happens after collection, after transmission, after storage. By the time &lt;code&gt;container_memory_usage &amp;gt; 1.8GB for 1m&lt;/code&gt; becomes true, the rule has to remain true &lt;em&gt;for another full minute&lt;/em&gt; before the alert fires. The math is brutal: you could be 2+ minutes behind a fast-moving failure before anyone is paged.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fragility of Connection.&lt;/strong&gt; The exogenous monitoring model has a silent assumption baked in: the network is always up. But consider a DDoS attack — the very event that saturates your outbound bandwidth also blinds your observability stack. Your Prometheus scrape fails. Your agent can't push metrics. Your node is simultaneously under attack and operationally invisible. The systems that should be protecting you lose eyes at exactly the moment you need them most.&lt;/p&gt;

&lt;p&gt;There's a name for what lives between these two failure modes. I call it the &lt;strong&gt;Lethal Interval&lt;/strong&gt; — the window between when a server starts dying and when your monitoring system first notices. A memory leak at 50MB/s gives you a Lethal Interval of roughly 100 seconds. A fast OOM scenario might be half that. A DDoS with bandwidth saturation could stretch it indefinitely.&lt;/p&gt;

&lt;p&gt;This is where most production incidents are born. Not in the explosion — in the silence before it.&lt;/p&gt;




&lt;h2&gt;
  
  
  A different mental model: the spinal reflex
&lt;/h2&gt;

&lt;p&gt;Here's a question that has nothing to do with servers: when you touch a hot stove, does your brain decide to pull your hand back?&lt;/p&gt;

&lt;p&gt;It doesn't. Your spinal cord does — in milliseconds. The signal never reaches your brain before the withdrawal is already executing. Your brain finds out &lt;em&gt;after&lt;/em&gt; the reflex has fired. The architecture of your nervous system doesn't make the cerebral cortex the bottleneck for survival-critical responses. It separates fast local reflexes from slow central reasoning, and both coexist perfectly.&lt;/p&gt;

&lt;p&gt;That's the architecture I built HOSA on.&lt;/p&gt;

&lt;p&gt;Your Kubernetes control plane is your brain. It has global context, complex reasoning, resource scheduling, orchestration. It's irreplaceable. But it operates on timescales of seconds to minutes — and it has the same structural blindspot as Prometheus: it depends on network connectivity and periodic reporting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Kubernetes control plane is your brain. HOSA is your spinal cord. Both are necessary. They operate at different speeds.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;HOSA doesn't replace your observability stack. It operates in the interval where your observability stack is structurally incapable of acting — the milliseconds between the start of a collapse and the arrival of the first metric at an external system. Each node runs its own detection and response, autonomously, locally, without waiting for the central orchestrator to notice and send instructions back.&lt;/p&gt;

&lt;p&gt;This is what the whitepaper formalizes as &lt;strong&gt;Endogenous Resilience&lt;/strong&gt;: the capacity of a node to detect and contain its own collapse, independent of network connectivity, operating at kernel speed.&lt;/p&gt;




&lt;h2&gt;
  
  
  How HOSA actually works
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The sensing layer: eBPF
&lt;/h3&gt;

&lt;p&gt;HOSA doesn't poll metrics like Prometheus does. It uses eBPF probes attached directly to the Linux kernel — tracepoints and kprobes — to observe CPU scheduling, memory pressure, I/O wait, and network state &lt;strong&gt;continuously&lt;/strong&gt;, at sub-millisecond granularity.&lt;/p&gt;

&lt;p&gt;If you're not familiar with eBPF: it lets you run sandboxed programs inside the Linux kernel without modifying kernel source code. Think of it as a microscope you can attach to any kernel event. No scrape interval. No transmission delay. Just continuous, in-process observation of what the kernel is actually doing.&lt;/p&gt;

&lt;p&gt;This is the first architectural break from the exogenous model: HOSA sees the system in real time, from the inside.&lt;/p&gt;

&lt;h3&gt;
  
  
  The detection engine: Mahalanobis Distance
&lt;/h3&gt;

&lt;p&gt;This is the core insight, and it's worth slowing down for.&lt;/p&gt;

&lt;p&gt;Most monitoring asks a question like: &lt;em&gt;"Is CPU above 90%?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;HOSA asks a different question: &lt;em&gt;"Is the current combination of CPU, memory pressure, I/O latency, and network state statistically unusual — compared to how this specific server normally behaves?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The distinction matters enormously. CPU at 85% during a video encoding job is completely normal. CPU at 85% &lt;em&gt;while memory pressure is spiking and I/O latency is tripling simultaneously&lt;/em&gt; is a completely different event — one that a threshold-based system cannot distinguish from the first case.&lt;/p&gt;

&lt;p&gt;The Mahalanobis Distance is a statistical measure of how far a data point is from a normal distribution, accounting for the correlations between variables. It answers the question: "Given everything I know about how these metrics usually move together, how anomalous is this specific combination right now?"&lt;/p&gt;

&lt;p&gt;HOSA builds a multivariate statistical baseline for each node — incrementally, using the Welford online algorithm, without requiring a training period. It then continuously computes the Mahalanobis Distance of the current metric vector against that baseline. When the distance spikes, and particularly when the &lt;em&gt;rate of change&lt;/em&gt; of that distance is accelerating, HOSA knows something is wrong — often before any single metric has crossed a static threshold.&lt;/p&gt;

&lt;p&gt;That's how it detects at t=1s what Prometheus won't see until t=100s.&lt;/p&gt;

&lt;h3&gt;
  
  
  The response system: graduated, not binary
&lt;/h3&gt;

&lt;p&gt;Most automated responses have two states: do nothing, or kill the process. This binary is dangerous. Killing a payment service to prevent a memory leak is not a win.&lt;/p&gt;

&lt;p&gt;HOSA implements six graduated response levels, ranging from increased observation to full network isolation. The key design principle: &lt;strong&gt;contain first, preserve function where possible, escalate only if containment fails&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The levels in brief:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Level 0&lt;/strong&gt; — Normal operation, baseline monitoring&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 1&lt;/strong&gt; — Vigilância (Watchfulness): anomaly detected, sampling frequency increases from 100ms to 10ms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 2&lt;/strong&gt; — Contenção (Containment): apply cgroup memory limits, reduce ceiling without killing the process&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 3&lt;/strong&gt; — Pressão (Pressure): further resource restriction, throttle CPU scheduling&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 4&lt;/strong&gt; — Isolamento (Isolation): network traffic throttled via XDP, service degraded but alive&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 5&lt;/strong&gt; — Quarentena (Quarantine): full network isolation, node preserved for forensics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The escalation is governed by both the magnitude of the Mahalanobis Distance and its acceleration — so a fast spike that stabilizes won't needlessly escalate, while a slow but continuously accelerating deviation will.&lt;/p&gt;




&lt;h2&gt;
  
  
  What this looks like in practice
&lt;/h2&gt;

&lt;p&gt;Let's run the 2am scenario again, but with HOSA running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;t=0&lt;/strong&gt; — The payment service begins leaking memory at 50MB/s. Every dashboard shows green. Memory is at 61%. HOSA's baseline says this is within normal range. D_M = 1.1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;t=1s&lt;/strong&gt; — Memory climbs to 64%. PSI (Pressure Stall Information) ticks up to 18%. No single threshold is broken. But the combination — memory trending up, PSI trending up, swap beginning to activate — produces D_M = 2.8. HOSA detects the anomaly. It increases its own sampling frequency from 100ms to 10ms. No alert fires. It just starts watching more closely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;t=2s&lt;/strong&gt; — D_M = 4.7. The rate of deviation is accelerating, not stabilizing. HOSA moves to Level 2: Containment. It adjusts the cgroup memory ceiling for the payment-service container from 2GB to 1.6GB, applying backpressure without killing the process. A webhook fires to the operator: container name, resource affected, action taken, current metrics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;t=4s&lt;/strong&gt; — The rate of memory growth slows. The containment is working. Memory stabilizes around 72%. HOSA confirms the intervention is effective and holds at Level 2.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;t=8s&lt;/strong&gt; — System stabilized at a degraded but functional state. Transactions are still processing, at reduced throughput. The service is alive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;t=100s&lt;/strong&gt; — Prometheus fires its first alert. By this point, HOSA has been managing the situation for 92 seconds. The operator already has full context from the t=2s webhook: what happened, what was done, whether it worked.&lt;/p&gt;

&lt;p&gt;The service stayed alive. Transactions were preserved. The operator received actionable context instead of a wake-up call and a dead container.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where the project is today
&lt;/h2&gt;

&lt;p&gt;HOSA is a research project — the foundation of my Master's thesis at Unicamp's IMECC, in Applied and Computational Mathematics.&lt;/p&gt;

&lt;p&gt;The mathematical framework is fully documented in the whitepaper (v2.1). The architecture is defined in detail: the eBPF sensing layer, the Welford incremental covariance computation, the Mahalanobis detection engine, the cgroup/XDP response system, the graduated response model.&lt;/p&gt;

&lt;p&gt;What's working in the current alpha: the eBPF probes, the Welford online covariance update, and the basic Mahalanobis calculation. The architecture is being built out toward experimental validation and comparative benchmarks against Prometheus + Alertmanager under controlled failure scenarios.&lt;/p&gt;

&lt;p&gt;What's next: the experimental validation suite, the academic paper, and the benchmark data that will either validate the model or force me to revise it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/bricio-sr/hosa" rel="noopener noreferrer"&gt;https://github.com/bricio-sr/hosa&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project site:&lt;/strong&gt; &lt;a href="https://hosaproject.org" rel="noopener noreferrer"&gt;https://hosaproject.org&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you work with Linux infrastructure, distributed systems, or anomaly detection — I'd genuinely love your feedback. Open an issue, send a message, or just read the whitepaper.&lt;/p&gt;




&lt;h2&gt;
  
  
  The question that doesn't go away
&lt;/h2&gt;

&lt;p&gt;Back to 2am.&lt;/p&gt;

&lt;p&gt;Your infrastructure will face a Lethal Interval. The question isn't whether — it's a structural property of any system that monitors from the outside. The question is whether something is watching closely enough, from the inside, to act before your monitoring stack even notices.&lt;/p&gt;

&lt;p&gt;Prometheus tells you what happened. HOSA is designed to act while it's still happening.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's your current strategy for the gap between anomaly start and first alert? I'd genuinely like to know.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Fabricio Amorim is a Software Engineer &amp;amp; SRE based in Brazil, building distributed systems and critical infrastructure with Go, Python, and C. Currently researching autonomous anomaly detection at the Linux kernel level as part of my Master's in Applied Mathematics at Unicamp's IMECC.&lt;br&gt;
Creator of HOSA (Homeostasis OS Agent) — an open-source autonomous SRE agent that detects and contains system failures in milliseconds using eBPF and multivariate statistics, without dependency on external monitoring infrastructure.&lt;br&gt;
🔗 hosaproject.org · github.com/bricio-sr/hosa · linkedin.com/in/fabricioroney&lt;/em&gt;&lt;/p&gt;

</description>
      <category>sre</category>
      <category>devops</category>
      <category>linux</category>
      <category>go</category>
    </item>
  </channel>
</rss>
