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

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

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
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews