<?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: Vladimir Boyko</title>
    <description>The latest articles on DEV Community by Vladimir Boyko (@vladimir_boyko_bdd79bf232).</description>
    <link>https://dev.to/vladimir_boyko_bdd79bf232</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%2F4251713%2F91859831-51a6-463e-bdc4-7f735a655c8c.jpg</url>
      <title>DEV Community: Vladimir Boyko</title>
      <link>https://dev.to/vladimir_boyko_bdd79bf232</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vladimir_boyko_bdd79bf232"/>
    <language>en</language>
    <item>
      <title>Daffi: A High-Performance Brokerless RPC Framework for Python</title>
      <dc:creator>Vladimir Boyko</dc:creator>
      <pubDate>Wed, 18 Nov 2026 11:14:19 +0000</pubDate>
      <link>https://dev.to/vladimir_boyko_bdd79bf232/daffi-a-high-performance-brokerless-rpc-framework-for-python-23k0</link>
      <guid>https://dev.to/vladimir_boyko_bdd79bf232/daffi-a-high-performance-brokerless-rpc-framework-for-python-23k0</guid>
      <description>&lt;p&gt;What if you could build distributed Python applications without introducing another message broker — and still get impressive performance?&lt;/p&gt;

&lt;p&gt;When building distributed Python applications, developers often reach for gRPC, ZeroMQ, RabbitMQ, Redis, or other messaging solutions.&lt;/p&gt;

&lt;p&gt;Each has its strengths, but sometimes the infrastructure and complexity required to connect Python processes feel disproportionate to the actual problem.&lt;/p&gt;

&lt;p&gt;I wanted something different.&lt;/p&gt;

&lt;p&gt;Meet Daffi — a lightweight, high-performance RPC and inter-process communication (IPC) framework for Python, powered by a compiled native core.&lt;/p&gt;

&lt;p&gt;Daffi lets Python applications communicate directly, execute remote functions, distribute workloads, broadcast messages, and stream data without requiring an external message broker.&lt;/p&gt;

&lt;p&gt;And yes, I benchmarked it against several established alternatives. The results were interesting.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/600apples/daffi" rel="noopener noreferrer"&gt;https://github.com/600apples/daffi&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why another RPC framework?
&lt;/h2&gt;

&lt;p&gt;Python has several mature communication libraries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;gRPC&lt;/strong&gt; — a powerful RPC framework with Protocol Buffers and cross-language support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ZeroMQ&lt;/strong&gt; — a flexible messaging library with excellent performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RPyC&lt;/strong&gt; — remote procedure calls with transparent Python object access.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pyro5&lt;/strong&gt; — distributed object communication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ZeroRPC&lt;/strong&gt; — RPC built on top of ZeroMQ.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are all useful projects. Daffi isn't trying to replace every one of them.&lt;/p&gt;

&lt;p&gt;Instead, it focuses on a particular use case: fast and straightforward communication between Python applications.&lt;/p&gt;

&lt;p&gt;I wanted an API that feels natural to Python developers, supports different communication patterns, and doesn't require a separate broker to get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Daffi?
&lt;/h2&gt;

&lt;p&gt;Daffi is a Python framework for inter-process communication and distributed applications.&lt;/p&gt;

&lt;p&gt;Its main features include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Brokerless architecture:&lt;/strong&gt; Direct communication between processes without an external message broker.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native runtime:&lt;/strong&gt; Performance-critical connection handling is implemented in a compiled native core.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple communication patterns:&lt;/strong&gt; RPC, fire-and-forget, broadcast, and streaming.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexible serialization:&lt;/strong&gt; MessagePack, JSON, Pickle, and OPAQUE binary transfer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple runtime models:&lt;/strong&gt; Thread-based and event-driven connection handling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple transports:&lt;/strong&gt; TCP and Unix domain sockets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TLS support:&lt;/strong&gt; Encrypted TCP communication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asyncio support:&lt;/strong&gt; Integration with Python's asynchronous programming model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's see how it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;Installation is straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install daffi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Daffi requires Python 3.10 or newer.&lt;/p&gt;

&lt;h3&gt;
  
  
  A simple RPC example
&lt;/h3&gt;

&lt;p&gt;Imagine that we have two independent Python applications.&lt;/p&gt;

&lt;p&gt;One exposes functions, and the other calls them remotely.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;service.py&lt;/code&gt;&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;daffi&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;TCPTransport&lt;/span&gt;


&lt;span class="nd"&gt;@callback&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;float&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;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;


&lt;span class="nd"&gt;@callback&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&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;f&lt;/span&gt;&lt;span class="s2"&gt;"Hello, {name}!"&lt;/span&gt;


&lt;span class="n"&gt;svc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;app_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"my-service"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;transport&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;TCPTransport&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"127.0.0.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5000&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="n"&gt;svc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;svc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&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;p&gt;&lt;code&gt;client.py&lt;/code&gt;&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;daffi&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;TCPTransport&lt;/span&gt;


&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;app_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"my-client"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;transport&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;TCPTransport&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"127.0.0.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5000&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="n"&gt;conn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rpc&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="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;10.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;20.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# 30.0&lt;/span&gt;

&lt;span class="n"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rpc&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="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Alice"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Hello, Alice!&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stop&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;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;No IDL files, no generated Python stubs, no separate broker process, and no additional infrastructure for this basic scenario.&lt;/p&gt;

&lt;p&gt;You expose Python functions using &lt;code&gt;@callback&lt;/code&gt; and invoke them remotely through the connection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beyond simple RPC
&lt;/h2&gt;

&lt;p&gt;Daffi isn't limited to request-response communication.&lt;/p&gt;

&lt;p&gt;It provides several communication patterns through the same connection interface.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fire-and-forget
&lt;/h3&gt;

&lt;p&gt;Sometimes you don't need a response.&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="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rpc_nowait&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="nf"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Something happened"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The remote function is invoked without waiting for its result.&lt;/p&gt;

&lt;h3&gt;
  
  
  Broadcast
&lt;/h3&gt;

&lt;p&gt;Need to notify multiple workers?&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="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cast&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="nf"&gt;process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"new-task"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Daffi sends the call to all matching workers and collects their results.&lt;/p&gt;

&lt;h3&gt;
  
  
  Streaming
&lt;/h3&gt;

&lt;p&gt;Daffi also supports sending data in chunks.&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;daffi&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;SerdeFormat&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;chunk_source&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;65536&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"rb"&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;handle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;


&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;serde&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;SerdeFormat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OPAQUE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;process_stream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;chunk_source&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"large.bin"&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is useful when working with large files, data pipelines, or other workloads where transferring everything as a single message isn't ideal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Under the hood: a compiled native core
&lt;/h2&gt;

&lt;p&gt;One of the important design decisions behind Daffi is its compiled native core.&lt;/p&gt;

&lt;p&gt;Instead of implementing all connection-handling operations using Python-level networking primitives, Daffi delegates performance-critical runtime operations to compiled code.&lt;/p&gt;

&lt;p&gt;Why does this matter?&lt;/p&gt;

&lt;p&gt;Python is excellent for application logic, but its overhead can become significant when handling large numbers of network operations.&lt;/p&gt;

&lt;p&gt;Moving performance-critical parts into a native runtime helps reduce that overhead.&lt;/p&gt;

&lt;p&gt;Daffi currently provides two runtime modes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;threads&lt;/code&gt; — creates an operating-system thread for each connection.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;evented&lt;/code&gt; — multiplexes connections across a smaller number of event-loop threads.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The runtime can be selected when creating a Service or Router.&lt;/p&gt;

&lt;p&gt;For example:&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;daffi&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Runtime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;TCPTransport&lt;/span&gt;

&lt;span class="n"&gt;router&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;transport&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;TCPTransport&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"127.0.0.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;runtime&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;Runtime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;EVENTED&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&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;p&gt;&lt;code&gt;threads&lt;/code&gt; is the default. The numbers later in this article were measured with that default and with &lt;code&gt;workers=1&lt;/code&gt;. The &lt;code&gt;evented&lt;/code&gt; runtime in the snippet above was not part of the benchmark.&lt;/p&gt;

&lt;p&gt;The goal is to provide flexibility without forcing application developers to deal with low-level networking implementation details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benchmarking Daffi
&lt;/h2&gt;

&lt;p&gt;Now for the interesting part.&lt;/p&gt;

&lt;p&gt;I wanted to compare Daffi with established communication libraries rather than simply claim that it is fast.&lt;/p&gt;

&lt;p&gt;I tested:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Daffi 4.0.0&lt;/li&gt;
&lt;li&gt;grpcio 1.85.0&lt;/li&gt;
&lt;li&gt;ZeroMQ (pyzmq 27.2.0)&lt;/li&gt;
&lt;li&gt;nng (pynng 0.9.0)&lt;/li&gt;
&lt;li&gt;RPyC 6.0.2&lt;/li&gt;
&lt;li&gt;Pyro5 5.17&lt;/li&gt;
&lt;li&gt;ZeroRPC 0.6.3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The harness, the JSON results, and the CSV are in the repository:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/600apples/daffi/blob/main/tests/perf/article_benchmark.py" rel="noopener noreferrer"&gt;Benchmark script&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/600apples/daffi/blob/main/tests/perf/results/article_benchmark.json" rel="noopener noreferrer"&gt;Results (JSON)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/600apples/daffi/blob/main/tests/perf/results/article_benchmark.csv" rel="noopener noreferrer"&gt;Results (CSV)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From a checkout of the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install \
  &lt;span class="s2"&gt;"daffi==4.0.0"&lt;/span&gt; \
  &lt;span class="s2"&gt;"grpcio==1.85.0"&lt;/span&gt; \
  &lt;span class="s2"&gt;"pyzmq==27.2.0"&lt;/span&gt; \
  &lt;span class="s2"&gt;"pynng==0.9.0"&lt;/span&gt; \
  &lt;span class="s2"&gt;"rpyc==6.0.2"&lt;/span&gt; \
  &lt;span class="s2"&gt;"Pyro5==5.17"&lt;/span&gt; \
  &lt;span class="s2"&gt;"zerorpc==0.6.3"&lt;/span&gt;

python tests/perf/article_benchmark.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That install also pulled in &lt;code&gt;msgpack==1.2.2&lt;/code&gt; (with Daffi), &lt;code&gt;gevent==26.9.0&lt;/code&gt; (with ZeroRPC), and &lt;code&gt;protobuf==7.36.2&lt;/code&gt; (with grpcio). The generated gRPC stub used by the script is already in &lt;code&gt;tests/perf/grpc_echo/&lt;/code&gt;, so &lt;code&gt;grpcio-tools&lt;/code&gt; is not required to rerun it.&lt;/p&gt;

&lt;p&gt;On this machine the full matrix finished in about two and a half minutes. Daffi was measured only with &lt;code&gt;runtime="threads"&lt;/code&gt; and &lt;code&gt;workers=1&lt;/code&gt;. The &lt;code&gt;evented&lt;/code&gt; runtime and other worker-pool sizes were not tested, so these numbers do not describe those configurations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Test environment
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Configuration&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CPU&lt;/td&gt;
&lt;td&gt;AMD Ryzen AI 9 HX 370&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Logical CPUs&lt;/td&gt;
&lt;td&gt;24&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAM&lt;/td&gt;
&lt;td&gt;60.4 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OS&lt;/td&gt;
&lt;td&gt;Linux 7.0.0-43-generic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Architecture&lt;/td&gt;
&lt;td&gt;x86_64&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;td&gt;3.14.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Daffi&lt;/td&gt;
&lt;td&gt;4.0.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Daffi runtime&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;threads&lt;/code&gt; only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;workers&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1 (callback pool; other sizes were not measured)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;All tests used loopback TCP without TLS.&lt;/p&gt;

&lt;p&gt;The server ran in a separate process. Warmup was performed outside the measurement period.&lt;/p&gt;

&lt;p&gt;Throughput and average latency were measured using wall-clock time. P50 and P99 were collected in a separate pass with per-call timestamps.&lt;/p&gt;

&lt;p&gt;Every reported result is the median of three runs.&lt;/p&gt;

&lt;p&gt;Two Daffi formats appear in the tables, and they are not the same amount of work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OPAQUE&lt;/strong&gt; sends one buffer that is already &lt;code&gt;bytes&lt;/code&gt; or &lt;code&gt;str&lt;/code&gt;. Daffi does not interpret it and does not build a Python object from it. The raw-bytes rows and the OPAQUE payload rows are this path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MessagePack&lt;/strong&gt; is the default. It serializes the Python arguments on the way out and the return value on the way back. The object-RPC rows, including the router row, are this path. A MessagePack call on a dict is a structured RPC. An OPAQUE call on a byte string is a binary echo.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Raw bytes: one call in flight
&lt;/h3&gt;

&lt;p&gt;The first test deliberately removes serialization from the equation.&lt;/p&gt;

&lt;p&gt;Every framework receives and returns the same 2,019-byte buffer without parsing it.&lt;/p&gt;

&lt;p&gt;10,000 calls were performed.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Framework&lt;/th&gt;
&lt;th&gt;Calls/s&lt;/th&gt;
&lt;th&gt;Avg latency&lt;/th&gt;
&lt;th&gt;P50&lt;/th&gt;
&lt;th&gt;P99&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ZeroMQ REQ/REP&lt;/td&gt;
&lt;td&gt;42,560&lt;/td&gt;
&lt;td&gt;23.5 µs&lt;/td&gt;
&lt;td&gt;21.5 µs&lt;/td&gt;
&lt;td&gt;45.0 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Daffi OPAQUE&lt;/td&gt;
&lt;td&gt;41,397&lt;/td&gt;
&lt;td&gt;24.2 µs&lt;/td&gt;
&lt;td&gt;21.8 µs&lt;/td&gt;
&lt;td&gt;32.0 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;nng REQ/REP&lt;/td&gt;
&lt;td&gt;18,114&lt;/td&gt;
&lt;td&gt;55.2 µs&lt;/td&gt;
&lt;td&gt;53.6 µs&lt;/td&gt;
&lt;td&gt;93.3 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;gRPC Protobuf&lt;/td&gt;
&lt;td&gt;7,095&lt;/td&gt;
&lt;td&gt;140.9 µs&lt;/td&gt;
&lt;td&gt;127.4 µs&lt;/td&gt;
&lt;td&gt;257 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;gRPC raw&lt;/td&gt;
&lt;td&gt;6,838&lt;/td&gt;
&lt;td&gt;146.3 µs&lt;/td&gt;
&lt;td&gt;124.9 µs&lt;/td&gt;
&lt;td&gt;253 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbcsuqcci8olt9cdopand.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbcsuqcci8olt9cdopand.png" alt="Raw bytes, one call in flight. Daffi OPAQUE 41,397 calls/s, ZeroMQ 42,560, nng 18,114, gRPC protobuf 7,095, gRPC raw 6,838." width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Daffi OPAQUE and ZeroMQ are in essentially the same performance range.&lt;/p&gt;

&lt;p&gt;Compared with the tuned Python gRPC unary implementation, Daffi delivers approximately 5.8 times the throughput in this test.&lt;/p&gt;

&lt;p&gt;For context, gRPC was configured on its fast path: registered method, no per-call deadline, and retries disabled.&lt;/p&gt;

&lt;p&gt;This is particularly interesting because Daffi achieves ZeroMQ-like performance while providing a higher-level Python RPC interface.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Object RPC: one call in flight
&lt;/h3&gt;

&lt;p&gt;The next test is closer to real application usage.&lt;/p&gt;

&lt;p&gt;Instead of raw bytes, each framework exchanges the same Python dictionary representing an order.&lt;/p&gt;

&lt;p&gt;Its JSON representation is 2,019 bytes.&lt;/p&gt;

&lt;p&gt;Each library uses its normal serialization mechanism. Daffi's default API serialization is MessagePack.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Framework&lt;/th&gt;
&lt;th&gt;Calls/s&lt;/th&gt;
&lt;th&gt;Avg latency&lt;/th&gt;
&lt;th&gt;P50&lt;/th&gt;
&lt;th&gt;P99&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Daffi PICKLE&lt;/td&gt;
&lt;td&gt;26,008&lt;/td&gt;
&lt;td&gt;38.4 µs&lt;/td&gt;
&lt;td&gt;33.2 µs&lt;/td&gt;
&lt;td&gt;74.5 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RPyC&lt;/td&gt;
&lt;td&gt;25,519&lt;/td&gt;
&lt;td&gt;39.2 µs&lt;/td&gt;
&lt;td&gt;30.5 µs&lt;/td&gt;
&lt;td&gt;75.8 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Daffi MSGPACK&lt;/td&gt;
&lt;td&gt;23,083&lt;/td&gt;
&lt;td&gt;43.3 µs&lt;/td&gt;
&lt;td&gt;36.6 µs&lt;/td&gt;
&lt;td&gt;98.2 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Daffi MSGPACK via Router&lt;/td&gt;
&lt;td&gt;20,912&lt;/td&gt;
&lt;td&gt;47.8 µs&lt;/td&gt;
&lt;td&gt;47.1 µs&lt;/td&gt;
&lt;td&gt;113 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Daffi JSON&lt;/td&gt;
&lt;td&gt;18,496&lt;/td&gt;
&lt;td&gt;54.1 µs&lt;/td&gt;
&lt;td&gt;50.5 µs&lt;/td&gt;
&lt;td&gt;113 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ZeroRPC&lt;/td&gt;
&lt;td&gt;3,607&lt;/td&gt;
&lt;td&gt;277 µs&lt;/td&gt;
&lt;td&gt;263 µs&lt;/td&gt;
&lt;td&gt;587 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pyro5&lt;/td&gt;
&lt;td&gt;2,390&lt;/td&gt;
&lt;td&gt;418 µs&lt;/td&gt;
&lt;td&gt;421 µs&lt;/td&gt;
&lt;td&gt;946 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdzr27vmkrku17id2w7wg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdzr27vmkrku17id2w7wg.png" alt="Object RPC, one call in flight. Daffi PICKLE 26,008 calls/s, RPyC 25,519, Daffi MSGPACK 23,083, via Router 20,912, JSON 18,496, ZeroRPC 3,607, Pyro5 2,390." width="800" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few things stand out.&lt;/p&gt;

&lt;p&gt;First, Daffi PICKLE and RPyC perform almost identically in this workload.&lt;/p&gt;

&lt;p&gt;Pickle is also the format to treat carefully. Unpickling runs code chosen by the sender, so it is safe only when you trust the peer. MessagePack is the default for ordinary calls. A service can refuse pickle with &lt;code&gt;serdes=SerdeFormat.SAFE&lt;/code&gt;. Daffi already refuses pickle from WebSocket peers.&lt;/p&gt;

&lt;p&gt;Second, Daffi MessagePack provides strong performance while remaining the default serialization format.&lt;/p&gt;

&lt;p&gt;Third, using a Router introduces a relatively small additional cost.&lt;/p&gt;

&lt;p&gt;The Router-based MessagePack call takes approximately 4.5 µs longer than direct MessagePack communication.&lt;/p&gt;

&lt;p&gt;This is the cost of adding an extra routing hop:&lt;/p&gt;

&lt;p&gt;Client → Router → Worker&lt;/p&gt;

&lt;p&gt;The advantage is that applications can introduce distributed workers without changing their basic RPC programming model.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Payload size and throughput
&lt;/h3&gt;

&lt;p&gt;Latency isn't everything.&lt;/p&gt;

&lt;p&gt;When transferring larger payloads, throughput becomes equally important.&lt;/p&gt;

&lt;p&gt;For this test, I measured sequential request-response exchanges with different payload sizes.&lt;/p&gt;

&lt;p&gt;Goodput counts both directions: request plus response.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Payload&lt;/th&gt;
&lt;th&gt;Daffi OPAQUE&lt;/th&gt;
&lt;th&gt;Daffi MSGPACK&lt;/th&gt;
&lt;th&gt;ZeroMQ REQ/REP&lt;/th&gt;
&lt;th&gt;gRPC Protobuf&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;64 B&lt;/td&gt;
&lt;td&gt;52,211 calls/s · 6.4 MiB/s&lt;/td&gt;
&lt;td&gt;40,767 · 5.0 MiB/s&lt;/td&gt;
&lt;td&gt;34,543 · 4.2 MiB/s&lt;/td&gt;
&lt;td&gt;7,127 · 0.9 MiB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1 KiB&lt;/td&gt;
&lt;td&gt;39,008 · 76 MiB/s&lt;/td&gt;
&lt;td&gt;52,674 · 103 MiB/s&lt;/td&gt;
&lt;td&gt;29,992 · 59 MiB/s&lt;/td&gt;
&lt;td&gt;7,252 · 14 MiB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;64 KiB&lt;/td&gt;
&lt;td&gt;19,429 · 2,429 MiB/s&lt;/td&gt;
&lt;td&gt;12,085 · 1,511 MiB/s&lt;/td&gt;
&lt;td&gt;10,743 · 1,343 MiB/s&lt;/td&gt;
&lt;td&gt;3,959 · 495 MiB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1 MiB&lt;/td&gt;
&lt;td&gt;2,590 · 5,181 MiB/s&lt;/td&gt;
&lt;td&gt;2,093 · 4,187 MiB/s&lt;/td&gt;
&lt;td&gt;1,414 · 2,827 MiB/s&lt;/td&gt;
&lt;td&gt;388 · 776 MiB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F33ttxf1mkvhkhyjdabfc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F33ttxf1mkvhkhyjdabfc.png" alt="Goodput by payload size. At 1 MiB, Daffi OPAQUE reaches 5,181 MiB/s, Daffi MSGPACK 4,187, ZeroMQ 2,827, and gRPC protobuf 776. Each panel has its own scale." width="800" height="557"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The 1 MiB result is particularly interesting.&lt;/p&gt;

&lt;p&gt;Daffi OPAQUE reaches 5,181 MiB/s of goodput, compared with 776 MiB/s for gRPC Protobuf.&lt;/p&gt;

&lt;p&gt;That's approximately 6.7 times the throughput.&lt;/p&gt;

&lt;p&gt;In terms of round-trip latency:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Daffi OPAQUE: approximately 386 µs.&lt;/li&gt;
&lt;li&gt;gRPC Protobuf: approximately 2.6 ms.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is where the distinction between raw binary transfer and structured serialization becomes important.&lt;/p&gt;

&lt;p&gt;If your application already has binary data and doesn't need to serialize it into a structured format, OPAQUE is worth considering.&lt;/p&gt;

&lt;p&gt;A note about measurement stability: the 1 KiB OPAQUE result showed higher variance across the three repetitions: 15.6k, 39.0k, and 41.8k calls/s. The reported value is the median, 39.0k. This result should therefore be interpreted with caution.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. What happens with multiple simultaneous clients?
&lt;/h3&gt;

&lt;p&gt;Single-client benchmarks are useful, but distributed systems rarely operate with only one client.&lt;/p&gt;

&lt;p&gt;For this test, each client maintains one in-flight call per connection and performs 1,000 calls.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Clients&lt;/th&gt;
&lt;th&gt;Daffi OPAQUE&lt;/th&gt;
&lt;th&gt;gRPC sync&lt;/th&gt;
&lt;th&gt;gRPC aio&lt;/th&gt;
&lt;th&gt;ZeroMQ DEALER/ROUTER&lt;/th&gt;
&lt;th&gt;RPyC&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;28,548&lt;/td&gt;
&lt;td&gt;6,553&lt;/td&gt;
&lt;td&gt;4,697&lt;/td&gt;
&lt;td&gt;34,546&lt;/td&gt;
&lt;td&gt;37,665&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;66,552&lt;/td&gt;
&lt;td&gt;9,634&lt;/td&gt;
&lt;td&gt;14,695&lt;/td&gt;
&lt;td&gt;97,179&lt;/td&gt;
&lt;td&gt;19,462&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;56,763&lt;/td&gt;
&lt;td&gt;9,521&lt;/td&gt;
&lt;td&gt;19,196&lt;/td&gt;
&lt;td&gt;145,046&lt;/td&gt;
&lt;td&gt;15,367&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;All values are calls per second.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjglc5s7weco8shuxc517.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjglc5s7weco8shuxc517.png" alt="Simultaneous clients. At 32 clients ZeroMQ DEALER/ROUTER reaches about 145k calls/s, Daffi OPAQUE about 57k, gRPC aio about 19k, RPyC about 15k, and gRPC sync about 10k." width="799" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Daffi reaches its peak at around eight clients, with approximately 67,000 calls/s.&lt;/p&gt;

&lt;p&gt;ZeroMQ DEALER/ROUTER continues scaling in this particular workload, reaching approximately 145,000 calls/s at 32 clients.&lt;/p&gt;

&lt;p&gt;This is an important distinction: ZeroMQ's messaging pattern is particularly effective for this concurrency scenario.&lt;/p&gt;

&lt;p&gt;Daffi, meanwhile, offers a different abstraction: remote Python function calls, worker routing, serialization, and multiple communication patterns through one framework.&lt;/p&gt;

&lt;p&gt;The gRPC synchronous implementation remains around 10,000 calls/s in this test.&lt;/p&gt;

&lt;p&gt;The gRPC asyncio result at one client was variable across repetitions, ranging from 1.9k to 5.2k calls/s. The eight- and 32-client results were stable.&lt;/p&gt;

&lt;p&gt;Note that this concurrency harness has its own baseline. Its one-client results should not be directly compared with the earlier single-in-flight latency table.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, what does all this mean?
&lt;/h2&gt;

&lt;p&gt;There isn't one universal winner for every networking workload.&lt;/p&gt;

&lt;p&gt;ZeroMQ is exceptionally good at messaging, and its DEALER/ROUTER pattern scales particularly well in the concurrent test.&lt;/p&gt;

&lt;p&gt;RPyC is competitive with Daffi for the tested Python object workload.&lt;/p&gt;

&lt;p&gt;But Daffi demonstrates several interesting characteristics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raw binary communication in the same performance range as ZeroMQ.&lt;/li&gt;
&lt;li&gt;Strong object RPC performance.&lt;/li&gt;
&lt;li&gt;In the tested sequential workloads, Daffi OPAQUE delivered 6.7× the goodput of gRPC Protobuf at 1 MiB, while maintaining latency in the same order of magnitude as ZeroMQ in the raw-bytes test.&lt;/li&gt;
&lt;li&gt;Efficient large-payload transfers.&lt;/li&gt;
&lt;li&gt;A relatively small overhead when introducing a Router.&lt;/li&gt;
&lt;li&gt;A higher-level API that doesn't require developers to build their own RPC abstractions on top of a messaging library.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For me, the most interesting result isn't a single benchmark number.&lt;/p&gt;

&lt;p&gt;It's the combination of performance and functionality.&lt;/p&gt;

&lt;p&gt;Daffi aims to provide a convenient Python programming interface without paying the same overhead typically associated with higher-level RPC implementations.&lt;/p&gt;

&lt;h2&gt;
  
  
  When should you consider Daffi?
&lt;/h2&gt;

&lt;p&gt;Daffi may be a good fit for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python microservices communicating over TCP.&lt;/li&gt;
&lt;li&gt;Distributed task execution.&lt;/li&gt;
&lt;li&gt;Worker-based architectures.&lt;/li&gt;
&lt;li&gt;Inter-process communication on a single machine.&lt;/li&gt;
&lt;li&gt;Applications transferring large binary payloads.&lt;/li&gt;
&lt;li&gt;Systems requiring RPC and broadcast communication.&lt;/li&gt;
&lt;li&gt;Data processing pipelines that benefit from streaming.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It may not be the right choice if your primary requirement is cross-language interoperability through a standardized RPC contract. In that case, gRPC remains an excellent option.&lt;/p&gt;

&lt;p&gt;Likewise, if you need a general-purpose messaging library with advanced messaging patterns, ZeroMQ deserves consideration.&lt;/p&gt;

&lt;p&gt;Daffi focuses on making communication between Python applications straightforward and fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give it a try
&lt;/h2&gt;

&lt;p&gt;Daffi is open source and available on GitHub.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/600apples/daffi" rel="noopener noreferrer"&gt;https://github.com/600apples/daffi&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Documentation: &lt;a href="https://600apples.github.io/daffi/" rel="noopener noreferrer"&gt;https://600apples.github.io/daffi/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install daffi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're working on Python microservices, distributed applications, or inter-process communication, I'd love to hear what you think.&lt;/p&gt;

&lt;p&gt;Try it, benchmark it against your own workloads, open an issue, or contribute.&lt;/p&gt;

&lt;p&gt;And if you find it useful, consider giving the project a star on GitHub.&lt;/p&gt;

&lt;p&gt;Your feedback and contributions are very welcome!&lt;/p&gt;

&lt;p&gt;Daffi — high-performance RPC for Python.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>backend</category>
      <category>performance</category>
      <category>python</category>
    </item>
  </channel>
</rss>
