I always hear people talking about how efficient and scalable Elixir and Phoenix are, but I cant find any real tutorials on how to do it? As far as I can tell I need all instances to be in one application in order for channels to work properly. How can I achieve something like this and how does it compare to using Golang and Kubernetes with stateless applications on Google Cloud?
The problem is, most people talk about scalability without ever hitting a limit.
Here is how I scale a single phoenix application:
- get a 5 dollar droplet on digitalocean, run a postgresql server and my phoenix application on the same server - until I hit a limit, then I upgrade the droplet
here is how I scale a single ruby on rails application:
- get a 5 dollar droplet on digitalocean, run a postgresql server and my rails application on the same server - until I hit a limit, then I upgrade the droplet
her is how I scale golang application:
you catch the drift?
Elixir theoretically has amazing tools for an application running on multiple different physical machines - but I highly doubt whatever 99% of us here are doing calls for that.
Phoenix is a great framework to work in, Elixir is great to work in, Ecto is a lot more enjoyable to me than many other database - packages (or whatever you call ecto), Live View is the coolest thing I have worked with in years.
Even if someone told me that Phoenix and Elixir do not scale, I wouldn’t care.
I’m using elixir running on k8s for rest-based microservices and real-time WebSocket based services.
It works great. I run each app on multiple pods and even in multiple k8s clusters (clusters aren’t networked directly).
Regarding go: that discussion has played out a lot here. Search should give lots of results.
By “scaling well” people might mean different things but to me it means that a very cheap server can do a lot before needing an upgrade. Trying with Rails and Phoenix and the difference was a night and day. The Rails mini server needed upgrade almost immediately while Phoenix hummed along all the way to 500 - 1000 requests/sec before I started feeling it lag (and it wasn’t by much).
As for stateless, Elixir is not your tech there. The startup times aren’t favourable for it. Stuff like Go and Rust are much better.
But how do you use things like Presence when your app is running in individual containers without direct networking?
Sorry I wasn’t clear. Clusters aren’t networked together, but pods in a cluster are. That’s setup with a headless service in k8s.
Each app is served from a single cluster currently. Some apps that I work on may end up multi cluster (data center separation) in the future and it might just be okay to take the networking penalty and connect them together.