markmeeus

markmeeus

Phoenix Channels horizontal scalability

Hi Everyone,

I have a question regarding horizontal scalability of the phoenix channels.
We are currently using phoenix channels to deliver realtime information to our app’s frontend.
A large portion of this data is a continuous flow of updates from an external system. Something like GPS updates.
Right now, everything is running real smooth with a few hundred concurrent users on a 2 small servers (using PG2 adapter).
We are preparing the software to deliver 100 times the data to a few 10 thousand users.
However, a specific subset of users will only need a specific subset of the data.

If I understand correctly, if we scale out to 10 servers, all servers will need to receive and process all that data, because the users’ sockets are spread out over all instances of the phoenix app.

So my question is, isn’t there a point where horizontal scalability ends because the data load is too high, and would it be a good idea to create separate clusters of the phoenix app, serving the sub-set of data to the subset of users? Or is there an easier solution I’m missing?

Most Liked

idi527

idi527

:waving_hand::+1:

A proper way to load test though would be not docker on a laptop, but a couple of vms in the cloud … Just in case it comes in helpful, I have a demo libcluster+digitalocean+terraform project. It can be modified to support phoenix, and then something like tsung can be used to actually load test it.

Also GitHub - dsander/phoenix-connection-benchmark: Reproduction of the 2 million connection in Phoenix benchmark · GitHub might still come in handy.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Notably, Phoenix also scales vertically extremely well. You’ve probably seen this: The Road to 2 Million Websocket Connections in Phoenix - Phoenix Blog

The core concern is sensible, in that the erlang distribution scheme does have limits to how far out horizontally you can scale a cluster (10 however should be fine). However, the load you should be able to handle on a reasonable number of servers should probably last you for a long time.

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

We're in Beta

About us Mission Statement