4 ms·
You scale Rails by adding servers (or containers) behind a load balancer and by scaling up the database server in the same ways you would do it for another serv
by pmontra 1y ago
You scale Rails by adding servers (or containers) behind a load balancer and by scaling up the database server in the same ways you would do it for another server technology, including Phoenix.
By the way, I've seen many more Rails projects than Phoenix ones but they share the same general architecture: (server or containers) + db. The only difference is that we usually run Ruby jobs inside sidekiq and we use Tasks or GenServers for Elixir jobs. We wrote our own code to restart and try again jobs that eventually failed (we can't lose a job because of a deploy or a reboot.)
- zwnow 1y agoWell most Javascript based apps ive seen utilize stuff like Redis for scaling, this for example isn't needed with Elixir.
- pmontra 1y agoYes, Redis is usually the backing store for Rails' Sidekiq. With Elixir we stored the job data in a PostgreSQL table and started a process with the id of that record as argument. When we had to restart the BEAM (deploy, reboot, anything) a process would look at that table and start a process for every record not marked as complete. If a process failed too many times and its supervisor gave up on it, we could restart it manually by calling a function in the console with the record id as argument. Or we could start all the processes of a given type at once, or all of them. So we basically wrote a small subset of Redis and of Sidekiq admin.