Owens

Owens

Lot’s of people are aware that, historically, Heroku is not a good choice for apps that use Websockets. I’m wondering if this has changed in the past 2 years or so.

The first reference I can find to this issue is from back in October 2013

  1. You can maintain around 6,000 open connections on a single dyno
  2. Creating more than 160 connections/sec will cause H11 errors (backlog too deep)

For comparison, an entry-level box from Digital Ocean (512MB RAM, Ubuntu 13.10) can handle 350+ new connections/sec, and seems to max out at around 7,200 open connections.

Heroku WebSocket Performance

Then as of September 2016, a comment posted in StackOverflow says this

“There are no limitations on the free dyno tier in terms of resources. In terms of concurrent connections there is a theoretical limit of 50 connections per Heroku router instance but we don’t currently publicise the number of router instances running at any one time. In general, for the EU region you can expect to have around 1500 connections available at any given time.” --staff reply to me. Later he clarified, this limit is for all dyno types. even paid ones.

stackoverflow.com/questions/25118381/websocket-concurrent-connections-limit-on-heroku

1500 connections available at any given time, for all dyno types

I am not even 100% sure what this is precisely. 1500 Websocket connections, ie. 1500 users connected to one channel each? Is this equal to 750 users on two channels each?

As a follow-up I looked into Heroku Router

Each router maintains an internal per-app request counter. On the Common Runtime, routers limit the number of concurrent requests per app. There is no coordination between routers however, so this request limit is per router. The request counter on each router has a maximum size of 50n (n = the number of web dynos your app has running). If the request counter on a particular router fills up, subsequent requests to that router will immediately return an H11 (Backlog too deep) response.

HTTP Routing | Heroku Dev Center

50n where n = the number of web dynos running. So what is appears is we would need an additional Redis instance to manage state across different dynos.

Does anyone know if this is true?

WebSockets on Heroku | Heroku Dev Center

Showing Posts 1 to 3

mikemccall

mikemccall

I was just running very basic ad hoc browser tests on heroku with a live view app and I did not run into any H11 errors. I didn’t use any ws testing tool, just opened browser tabs. My machine started to fly off the table at 250 chrome tabs. I read a lot of what you posted and I don’t feel it’s a major concern. A single dyno can handle 6k open connections (I have no reason to believe this to have changed) and if the limits are reached one can always scale. Web sockets are now a big part of web development. I have noticed, at least heroku pipelines (https://particleboard.heroku.com/) is using phoenix websockets. So I assume they are aware of the importance.

vasilakisfil

vasilakisfil

Asked them about it today and this is what I got:

Hello, and thanks for writing in.

There is a limit to the number to the concurrent websocket connections that your application can handle, getting to the actual figure is complicated, and it depends on how many Dynos your application uses, rather than their type. The details are explained a bit here - HTTP Routing | Heroku Dev Center

Basically you’re limited to 50x connections per Dyno per Router. We have a Router layer that has many machines, and each router can track 50 connections to each Dyno in your app, but each Router is unaware of other Routers. For example, to keep the numbers simple, assuming we have 50 routers, and your app has 5 Dynos, then you can theoretically have 12,500 websocket connections (50 * 50 * 5). Unfortunately we don’t publish the number of active routers as this figure scales as our platform reacts to the current inbound traffic (although you can figure out from the limit that you are hitting that this is currently around 50). However, the more Dynos you run, the more concurrent connections you can handle.

Does this information help you feel more prepared for the expected increase in traffic?

stefanluptak

stefanluptak

Do I understand this correctly, that Heroku is still not a good option for apps that have lot of living WebSocket connections such as chat rooms etc.?

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New
dillonoconnor
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
thiagogsr
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews