<?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: Madi souheib</title>
    <description>The latest articles on DEV Community by Madi souheib (@madisouheib).</description>
    <link>https://dev.to/madisouheib</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%2F4040130%2Fe248e81d-cf58-469c-8222-18cf0d82d1d0.jpg</url>
      <title>DEV Community: Madi souheib</title>
      <link>https://dev.to/madisouheib</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/madisouheib"/>
    <language>en</language>
    <item>
      <title>Why I built a Reverb alternative in Rust ?</title>
      <dc:creator>Madi souheib</dc:creator>
      <pubDate>Tue, 21 Jul 2026 12:45:38 +0000</pubDate>
      <link>https://dev.to/madisouheib/why-i-built-a-reverb-alternative-in-rust--2e57</link>
      <guid>https://dev.to/madisouheib/why-i-built-a-reverb-alternative-in-rust--2e57</guid>
      <description>&lt;p&gt;I've been running real-time features in Laravel apps for a while, and self-hosted broadcasting always came with a tax. You either pay Pusher/Ably per connection, or you self-host — and self-hosting meant Reverb (single-threaded PHP, needs &lt;code&gt;ext-ev&lt;/code&gt; + Redis once you pass ~1k connections) or Soketi (a Node runtime sitting next to your PHP stack).&lt;/p&gt;

&lt;p&gt;Two things kept biting me: &lt;strong&gt;memory per connection&lt;/strong&gt;, and what happens when &lt;strong&gt;one slow client&lt;/strong&gt; backs up the event loop for everyone else.&lt;/p&gt;

&lt;p&gt;So I built &lt;a href="https://github.com/madisoheib/Ripple" rel="noopener noreferrer"&gt;Ripple&lt;/a&gt; — a Pusher-compatible WebSocket server written in Rust — to see if I could fix both without asking anyone to change a single line of client code.&lt;/p&gt;

&lt;h2&gt;
  
  
  The design constraint: change nothing on the client
&lt;/h2&gt;

&lt;p&gt;The most important decision was compatibility. Ripple speaks the Pusher Channels protocol, so your existing setup works unchanged:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Laravel Echo&lt;/li&gt;
&lt;li&gt;pusher-js&lt;/li&gt;
&lt;li&gt;pusher-php-server&lt;/li&gt;
&lt;li&gt;mobile SDKs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You point &lt;code&gt;wsHost&lt;/code&gt; / &lt;code&gt;wsPort&lt;/code&gt; at Ripple and you're done. No Redis, no Node, no PHP extensions. It ships as a &lt;strong&gt;single static binary&lt;/strong&gt; — the Docker image is a ~5 MB &lt;code&gt;FROM scratch&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require ripple/ripple-laravel
php artisan ripple:install
php artisan ripple:start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why Rust
&lt;/h2&gt;

&lt;p&gt;Reverb is a single-threaded PHP event loop. That's a hard ceiling: one core, and it needs &lt;code&gt;ext-ev&lt;/code&gt;/&lt;code&gt;ext-uv&lt;/code&gt; plus Redis to scale past a thousand-ish connections.&lt;/p&gt;

&lt;p&gt;Ripple runs across all cores natively, and the memory footprint per connection is small enough that a modest box holds tens of thousands of idle connections.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&lt;/h2&gt;

&lt;p&gt;Measured head-to-head against Reverb on an AWS c6i.xlarge, both servers pinned to 2 cores. Full methodology and caveats live in the repo's &lt;code&gt;bench/RESULTS.md&lt;/code&gt;:&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;Ripple&lt;/th&gt;
&lt;th&gt;Reverb (tuned)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;60,000 idle connections&lt;/td&gt;
&lt;td&gt;770 MiB, 100% established&lt;/td&gt;
&lt;td&gt;not attempted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory @ 40k connections&lt;/td&gt;
&lt;td&gt;512 MiB (~12.8 KB/conn)&lt;/td&gt;
&lt;td&gt;834 MiB (~20 KB/conn)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;50k deliveries/s — p50 / p99&lt;/td&gt;
&lt;td&gt;14.7 / 32 ms&lt;/td&gt;
&lt;td&gt;24.6 / 254 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fan-out 1 event → 10k subs&lt;/td&gt;
&lt;td&gt;p50 94 ms&lt;/td&gt;
&lt;td&gt;p50 122 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A caveat I want to be honest about: these numbers are specific to that hardware — treat them as &lt;em&gt;relative&lt;/em&gt;, not absolute. And I haven't run Soketi on this harness yet, so there are no Soketi numbers here. I don't want to publish benchmarks I didn't measure.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part I actually care about: slow consumers
&lt;/h2&gt;

&lt;p&gt;Benchmarks of raw throughput are the easy part. The failure mode that hurts in production is subtler: one client on a bad mobile connection can't drain messages fast enough, its buffer grows, and — depending on the server — that pressure degrades &lt;em&gt;everyone&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Under a flood, Reverb buffered unbounded and p99 latency for all clients climbed into the hundreds of seconds. Ripple bounds each connection's buffer, keeps fan-out non-blocking, and disconnects the laggard instead of letting it drag the rest down. Memory stays flat.&lt;/p&gt;

&lt;p&gt;That, more than any throughput number, is why I kept building.&lt;/p&gt;

&lt;h2&gt;
  
  
  Session resume (the one extension I'm proud of)
&lt;/h2&gt;

&lt;p&gt;Standard Pusher clients drop messages across a reconnect — a mobile blip or a deploy and those events are gone.&lt;/p&gt;

&lt;p&gt;Ripple has an opt-in extension: with &lt;code&gt;history_size = N&lt;/code&gt; on an app, every broadcast frame carries a per-channel sequence number (standard clients ignore it, so full compatibility is preserved), and the server keeps the last N events. After a reconnect, the client sends its last seen sequence and the missed events replay in order. It ships with a ~40-line Echo/pusher-js companion and it's authorization-safe — resume requires a prior signed subscribe.&lt;/p&gt;

&lt;h2&gt;
  
  
  What else is in the box
&lt;/h2&gt;

&lt;p&gt;Presence channels, client events, webhooks, Prometheus metrics at &lt;code&gt;/metrics&lt;/code&gt;, a Horizon-style Laravel dashboard at &lt;code&gt;/ripple&lt;/code&gt;, native TLS via rustls, and graceful shutdown that drains in-flight messages and sends a proper close frame so clients auto-reconnect cleanly on deploy.&lt;/p&gt;

&lt;h2&gt;
  
  
  It's early
&lt;/h2&gt;

&lt;p&gt;Ripple is v0 and MIT licensed. It's not battle-tested at massive scale yet, and I'd genuinely value scrutiny — on the protocol edge cases, and especially on the benchmark methodology.&lt;/p&gt;

&lt;p&gt;Repo: &lt;strong&gt;&lt;a href="https://github.com/madisoheib/Ripple" rel="noopener noreferrer"&gt;https://github.com/madisoheib/Ripple&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you run real-time on Laravel, I'd love to hear where your setup hurts.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>rust</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
