EssenceOfChaos
I created an app that uses Phoenix LiveView and is deployed on Gigalixir. The app manages the state of multiple players (for example, a poker table) using a Registry and a GenServer. I’m aware that Phoenix can handle many simultaneous connections, but my concern is that if I ever want to scale horizontally, I will need to use something like a Global Registry and libcluster; otherwise, the state might be split between multiple replicas. I’ve read some conflicting advice online: either that, for a start-up using Phoenix LiveView, it’s fine to start with a single replica and the decision of scaling should be left until the app actually starts receiving heavy traffic, or that it’s easier to start building a scalable app from the beginning rather than adjusting for scale later on.
So, do I wait until the traffic load becomes a strain, or do I try to implement horizontal scaling from the start? I have no idea how many users I’m going to have. I will be hosting a poker tournament with a $100 USD giveaway, so I would expect some traffic, but not very much. I gave myself about a month to figure out this problem and work out any bugs in the app before the tournament begins. Any guidance on this is greatly appreciated. You can see the site at High Society.
Trending in Thoughts On...
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex











Most Liked- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
derek-zhou
You can achieve a lot with just one node, one Registry, one GenServer per game, on a beefy machine. Try horizontal scaling only when vertical scaling start hitting diminishing return.
spacebat
There are some subtleties to horizontal scaling and one of the benefits is high availability if done well. To cope with heavy load simply you can profile and optimise, and you can upgrade to a machine with more cores and memory. Best to see if you get that kind of traffic first, unless it’s really a learning exercise you’re after.
rhcarvalho
Well, on the other hand, running a multi node setup may require more from you up front and never pay off
There’s no global optimum here. If you’re familiar with multi node deployments, you could make your early decisions aligned with not complicating your life later.
I’d make the simplest system that can possibly work for your current requirements. That will be cheaper to build and operate now.
Last Post!
FlyingNoodle
Just take the memory per gameserver and then multiply by the player count that you expect.
You say a poker game so maybe 1MB per table at most. So with 1GB of ram you can host 1000 concurrent tables.
I would be surprised if you get that number.