<?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: Aomi Qaza</title>
    <description>The latest articles on DEV Community by Aomi Qaza (@aomiqaza).</description>
    <link>https://dev.to/aomiqaza</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3518049%2F86cc2c42-d371-45ba-8ebd-440886cd6173.jpg</url>
      <title>DEV Community: Aomi Qaza</title>
      <link>https://dev.to/aomiqaza</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aomiqaza"/>
    <language>en</language>
    <item>
      <title>Zero-Trust Microservices with WebAssembly (Wasm) Runtime Sandboxing</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:49:32 +0000</pubDate>
      <link>https://dev.to/aomiqaza/zero-trust-microservices-with-webassembly-wasm-runtime-sandboxing-3h79</link>
      <guid>https://dev.to/aomiqaza/zero-trust-microservices-with-webassembly-wasm-runtime-sandboxing-3h79</guid>
      <description>&lt;h1&gt;
  
  
  Zero-Trust Microservices with WebAssembly (Wasm) Runtime Sandboxing
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Architecture blueprint for running untrusted microservice code inside WebAssembly sandboxes with nanosecond startup times and linear memory bounds.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Memory Isolation: Wasm runtimes enforce strict linear memory bounds, preventing out-of-bounds pointer reads and memory corruption.&lt;/li&gt;
&lt;li&gt;Capability-Based I/O: WASI (WebAssembly System Interface) enforces default-deny access to filesystems, environment variables, and network sockets.&lt;/li&gt;
&lt;li&gt;Nanosecond Cold Starts: Execute microservices in sub-millisecond timeframes compared to multi-second container startup overhead.&lt;/li&gt;
&lt;li&gt;Polyglot Security: Compile Rust, Go, C/C++, and Zig applications to portable Wasm bytecode binaries.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. The WebAssembly Linear Memory Isolation Architecture
&lt;/h2&gt;

&lt;p&gt;Traditional containerization (Docker, OCI) relies on Linux kernel namespaces and cgroups. While effective, containers share the host Linux kernel syscall interface, creating vulnerability vectors when kernel zero-day exploits occur.&lt;/p&gt;

&lt;p&gt;WebAssembly (Wasm) provides a language-agnostic virtual machine target operating on a strict linear memory sandbox model. A Wasm module cannot access memory outside its allocated byte array, eliminating pointer arithmetic exploits and arbitrary code execution.&lt;/p&gt;

&lt;p&gt;By decoupling application code execution from the underlying host operating system kernel, WebAssembly runtimes (such as Wasmtime and WasmEdge) deliver defense-in-depth for multi-tenant microservices.&lt;/p&gt;

&lt;p&gt;Wasm modules are validated statically prior to execution, ensuring that control flow integrity (CFI) is maintained throughout execution.&lt;/p&gt;

&lt;p&gt;This isolation paradigm guarantees that compromised Wasm modules cannot compromise neighbor workloads or read host memory.&lt;/p&gt;

&lt;p&gt;Wasm JIT compilers optimize machine code generation while maintaining memory boundary safety checks.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Rust Microservice compiled to wasm32-wasip1 target&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;std&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;File&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;std&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;io&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Read&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nb"&gt;Box&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Executing isolated Wasm microservice..."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// WASI capability check: Accessing un-mapped directories will fail gracefully&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;File&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/data/config.json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;String&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="nf"&gt;.read_to_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nd"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Config payload: {}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nf"&gt;Ok&lt;/span&gt;&lt;span class="p"&gt;(())&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Enforcing WASI Capability-Based Access Control
&lt;/h2&gt;

&lt;p&gt;Unlike traditional POSIX environments where applications inherit host user permissions, WASI (WebAssembly System Interface) operates on explicit capability grants.&lt;/p&gt;

&lt;p&gt;By default, a Wasm module has zero access to filesystems, system clocks, random number generators, or network sockets. The host runtime must explicitly mount specific host directories or grant socket descriptors during execution.&lt;/p&gt;

&lt;p&gt;This capability-based security model ensures that even if a Wasm module contains vulnerable dependencies, an attacker cannot read host environment variables or establish unauthorized outbound network connections.&lt;/p&gt;

&lt;p&gt;WASI Preview 2 introduces component model interfaces (WIT), enabling fine-grained API contract definitions between isolated modules.&lt;/p&gt;

&lt;p&gt;Granular capability configuration prevents lateral movement across serverless microservice architectures.&lt;/p&gt;

&lt;p&gt;Explicit I/O capability mapping eliminates unauthorized network socket creation in cloud-native workloads.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Compile Rust code to Wasm target&lt;/span&gt;
cargo build &lt;span class="nt"&gt;--target&lt;/span&gt; wasm32-wasip1 &lt;span class="nt"&gt;--release&lt;/span&gt;

&lt;span class="c"&gt;# Execute Wasm module with explicit directory capability grant&lt;/span&gt;
wasmtime run &lt;span class="nt"&gt;--dir&lt;/span&gt; /opt/app/data::/data target/wasm32-wasip1/release/microservice.wasm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Kubernetes Integration with Spin &amp;amp; Runwasi
&lt;/h2&gt;

&lt;p&gt;Cloud-native platforms integrate Wasm workloads into Kubernetes clusters using containerd shim plugins like runwasi.&lt;/p&gt;

&lt;p&gt;Wasm pods run alongside standard OCI containers, enabling developers to deploy lightweight microservices with minimal RAM footprint (2MB per instance).&lt;/p&gt;

&lt;p&gt;Nanosecond startup times allow serverless Wasm workloads to scale from zero to thousands of instances instantly without cold start latency.&lt;/p&gt;

&lt;p&gt;Wasm runtimes consume significantly fewer CPU resources than container runtimes, optimizing cluster node density.&lt;/p&gt;

&lt;p&gt;Deploying Wasm workloads on Kubernetes reduces cluster infrastructure operating costs dramatically.&lt;/p&gt;

&lt;p&gt;Runwasi shims abstract runtime lifecycle management while maintaining native Kubernetes pod API compatibility.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Kubernetes Pod using RuntimeClass for Wasm workload&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;WASI-microservice&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;runtimeClassName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;wasmtime-spin&lt;/span&gt;
  &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;API-worker&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ghcr.io/zyekh/wasi-service:v1.0.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Verification &amp;amp; Security Audit Checklist
&lt;/h2&gt;

&lt;p&gt;Audit compiled Wasm binaries using wasm-objdump to verify exported functions and linear memory section boundaries.&lt;/p&gt;

&lt;p&gt;Inspect WASI imports using wasm-tools to confirm that no unapproved host capabilities are requested.&lt;/p&gt;

&lt;p&gt;Enforce cryptographic signing on Wasm modules using Sigstore Cosign to verify artifact integrity before execution.&lt;/p&gt;

&lt;p&gt;Monitor Wasm runtime memory consumption using Prometheus metrics exported by Wasmtime shims.&lt;/p&gt;

&lt;p&gt;Incorporate static analysis checks into CI/CD pipelines to audit WASI import grants automatically.&lt;/p&gt;

&lt;p&gt;Automated binary analysis ensures Wasm bytecode contains no malicious host function calls.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Inspect Wasm binary sections and imports&lt;/span&gt;
wasm-objdump &lt;span class="nt"&gt;-h&lt;/span&gt; target/wasm32-wasip1/release/microservice.wasm

&lt;span class="c"&gt;# Verify WASI imports allowlist&lt;/span&gt;
wasm-tools component inspect microservice.wasm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Can Wasm replace Docker containers entirely?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Wasm is complementary. It excels for high-concurrency microservices and edge computing, while containers remain ideal for full OS distributions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Is WebAssembly limited to browser applications?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. Non-browser Wasm runtimes (Wasmtime, WasmEdge) power enterprise backend microservices and serverless infrastructure.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/zero-trust-microservices-with-wasm-runtime-sandboxing.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/zero-trust-microservices-with-wasm-runtime-sandboxing.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cloudsecurity</category>
      <category>webassembly</category>
    </item>
    <item>
      <title>Understanding eBPF for Real-Time Linux Security Monitoring</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:48:56 +0000</pubDate>
      <link>https://dev.to/aomiqaza/understanding-ebpf-for-real-time-linux-security-monitoring-3bfn</link>
      <guid>https://dev.to/aomiqaza/understanding-ebpf-for-real-time-linux-security-monitoring-3bfn</guid>
      <description>&lt;h1&gt;
  
  
  Understanding eBPF for Real-Time Linux Security Monitoring
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Technical deep-dive on Extended Berkeley Packet Filter (eBPF) tracing, kprobes, tracepoints, bpftrace, and zero-overhead kernel runtime security monitoring.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Kernel-Level Visibility: eBPF enables non-intrusive tracing of system calls, process executions, network packets, and file I/O directly within kernel space.&lt;/li&gt;
&lt;li&gt;Zero Context-Switch Overhead: In-kernel JIT-compiled execution avoids costly user-to-kernel space context switches.&lt;/li&gt;
&lt;li&gt;Safety-Verified Execution: The in-kernel eBPF verifier proves program safety (no memory corruption, no infinite loops) prior to loading.&lt;/li&gt;
&lt;li&gt;Real-Time Threat Detection: Hook into kprobes, uprobes, and tracepoints to catch container breakouts and rootkit persistence instantly.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Traditional Linux security monitoring tools rely on user-space daemons polling /proc, intercepting system calls via ptrace, or consuming syslog streams. These approaches introduce significant CPU context-switching overhead and can be bypassed or disabled by sophisticated rootkits operating with kernel privileges.&lt;/p&gt;

&lt;p&gt;eBPF (Extended Berkeley Packet Filter) revolutionizes Linux system security by allowing developers and security engineers to execute sandboxed byte-code directly inside the Linux kernel without recompiling the kernel or loading risk-prone kernel modules (LKM).&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What is eBPF &amp;amp; Kernel Architecture
&lt;/h2&gt;

&lt;p&gt;Originally designed for high-performance network packet filtering, eBPF has evolved into a general-purpose, event-driven execution engine embedded inside the Linux kernel. It allows non-root users with appropriate capabilities to inspect kernel internals without crashing or slowing down system operations.&lt;/p&gt;

&lt;p&gt;When an eBPF program is attached to a kernel event (such as a sys_execve system call or socket packet arrival), the kernel triggers the eBPF bytecode immediately when the event fires. The bytecode reads event context (such as process ID, UID, parent PID, command line arguments) and pushes the data to user-space via high-speed eBPF Ring Buffers.&lt;/p&gt;

&lt;p&gt;eBPF state is maintained across events using BPF Maps—generic key/value data structures accessible from both kernel bytecode and user-space control daemons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hash Maps (BPF_MAP_TYPE_HASH): Fast lookup tables for tracking open connections or active file descriptors.&lt;/li&gt;
&lt;li&gt;Ring Buffers (BPF_MAP_TYPE_RINGBUF): Lockless ring buffer data structures providing high-throughput event notification to user-space with minimal CPU cache thrashing.&lt;/li&gt;
&lt;li&gt;Array Maps (BPF_MAP_TYPE_ARRAY): Fixed-size indexed arrays for storing metrics, counters, and configuration flags.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. The eBPF Verifier &amp;amp; JIT Compiler Safety
&lt;/h2&gt;

&lt;p&gt;A primary concern when running custom code inside the operating system kernel is system stability—a bug in a traditional kernel module causes a kernel panic (BSOD).&lt;/p&gt;

&lt;p&gt;eBPF solves this via the eBPF Verifier. Before any eBPF bytecode is loaded into the kernel, the verifier analyzes all execution paths to guarantee:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The program does not contain unconstrained loops (ensuring execution completes).&lt;/li&gt;
&lt;li&gt;Memory access is strictly bounded (preventing out-of-bounds pointer dereferencing).&lt;/li&gt;
&lt;li&gt;The program holds appropriate Linux capabilities (CAP_BPF or CAP_SYS_ADMIN).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Probes &amp;amp; Tracepoints: Hooking System Events
&lt;/h2&gt;

&lt;p&gt;eBPF programs attach to various kernel instrumentation points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;kprobes / kretprobes: Dynamic attachment to any internal Linux kernel function entry or exit point.&lt;/li&gt;
&lt;li&gt;tracepoints: Stable, static kernel instrumentation points defined by Linux kernel developers.&lt;/li&gt;
&lt;li&gt;uprobes / uretprobes: Dynamic tracing of user-space functions (e.g., tracing SSL/TLS library calls in OpenSSL).&lt;/li&gt;
&lt;li&gt;XDP (eXpress Data Path): In-driver network packet filtering executing before memory allocation for the Linux network stack.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Practical bpftrace Security One-Liners
&lt;/h2&gt;

&lt;p&gt;bpftrace is a high-level tracing language for eBPF. Below are real-world security monitoring scripts that can be executed directly from the terminal:&lt;/p&gt;

&lt;p&gt;Trace all new process executions with PID, parent PID, and command line arguments in real time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;bpftrace &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'tracepoint:syscalls:sys_enter_execve { printf("%-6d %-6d %-16s %s\n", pid, ppid, comm, str(args-&amp;gt;filename)); }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Trace failed SSH / pam authentication attempts by monitoring open file handles:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;bpftrace &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'tracepoint:syscalls:sys_enter_openat /str(args-&amp;gt;filename) == "/etc/shadow"/ { printf("Alert: %s (PID %d) accessed /etc/shadow\n", comm, pid); }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Portable eBPF Execution: CO-RE &amp;amp; BTF
&lt;/h2&gt;

&lt;p&gt;Historically, compiled eBPF C code required header files matching the exact running Linux kernel version installed on the target machine. This created deployment friction in heterogeneous cloud server fleets.&lt;/p&gt;

&lt;p&gt;Modern eBPF resolves kernel portability via CO-RE (Compile Once – Run Everywhere) powered by BTF (BPF Type Format). BTF provides compact, self-describing kernel metadata that enables the eBPF loader (libbpf) to dynamically relocate struct offset fields at load time across diverse kernel releases without recompilation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// C code using eBPF CO-RE struct relocation&lt;/span&gt;
&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;vmlinux.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;bpf/bpf_helpers.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;bpf/bpf_core_read.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="n"&gt;SEC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"kprobe/sys_execve"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;BPF_KPROBE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;trace_exec&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;u32&lt;/span&gt; &lt;span class="n"&gt;pid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bpf_get_current_pid_tgid&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;bpf_printk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Execve triggered by PID %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pid&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="n"&gt;LICENSE&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;SEC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"license"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"GPL"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Performance Comparison: eBPF vs ptrace vs Auditd
&lt;/h2&gt;

&lt;p&gt;Comparison of kernel observability mechanisms:&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Frequently Asked Questions (FAQ)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: What is eBPF and why is it revolutionary for Linux security?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;eBPF (Extended Berkeley Packet Filter) allows sandboxed programs to run directly inside the Linux kernel without changing kernel source code or loading kernel modules, enabling zero-overhead security monitoring.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: How does eBPF compare to traditional ptrace or auditd logging?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Traditional ptrace and auditd introduce heavy context-switching overhead and can be bypassed by user-space rootkits. eBPF hooks directly into kernel tracepoints with microsecond latency.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/understanding-linux-ebpf-security-monitoring.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/understanding-linux-ebpf-security-monitoring.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linuxkernel</category>
      <category>ebpfmonitoring</category>
    </item>
    <item>
      <title>S-LoRA: Multiplexing Thousands of Fine-Tuned Adapters on a Single GPU</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:48:52 +0000</pubDate>
      <link>https://dev.to/aomiqaza/s-lora-multiplexing-thousands-of-fine-tuned-adapters-on-a-single-gpu-2c9e</link>
      <guid>https://dev.to/aomiqaza/s-lora-multiplexing-thousands-of-fine-tuned-adapters-on-a-single-gpu-2c9e</guid>
      <description>&lt;h1&gt;
  
  
  S-LoRA: Multiplexing Thousands of Fine-Tuned Adapters on a Single GPU
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;How Unified Paging and scalable LoRA adapter serving allows cloud platforms to host 10,000+ custom fine-tuned models concurrently on a single GPU without OOM errors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Multi-Tenant Serving Challenge: Hosting thousands of custom fine-tuned LLMs natively requires independent base model instances, causing severe VRAM waste.&lt;/li&gt;
&lt;li&gt;S-LoRA Architecture: Store a single shared base model in VRAM and dynamically multiplex thousands of small Low-Rank Adapters (LoRA).&lt;/li&gt;
&lt;li&gt;Unified Paging: Manage adapter weights and KV caches in a unified memory pool, eliminating fragmentation during batched inference.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. The Multi-Tenant Model Serving Bottleneck
&lt;/h2&gt;

&lt;p&gt;SaaS platforms and enterprise AI providers frequently need to serve customized language models tailored to thousands of individual enterprise clients. Traditional fine-tuning creates full model copies for every client, requiring immense hardware infrastructure.&lt;/p&gt;

&lt;p&gt;Deploying 1,000 fine-tuned 7B models using standard serving infrastructure would require 1,000 independent GPU instances, costing tens of thousands of dollars per month in hardware overhead and leaving GPUs idle during low-traffic periods.&lt;/p&gt;

&lt;p&gt;Low-Rank Adaptation (LoRA) mitigates training costs by freezing base model weights and training small low-rank rank-decomposition matrices (A and B). However, standard serving engines like Hugging Face or vLLM historically required merging LoRA weights into the base model before inference.&lt;/p&gt;

&lt;p&gt;Merging weights destroys multi-tenant flexibility and requires reloading base models repeatedly. S-LoRA addresses this challenge by serving thousands of unmerged LoRA adapters concurrently on top of a single base model instance without restarting CUDA runtimes.&lt;/p&gt;

&lt;p&gt;By decoupling the heavy base model parameters (e.g., 14GB for Llama-3 8B) from lightweight client-specific adapter deltas (10MB-30MB), S-LoRA transforms GPU VRAM into a multi-tenant dynamic cache.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Unified Paging &amp;amp; Memory Allocation Mechanics
&lt;/h2&gt;

&lt;p&gt;The core innovation of S-LoRA is Unified Paging. Similar to vLLM's PagedAttention, S-LoRA manages both dynamic KV cache pages and dynamic LoRA adapter weights within a single unified memory pool in GPU HBM.&lt;/p&gt;

&lt;p&gt;LoRA matrices typically have small rank sizes (e.g., r=8 or r=16), resulting in adapter weights ranging from 10MB to 50MB per model, compared to 14GB for the base 7B model. Managing these heterogeneous tensor sizes without fragmentation requires specialized OS-like virtual memory mapping.&lt;/p&gt;

&lt;p&gt;S-LoRA allocates memory for adapter weights dynamically in non-contiguous 2D memory blocks. When a client request arrives specifying Adapter ID #4092, S-LoRA fetches only the small adapter weight blocks into GPU memory on demand.&lt;/p&gt;

&lt;p&gt;This dynamic allocation allows a single GPU equipped with 80GB VRAM to host over 10,000 distinct fine-tuned customer adapters simultaneously without triggering out-of-memory errors.&lt;/p&gt;

&lt;p&gt;The unified memory pool acts as an adaptive cache buffer: frequently requested adapters are retained in fast HBM VRAM, while cold client adapters are swapped to host RAM or NVMe storage in sub-millisecond background streams.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Pseudocode for Batched S-LoRA Vector Matrix Addition
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;batched_slora_forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base_x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;adapter_ids&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lora_A_pool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lora_B_pool&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Compute shared base model output
&lt;/span&gt;    &lt;span class="n"&gt;base_out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;base_model_forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base_x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Batched GEMM for custom LoRA adapters
&lt;/span&gt;    &lt;span class="n"&gt;adapter_out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_like&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base_out&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;adapter_id&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;adapter_ids&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;lora_A_pool&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;adapter_id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;B&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;lora_B_pool&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;adapter_id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;adapter_out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base_x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;@&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="o"&gt;@&lt;/span&gt; &lt;span class="n"&gt;B&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;scaling&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;base_out&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;adapter_out&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Fused Batched GEMM Kernels for Multi-Adapter Inference
&lt;/h2&gt;

&lt;p&gt;Executing distinct LoRA adapters for different requests in a single batch introduces kernel launch overhead. Naive sequential loops over individual adapters destroy GPU tensor core utilization and cause severe latency spikes.&lt;/p&gt;

&lt;p&gt;S-LoRA implements customized CUDA GEMM kernels (Cutlass-based) that execute batched matrix multiplications for heterogeneous rank adapters in a single GPU kernel invocation.&lt;/p&gt;

&lt;p&gt;The custom kernel gathers input hidden states for all requests, matches them against their corresponding adapter weight pointers in the Unified Paging table, and computes the low-rank delta outputs in parallel across warp threads.&lt;/p&gt;

&lt;p&gt;This kernel fusion ensures that adding thousands of active adapters adds less than 5% latency overhead compared to serving the un-adapted base model alone.&lt;/p&gt;

&lt;p&gt;Furthermore, memory layout alignment ensures that tensor core matrix multiplications achieve near-peak TFLOPS throughput during batched inference passes.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Production Deployment &amp;amp; Hot-Swapping Architecture
&lt;/h2&gt;

&lt;p&gt;Platforms using S-LoRA can dynamically hot-swap adapters without restarting GPU inference processes or flushing KV cache pools.&lt;/p&gt;

&lt;p&gt;New fine-tuned customer adapters can be uploaded to S3 storage and loaded by S-LoRA in sub-50 milliseconds upon the first incoming request.&lt;/p&gt;

&lt;p&gt;This architecture turns multi-tenant AI customization into a highly scalable, cost-efficient utility suitable for enterprise SaaS applications.&lt;/p&gt;

&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Does S-LoRA support adapters trained on different base models?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. All multiplexed adapters must share the same underlying base model architecture (e.g., Llama-3 8B).&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/slora-adapter-multiplexing-single-gpu.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/slora-adapter-multiplexing-single-gpu.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aiengineering</category>
      <category>performance</category>
    </item>
    <item>
      <title>OmniRouter Architecture: Resilient LLM Gateway Routing &amp; Fallback Pipelines</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:48:15 +0000</pubDate>
      <link>https://dev.to/aomiqaza/omnirouter-architecture-resilient-llm-gateway-routing-fallback-pipelines-12op</link>
      <guid>https://dev.to/aomiqaza/omnirouter-architecture-resilient-llm-gateway-routing-fallback-pipelines-12op</guid>
      <description>&lt;h1&gt;
  
  
  OmniRouter Architecture: Resilient LLM Gateway Routing &amp;amp; Fallback Pipelines
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Advanced API routing techniques for multi-LLM architectures, mitigating rate limits, and ensuring speculative decoding fallbacks across OpenAI, Anthropic, and open-source nodes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic Gateway Routing: Route queries to specialized models based on semantic classification and latency metrics.&lt;/li&gt;
&lt;li&gt;Resilient Fallback Chains: Automatically downgrade from expensive frontier models to local 8B models during API outages.&lt;/li&gt;
&lt;li&gt;Speculative Decoding Pipelines: Accelerate inference by drafting tokens on smaller models and verifying on larger models.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. Multi-Model Gateway Routing Topologies
&lt;/h2&gt;

&lt;p&gt;In modern AI engineering, relying on a single monolithic language model API creates unacceptable single points of failure. The OmniRouter architecture introduces a specialized Model Gateway that intercepts client requests, analyzes the prompt's structural intent, and dynamically routes the inference workload to the most optimal model based on cost, latency, and capability matrices.&lt;/p&gt;

&lt;p&gt;By deploying a sidecar proxy written in Rust or Go, organizations can implement context-aware load balancing. If a user submits a complex logical reasoning task, the router forwards the request to a reasoning-heavy frontier model. Conversely, if the prompt is a simple summarization task, the router seamlessly redirects the payload to a locally hosted, highly quantized Llama-3 8B model.&lt;/p&gt;

&lt;p&gt;This selective routing mechanism significantly reduces token expenditure while maintaining high-fidelity responses. It also shields the underlying application logic from downstream API deprecations or sudden latency spikes in third-party model providers. The gateway acts as a robust abstraction layer.&lt;/p&gt;

&lt;p&gt;Advanced routing strategies also involve embedding-based classification, where the router maintains a vector store of historical queries mapped to the most successful model choices. This machine-learning-driven routing ensures that the system continuously optimizes its own pathing logic.&lt;/p&gt;

&lt;p&gt;Furthermore, semantic caching layers can be integrated directly into the router, allowing exact or highly similar queries to bypass inference entirely, returning sub-millisecond responses derived from previous generation cycles.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;// Example OmniRouter Configuration in YAML&lt;/span&gt;
&lt;span class="na"&gt;routes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;match&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;intent&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;complex_reasoning"&lt;/span&gt;
    &lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-3-5-sonnet"&lt;/span&gt;
    &lt;span class="na"&gt;fallback&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4o"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;llama-3-70b-instruct"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;match&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;intent&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;summarization"&lt;/span&gt;
    &lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;llama-3-8b-instruct"&lt;/span&gt;
    &lt;span class="na"&gt;fallback&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mistral-7b-instruct"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Fallback Resilience &amp;amp; Latency Mitigation
&lt;/h2&gt;

&lt;p&gt;Outages and rate limits are inevitable when orchestrating cloud-based inference APIs. A naive implementation that retries the same endpoint will quickly exhaust operational timeout windows, leading to catastrophic user experience degradation. A proper fallback chain architecture gracefully handles HTTP 429 (Too Many Requests) and HTTP 503 (Service Unavailable) errors.&lt;/p&gt;

&lt;p&gt;The OmniRouter enforces strict latency budgets. If the primary model fails to stream the first token within 800 milliseconds, the router automatically cancels the request and shifts the payload to the secondary fallback model. This aggressive circuit-breaking mechanism ensures that users never stare at infinite loading spinners.&lt;/p&gt;

&lt;p&gt;When designing these fallback chains, engineers must account for tokenization discrepancies. Different models utilize different subword tokenizers (e.g., Tiktoken vs. SentencePiece). The router must dynamically re-tokenize and adjust max-token limits on the fly to ensure compatibility with the fallback model's context window constraints.&lt;/p&gt;

&lt;p&gt;To prevent cascading failures, the router implements exponential backoff with jitter when communicating with degraded endpoints. It also maintains a sliding window of health checks, temporarily quarantining models that exhibit high error rates until they pass synthetic baseline tests.&lt;/p&gt;

&lt;p&gt;This decoupling of the inference layer guarantees that the application remains fully operational, even during global service disruptions of major AI providers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;executeWithFallback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;ModelBackend&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;backend&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="m"&gt;800&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Millisecond&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;backend&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Backend %s failed, cascading to next..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;backend&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"All fallback backends exhausted"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Speculative Decoding Optimization
&lt;/h2&gt;

&lt;p&gt;Speculative decoding represents a paradigm shift in auto-regressive generation speed. Instead of relying solely on a massive, high-latency model to generate tokens sequentially, the router pairs a small 'draft' model with a large 'verification' model. The draft model rapidly generates a sequence of speculative tokens.&lt;/p&gt;

&lt;p&gt;The large verification model then evaluates these drafted tokens in parallel. Because LLMs are significantly faster at processing and verifying existing tokens than generating new ones, this parallel verification step drastically reduces the overall time-to-first-token (TTFT) and time-between-tokens (TBT).&lt;/p&gt;

&lt;p&gt;In an OmniRouter setup, the gateway manages this speculative pipeline. It handles the synchronization between the local draft model running on consumer-grade GPUs and the massive verification model running on a cluster of H100s. If the verification model rejects a drafted token, the pipeline simply discards the subsequent sequence and resumes standard generation.&lt;/p&gt;

&lt;p&gt;This technique yields a 2x to 3x speedup in generation tasks without any degradation in output quality, as the final output is mathematically identical to what the large model would have generated on its own.&lt;/p&gt;

&lt;p&gt;Implementing speculative decoding requires rigorous alignment between the draft and target models. They must share the exact same vocabulary and tokenizer. The router acts as the orchestrator, ensuring precise state management across the distributed tensor operations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Pseudocode for Speculative Decoding loop
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;speculative_decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;draft_model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;draft_tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;draft_model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;target_logits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;target_model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;draft_tokens&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;verified_tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;verify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;draft_tokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_logits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;verified_tokens&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;verified_tokens&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;verified_tokens&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;sample&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target_logits&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Observability and Cost Telemetry
&lt;/h2&gt;

&lt;p&gt;Operating a multi-model routing gateway introduces significant observability challenges. Traditional APM tools are often insufficient for tracking LLM-specific metrics such as tokens-per-second, prompt cache hit rates, and speculative acceptance ratios. The OmniRouter must emit high-cardinality telemetry data.&lt;/p&gt;

&lt;p&gt;By logging payload sizes, latency distributions, and explicit cost-per-query calculations to a time-series database like ClickHouse, engineering teams can visualize exactly which routing paths are consuming the most budget. This granular visibility is crucial for identifying inefficient prompts that are unnecessarily routed to expensive frontier models.&lt;/p&gt;

&lt;p&gt;Furthermore, capturing the raw input and output payloads (subject to PII redaction) allows teams to perform offline evaluations. These evaluations feed back into the routing logic, continuously refining the intent classification models.&lt;/p&gt;

&lt;p&gt;The telemetry pipeline also monitors the health of the fallback chains, triggering alerts if a secondary model experiences anomalous traffic volumes, indicating a silent failure in the primary routing path.&lt;/p&gt;

&lt;p&gt;Ultimately, this observability framework transforms the LLM gateway from a simple proxy into an intelligent, self-optimizing control plane for enterprise AI workloads.&lt;/p&gt;

&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Does OmniRouter introduce significant network latency?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. When deployed as a sidecar or within the same VPC, the routing overhead is typically under 2 milliseconds, which is negligible compared to standard LLM generation times.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/omnirouter-llm-gateway-routing-fallback-patterns.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/omnirouter-llm-gateway-routing-fallback-patterns.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aiengineering</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Serving Mixture of Experts (MoE): Memory-Efficient Inference Routing</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:48:11 +0000</pubDate>
      <link>https://dev.to/aomiqaza/serving-mixture-of-experts-moe-memory-efficient-inference-routing-1l3b</link>
      <guid>https://dev.to/aomiqaza/serving-mixture-of-experts-moe-memory-efficient-inference-routing-1l3b</guid>
      <description>&lt;h1&gt;
  
  
  Serving Mixture of Experts (MoE): Memory-Efficient Inference Routing
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Deep dive into the gating router mechanisms of Mixtral 8x7B and DeepSeek-V2, expert parallelism strategies, and VRAM memory offloading patterns across multi-GPU setups.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Sparse Execution: MoE architectures scale model parameter count to hundreds of billions while executing only a fraction of parameters per token.&lt;/li&gt;
&lt;li&gt;Gating Router Mechanisms: Softmax gating routers dynamically assign tokens to top-k expert networks based on semantic specialization.&lt;/li&gt;
&lt;li&gt;Expert Parallelism (EP): Shard individual expert Feed-Forward Networks across multiple GPUs to balance VRAM footprint.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. Sparse Computation: The Power of Mixture of Experts
&lt;/h2&gt;

&lt;p&gt;Dense Transformer models process every single input token through every parameter in the network. As model parameter counts scale from 7B to 70B and beyond, the FLOPs required per token scale linearly, making real-time inference prohibitively expensive.&lt;/p&gt;

&lt;p&gt;Mixture-of-Experts (MoE) architectures solve this efficiency scaling problem by replacing monolithic Feed-Forward Network (FFN) layers with multiple independent 'expert' sub-networks.&lt;/p&gt;

&lt;p&gt;In a sparse MoE model such as Mixtral 8x7B, the total parameter count is 47 billion. However, during inference, a router routes each token to only 2 of the 8 available experts per layer. Consequently, only 13 billion parameters are active per token.&lt;/p&gt;

&lt;p&gt;This sparse execution model delivers the high capability and knowledge capacity of a 47B model at the inference latency and FLOP cost of a much smaller 13B model.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Gating Router Mathematics &amp;amp; Top-K Softmax
&lt;/h2&gt;

&lt;p&gt;The core intelligence of an MoE layer resides in its gating router network. The router is a lightweight learnable linear layer that takes input token representations H and computes a probability distribution over N experts.&lt;/p&gt;

&lt;p&gt;To enforce sparsity, the router applies a Top-K gating function. The router multiplies input hidden state H by weight matrix W_g, adds noise during training for load balancing, and selects the top K highest scoring expert indices via Softmax normalization.&lt;/p&gt;

&lt;p&gt;If an expert's score falls outside the top K, its gate value is set to zero, bypassing compute execution for that sub-network entirely.&lt;/p&gt;

&lt;p&gt;The outputs of the selected top K experts are weighted by their normalized gating scores and summed together before passing to the next Transformer layer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# PyTorch Top-K MoE Gating Router Implementation
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch.nn&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;nn&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch.nn.functional&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;F&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TopKGatingRouter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hidden_dim&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;num_experts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;top_k&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;super&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hidden_dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;num_experts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bias&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;top_k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;top_k&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Tensor&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;# x: [batch_size * seq_len, hidden_dim]
&lt;/span&gt;        &lt;span class="n"&gt;logits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;indices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;topk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;F&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;softmax&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logits&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;top_k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c1"&gt;# Normalize top-k weights so they sum to 1.0
&lt;/span&gt;        &lt;span class="n"&gt;weights&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;keepdim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;indices&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Expert Parallelism (EP) and Multi-GPU Sharding
&lt;/h2&gt;

&lt;p&gt;While MoE models save compute FLOPs per token, they do NOT save VRAM footprint. All 47B parameters of Mixtral 8x7B must reside in GPU memory to respond immediately to routed tokens.&lt;/p&gt;

&lt;p&gt;Fitting these parameters across multiple GPUs requires Expert Parallelism (EP). Unlike Tensor Parallelism (TP), which shards weight matrices within a layer, Expert Parallelism assigns different expert sub-networks to different GPU devices.&lt;/p&gt;

&lt;p&gt;GPU 0 might host Experts 1 and 2, while GPU 1 hosts Experts 3 and 4. During inference, tokens are dispatched across GPUs via high-speed All-to-All communication primitives.&lt;/p&gt;

&lt;p&gt;When token distribution across experts is unbalanced (e.g., Expert 1 receives 80% of all tokens), load imbalance occurs, causing GPU 0 to bottleneck the entire cluster. Production serving engines enforce auxiliary load-balancing losses to keep expert utilization uniform.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. High-Throughput Production Deployment Blueprint
&lt;/h2&gt;

&lt;p&gt;Serving MoE architectures in production requires high-throughput inference engines like vLLM or SGLang equipped with specialized MoE kernels.&lt;/p&gt;

&lt;p&gt;These engines implement fused Megatron-LM MoE operations and quantized weight formats (such as AWQ 4-bit), allowing a 47B MoE model to fit comfortably on a single node equipped with two 24GB or 40GB GPUs.&lt;/p&gt;

&lt;p&gt;Configuring appropriate continuous batching limits ensures that expert dispatch queues remain full, maximizing GPU HBM memory bandwidth utilization.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Deploying Mixtral 8x7B MoE on vLLM with Tensor &amp;amp; Expert Parallelism&lt;/span&gt;
python3 &lt;span class="nt"&gt;-m&lt;/span&gt; vllm.entrypoints.openai.api_server &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--model&lt;/span&gt; mistralai/Mixtral-8x7B-Instruct-v0.1 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--tensor-parallel-size&lt;/span&gt; 2 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--gpu-memory-utilization&lt;/span&gt; 0.92 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--max-num-batched-tokens&lt;/span&gt; 16384 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--quantization&lt;/span&gt; awq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Why is Mixtral 8x7B faster than Llama-2 70B if parameter sizes are comparable?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because Mixtral only executes 13B parameters per token via top-2 expert gating, requiring significantly fewer FLOPs per token than Llama-2 70B.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/moe-serving-mixture-of-experts-routing.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/moe-serving-mixture-of-experts-routing.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aiengineering</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Linux Seccomp-BPF Syscall Filtering: Restricting Process Attack Surfaces</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:47:35 +0000</pubDate>
      <link>https://dev.to/aomiqaza/linux-seccomp-bpf-syscall-filtering-restricting-process-attack-surfaces-2fch</link>
      <guid>https://dev.to/aomiqaza/linux-seccomp-bpf-syscall-filtering-restricting-process-attack-surfaces-2fch</guid>
      <description>&lt;h1&gt;
  
  
  Linux Seccomp-BPF Syscall Filtering: Restricting Process Attack Surfaces
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Step-by-step engineering blueprint for implementing Seccomp-BPF syscall filters to restrict Linux process capabilities and block zero-day kernel exploits.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Syscall Attack Surface Reduction: Block unused system calls (e.g., ptrace, reboot, kexec_load) at the kernel boundary.&lt;/li&gt;
&lt;li&gt;BPF Filter Evaluation: Evaluate syscall arguments in constant time using compiled BPF bytecode instructions.&lt;/li&gt;
&lt;li&gt;Default-Deny Policy: Enforce SECCOMP_RET_KILL_PROCESS or SECCOMP_RET_ERRNO for unapproved syscalls.&lt;/li&gt;
&lt;li&gt;Container Integration: Deploy custom Seccomp profiles across Docker, Podman, and Kubernetes workloads.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. Seccomp-BPF Kernel Architecture &amp;amp; Filter Mechanics
&lt;/h2&gt;

&lt;p&gt;The Linux kernel exposes over 450 system calls to user-space applications. A typical web server or microservice requires fewer than 50 syscalls to operate normally.&lt;/p&gt;

&lt;p&gt;Seccomp (Secure Computing Mode) with BPF extension allows developers to attach custom BPF filter programs to processes. When a syscall is invoked, the kernel passes the syscall number and arguments to the BPF evaluator before executing the kernel routine.&lt;/p&gt;

&lt;p&gt;If an attacker attempts to exploit a kernel vulnerability using an unapproved syscall (e.g., sys_ptrace or sys_unshare), Seccomp terminates the process instantly with SECCOMP_RET_KILL_PROCESS.&lt;/p&gt;

&lt;p&gt;Because Seccomp filters execute inside the kernel, they cannot be tampered with by user-space code once loaded.&lt;/p&gt;

&lt;p&gt;This in-kernel evaluation guarantees minimal latency overhead while restricting dangerous syscall execution.&lt;/p&gt;

&lt;p&gt;BPF filter chains evaluate syscall numbers in constant time, optimizing system performance under heavy load.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// C Implementation of Seccomp-BPF Syscall Allowlist&lt;/span&gt;
&lt;span class="cp"&gt;#include 
#include 
#include 
#include 
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;init_seccomp_sandbox&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Initialize default-kill Seccomp context&lt;/span&gt;
    &lt;span class="n"&gt;scmp_filter_ctx&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;seccomp_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SCMP_ACT_KILL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Allow essential system calls&lt;/span&gt;
    &lt;span class="n"&gt;seccomp_rule_add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCMP_ACT_ALLOW&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCMP_SYS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;seccomp_rule_add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCMP_ACT_ALLOW&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCMP_SYS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;seccomp_rule_add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCMP_ACT_ALLOW&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCMP_SYS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exit_group&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;seccomp_rule_add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCMP_ACT_ALLOW&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCMP_SYS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fstat&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Load BPF filter into Linux kernel&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;ret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;seccomp_load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;seccomp_release&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ret&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Deploying Custom Seccomp Profiles in Kubernetes
&lt;/h2&gt;

&lt;p&gt;Kubernetes supports custom Seccomp profiles configured via JSON security profiles placed in the /var/lib/kubelet/seccomp directory on worker nodes.&lt;/p&gt;

&lt;p&gt;Configuring Localhost Seccomp profiles restricts pod permissions beyond default container runtime settings.&lt;/p&gt;

&lt;p&gt;Profiles specify architectural target filters (x86_64, aarch64) and define explicit allowlist rules for application requirements.&lt;/p&gt;

&lt;p&gt;Using SCMP_ACT_ERRNO instead of SCMP_ACT_KILL during testing enables developers to debug missing syscalls without crashing application pods.&lt;/p&gt;

&lt;p&gt;Exporting Seccomp JSON profiles to Git repositories ensures infrastructure-as-code version control for container security settings.&lt;/p&gt;

&lt;p&gt;Configuring Architecture-specific Seccomp rules prevents cross-architecture syscall emulation exploits.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;/*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Seccomp&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Profile&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;JSON&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;(/var/lib/kubelet/seccomp/custom-strict.json)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;*/&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"defaultAction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SCMP_ACT_ERRNO"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"architectures"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"SCMP_ARCH_X86_64"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"SCMP_ARCH_AARCH64"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"syscalls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"names"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"read"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"write"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"exit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"exit_group"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"futex"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"epoll_wait"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"epoll_ctl"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SCMP_ACT_ALLOW"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Enforcing Seccomp in Pod Security Context
&lt;/h2&gt;

&lt;p&gt;Reference the custom Seccomp profile in the pod securityContext spec to apply the syscall restrictions upon container startup.&lt;/p&gt;

&lt;p&gt;Applying RuntimeDefault Seccomp profiles across all Kubernetes workloads blocks dangerous syscalls like unshare and keyctl by default.&lt;/p&gt;

&lt;p&gt;Seccomp profiles inherit down to container init processes, securing the execution lifecycle.&lt;/p&gt;

&lt;p&gt;Pod Security Standards mandate Seccomp profile configuration for all production workloads under Restricted security levels.&lt;/p&gt;

&lt;p&gt;Default-deny Seccomp enforcement blocks zero-day kernel exploit execution inside container environments.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Kubernetes SecurityContext with Seccomp Profile&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;secure-web-app&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;securityContext&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;seccompProfile&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Localhost&lt;/span&gt;
      &lt;span class="na"&gt;localhostProfile&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;custom-strict.json&lt;/span&gt;
  &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx:alpine&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Verification &amp;amp; Seccomp Audit Checklist
&lt;/h2&gt;

&lt;p&gt;Audit process Seccomp status by inspecting /proc/[pid]/status. A Seccomp value of 2 indicates active Seccomp-BPF filtering.&lt;/p&gt;

&lt;p&gt;Monitor dmesg logs for audit events generated when processes attempt unauthorized syscalls.&lt;/p&gt;

&lt;p&gt;Utilize strace with c flag to profile application syscall requirements before authoring production Seccomp profiles.&lt;/p&gt;

&lt;p&gt;Regularly review audit logs to identify unused syscalls that can be pruned from Seccomp allowlists.&lt;/p&gt;

&lt;p&gt;Automated CI testing verifies that application features function correctly under strict Seccomp enforcement.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Inspect process Seccomp status mode&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"Seccomp"&lt;/span&gt; /proc/self/status

&lt;span class="c"&gt;# Audit blocked syscall violations in dmesg audit logs&lt;/span&gt;
dmesg | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"SECCOMP"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: What is the performance overhead of Seccomp-BPF?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Seccomp-BPF executes in nanoseconds per syscall because BPF bytecode is JIT-compiled into native machine instructions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: What happens if an application invokes a forbidden syscall?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Depending on policy, Seccomp terminates the process immediately (SECCOMP_RET_KILL_PROCESS) or returns EPERM error status.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/linux-seccomp-bpf-syscall-filtering-hardening-guide.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/linux-seccomp-bpf-syscall-filtering-hardening-guide.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linuxsecurity</category>
      <category>processisolation</category>
    </item>
    <item>
      <title>High-Throughput Linux Audit Logging with Vector &amp; ClickHouse DFIR Pipeline</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:47:31 +0000</pubDate>
      <link>https://dev.to/aomiqaza/high-throughput-linux-audit-logging-with-vector-clickhouse-dfir-pipeline-15l1</link>
      <guid>https://dev.to/aomiqaza/high-throughput-linux-audit-logging-with-vector-clickhouse-dfir-pipeline-15l1</guid>
      <description>&lt;h1&gt;
  
  
  High-Throughput Linux Audit Logging with Vector &amp;amp; ClickHouse DFIR Pipeline
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Architecture guide on building a high-throughput Linux kernel audit logging pipeline using Vector log forwarder and ClickHouse for real-time DFIR forensics.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;High-Throughput Log Forwarding: Ingest 100,000+ audit events/sec using Vector written in Rust.&lt;/li&gt;
&lt;li&gt;Columnar Storage Efficiency: Compress security audit logs by 10x using ClickHouse columnar database storage.&lt;/li&gt;
&lt;li&gt;Real-Time DFIR Queries: Execute SQL analytical queries over billions of kernel process events in sub-seconds.&lt;/li&gt;
&lt;li&gt;Zero Log Loss Architecture: Utilize Vector disk-backed memory buffers to survive network outages.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. Vector Rust Forwarder vs Traditional Syslog/Filebeat
&lt;/h2&gt;

&lt;p&gt;High-volume Linux server fleets generate gigabytes of auditd events per hour. Legacy log forwarders (rsyslog, Logstash) consume excessive RAM and CPU cycles under heavy kernel syscall tracing, causing log drop under peak loads.&lt;/p&gt;

&lt;p&gt;Vector is an ultra-fast, memory-safe log forwarder written in Rust. By utilizing async I/O and zero-copy parsing, Vector processes audit events with minimal CPU overhead.&lt;/p&gt;

&lt;p&gt;Vector streams auditd logs directly from /var/log/audit/audit.log, parses raw key-value pairs into structured JSON payloads, and batches writes to ClickHouse.&lt;/p&gt;

&lt;p&gt;Using Vector's VRL (Vector Remap Language), security teams enrich raw audit records with host metadata before transmission.&lt;/p&gt;

&lt;p&gt;Vector handles high-concurrency log streams seamlessly without triggering backpressure stalls.&lt;/p&gt;

&lt;p&gt;Native Rust memory safety guarantees prevent memory leaks during prolonged high-volume logging events.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Vector Configuration (/etc/vector/vector.yaml)&lt;/span&gt;
&lt;span class="na"&gt;sources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;linux_audit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;file&lt;/span&gt;
    &lt;span class="na"&gt;include&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/var/log/audit/audit.log&lt;/span&gt;
    &lt;span class="na"&gt;ignore_checkpoints&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;

&lt;span class="na"&gt;transforms&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;parse_audit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;remap&lt;/span&gt;
    &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;linux_audit&lt;/span&gt;
    &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
      &lt;span class="s"&gt;. = parse_key_value!(.message)&lt;/span&gt;
      &lt;span class="s"&gt;.timestamp = parse_timestamp!(.msg, "%s.%3f") ?? now()&lt;/span&gt;

&lt;span class="na"&gt;sinks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;clickhouse_dfir&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;clickhouse&lt;/span&gt;
    &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;parse_audit&lt;/span&gt;
    &lt;span class="na"&gt;endpoint&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;http://127.0.0.1:8123&lt;/span&gt;
    &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;security_logs&lt;/span&gt;
    &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;audit_events&lt;/span&gt;
    &lt;span class="na"&gt;skip_unknown_fields&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. ClickHouse Columnar Schema for DFIR Forensics
&lt;/h2&gt;

&lt;p&gt;ClickHouse stores audit data column-by-column rather than row-by-row, enabling massive compression ratios (ZSTD) and rapid aggregation across billions of security events.&lt;/p&gt;

&lt;p&gt;Define MergeTree tables indexed by event timestamp and process executable path for instant query execution during incident response investigations.&lt;/p&gt;

&lt;p&gt;Configuring TTL policies automatically purges or archives cold audit logs after 90 days, optimizing disk storage.&lt;/p&gt;

&lt;p&gt;ClickHouse vector engines execute analytical aggregations directly in CPU L1/L2 caches for ultra-fast query speeds.&lt;/p&gt;

&lt;p&gt;Column-level dictionary encoding compresses repeated process execution paths efficiently.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- ClickHouse Audit Events Table Schema&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="n"&gt;security_logs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="n"&gt;security_logs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;audit_events&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nb"&gt;timestamp&lt;/span&gt; &lt;span class="n"&gt;DateTime64&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'UTC'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;LowCardinality&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;pid&lt;/span&gt; &lt;span class="n"&gt;UInt32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;uid&lt;/span&gt; &lt;span class="n"&gt;UInt32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;exe&lt;/span&gt; &lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;key&lt;/span&gt; &lt;span class="n"&gt;LowCardinality&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;success&lt;/span&gt; &lt;span class="n"&gt;UInt8&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;ENGINE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MergeTree&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exe&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;TTL&lt;/span&gt; &lt;span class="nb"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;INTERVAL&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt; &lt;span class="k"&gt;DAY&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Executing Sub-Second Forensics SQL Queries
&lt;/h2&gt;

&lt;p&gt;DFIR analysts query ClickHouse using standard SQL to investigate unauthorized binary executions or privilege escalation events across thousands of servers.&lt;/p&gt;

&lt;p&gt;Sub-second execution speeds allow incident response teams to trace lateral movement during live security incidents.&lt;/p&gt;

&lt;p&gt;Complex JOIN queries allow security operations centers to correlate process executions with network connection events.&lt;/p&gt;

&lt;p&gt;Exporting query results to CSV or JSON formats facilitates forensic evidence preservation for security reports.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Query Top 10 Executed Commands by Non-Root Users&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;exe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="k"&gt;count&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;executions&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;security_logs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;audit_events&lt;/span&gt; 
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;uid&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'EXECVE'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="nb"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;INTERVAL&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="n"&gt;HOUR&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;exe&lt;/span&gt; 
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;executions&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt; 
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Verification &amp;amp; Telemetry Audit Checklist
&lt;/h2&gt;

&lt;p&gt;Verify Vector pipeline throughput metrics and monitor ClickHouse table insertion rates.&lt;/p&gt;

&lt;p&gt;Audit disk buffer queues to ensure zero log loss during database maintenance windows.&lt;/p&gt;

&lt;p&gt;Set up Prometheus alerts for Vector buffer queue growth to detect database connectivity issues early.&lt;/p&gt;

&lt;p&gt;Regular benchmark tests confirm that ClickHouse maintains sub-second query speeds under continuous log ingestion.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Inspect Vector top processing stats&lt;/span&gt;
vector top

&lt;span class="c"&gt;# Audit ClickHouse table disk usage and row count&lt;/span&gt;
clickhouse-client &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s2"&gt;"SELECT count(), formatReadableSize(sum(data_compressed_bytes)) FROM system.parts WHERE table = 'audit_events'"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Why use ClickHouse over Elasticsearch for DFIR log storage?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ClickHouse provides 5x-10x higher log compression rates and significantly faster analytical aggregation queries with much lower RAM requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: How does Vector prevent log loss during ClickHouse server downtime?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Vector maintains disk-backed buffer queues on the local filesystem, storing incoming events until the ClickHouse endpoint recovers.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/linux-audit-logging-with-vector-and-clickhouse-dfir.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/linux-audit-logging-with-vector-and-clickhouse-dfir.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>securitymonitoring</category>
      <category>dfir</category>
    </item>
    <item>
      <title>HTTP/3 &amp; QUIC Protocol Security Hardening: Mitigating 0-RTT Replay Attacks</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:46:43 +0000</pubDate>
      <link>https://dev.to/aomiqaza/http3-quic-protocol-security-hardening-mitigating-0-rtt-replay-attacks-3p8e</link>
      <guid>https://dev.to/aomiqaza/http3-quic-protocol-security-hardening-mitigating-0-rtt-replay-attacks-3p8e</guid>
      <description>&lt;h1&gt;
  
  
  HTTP/3 &amp;amp; QUIC Protocol Security Hardening: Mitigating 0-RTT Replay Attacks
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Production blueprint for hardening HTTP/3 and QUIC transport protocols, mitigating 0-RTT replay vectors, and configuring UDP rate limiting.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;UDP Flood Mitigation: Enforce strict eBPF/XDP rate limiting on UDP port 443 to prevent QUIC amplification attacks.&lt;/li&gt;
&lt;li&gt;0-RTT Replay Defense: Disable 0-RTT early data or enforce anti-replay token validation for non-idempotent HTTP methods.&lt;/li&gt;
&lt;li&gt;Connection ID Privacy: Enable randomized QUIC Connection ID rotation to prevent client tracking across networks.&lt;/li&gt;
&lt;li&gt;Active Migration Protection: Require Path Validation (PATH_CHALLENGE) when clients switch network interfaces.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. QUIC Protocol Architecture &amp;amp; UDP Attack Vectors
&lt;/h2&gt;

&lt;p&gt;HTTP/3 replaces TCP with QUIC, a multiplexed transport protocol built on top of UDP. By integrating TLS 1.3 handshake encryption directly into the transport layer, QUIC eliminates TCP head-of-line blocking.&lt;/p&gt;

&lt;p&gt;However, shifting web traffic to UDP introduces unique security challenges. Unlike TCP SYN cookies that protect against spoofed IP handshakes, UDP socket endpoints are susceptible to UDP reflection and amplification attacks if Initial packets are not validated.&lt;/p&gt;

&lt;p&gt;QUIC mitigates address spoofing by requiring servers to validate client IP addresses using Retry packets or anti-amplification limits before sending data exceeding three times the received payload size.&lt;/p&gt;

&lt;p&gt;Enforcing QUIC connection migration rules prevents malicious actors from hijacking active sessions when clients transition between Wi-Fi and mobile networks.&lt;/p&gt;

&lt;p&gt;Properly tuning QUIC congestion control parameters optimizes throughput while mitigating bufferbloat across high-latency wireless connections.&lt;/p&gt;

&lt;p&gt;Enabling Connection ID randomization protects mobile client privacy across public Wi-Fi networks.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Nginx HTTP/3 QUIC Security Hardening in server block&lt;/span&gt;
&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="s"&gt;quic&lt;/span&gt; &lt;span class="s"&gt;reuseport&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="s"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;zyekh.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;# Mandatory TLS 1.3 for QUIC&lt;/span&gt;
    &lt;span class="kn"&gt;ssl_protocols&lt;/span&gt; &lt;span class="s"&gt;TLSv1.3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;ssl_certificate&lt;/span&gt; &lt;span class="n"&gt;/etc/letsencrypt/live/zyekh.com/fullchain.pem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;ssl_certificate_key&lt;/span&gt; &lt;span class="n"&gt;/etc/letsencrypt/live/zyekh.com/privkey.pem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;# Announce HTTP/3 availability via Alt-Svc header&lt;/span&gt;
    &lt;span class="kn"&gt;add_header&lt;/span&gt; &lt;span class="s"&gt;Alt-Svc&lt;/span&gt; &lt;span class="s"&gt;'h3=":443"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="kn"&gt;ma=86400'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Mitigating 0-RTT Replay Vulnerabilities
&lt;/h2&gt;

&lt;p&gt;QUIC supports 0-RTT (Zero Round-Trip Time) early data resumption, allowing returning clients to send HTTP request payloads in the first packet before the TLS handshake completes.&lt;/p&gt;

&lt;p&gt;Because 0-RTT packets lack forward secrecy and can be recorded and replayed by network attackers, accepting non-idempotent HTTP requests (e.g., POST, PUT, DELETE) in 0-RTT early data creates severe replay vulnerability vectors.&lt;/p&gt;

&lt;p&gt;To defend against 0-RTT replay attacks, configure reverse proxies to reject early data for state-modifying requests or disable 0-RTT entirely for sensitive endpoints.&lt;/p&gt;

&lt;p&gt;Enforcing single-use session tickets and strike register tracking prevents attackers from replaying 0-RTT requests across multiple edge locations.&lt;/p&gt;

&lt;p&gt;Application gateways should inspect Early-Data HTTP headers to reject 0-RTT execution on write-heavy database transactions.&lt;/p&gt;

&lt;p&gt;Configuring short TLS session ticket lifespans reduces replay windows significantly.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Reject 0-RTT Early Data on State-Modifying Requests&lt;/span&gt;
&lt;span class="k"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/api/v1/payment&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;# Disable 0-RTT early data for payment routes&lt;/span&gt;
    &lt;span class="kn"&gt;ssl_early_data&lt;/span&gt; &lt;span class="no"&gt;off&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;proxy_pass&lt;/span&gt; &lt;span class="s"&gt;http://127.0.0.1:8080&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. UDP Port 443 Rate Limiting &amp;amp; BPF Defense
&lt;/h2&gt;

&lt;p&gt;Protect QUIC endpoints against UDP flood attacks by enforcing hardware-level eBPF/XDP rate limiting on port 443.&lt;/p&gt;

&lt;p&gt;Drop invalid QUIC packets lacking valid Initial long headers before CPU memory allocation occurs.&lt;/p&gt;

&lt;p&gt;Utilizing nftables meter rules limits UDP connection rates per IP subnet, absorbing volume spikes before web server processes are affected.&lt;/p&gt;

&lt;p&gt;Configuring BPF socket filters drops malformed QUIC packets at the network driver level.&lt;/p&gt;

&lt;p&gt;Deploying eBPF XDP filters at the edge ensures that volumetric UDP floods are mitigated with microsecond latencies.&lt;/p&gt;

&lt;p&gt;Hardware-accelerated packet filtering prevents host CPU saturation during DDoS events.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Apply iptables / nftables UDP rate limit for QUIC fallback&lt;/span&gt;
nft add rule inet filter input udp dport 443 meter quic-limit &lt;span class="o"&gt;{&lt;/span&gt; ip saddr limit rate 50/second &lt;span class="o"&gt;}&lt;/span&gt; accept
nft add rule inet filter input udp dport 443 drop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Verification &amp;amp; HTTP/3 Audit Checklist
&lt;/h2&gt;

&lt;p&gt;Audit HTTP/3 headers using cURL with HTTP/3 support enabled. Verify that the Alt-Svc header correctly advertises the h3 protocol frame.&lt;/p&gt;

&lt;p&gt;Test 0-RTT rejection behavior on API endpoints using openssl s_client with early data flags.&lt;/p&gt;

&lt;p&gt;Monitor UDP packet drop metrics using netstat -su to verify firewall rate limiting efficiency.&lt;/p&gt;

&lt;p&gt;Ensure fallback to HTTP/2 over TLS 1.3 works seamlessly when UDP port 443 is blocked by enterprise firewalls.&lt;/p&gt;

&lt;p&gt;Validate Alt-Svc max-age values to ensure browser clients transition to QUIC transport without stale cache issues.&lt;/p&gt;

&lt;p&gt;Regular cURL audits confirm that HTTP/3 negotiation operates with optimal TLS handshake performance.&lt;/p&gt;

&lt;p&gt;Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.&lt;/p&gt;

&lt;p&gt;Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.&lt;/p&gt;

&lt;p&gt;Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.&lt;/p&gt;

&lt;p&gt;Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Audit HTTP/3 QUIC response headers with cURL&lt;/span&gt;
curl &lt;span class="nt"&gt;--http3&lt;/span&gt; &lt;span class="nt"&gt;-I&lt;/span&gt; https://zyekh.com/

&lt;span class="c"&gt;# Inspect QUIC Alt-Svc response string&lt;/span&gt;
curl &lt;span class="nt"&gt;-sI&lt;/span&gt; https://zyekh.com/ | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"Alt-Svc"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Why is 0-RTT early data vulnerable to replay attacks?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;0-RTT data is encrypted under static session ticket keys without ephemeral Diffie-Hellman keys, allowing network attackers to duplicate and retransmit the packet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: What happens if a network firewall blocks UDP port 443?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Browsers automatically fallback to HTTP/2 over standard TCP port 443 within milliseconds.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/http3-quic-security-hardening-and-0rtt-mitigation-blueprint.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/http3-quic-security-hardening-and-0rtt-mitigation-blueprint.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>websecurity</category>
      <category>networkprotocols</category>
    </item>
    <item>
      <title>ColBERT Late Interaction: Advancing RAG Beyond Dense Embeddings</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:46:38 +0000</pubDate>
      <link>https://dev.to/aomiqaza/colbert-late-interaction-advancing-rag-beyond-dense-embeddings-3n1b</link>
      <guid>https://dev.to/aomiqaza/colbert-late-interaction-advancing-rag-beyond-dense-embeddings-3n1b</guid>
      <description>&lt;h1&gt;
  
  
  ColBERT Late Interaction: Advancing RAG Beyond Dense Embeddings
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;How late interaction retrieval models solve the lost-in-the-middle problem and dramatically improve Retrieval-Augmented Generation precision over standard single-vector embeddings.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Single-Vector Bottleneck: Single-vector dense embeddings compress entire documents into one vector, losing granular semantic nuances.&lt;/li&gt;
&lt;li&gt;Late Interaction Paradigm: Retain token-level embeddings for query and document, scoring similarity using the MaxSim operator.&lt;/li&gt;
&lt;li&gt;PLAID Indexing: Compress token vectors using residual quantization to achieve sub-10ms search over millions of documents.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. The Single-Vector Dense Embedding Bottleneck
&lt;/h2&gt;

&lt;p&gt;Traditional Retrieval-Augmented Generation (RAG) pipelines rely on dense single-vector embedding models (such as OpenAI text-embedding-3 or BGE-Large). In this architecture, an entire passage consisting of hundreds of words is compressed into a single floating-point vector of fixed dimension (e.g., 1536 dimensions).&lt;/p&gt;

&lt;p&gt;This lossy compression introduces a severe semantic bottleneck. When a document contains multiple distinct facts or intricate technical specifications, compressing the entire context into one vector dilutes specific token relationships. As a result, dense vector search frequently fails on fine-grained keyword queries, exact part-number lookups, and complex multi-hop queries.&lt;/p&gt;

&lt;p&gt;Furthermore, standard dense retrieval suffers from the well-documented 'lost in the middle' phenomenon, where relevant details positioned deep inside long passages fail to achieve high cosine similarity scores against concise user queries.&lt;/p&gt;

&lt;p&gt;Solving this structural limitation requires an architectural shift from early interaction (expensive cross-encoders) and single-vector compression to token-level late interaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Late Interaction Architecture &amp;amp; MaxSim Operator
&lt;/h2&gt;

&lt;p&gt;ColBERT (Contextualized Late Interaction over BERT) introduces a hybrid retrieval model that combines the high retrieval quality of heavy cross-encoders with the execution speed of dual-encoder vector search.&lt;/p&gt;

&lt;p&gt;Instead of compressing a document into a single vector, ColBERT processes the query and document independently through BERT, generating a sequence of contextualized token embeddings for every single token in the query (Q) and document (D).&lt;/p&gt;

&lt;p&gt;The similarity score between query Q and document D is computed using the MaxSim operator. For each token vector in the query, ColBERT computes the maximum dot-product similarity across all token vectors in the document. The final relevance score is the sum of these maximum similarity scores.&lt;/p&gt;

&lt;p&gt;Because query-document token interactions are deferred until the final scoring phase (hence 'late interaction'), query embeddings and document embeddings can be pre-computed and indexed offline.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# PyTorch Implementation of ColBERT MaxSim Operator
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch.nn.functional&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;F&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;colbert_maxsim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query_embeddings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Tensor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;doc_embeddings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Tensor&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Tensor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# query_embeddings: [batch_size, q_len, dim]
&lt;/span&gt;    &lt;span class="c1"&gt;# doc_embeddings:   [batch_size, d_len, dim]
&lt;/span&gt;    &lt;span class="c1"&gt;# Compute cosine similarity matrix between all query and document tokens
&lt;/span&gt;    &lt;span class="n"&gt;sim_matrix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bmm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query_embeddings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;doc_embeddings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transpose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="c1"&gt;# MaxSim: find maximum similarity per query token across all document tokens
&lt;/span&gt;    &lt;span class="n"&gt;max_sim_per_qtoken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sim_matrix&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Sum maximum similarities across query sequence
&lt;/span&gt;    &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_sim_per_qtoken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. PLAID: Performance-Optimized Token Indexing
&lt;/h2&gt;

&lt;p&gt;Storing multiple 128-dimensional token vectors for every document in a large corpus creates immense memory overhead. Storing token embeddings for 10 million passages in uncompressed FP32 format would require terabytes of RAM.&lt;/p&gt;

&lt;p&gt;ColBERTv2 resolves this footprint challenge through PLAID (Performance-optimized Late Interaction for Asymmetric Search). PLAID utilizes residual quantization and k-means centroid clustering to compress token vectors down to 16-32 bytes per token.&lt;/p&gt;

&lt;p&gt;During retrieval, PLAID executes a pruned 3-stage search pipeline: first filtering candidate documents using centroid-level IVF indexes, then pruning unpromising documents using quantized vector representations, and finally computing exact MaxSim scores on top candidates.&lt;/p&gt;

&lt;p&gt;This quantization pipeline enables sub-10 millisecond retrieval latencies over millions of passages while consuming 90% less VRAM than uncompressed multi-vector stores.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Enterprise RAG Pipeline Integration Blueprint
&lt;/h2&gt;

&lt;p&gt;Integrating ColBERT into an enterprise RAG stack eliminates the need for complex, fragile hybrid search pipelines that attempt to merge BM25 keyword scores with dense vector cosine similarities via reciprocal rank fusion (RRF).&lt;/p&gt;

&lt;p&gt;ColBERT natively captures both fine-grained token matches and high-level semantic intent in a single unified scoring pass. Frameworks such as RAGatouille and PyLate allow developers to replace standard vector store retrievers with ColBERTv2 in fewer than ten lines of Python code.&lt;/p&gt;

&lt;p&gt;When combined with large context frontier models, ColBERT ensures that the context window receives high-density, highly relevant passages, directly reducing model hallucinations and improving answer accuracy in production environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Enterprise RAG Indexing and Search with RAGatouille / ColBERT
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;ragatouille&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RAGPreTrainedModel&lt;/span&gt;

&lt;span class="c1"&gt;# Load pre-trained ColBERTv2 checkpoint
&lt;/span&gt;&lt;span class="n"&gt;RAG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;RAGPreTrainedModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;colbert-ir/colbertv2.0&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Index technical documentation passages
&lt;/span&gt;&lt;span class="n"&gt;RAG&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;documents_list&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;index_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dfir_security_docs&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_document_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;split_documents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Execute Late Interaction search query
&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;RAG&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;How to configure eBPF XDP DDoS rate limits?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: How does ColBERT latency compare to traditional HNSW dense vector search?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With PLAID optimization, ColBERT search latency is between 5ms and 15ms, making it fully suitable for real-time production RAG pipelines.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/colbert-late-interaction-advanced-rag.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/colbert-late-interaction-advanced-rag.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aiengineering</category>
      <category>rag</category>
    </item>
    <item>
      <title>Securing VPS Infrastructure with WireGuard Mesh VPN Tunnels &amp; Strict Firewall Rules</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:46:10 +0000</pubDate>
      <link>https://dev.to/aomiqaza/securing-vps-infrastructure-with-wireguard-mesh-vpn-tunnels-strict-firewall-rules-39ag</link>
      <guid>https://dev.to/aomiqaza/securing-vps-infrastructure-with-wireguard-mesh-vpn-tunnels-strict-firewall-rules-39ag</guid>
      <description>&lt;h1&gt;
  
  
  Securing VPS Infrastructure with WireGuard Mesh VPN Tunnels &amp;amp; Strict Firewall Rules
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Step-by-step technical blueprint for creating encrypted private mesh networks between multi-cloud VPS nodes using WireGuard and UDP noise protocols.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Kernel-Level Performance: WireGuard executes inside Linux kernel space with minimal latency.&lt;/li&gt;
&lt;li&gt;Noise Protocol Framework: Cryptographic handshakes ensure perfect forward secrecy.&lt;/li&gt;
&lt;li&gt;Interface Isolation: Bind internal database and backend traffic strictly to WireGuard IP (10.0.0.x).&lt;/li&gt;
&lt;li&gt;Automated Peer Routing: Configure AllowedIPs to enforce point-to-point mesh routing.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. Cryptographic Principles of WireGuard &amp;amp; Noise Protocol
&lt;/h2&gt;

&lt;p&gt;Traditional VPN protocols like IPSec and OpenVPN suffer from extreme complexity, legacy cipher negotiation, and heavy codebase sizes exceeding 100,000 lines of C code.&lt;/p&gt;

&lt;p&gt;WireGuard features an ultra-lean codebase under 4,000 lines of C. It runs directly inside Linux kernel space and relies on modern fixed cryptographic primitives: Curve25519 for ECDH, ChaCha20 for symmetric encryption, Poly1305 for authentication, and BLAKE2s for hashing.&lt;/p&gt;

&lt;p&gt;WireGuard uses the Noise IK protocol framework, responding only to packets carrying valid cryptographic signatures, making WireGuard servers completely invisible to unauthenticated UDP port scanners.&lt;/p&gt;

&lt;p&gt;This silent response architecture eliminates port scanning visibility across public cloud infrastructure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Generate WireGuard private and public key pairs&lt;/span&gt;
wg genkey | &lt;span class="nb"&gt;tee &lt;/span&gt;privatekey | wg pubkey &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; publickey

&lt;span class="c"&gt;# Secure private key file permissions&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;600 privatekey
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Configuring Interface Parameters in /etc/wireguard/wg0.conf
&lt;/h2&gt;

&lt;p&gt;WireGuard interfaces are configured using simple INI-style configuration files in /etc/wireguard/wg0.conf.&lt;/p&gt;

&lt;p&gt;Each node defines its own local [Interface] parameters (private key, virtual IP address, listening UDP port) and a series of [Peer] sections for remote nodes.&lt;/p&gt;

&lt;p&gt;The AllowedIPs setting acts as both a routing table and an access control list: packets sent to an AllowedIP are routed through the tunnel, and incoming packets from the tunnel are accepted only if their source IP matches AllowedIPs.&lt;/p&gt;

&lt;p&gt;Configuring 10.0.0.0/24 in AllowedIPs enables secure point-to-point mesh routing between multi-cloud instances.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="c"&gt;# /etc/wireguard/wg0.conf on Gateway Server (Node A)
&lt;/span&gt;&lt;span class="nn"&gt;[Interface]&lt;/span&gt;
&lt;span class="py"&gt;PrivateKey&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; 
&lt;span class="s"&gt;Address = 10.0.0.1/24&lt;/span&gt;
&lt;span class="py"&gt;ListenPort&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;51820&lt;/span&gt;

&lt;span class="nn"&gt;[Peer]&lt;/span&gt;
&lt;span class="c"&gt;# Web Server (Node B)
&lt;/span&gt;&lt;span class="py"&gt;PublicKey&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; 
&lt;span class="s"&gt;AllowedIPs = 10.0.0.2/32&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Connecting Remote Multi-Cloud Peer Nodes
&lt;/h2&gt;

&lt;p&gt;On Node B (Web Server), configure the peer connection pointing back to Node A's public IP and UDP port.&lt;/p&gt;

&lt;p&gt;Setting PersistentKeepalive = 25 sends a periodic silent ping every 25 seconds, keeping NAT sessions and firewall state tables open on cloud provider gateways.&lt;/p&gt;

&lt;p&gt;This ensures continuous tunnel connectivity without requiring re-authentication handshakes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="c"&gt;# /etc/wireguard/wg0.conf on Web Server (Node B)
&lt;/span&gt;&lt;span class="nn"&gt;[Interface]&lt;/span&gt;
&lt;span class="py"&gt;PrivateKey&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; 
&lt;span class="s"&gt;Address = 10.0.0.2/24&lt;/span&gt;

&lt;span class="nn"&gt;[Peer]&lt;/span&gt;
&lt;span class="c"&gt;# Gateway Server (Node A)
&lt;/span&gt;&lt;span class="py"&gt;PublicKey&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; 
&lt;span class="s"&gt;Endpoint = 203.0.113.10:51820&lt;/span&gt;
&lt;span class="py"&gt;AllowedIPs&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;10.0.0.0/24&lt;/span&gt;
&lt;span class="py"&gt;PersistentKeepalive&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;25&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Binding Internal Backend Services Strictly to Mesh IPs
&lt;/h2&gt;

&lt;p&gt;Once the WireGuard interface (wg0) is established, reconfigure database servers (PostgreSQL, MySQL, Redis) and internal API gateways to listen exclusively on the private WireGuard IP (e.g., 10.0.0.1).&lt;/p&gt;

&lt;p&gt;This ensures internal infrastructure services are completely unreachable from public IPv4/IPv6 internet interfaces, even if firewall rules are misconfigured.&lt;/p&gt;

&lt;p&gt;Strict IP binding guarantees zero public network exposure for core data storage layers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="c"&gt;# /etc/postgresql/15/main/postgresql.conf
&lt;/span&gt;&lt;span class="py"&gt;listen_addresses&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'10.0.0.1'&lt;/span&gt;

&lt;span class="c"&gt;# /etc/redis/redis.conf
&lt;/span&gt;&lt;span class="err"&gt;bind&lt;/span&gt; &lt;span class="err"&gt;10.0.0.1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Firewall Isolation &amp;amp; Routing Table Tuning
&lt;/h2&gt;

&lt;p&gt;Configure UFW or iptables rules to allow UDP traffic on port 51820 exclusively for WireGuard handshake packets, while permitting unrestricted internal communication over the wg0 interface.&lt;/p&gt;

&lt;p&gt;Using interface-specific firewall rules isolates private tunnel traffic from external network interfaces.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Enable WireGuard UDP port on public interface eth0&lt;/span&gt;
ufw allow &lt;span class="k"&gt;in &lt;/span&gt;on eth0 to any port 51820 proto udp comment &lt;span class="s1"&gt;'WireGuard Handshakes'&lt;/span&gt;

&lt;span class="c"&gt;# Allow all internal traffic on virtual interface wg0&lt;/span&gt;
ufw allow &lt;span class="k"&gt;in &lt;/span&gt;on wg0 comment &lt;span class="s1"&gt;'Internal Mesh Traffic'&lt;/span&gt;

&lt;span class="c"&gt;# Bring up WireGuard interface&lt;/span&gt;
wg-quick up wg0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Performance Benchmark &amp;amp; Troubleshooting Verification
&lt;/h2&gt;

&lt;p&gt;Inspect WireGuard active tunnel status, handshake timestamps, and transfer metrics using the wg command.&lt;/p&gt;

&lt;p&gt;Verify ICMP connectivity across private mesh IP endpoints using ping.&lt;/p&gt;

&lt;p&gt;Benchmark network throughput using iperf3 over the WireGuard interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Inspect active peer status and handshake ages&lt;/span&gt;
wg show

&lt;span class="c"&gt;# Ping private mesh node&lt;/span&gt;
ping 10.0.0.2

&lt;span class="c"&gt;# Benchmark throughput over WireGuard mesh&lt;/span&gt;
iperf3 &lt;span class="nt"&gt;-c&lt;/span&gt; 10.0.0.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Why is WireGuard faster than OpenVPN?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;WireGuard has fewer than 4,000 lines of code running natively inside kernel space, avoiding context switching overhead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: What happens if a WireGuard endpoint IP address changes?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;WireGuard automatically updates the endpoint IP when it receives a cryptographically authenticated packet from the new IP.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/wireguard-vpn-tunneling-for-secure-vps-mesh-networks.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/wireguard-vpn-tunneling-for-secure-vps-mesh-networks.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>websecurity</category>
      <category>wireguardmesh</category>
    </item>
    <item>
      <title>WebGPU LLM Inference: Running 7B Models Natively in the Browser</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:45:56 +0000</pubDate>
      <link>https://dev.to/aomiqaza/webgpu-llm-inference-running-7b-models-natively-in-the-browser-521c</link>
      <guid>https://dev.to/aomiqaza/webgpu-llm-inference-running-7b-models-natively-in-the-browser-521c</guid>
      <description>&lt;h1&gt;
  
  
  WebGPU LLM Inference: Running 7B Models Natively in the Browser
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Leveraging WebGPU compute shaders, TVM WebAssembly, and WGSL pipelines to run private local LLMs entirely within client-side browser sandboxes without server infrastructure.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Zero-Server Cost Architecture: Run 7B parameter models client-side with 0 infrastructure cost and total data privacy.&lt;/li&gt;
&lt;li&gt;WGSL Compute Pipelines: Utilize WebGPU Shading Language to execute parallel matrix multiplications directly on client GPUs.&lt;/li&gt;
&lt;li&gt;Web Worker Offloading: Prevent DOM freezing by decoupling WebGPU tensor execution into background Web Workers.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. The Browser Compute Revolution: WebGL vs. WebGPU
&lt;/h2&gt;

&lt;p&gt;For over a decade, browser-based graphics and compute were constrained by WebGL, an API designed primarily for rendering 2D and 3D graphics built on legacy OpenGL ES pipelines. WebGL lacked native support for general-purpose GPU (GPGPU) compute shaders, forcing machine learning engineers to resort to inefficient hacks such as packing matrix tensors into RGBA texture pixels.&lt;/p&gt;

&lt;p&gt;WebGPU fundamentally transforms client-side compute. Designed from the ground up to mirror modern low-level graphics APIs such as Vulkan, Metal, and Direct3D 12, WebGPU exposes explicit GPU queue management, bind groups, and native compute shaders through the WebGPU Shading Language (WGSL).&lt;/p&gt;

&lt;p&gt;By granting web applications direct access to hardware-accelerated parallel processing, WebGPU enables client-side execution of large language models. A modern browser running on consumer hardware can now execute 4-bit quantized 7B and 8B models (such as Llama-3 8B or Phi-3) at generation speeds exceeding 25 tokens per second.&lt;/p&gt;

&lt;p&gt;This paradigm shift eliminates server-side API hosting costs, guarantees absolute data privacy since user prompts never leave the local browser environment, and enables offline-first AI applications.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// WGSL Compute Shader for Parallel Matrix Multiplication (GEMM)
@group(0) @binding(0) var matrixA : array;
@group(0) @binding(1) var matrixB : array;
@group(0) @binding(2) var matrixC : array;

@compute @workgroup_size(16, 16)
fn main(@builtin(global_invocation_id) global_id : vec3) {
    let row = global_id.x;
    let col = global_id.y;
    var sum = 0.0;
    for (var i = 0u; i &amp;lt; 64u; i = i + 1u) {
        sum = sum + matrixA[row * 64u + i] * matrixB[i * 64u + col];
    }
    matrixC[row * 64u + col] = sum;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. WebAssembly &amp;amp; TVM Compilation Pipeline
&lt;/h2&gt;

&lt;p&gt;Running an LLM in WebGPU requires more than just compute shaders. The execution pipeline requires an intelligent runtime to manage KV caching, tokenization, autoregressive sampling, and model weight loading. Apache TVM (Tensor Virtual Machine) serves as the primary compiler framework for WebLLM deployments.&lt;/p&gt;

&lt;p&gt;The model compilation workflow begins by taking Hugging Face PyTorch weights and quantizing them into AWQ or GPTQ 4-bit representations. TVM then compiles the computational graph into two core artifacts: a WASM module containing the model's control flow logic, and a set of binary weight shards formatted for WebGPU buffer binding.&lt;/p&gt;

&lt;p&gt;During initial load, the browser fetches the quantized weight shards via HTTP range requests or retrieves them instantly from IndexedDB cache. The WebAssembly runtime allocates GPU buffer objects, binds the WGSL shaders, and initializes the autoregressive generation loop.&lt;/p&gt;

&lt;p&gt;Because memory allocation on the GPU is managed asynchronously through GPUBuffer objects, memory transfers between the CPU host and GPU device are minimized, preventing bottlenecking over the PCIe/system bus.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Preventing DOM Thread Blocking with Web Workers
&lt;/h2&gt;

&lt;p&gt;A critical engineering challenge in client-side LLM inference is main-thread starvation. If WebGPU API calls and WebAssembly generation loops execute on the main browser UI thread, heavy matrix operations will freeze the DOM, causing dropped frames, unresponsive user inputs, and browser freeze warnings.&lt;/p&gt;

&lt;p&gt;To achieve 60 FPS UI responsiveness while generating tokens, the entire WebGPU engine must be offloaded to a dedicated Web Worker thread. Modern browsers support OffscreenCanvas and WebGPU device initialization directly inside worker threads.&lt;/p&gt;

&lt;p&gt;The main thread communicates with the inference Web Worker using lightweight postMessage calls containing prompt payloads. The Web Worker streams generated token IDs back to the main thread in real time, where the UI renders them incrementally using CSS transitions.&lt;/p&gt;

&lt;p&gt;This decoupled architecture ensures that heavy tensor arithmetic never interferes with user interactions, form inputs, or smooth scrolling.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Web Worker Initialization for Client-Side LLM Streaming&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;CreateWebWorkerMLCEngine&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@mlc-ai/web-llm&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;worker&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Worker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./llm-worker.ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;module&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;worker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onmessage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;appendTokenToUI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;worker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;postMessage&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;generate&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Explain eBPF packet filtering.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Memory Limits and Browser Security Sandboxing
&lt;/h2&gt;

&lt;p&gt;Browser sandboxing enforces strict hardware boundaries. Unlike native C++ or CUDA runtimes, WebGPU applications cannot access raw host memory addresses or execute arbitrary GPU driver commands. WebGPU devices operate within a strictly isolated memory space.&lt;/p&gt;

&lt;p&gt;Chrome and Firefox cap WebGPU buffer allocations based on device capabilities, typically limiting maximum single buffer size to 2GB or 4GB on desktop hardware. Large 7B models must therefore shard their weight matrices across multiple smaller GPUBuffer allocations.&lt;/p&gt;

&lt;p&gt;Furthermore, WebGPU implements rigorous buffer sanitization. Uninitialized GPU buffers are zero-filled by the browser runtime before access is granted, preventing side-channel attacks that attempt to read leftover VRAM data from other process tabs.&lt;/p&gt;

&lt;p&gt;These security guarantees, combined with zero-server cost metrics, position WebGPU as the definitive architecture for privacy-sensitive enterprise applications.&lt;/p&gt;

&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Can WebGPU LLMs run on mobile browsers?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes. Modern iOS (Safari WebGPU) and Android (Chrome WebGPU) devices with 8GB+ RAM can execute quantized 3B models like Phi-3 or Gemma-2B at interactive speeds.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/webgpu-llm-inference-browser-sandbox.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/webgpu-llm-inference-browser-sandbox.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aiengineering</category>
      <category>webgpu</category>
    </item>
    <item>
      <title>UFW Firewall Hardening: Advanced Rate Limiting &amp; Default-Deny Security Blueprint</title>
      <dc:creator>Aomi Qaza</dc:creator>
      <pubDate>Sat, 15 Aug 2026 03:45:28 +0000</pubDate>
      <link>https://dev.to/aomiqaza/ufw-firewall-hardening-advanced-rate-limiting-default-deny-security-blueprint-3hod</link>
      <guid>https://dev.to/aomiqaza/ufw-firewall-hardening-advanced-rate-limiting-default-deny-security-blueprint-3hod</guid>
      <description>&lt;h1&gt;
  
  
  UFW Firewall Hardening: Advanced Rate Limiting &amp;amp; Default-Deny Security Blueprint
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Production guide for securing Linux servers using UFW with default-deny policies, custom application profiles, rate limiting, and interface isolation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Executive Summary &amp;amp; Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Strict Default-Deny Rules: Block all unrequested incoming connections while permitting stateful outbound traffic.&lt;/li&gt;
&lt;li&gt;Native SSH Rate Limiting: Enforce ufw limit to block IP addresses making 6+ connections within 30 seconds.&lt;/li&gt;
&lt;li&gt;Custom Application Profiles: Define precise port and protocol definitions in /etc/ufw/applications.d/.&lt;/li&gt;
&lt;li&gt;Routed Packet Filtering: Restrict IPv4/IPv6 forwarding across network bridges and container interfaces.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. Establishing Default-Deny Baseline Policies
&lt;/h2&gt;

&lt;p&gt;Unused open ports are primary targets for automated port scanners. A strict firewall baseline mandates dropping all incoming traffic by default unless explicitly allowed.&lt;/p&gt;

&lt;p&gt;When default-deny incoming is enforced, Linux drops all TCP SYN requests and UDP packets to closed ports without sending ICMP unreachable responses, preventing port scanning reconnaissance.&lt;/p&gt;

&lt;p&gt;Execute the following baseline initialization sequence on production Debian and Ubuntu instances:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Reset UFW to clean state&lt;/span&gt;
ufw &lt;span class="nt"&gt;--force&lt;/span&gt; reset

&lt;span class="c"&gt;# Set default traffic policies&lt;/span&gt;
ufw default deny incoming
ufw default allow outgoing

&lt;span class="c"&gt;# Allow SSH on custom port with rate limiting&lt;/span&gt;
ufw limit 22/tcp comment &lt;span class="s1"&gt;'SSH Rate Limited'&lt;/span&gt;

&lt;span class="c"&gt;# Enable UFW logging&lt;/span&gt;
ufw logging low
ufw &lt;span class="nt"&gt;--force&lt;/span&gt; &lt;span class="nb"&gt;enable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Advanced SSH Rate Limiting &amp;amp; Brute-Force Prevention
&lt;/h2&gt;

&lt;p&gt;Automated bots scan IPv4 CIDR blocks continuously for open port 22. Standard ufw allow 22/tcp leaves the SSH port vulnerable to sustained password guessing and handshake attacks.&lt;/p&gt;

&lt;p&gt;The ufw limit directive leverages iptables recent module to track connection attempts per IP address. If an IP address attempts 6 or more connections within a 30-second window, UFW automatically drops packets from that IP address.&lt;/p&gt;

&lt;p&gt;For maximum security, combine ufw limit with custom SSH listening ports to eliminate 99% of automated scanner noise.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Restrict custom SSH port with rate limiting&lt;/span&gt;
ufw limit 2222/tcp comment &lt;span class="s1"&gt;'Custom SSH Port Limited'&lt;/span&gt;

&lt;span class="c"&gt;# Inspect UFW active rules with rule numbers&lt;/span&gt;
ufw status numbered
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Defining Custom Application Profiles
&lt;/h2&gt;

&lt;p&gt;Instead of specifying raw port numbers directly in shell scripts, define structured application profiles in /etc/ufw/applications.d/. Profiles standardize firewall configurations across fleet management tooling.&lt;/p&gt;

&lt;p&gt;Application profiles specify the title, description, and exact TCP/UDP ports required by a service.&lt;/p&gt;

&lt;p&gt;Reload UFW application profiles and verify profile syntax using ufw app list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create /etc/ufw/applications.d/custom-web.ini
&lt;/span&gt;&lt;span class="nn"&gt;[CustomWebserver]&lt;/span&gt;
&lt;span class="py"&gt;title&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Custom Production Web Server&lt;/span&gt;
&lt;span class="py"&gt;description&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Allows HTTP and HTTPS traffic on standard web ports&lt;/span&gt;
&lt;span class="py"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;80,443/tcp&lt;/span&gt;

&lt;span class="c"&gt;# Apply application profile
&lt;/span&gt;&lt;span class="err"&gt;ufw&lt;/span&gt; &lt;span class="err"&gt;allow&lt;/span&gt; &lt;span class="err"&gt;CustomWebserver&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Interface Isolation &amp;amp; Subnet Access Control
&lt;/h2&gt;

&lt;p&gt;Multi-homed cloud instances connected to public internet interfaces and private VPC networks must restrict management access strictly to private interfaces.&lt;/p&gt;

&lt;p&gt;Configuring interface-specific rules prevents administrative ports (e.g., Redis on 6379, Postgres on 5432) from exposing bindings to public IPv4 addresses.&lt;/p&gt;

&lt;p&gt;Use in on  directives to bind rules to specific network interfaces like eth1 or wireguard wg0.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Allow PostgreSQL strictly on private VPC interface eth1&lt;/span&gt;
ufw allow &lt;span class="k"&gt;in &lt;/span&gt;on eth1 to any port 5432 proto tcp comment &lt;span class="s1"&gt;'Private DB Access'&lt;/span&gt;

&lt;span class="c"&gt;# Allow WireGuard VPN traffic on public interface eth0&lt;/span&gt;
ufw allow &lt;span class="k"&gt;in &lt;/span&gt;on eth0 to any port 51820 proto udp comment &lt;span class="s1"&gt;'WireGuard Public VPN'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Logging Calibration &amp;amp; Logrotate Management
&lt;/h2&gt;

&lt;p&gt;Uncalibrated firewall logging can fill server root disks rapidly during heavy DDoS attacks. UFW supports five logging levels: off, low, medium, high, and full.&lt;/p&gt;

&lt;p&gt;Logging level low records all blocked packets that violate default policy, plus matching logged rules. Logs are saved to /var/log/ufw.log.&lt;/p&gt;

&lt;p&gt;Ensure logrotate compresses UFW log files daily to preserve disk headroom.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Set optimal production logging level&lt;/span&gt;
ufw logging low

&lt;span class="c"&gt;# Tail live UFW blocked packets&lt;/span&gt;
&lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /var/log/ufw.log | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s1"&gt;'[UFW BLOCK]'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Verification &amp;amp; Security Audit Checklist
&lt;/h2&gt;

&lt;p&gt;Verify UFW active status, rule numbers, and default policies using verbose status outputs.&lt;/p&gt;

&lt;p&gt;Test firewall rule enforcement from an external client using nmap port scans.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Verify UFW status and rules&lt;/span&gt;
ufw status verbose

&lt;span class="c"&gt;# External port audit with nmap&lt;/span&gt;
nmap &lt;span class="nt"&gt;-sS&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 22,80,443,5432
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Frequently Asked Questions (FAQ)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Does UFW override iptables rules defined by Docker?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Docker bypasses standard UFW user rules by inserting iptables rules directly into the DOCKER chain. Use ufw-docker or configure daemon.json iptables: false for strict isolation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: What is the difference between ufw allow and ufw limit?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ufw allow permits unlimited connections, while ufw limit denies connections if an IP address attempts 6+ connections within 30 seconds.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://zyekh.com/blog/ufw-firewall-hardening-and-rate-limiting-blueprint-2026.html" rel="noopener noreferrer"&gt;https://zyekh.com/blog/ufw-firewall-hardening-and-rate-limiting-blueprint-2026.html&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>systemhardening</category>
      <category>ufwfirewall</category>
    </item>
  </channel>
</rss>
