Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Websocket concurrent connections limit on Heroku

How many websocket concurrent connections can a single Heroku dyno hold?

I'm running Thin as the web server on top of the Cedar stack with a Ruby framework.

like image 901
Alex Pinsky Avatar asked Aug 04 '14 12:08

Alex Pinsky


3 Answers

I asked support again (as the latest here was from 2016) and got a similar answer:

There is no hard limit on the number of WebSocket connections per dyno, as you mentioned the limit is 50x connections per router. Giving you an exact figure is complicated as the number of available routers is not static. We have a Router layer that has many machines, and each router can track 50 connections to each Dyno in your app. Unfortunately, we don't publish the number of active routers as this figure scales as our platform reacts to the current inbound traffic.

1500 to 2000 is a decent average estimate with a theoretical upper bound somewhere in the range of 4500. Generally, once you have exhausted the number of concurrent connections, you'll start to receive H11 errors back from Heroku. If you're expecting thousands of concurrent users I would recommend having more than 1 dyno not just to increase the number of WebSocket connections but also because horizontal scaling would add some resiliency to your application.

like image 186
PanMan Avatar answered Nov 18 '22 00:11

PanMan


I've got an answer from Heroku's support:

Hi, Our router will accept 50 simultaneous requests, after which it will send an H11 error. This means each dyno can handle a maximum of 50 open websockets. Please let us know if you still have any doubt or question.

like image 32
Alex Pinsky Avatar answered Nov 18 '22 02:11

Alex Pinsky


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

Take a look to this link:

http://veldstra.org/2013/10/25/heroku-websocket-performance-test.html

like image 45
diegopau Avatar answered Nov 18 '22 01:11

diegopau