<?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: Starry_Epidemic</title>
    <description>The latest articles on DEV Community by Starry_Epidemic (@starry_epidemic).</description>
    <link>https://dev.to/starry_epidemic</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%2F1504172%2F9be0e2b2-ddce-40be-aa40-310e37d32f2e.jpg</url>
      <title>DEV Community: Starry_Epidemic</title>
      <link>https://dev.to/starry_epidemic</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/starry_epidemic"/>
    <language>en</language>
    <item>
      <title>When Kernel Bypass Wasn't Faster: Our mTCP + AF_XDP Experiment</title>
      <dc:creator>Starry_Epidemic</dc:creator>
      <pubDate>Sun, 25 Oct 2026 10:36:36 +0000</pubDate>
      <link>https://dev.to/starry_epidemic/when-kernel-bypass-wasnt-faster-our-mtcp-afxdp-experiment-20b0</link>
      <guid>https://dev.to/starry_epidemic/when-kernel-bypass-wasnt-faster-our-mtcp-afxdp-experiment-20b0</guid>
      <description>&lt;p&gt;An engineering lesson from integrating a userspace TCP stack into Velora.&lt;/p&gt;

&lt;p&gt;Kernel bypass has an appealing promise: reduce the overhead of the kernel networking path, move packet processing into userspace, and gain more control over how packets are received, processed, and transmitted.&lt;/p&gt;

&lt;p&gt;That promise was one of the reasons we decided to integrate mTCP and AF_XDP into &lt;a href="https://github.com/Vishisht-Dwivedi/Velora" rel="noopener noreferrer"&gt;Velora&lt;/a&gt;, our C-based, event-driven TCP protocol engine.&lt;/p&gt;

&lt;p&gt;We expected the new backend to give us a performance advantage. Instead, our first controlled comparison showed the opposite.&lt;/p&gt;

&lt;p&gt;And that turned out to be an interesting result in itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  The expectation
&lt;/h2&gt;

&lt;p&gt;Velora's native backend uses Linux's TCP stack, non-blocking sockets, &lt;code&gt;epoll&lt;/code&gt;, per-connection state, and custom ring buffers. Its protocol parser uses an incremental state machine with optimized paths for contiguous headers and payloads.&lt;/p&gt;

&lt;p&gt;The alternative backend integrates mTCP, a userspace TCP stack designed around efficient packet I/O, connection management, and batching. AF_XDP provides the mechanism for redirecting packets from an XDP program into userspace through shared-memory rings.&lt;/p&gt;

&lt;p&gt;The reasoning seemed straightforward: if the application controls more of the networking path and avoids some conventional socket-processing overhead, why shouldn't it be faster?&lt;/p&gt;

&lt;p&gt;The important caveat is that &lt;strong&gt;kernel bypass is a mechanism, not a performance guarantee&lt;/strong&gt;. The gain depends on the packet I/O mode, batching, hardware support, workload, and the costs introduced by the userspace implementation itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we measured
&lt;/h2&gt;

&lt;p&gt;We started with a controlled PING/PONG benchmark comparing the native backend with the mTCP + AF_XDP backend.&lt;/p&gt;

&lt;p&gt;Both ran on the same machine, using the same client workload: 50 persistent connections, a pipeline depth of eight requests per connection, a two-second warm-up, and a five-second measurement window. We performed three alternating runs per backend.&lt;/p&gt;

&lt;p&gt;The test topology used a Linux virtual Ethernet (&lt;code&gt;veth&lt;/code&gt;) pair. It was useful for isolating the software paths, but it was not a physical-NIC benchmark.&lt;/p&gt;

&lt;p&gt;The results were clear.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Native backend&lt;/th&gt;
&lt;th&gt;mTCP + AF_XDP&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Median throughput&lt;/td&gt;
&lt;td&gt;219,015 PONG/s&lt;/td&gt;
&lt;td&gt;55,238 PONG/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Throughput range&lt;/td&gt;
&lt;td&gt;217,050–226,708 PONG/s&lt;/td&gt;
&lt;td&gt;49,610–72,205 PONG/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Median p50 RTT&lt;/td&gt;
&lt;td&gt;1.815 ms&lt;/td&gt;
&lt;td&gt;0.606 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Median p95 RTT&lt;/td&gt;
&lt;td&gt;2.588 ms&lt;/td&gt;
&lt;td&gt;11.060 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Median p99 RTT&lt;/td&gt;
&lt;td&gt;3.423 ms&lt;/td&gt;
&lt;td&gt;12.164 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Server CPU utilization, normalized to one core&lt;/td&gt;
&lt;td&gt;95.6%&lt;/td&gt;
&lt;td&gt;47.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Results from our three-run-per-backend benchmark; throughput and latency are application-level measurements.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Native Velora achieved approximately &lt;strong&gt;3.97 times the median throughput&lt;/strong&gt; of the mTCP + AF_XDP backend in this configuration.&lt;/p&gt;

&lt;p&gt;Yet the results were not uniformly worse for AF_XDP. Its median round-trip latency was lower, while its high-percentile latency was substantially worse. It also used less of one logical CPU's capacity during the measured workload.&lt;/p&gt;

&lt;p&gt;That combination matters. The userspace backend was doing less completed work per second despite not reaching the same measured CPU utilization as the native backend.&lt;/p&gt;

&lt;p&gt;The measurements tell us what happened, but not yet precisely why.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the result makes sense
&lt;/h2&gt;

&lt;p&gt;The first important detail was the interface.&lt;/p&gt;

&lt;p&gt;Our benchmark used &lt;code&gt;veth&lt;/code&gt;, not a physical NIC with native AF_XDP zero-copy support. The AF_XDP path ran in generic/SKB mode with copying into userspace. The Linux kernel's &lt;a href="https://docs.kernel.org/networking/af_xdp.html" rel="noopener noreferrer"&gt;AF_XDP documentation&lt;/a&gt; explicitly distinguishes this mode from zero-copy operation.&lt;/p&gt;

&lt;p&gt;Consequently, this experiment did not measure the full potential of an optimized, hardware-assisted AF_XDP deployment. It measured our current userspace backend under the interface and configuration we had available.&lt;/p&gt;

&lt;p&gt;That distinction is fundamental.&lt;/p&gt;

&lt;p&gt;A userspace stack must still receive packets, manage queues and buffers, process TCP state, handle retransmissions and timers, and transmit packets. Moving work out of the kernel does not eliminate that work. Depending on the path, it can replace existing costs with new ones.&lt;/p&gt;

&lt;p&gt;The native backend, meanwhile, benefits from a mature kernel TCP implementation and the surrounding networking machinery. On this particular virtual interface and workload, that path was more effective.&lt;/p&gt;

&lt;p&gt;The second detail was the workload itself. We tested complete request/response transactions rather than isolated packet reception. Each completed operation required a valid PONG to reach the client. That makes the measurement sensitive to the entire path—not just packet ingestion or protocol parsing.&lt;/p&gt;

&lt;p&gt;We also observed a large difference between median and tail latency. AF_XDP's median RTT was lower, but its p95 and p99 were much higher. This suggests uneven completion times under the tested load. Queue handling, scheduling, buffering, or TCP processing are possible contributors, but further profiling is needed before assigning a specific cause.&lt;/p&gt;

&lt;p&gt;The CPU figures reinforce the need for that investigation. Lower utilization is not automatically better efficiency if throughput has fallen even more. Equally, higher utilization does not imply an inferior design: the native backend was completing more than three times as many transactions per second.&lt;/p&gt;

&lt;h2&gt;
  
  
  The parser benchmark was a different experiment
&lt;/h2&gt;

&lt;p&gt;There is another result worth separating from this comparison.&lt;/p&gt;

&lt;p&gt;Velora's parser-oriented benchmark processes sequences of 64 &lt;code&gt;PUBLISH&lt;/code&gt; messages followed by a &lt;code&gt;PING&lt;/code&gt; marker. A sequence counts only after its confirming PONG reaches the client. With 10,000 loopback connections and 64-byte payloads, we reproduced approximately &lt;strong&gt;2.44 million confirmed protocol messages per second&lt;/strong&gt; in the native backend.&lt;/p&gt;

&lt;p&gt;That result is not directly comparable to the 219,015 PONG/s result above. The parser-oriented test amortizes one response across many incoming messages; the PING/PONG test generates a response for every request. They measure different workloads.&lt;/p&gt;

&lt;p&gt;This distinction is easy to lose when looking at performance numbers. A benchmark is only meaningful when we understand exactly what it counts.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we learned
&lt;/h2&gt;

&lt;p&gt;Our result does not demonstrate that mTCP is inherently slower than Linux TCP, or that AF_XDP cannot improve performance. The original &lt;a href="https://www.usenix.org/conference/nsdi14/technical-sessions/presentation/jeong" rel="noopener noreferrer"&gt;mTCP research&lt;/a&gt; demonstrated substantial gains through coordinated optimization of the userspace TCP stack, packet I/O, and batching on its evaluated systems.&lt;/p&gt;

&lt;p&gt;Our result is narrower: &lt;strong&gt;integrating mTCP and AF_XDP into an existing application did not, by itself, produce a throughput gain in our tested configuration.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is still a valuable finding.&lt;/p&gt;

&lt;p&gt;It tells us not to assume that an architecture associated with high performance automatically transfers those gains to a different application, machine, interface, and workload. It also gives us a concrete baseline for future work.&lt;/p&gt;

&lt;p&gt;The next experiments would need to isolate the sources of overhead, verify the packet-processing path, examine queue and buffer behavior, and evaluate a NIC and driver that support native AF_XDP operation. We also need equivalent workloads and repeatable measurements before drawing broader conclusions.&lt;/p&gt;

&lt;p&gt;For now, the native backend remains faster in the configuration we measured.&lt;/p&gt;

&lt;p&gt;And that is a perfectly useful engineering outcome. We set out expecting an improvement, measured the result, and found that our assumptions did not hold for this implementation. The next step is not to defend the optimization—it is to understand the system.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Code and benchmark artifacts: &lt;a href="https://github.com/Vishisht-Dwivedi/Velora" rel="noopener noreferrer"&gt;Velora on GitHub&lt;/a&gt;.&lt;/em&gt; &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Getting into eBPF and XDP</title>
      <dc:creator>Starry_Epidemic</dc:creator>
      <pubDate>Thu, 22 Oct 2026 15:36:48 +0000</pubDate>
      <link>https://dev.to/starry_epidemic/getting-into-ebpf-and-xdp-2706</link>
      <guid>https://dev.to/starry_epidemic/getting-into-ebpf-and-xdp-2706</guid>
      <description>&lt;p&gt;I've been spending some time learning about eBPF and XDP lately, and honestly, the Linux networking stack is a lot more interesting than I expected.&lt;/p&gt;

&lt;p&gt;The basic idea behind eBPF is pretty cool. You can run small, verified programs inside the kernel at specific hooks without having to modify the kernel itself. Depending on where you attach them, these programs can help with tracing, monitoring, security, and networking.&lt;/p&gt;

&lt;p&gt;Naturally, I ended up going down the networking rabbit hole.&lt;br&gt;
I learnt about netfilter in linux and it was kind of interesting, I used an old book from 2002 for which iptables was the newest thing but hey, it was an interesting read.&lt;/p&gt;

&lt;p&gt;Anyways, as my curiousity grew I ended up going into the actual network path that a packet must take, with the earliest section of it all being the XDP hook.&lt;/p&gt;

&lt;p&gt;XDP (eXpress Data Path) lets us run eBPF programs very early in the packet reception path. So instead of letting every incoming packet travel through the entire networking stack before deciding what to do with it, we can make certain decisions much earlier.&lt;/p&gt;

&lt;p&gt;Now some of you may ask, whats eBPF, so eBPF stands for extended berkeley packet filter which is pretty much irrelevant to the tasks it performs lol, eBPF is basically a tiny VM that runs inside the kernel at specific "hooks" and carries your programmable code, basically it's a similar kind of concept to an event based hook in React, you have an event that fires, and the eBPF code that triggers in response to that event.&lt;/p&gt;

&lt;p&gt;For example, we can drop unwanted packets, pass them to the normal networking stack, or redirect them somewhere else. The interesting part is how much unnecessary work we might be able to avoid by making the right decision early, we use it daily at the company I intern at, for rule based filtering etc, it's much much much more faster than your typical socket based or netfilter based approaches since it's the earliest intercept point you can have, thus saving a lot of context switch cycles etc at the cost of added complexity of coding it, it's quite restrictive.&lt;/p&gt;

&lt;p&gt;Then there's AF_XDP, which takes things a step further by allowing userspace applications to exchange packets with the kernel using shared memory and ring buffers. It also supports zero-copy operation on compatible setups, although that isn't guaranteed on every machine, since your NIC basically needs to support the fast path and userspace dump mechanics, otherwise it defaults to the skbuff approach which is still better than kernel based packet processing but, may not give that much of an advantage against the complexity it takes to code it up&lt;/p&gt;

&lt;p&gt;One thing I'm beginning to appreciate is that kernel bypass doesn't magically make networking faster. Moving packet processing into userspace also means taking responsibility for things the kernel would otherwise handle. And if we're talking about TCP, there's a whole lot more to deal with than simply sending and receiving packets.&lt;/p&gt;

&lt;p&gt;I still have plenty to learn about the internals, especially how XDP interacts with the driver and how AF_XDP manages packet buffers. But it's a fascinating area to explore, and I'm looking forward to getting my hands dirty with more experiments.&lt;/p&gt;

&lt;p&gt;One packet at a time, I guess. &lt;/p&gt;

&lt;p&gt;If you guys appreciate this rant, there's a also a repo I made which uses standard linux kernel mechanisms like sockets and epoll to have an asynchronous fast packet processing messaging engine with a custom binary fsm, I'm using AI to port it to support AF_XDP... however it will always remain as an external branch until I've custom coded it all, if ur working in this field.. let's connect and I'm always up for learning new things.. &lt;a href="https://github.com/Vishisht-Dwivedi/Velora" rel="noopener noreferrer"&gt;https://github.com/Vishisht-Dwivedi/Velora&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>showdev</category>
      <category>performance</category>
      <category>backend</category>
    </item>
    <item>
      <title>Systems Dev Journey</title>
      <dc:creator>Starry_Epidemic</dc:creator>
      <pubDate>Fri, 09 Oct 2026 16:02:30 +0000</pubDate>
      <link>https://dev.to/starry_epidemic/systems-dev-journey-4i4c</link>
      <guid>https://dev.to/starry_epidemic/systems-dev-journey-4i4c</guid>
      <description>&lt;p&gt;Hi, My name is Vishisht, I'm a prefinal year student and I'm trying to get into Systems Development and Kernel dev and so forth, I have experience working in web development and distributed systems (basics) and have a bit of experience working with systems and packet processing that I have earned over the past few months, I'm going further down the journey and this post is to mark the start of a series where I'll be sharing what I learned in hopes to get feedback and find people who are willing to learn with me.&lt;/p&gt;

&lt;p&gt;The blog will be focused more slightly towards the network stack and network I/O since that is the part that interests me the most at the present moment.&lt;/p&gt;

&lt;p&gt;About my current knowledge - I know how to write code in C, I understand OS curriculum along with how processes work, what filesystems are (i do not know much about their internals), how scheduling is done on the OS level, some sets of APIs that the linux kernel provides, shell, file descriptors, sockets and a bunch of stuff I learned while making some of my projects&lt;/p&gt;

&lt;p&gt;Follow along if you are in the same boat as I am, or if you just want to see a kid try getting into systems programming.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>linux</category>
      <category>architecture</category>
      <category>c</category>
    </item>
  </channel>
</rss>
