Scaling Laravel Reverb WebSockets in Production | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. Laravel Reverb in Production: Scaling WebSockets Beyond a Single Server

 Laravel Reverb in Production: Scaling WebSockets Beyond a Single Server
========================================================================

 Running Laravel Reverb on a single node is easy. Scaling it across multiple workers, handling reconnects gracefully, and keeping broadcast latency low in production requires deliberate architecture choices.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 22 Aug 2026 · Updated 22 Aug 2026 · 4 min read

ShareCopy linkCopied

 ![Laravel Reverb in Production: Scaling WebSockets Beyond a Single Server](https://cdn.msaied.com/580/851fec3976838708af1706f705fe70cd.png) 

  On this page +1. [The Gap Between Demo and Production](#the-gap-between-demo-and-production)
2. [Problem 1: Multiple App Servers, One Reverb Node](#problem-1-multiple-app-servers-one-reverb-node)
3. [Problem 2: Horizontal Reverb Scaling](#problem-2-horizontal-reverb-scaling)
4. [Problem 3: Reconnect Storms After a Deploy](#problem-3-reconnect-storms-after-a-deploy)
5. [Tuning Connection Limits](#tuning-connection-limits)
6. [Takeaways](#takeaways)

 The Gap Between Demo and Production
-----------------------------------

Laravel Reverb ships with a compelling zero-dependency story: one `php artisan reverb:start` command and you have a WebSocket server. That works brilliantly on a single Forge server. The moment you add a second app server — or your connection count climbs past a few thousand — you need a deliberate scaling plan.

This article covers the three concrete problems you will face and how to solve each one.

---

Problem 1: Multiple App Servers, One Reverb Node
------------------------------------------------

Your Laravel app runs on two EC2 instances behind a load balancer. Both instances dispatch broadcast events. Only one instance runs Reverb. The instance that *doesn't* host Reverb still needs to push messages to it.

Reverb solves this with a **Redis pub/sub backend**. Configure it in `config/reverb.php`:

```php
'servers' => [
    'reverb' => [
        // ...
        'scaling' => [
            'driver' => 'redis',
            'connection' => 'default', // your Redis connection name
        ],
    ],
],

```

With this in place, every app server publishes broadcast events to Redis. The Reverb process subscribes and fans them out to connected clients. Your app servers never need a direct TCP connection to Reverb.

> **Important:** Use a dedicated Redis logical database or a separate Redis instance for Reverb pub/sub. Mixing it with your cache or queue database makes debugging latency spikes much harder.

---

Problem 2: Horizontal Reverb Scaling
------------------------------------

A single Reverb process is single-threaded by design (it runs on ReactPHP's event loop). You can scale vertically to a point, but eventually you need multiple Reverb processes.

Run multiple Reverb workers and put a **sticky-session-aware load balancer** in front of them. Nginx with `ip_hash` is the simplest option:

```nginx
upstream reverb {
    ip_hash;
    server 10.0.0.10:8080;
    server 10.0.0.11:8080;
}

server {
    listen 443 ssl;
    location / {
        proxy_pass http://reverb;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_read_timeout 3600s;
    }
}

```

Sticky sessions ensure a client's WebSocket upgrade and subsequent frames all hit the same Reverb worker. Because all workers share the Redis pub/sub channel, a broadcast from any app server reaches every connected client regardless of which worker they landed on.

---

Problem 3: Reconnect Storms After a Deploy
------------------------------------------

When you restart Reverb (e.g., during a deploy), every connected client disconnects simultaneously. Laravel Echo's default reconnect strategy uses a fixed 1-second delay, so thousands of clients hammer the server at once.

Override Echo's reconnect options on the client side:

```javascript
import Echo from 'laravel-echo';
import Pusher from 'pusher-js';

window.Echo = new Echo({
    broadcaster: 'reverb',
    key: import.meta.env.VITE_REVERB_APP_KEY,
    wsHost: import.meta.env.VITE_REVERB_HOST,
    wsPort: import.meta.env.VITE_REVERB_PORT,
    forceTLS: true,
    enabledTransports: ['ws', 'wss'],
    // Pusher-js reconnect options
    activityTimeout: 30000,
    pongTimeout: 6000,
});

```

Pusher-js uses exponential backoff internally; the key is ensuring `activityTimeout` is long enough that routine Reverb restarts (&lt; 5 s) don't trigger a reconnect at all. Pair this with a **zero-downtime Reverb restart** using Supervisor:

```ini
[program:reverb]
command=php /var/www/artisan reverb:start --host=0.0.0.0 --port=8080
autostart=true
autorestart=true
stopwaitsecs=10

```

Supervisor's `stopwaitsecs` gives Reverb time to drain existing connections before the new process starts.

---

Tuning Connection Limits
------------------------

Reverb inherits ReactPHP's file-descriptor limits. On Linux, the default is 1024 open files per process. Raise it in your Supervisor config:

```ini
[program:reverb]
; ...
minfds=65536

```

And confirm your OS-level limit:

```bash
ulimit -n 65536

```

---

Takeaways
---------

- Enable the Redis scaling driver so all app servers can publish through a single Reverb cluster.
- Use sticky-session load balancing (Nginx `ip_hash`) in front of multiple Reverb workers.
- Tune Echo's `activityTimeout` to survive short Reverb restarts without a reconnect storm.
- Raise file-descriptor limits in Supervisor and at the OS level before you hit connection ceilings.
- Keep Reverb's Redis pub/sub on a dedicated database to isolate latency from cache/queue traffic.

- [laravel](https://www.msaied.com/public/articles?search=laravel)
- [reverb](https://www.msaied.com/public/articles?search=reverb)
- [websockets](https://www.msaied.com/public/articles?search=websockets)
- [broadcasting](https://www.msaied.com/public/articles?search=broadcasting)
- [redis](https://www.msaied.com/public/articles?search=redis)

 Frequently asked questions 
---------------------------

  Does Laravel Reverb support clustering without Redis?No. Without the Redis scaling driver, each Reverb process maintains its own in-memory connection table. Broadcasts published by an app server that doesn't host that Reverb process will never reach clients. Redis pub/sub is required for any multi-process or multi-server setup.

   Can I run Reverb behind AWS ALB instead of Nginx?Yes, but ALB requires sticky sessions via a cookie (not IP hash). Enable 'Stickiness' on the ALB target group with a duration longer than your longest expected WebSocket session. Without stickiness, WebSocket upgrade requests may be routed to a different target than subsequent frames, causing immediate disconnects.

   How do I monitor active Reverb connections in production?Reverb exposes a built-in statistics endpoint when you enable the `reverb.apps.\*.statistics` option. You can also track connection counts via the Redis pub/sub channel subscriber count, or instrument the Reverb event loop with a custom ReactPHP timer that publishes metrics to your observability stack.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

[Mohamed Said](https://www.msaied.com/public#person)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articleFilament v3 to v4 Migration: Breaking Changes and Practical Refactor Patterns](https://www.msaied.com/public/articles/filament-v3-to-v4-migration-breaking-changes-and-practical-refactor-patterns-2) [Next articleBuilding a Laravel Package: Service Providers, Auto-Discovery, and Config Merging](https://www.msaied.com/public/articles/building-a-laravel-package-service-providers-auto-discovery-and-config-merging-3)  

   On this page
-------------

1. [The Gap Between Demo and Production](#the-gap-between-demo-and-production)
2. [Problem 1: Multiple App Servers, One Reverb Node](#problem-1-multiple-app-servers-one-reverb-node)
3. [Problem 2: Horizontal Reverb Scaling](#problem-2-horizontal-reverb-scaling)
4. [Problem 3: Reconnect Storms After a Deploy](#problem-3-reconnect-storms-after-a-deploy)
5. [Tuning Connection Limits](#tuning-connection-limits)
6. [Takeaways](#takeaways)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/740/cce86edc21eddcbdd2f2454fadaf9c70.png)  · 3 min read### The Pipeline Pattern in Laravel: Custom Pipelines Beyond Middleware

5 Oct 2026 ](https://www.msaied.com/public/articles/the-pipeline-pattern-in-laravel-custom-pipelines-beyond-middleware-1) [ ![](https://cdn.msaied.com/739/2d6897fdcdcf090613f96f72a64b8a78.png)  · 4 min read### MySQL Full-Text Search in Laravel: Indexes, Relevance Scoring, and Boolean Mode

4 Oct 2026 ](https://www.msaied.com/public/articles/mysql-full-text-search-in-laravel-indexes-relevance-scoring-and-boolean-mode) [ ![](https://cdn.msaied.com/738/073696a3fefe18bec825beec5ac658f5.png)  · 4 min read### Laravel Queue Rate-Limited Middleware: Throttling Jobs Without Losing Work

4 Oct 2026 ](https://www.msaied.com/public/articles/laravel-queue-rate-limited-middleware-throttling-jobs-without-losing-work) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
