# Laravel Reverb past 1,000 connections on serverless

Laravel Reverb stops near 1,000 connections without the uv extension. With it, one Scaleway container held 4,096, whatever its memory. What we built on that.

## In short

- Without the uv extension PHP holds Reverb's connections with stream_select, which stops at 1,024 open files, and in our measurement the server stopped at connection 1,018 and cut every browser.
- With uv, one Serverless Container at Scaleway held exactly 4,096 connections with 512, 1024 and 2048 MB alike, while the same image on a machine of our own held 6,000, so that number is Scaleway's and more memory does not buy more connections.
- Traffic runs out of processor and not of memory, and on the default 512 MB size an event to 1,000 subscribers took about 2 seconds to reach nearly all of them, and about 10 seconds at one event a second.
- Brewless now tells Reverb a ceiling that follows the memory of the container and never passes 4,000, so a full server turns the next browser away with Pusher code 4004 and keeps the ones it holds.
- Only pages on your own hostnames may connect to the realtime server, also on your application's own image, from brewless/laravel 1.8.0 on.

Realtime is in beta: it works and is measured on Scaleway, but its limits and defaults may still change.

When we [introduced Realtime](/blog/realtime-laravel-reverb-scaleway), Laravel Reverb in a serverless container in your own Scaleway account, we wrote that one container holds a few hundred connections. That was what we had measured: 400, and no further. This week we went looking for the real edge. We found two, neither where we expected it, and built four things because of them.

## Why does Laravel Reverb stop at about 1,000 connections?

Because PHP, without an extension for it, watches its open connections with `stream_select`, and that call cannot go past 1,024 open files. Reverb does not slow down when it gets there. The server stops, and every browser that was connected is cut at once.

We opened 1,200 connections to a Reverb server without the `uv` extension, first on a laptop and then on a Serverless Container at Scaleway. Both times the server stopped at connection 1,018. On Scaleway the platform started the container again, on an empty server.

| | Without `uv` | With `uv` |
| --- | --- | --- |
| How PHP watches its connections | `stream_select` | libuv |
| What happened | Server stopped at 1,018, everyone cut | 6,000 held on our own machine; 4,096 on one container at Scaleway |

Reverb's own documentation names `uv` for more than a thousand connections. It is easy to miss on a platform where you do not build the image yourself. Brewless's images carry the extension since 12 November 2026:

- **`image: app`**, Reverb on your application's own image: your application gets `uv` with its next deploy, because every build starts from the current base image.
- **`image: brewless`**, the small image Brewless maintains: `uv` is in version 1.1.0, which the next deploy puts on the container.

You change nothing. Reverb picks the extension up by itself when it is loaded.

## How many connections does one container hold?

With `uv` in place we expected memory to be the edge. It was not. We ran a bare Laravel 13 application with Reverb 1.13 on four sizes of container and opened connections to it from k6 clients running as jobs in the same Scaleway region, a thousand connections to a job:

| Container | Asked for | Connected | The rest | Cut |
| --- | --- | --- | --- | --- |
| 256 MB, 140 mvCPU | 4,000 | 3,871 | 127 got a 502 | 0 |
| 512 MB, 280 mvCPU | 6,000 | 4,096 | 74 got a 502, 1,830 got no answer | 0 |
| 1024 MB, 560 mvCPU | 6,000 | 4,096 | 1,904 got no answer | 0 |
| 2048 MB, 1120 mvCPU | 6,000 | 4,096 | 1,904 got no answer | 0 |

Three sizes stopped at exactly 4,096, and eight times the memory changed nothing. The connection after that was not refused. It got no answer at all, and the client waited until it gave up. Nobody who was connected was cut.

That number is Scaleway's and not Reverb's. The same image on a machine of our own held 6,000 connections, all of them, at about 23 kB each. And inside the container at Scaleway a process may open more than a million files, so it is not that limit either.

> [!NOTE]
> These were connections that subscribed to one channel and then only answered pings, in one run for each size. What happens when they carry events or sit in a presence channel is further down. Memory as Scaleway counts it came to 0.12 to 0.18 MB for each connection, and went past the container's own limit without the container being stopped.

An earlier round, with the clients on a laptop, had given us lower numbers that looked like a wall of memory. They were the laptop and its one address. Measure with the clients next to the server.

## A ceiling instead of silence

A browser that connects to a full realtime server and hears nothing is the worst case. Laravel Echo keeps trying, the page looks fine, and no event ever arrives.

Brewless now tells Reverb how many connections it may hold (`REVERB_APP_MAX_CONNECTIONS`). The number follows the memory of the container, at 350 kB for each connection after what is set aside for the server itself, and it never passes 4,000:

| Memory | `image: app` | `image: brewless` |
| --- | --- | --- |
| 512 MB | 1,029 | 1,217 |
| 1024 MB | 2,527 | 2,715 |
| 2048 MB and more | 4,000 | 4,000 |
| 256 MB | 280 | 468 |

At the ceiling Reverb turns the next browser away with Pusher code 4004 and keeps every connection it holds. We tried it on Scaleway with 512 MB and 1,500 browsers against a ceiling of 1,217: 1,217 connected, 283 were turned away, and nobody who was connected lost their connection.

The ceiling is far below what a container held in our measurement, on purpose: those connections only listened, and a thousand browsers that all get events is about what the processor of the default size delivers (see the next section). If you know what your own connections take, set `REVERB_APP_MAX_CONNECTIONS` in your environment's variables. A value of your own wins, up to what Scaleway holds.

A browser that is turned away does not try again by itself, so that page has no realtime until it is loaded again. Give the container more `memory` in `brewless.yml` before you get close:

```yaml brewless.yml
environments:
  production:
    realtime:
      memory: 1024
```

One container is one Reverb server, so about 4,000 connections is where Realtime ends for now. Past that takes several servers that share their channels through Redis, which Realtime does not do yet.

## What do traffic and presence channels cost?

Processor, not memory. We put 1,000 browsers on one channel and sent events of 1 kB from the application's side, on the default size of 512 MB with 280 thousandths of a vCPU:

| Events | Delivered | Nearly every browser had it within | The broadcast request took |
| --- | --- | --- | --- |
| One every four seconds | all of them | about 2 seconds | about 2 seconds |
| One every two seconds | all of them | about 4 seconds | about 4 seconds |
| One a second | all of them | about 10 seconds | about 10 seconds |
| One a second, to 4,000 browsers | about a quarter | most of a minute | most timed out |

Nobody was cut in any of these, and memory stayed where it was without traffic. But an event goes to every subscriber one after the other, and Reverb answers the application once it is out. A channel that a thousand browsers listen to is the heavy case; a private channel for each user costs next to nothing for an event. A container of twice the size did no better in its one run, which we cannot explain yet.

So broadcast through the queue. An event that implements `ShouldBroadcast` instead of `ShouldBroadcastNow` leaves the visitor's request alone while the event goes out.

Presence channels cost by the member, because every member is told about every other:

| Presence channels, 512 MB | Asked for | Joined | A join took |
| --- | --- | --- | --- |
| 50 rooms of twenty | 1,000 | 1,000 | under a tenth of a second |
| One room with everybody | 1,000 | 991 | about 2 seconds |
| One room with everybody | 3,000 | 1,677 | 4 to 7 seconds; the rest got no answer |

Keep a presence channel to the people who are together in one place. One room for the whole application is where it stops scaling.

## Only your own pages may connect

Reverb's configuration starts with `'allowed_origins' => ['*']`: a page on any website may open a connection to your server with your public key. For a public channel that means anyone can listen in from their own site. On a serverless container it also means anyone can keep your container awake, at your cost.

Brewless names the hostnames of the environment in `REVERB_ALLOWED_ORIGINS`: the host of your `APP_URL` and every domain in `brewless.yml`. The Brewless image has read that from the start. On your application's own image, `brewless/laravel` 1.8.0 now puts those hostnames where Reverb reads them, as long as `config/reverb.php` still allows every origin. A list you wrote there yourself is left alone.

```bash
composer update brewless/laravel
```

> [!WARNING]
> A client that sends no `Origin` header, such as a mobile app, is refused once the hostnames are limited. Set `REVERB_ALLOWED_ORIGINS=*` in your environment's variables if you have one.

## A broadcast is at most 10,000 bytes

This one was always true and we had not written it down. Reverb refuses a broadcast from your application that is larger than 10,000 bytes, and a message from a browser of the same size. An event that carries a whole order with its lines can pass that without anyone noticing in development.

Send the id and let the page fetch the rest:

```php app/Events/OrderShipped.php
public function broadcastWith(): array
{
    return ['order_id' => $this->order->id];
}
```

If you do need more, set `REVERB_MAX_REQUEST_SIZE` and `REVERB_APP_MAX_MESSAGE_SIZE` in your environment's variables. They now reach the Brewless image too.

## What did it run this month?

A realtime container with `min: 0` costs nothing while nobody is connected, and runs for as long as one browser holds a page open. How many hours that comes to was a guess until the bill from Scaleway arrived.

Brewless now counts it once an hour, from Scaleway's own figures. Nothing is asked of the container, so counting never wakes it. The **Realtime** page of an environment shows how long the container ran since the start of the month and what that comes to at Scaleway's list prices.

The price does not depend on how much you send. Scaleway bills a container per second it runs:

| Who is connected | Hours it runs | 512 MB | 256 MB |
| --- | --- | --- | --- |
| A back office, open in office hours | 176 | about €2.41 a month | about €1.20 a month |
| A dashboard on a screen, day and night | 730 | about €9.99 a month | about €4.99 a month |
| A public site with visitors around the clock | 730 | about €9.99 a month | about €4.99 a month |

These are Scaleway's list prices in `fr-par` before VAT, checked on 5 November 2026. One browser or a thousand, one event a minute or ten a second: the amount is the same.

## What you have to do

| To get | Do this |
| --- | --- |
| `uv`, and the ceiling on connections | Deploy |
| Only your own hostnames on `image: app` | `composer update brewless/laravel` to 1.8.0 or later, and deploy |
| The hours it ran this month | Nothing: they show up on the Realtime page after the next count |

The limits that have not changed are still there. A connection lasts an hour at most, a deploy reconnects everyone, and an event sent while a browser was reconnecting is not sent again, so a page loads its state again after every reconnect. All of it is in [the Realtime documentation](https://docs.brewless.eu/running/realtime).

## Frequently asked questions

### Why does Laravel Reverb stop at about 1,000 connections?

Without an event loop extension PHP watches its connections with stream_select, which cannot go past 1,024 open files. Reverb's server then stops, and every open connection is cut. With the uv extension loaded, Reverb uses libuv instead and the limit is gone.

### How many WebSocket connections does one Scaleway Serverless Container hold?

In our measurement of 12 November 2026, with the server and the clients both at Scaleway, containers of 512, 1024 and 2048 MB each held exactly 4,096 connections that only listened. The connection after that got no answer. A container of 256 MB held about 3,900 of the 4,000 we asked for.

### Does more memory give a Reverb container more connections?

Not past 4,096 on one Scaleway Serverless Container. A container with 2048 MB stopped at the same number as one with 512 MB. What traffic runs out of is the processor, and in our measurement memory hardly moved when the connections carried events.

### What happens when the Reverb container is full?

With a ceiling set, Reverb turns the next browser away with Pusher code 4004 and keeps every connection it already holds. Without one, the browser that is one too many gets no answer from Scaleway at all, or a 502, and keeps waiting.

### Does it cost more to send more messages?

No. A Serverless Container at Scaleway is billed per second it runs, for its processor and memory. One browser or a thousand, one event a minute or ten a second, the amount is the same.

Source: https://brewless.eu/blog/laravel-reverb-past-1000-connections
