elixir rails migration

Elixir vs Rails: An Honest Comparison for Rails Teams

Daniil Popov November 26, 2026

Rails people built Elixir

I run an Elixir agency, so I'm biased. Keep that in mind and click the links, every number below has one. I'll also say where Rails wins, because it does win in some places.

Funny part: Elixir was created by a Rails core team member, and now Rails teams ask me if they should move to it. Strictly speaking Elixir is a language and Rails is a framework, so the fair match is Phoenix vs Rails. But the question I get is simpler: we have a Rails app and a Rails team, is the switch worth it?

Short version: if your app is mostly forms and pages and the team ships fine, stay. If you fight real time features, job infrastructure or a server bill that grows with every connected user, Elixir fixes that at the root. And you can try it on one module before you bet the whole app.

What's the plan?

  • Why Phoenix feels like home for a Rails developer
  • Puma threads and the GVL vs BEAM processes
  • Action Cable vs Phoenix Channels, Hotwire vs LiveView
  • Sidekiq vs Oban
  • CRUD speed, gems, hiring and running cost
  • When to stay, when to move, and how to move one module at a time

Shared heritage

José Valim was on the Rails core team. When he moved to the alumni list, the Rails team wrote that he "was once a Rails patch monster without peer" and had gone on to create Elixir.

You can feel it. Phoenix has a router, controllers, templates, generators, migrations and a dev server that reloads code. mix phx.gen.html is your rails generate scaffold. mix phx.gen.auth is the Rails 8 authentication generator. A Ruby developer reads Elixir on day one.

The differences sit deeper. No objects, no mutable state. Data goes into a function and new data comes out. Ecto is not Active Record: a schema describes a table, a changeset validates changes, the Repo talks to the database, and nothing loads lazily behind your back. Same create action in both:

{@code}
{@code}

Same shape. Phoenix matches on the result instead of asking a mutable object if it saved. You'll miss callbacks for about a week.

Concurrency: the GVL vs the BEAM

This is the real difference. Most of the rest of this article follows from it.

A Rails app in production usually runs on Puma: several worker processes, each serving requests in threads. In CRuby the Global VM Lock lets only one thread run Ruby code at a time in a process. Threads still help while a request waits on the database or an API, because waiting happens in parallel. CPU work in one process doesn't. The Rails performance guide says the default generated config uses 3 threads and recommends about one process per CPU core. So Rails scales by adding processes, and every process needs its own memory, because copy-on-write shares only a fraction of it.

Elixir runs on the BEAM, the Erlang VM. It starts one scheduler per CPU core and spreads its own processes over them. Those are not OS processes. The Elixir docs call them extremely lightweight and say it's not uncommon to have tens or even hundreds of thousands running at once. Each has its own memory and its own garbage collection, so one heavy request doesn't pause the others. In Phoenix with Bandit every connection gets its own process, and so does every channel and every LiveView. Over HTTP/1.1, requests on one keep-alive connection run one after another in that connection's process. Over HTTP/2, every request gets its own process.

In practice: a slow endpoint in Rails eats a thread from a pool of 3. A slow endpoint in Phoenix eats one process out of hundreds of thousands. You stop tuning thread counts. You still size the database pool, same as in Rails.

Ruby got faster, to be fair. The same guide says Rails 7.2 and later turn YJIT on by default when you run Ruby 3.3 or later. But a JIT speeds up Ruby code, the GVL is still there. Ractors can run Ruby in parallel, but Ruby 4.0 still marks them as experimental.

Real time: Action Cable vs Phoenix Channels

Action Cable gives Rails WebSockets. Rails 8 ships Solid Cable, which relays messages through the database by polling so you don't need Redis for pubsub anymore. The connections are still held by Ruby processes, in Puma or a standalone cable server, so a lot of connected users means more Ruby memory and, at scale, more Ruby processes. Teams at that scale often add AnyCable, a WebSocket server written in Go.

Phoenix Channels were built for this. Phoenix PubSub talks across a cluster with Distributed Elixir, no Redis needed. The famous number is from 2015: the Phoenix team held 2 million WebSocket connections on one 40 core, 128 GB box. They measured open sockets, not messages, so treat it as the ceiling of the platform. Your app will hit other limits first.

The real world version is Veeps, the concert streaming company. They rewrote their Rails backend in Elixir in eight months. A service that needed 20 Rails nodes during big events now runs on 2, and the platform handles 83 times more concurrent users.

LiveView vs Hotwire

Both want HTML from the server and as little JavaScript as possible. They get there differently.

Hotwire is mostly classic HTTP. Turbo Drive swaps the page body, Turbo Frames update parts of a page, Turbo Streams push small changes. Turbo can also do page refreshes with morphing: the server says "refresh" and only the changed DOM is updated. Live updates can be rendered in Active Job and are delivered over Action Cable. Apart from the Action Cable connection, the server keeps no page state per user.

{@code}

LiveView keeps one process per open page. It holds the page state, handles events and sends only the changed values over Phoenix Channels. The LiveView 1.0 announcement gives a baseline of about 40 KB of memory per connection.

{@code}

For a page that updates now and then, Hotwire is great and I'd keep it. LiveView pulls ahead when the state lives on the screen: multi step forms, live validation, dashboards, things two people edit at once. That's where a Rails app grows Stimulus controllers, then a store, then somebody says "maybe React". In LiveView the state stays in one Elixir module.

Catch: every interaction is a round trip, so latency matters, and you pay memory per connected user. Pure client side stuff like a drag handle still wants a small JS hook.

Background jobs: Sidekiq vs Oban

Sidekiq is great and has run Rails jobs for years. It requires Redis (or Valkey, or Dragonfly). Batches are in Sidekiq Pro, unique jobs, rate limiting and cron jobs are in Enterprise. Rails 8 also ships Solid Queue, a database backed queue, which closes a good part of the gap.

Oban keeps jobs in your database. MySQL joined PostgreSQL and SQLite in v2.19. The job can go in the same transaction as the data it works on, so it can't fire for a row that rolled back. Solid Queue can do that too when it shares your app database, but by default Rails 8 gives it a separate one. The dashboard, Oban Web, went free and open source in January 2025. Oban Pro is still paid.

{@code}
{@code}

What I like more than the library: on the BEAM, a lot of what you'd queue in Rails doesn't need a queue at all. A supervised task, a cache in ETS, a process that wakes up every minute, all inside the app. In our own migration a Zeebe workflow engine, its monitoring UI and the Elasticsearch it needed all went away, and Oban took over inside the one app.

Speed of building a CRUD product

Rails is still excellent here and I won't pretend otherwise. Admin, emails, uploads, payments: Rails gets you to a working product very fast. Active Storage, Action Mailer, Action Text, mature admin gems, a gem for almost every SaaS API, and twenty years of answers one search away. Convention over configuration is real.

Phoenix is close on the basics. Generators, auth, migrations, forms. Since Phoenix 1.8 the auth generator does magic link login and scopes out of the box. You lose time at the edges: an SDK that only exists for Ruby, an admin panel you'd get from a gem. We sometimes write a thin API client with Req instead. Usually an afternoon. Still an afternoon Rails didn't need.

Phoenix wins the time back later, when features get interactive and the app gets big. One language, one process, no separate frontend, no extra services to keep alive.

Gems, hex packages and hiring

Ruby has the bigger ecosystem. In the Stack Overflow 2025 survey Ruby is at 6.4% of respondents and Elixir at 2.7%, Rails at 5.9% and Phoenix at 2.4%. More than two Ruby people for every Elixir person. The Elixir side is smaller but covers what a web product needs: Ecto, Oban, Req, Swoosh for email, Broadway for data pipelines.

For hiring, a Rails team is the best place to grow an Elixir team. The ideas carry over and the syntax looks familiar. I'd expect a senior Rails developer to be useful in Phoenix after a few weeks. And one Elixir developer covers more of the stack, so you need fewer of them.

Running cost at scale

Rails scales with processes, and each one needs its own memory. Fine at small scale. Rails 8 dropped Redis from the default setup with the Solid adapters, which is a real saving. The bill climbs when traffic and connected users climb, WebSockets most of all.

The BEAM uses every core from one OS process and keeps idle connections cheap. Veeps went from 20 Rails nodes to 2 for one service. Our own number is from a different stack: we rebuilt a Python, React and Zeebe accounting SaaS in Elixir in three weeks, 63% less code, 76% fewer files and 83% fewer Docker services. It wasn't Rails. But what we deleted (a workflow engine, Redis, a separate frontend) is the same kind of weight a ten year old Rails app collects.

Elixir vs Rails at a glance

Ruby on Rails Elixir and Phoenix
Concurrency Puma threads, one runs Ruby at a time per process (GVL) Hundreds of thousands of light processes on all cores
Scaling More processes, about one per core One OS process uses every core
Real time Action Cable with Solid Cable or Redis Channels and PubSub, no broker
Interactive UI Hotwire: Turbo and Stimulus, no page state on the server LiveView: one stateful process per open page
Background jobs Sidekiq (Redis) or Solid Queue (database) Oban (database), plus supervised tasks
CRUD speed Excellent, huge gem ecosystem Very good, fewer ready made libraries
Hiring pool Bigger Smaller, Ruby developers convert well
A crash Fails the request, sometimes the worker One process dies alone, supervisors restart the long lived ones

When to stay on Rails

  • The app is mostly forms, pages and reports, and it ships fine.
  • The team is big, happy and fast in Ruby, and the bill doesn't hurt.
  • You depend on gems with no Elixir equivalent, and rebuilding them would be the whole project.
  • Hotwire covers your UI and Solid Queue covers your jobs.

If that's you, don't switch. A migration has to pay for itself, and here it won't.

When to move

  • Real time is the product: chat, live dashboards, collaboration, streaming, IoT.
  • You run a pile of Puma processes plus Redis plus Sidekiq, and the bill grows faster than revenue.
  • Your Stimulus controllers are turning into a frontend app, or React already moved in next to Rails.
  • You need long lived connections or a process per user, device or game.
  • One bad job or request shouldn't be able to hurt the others.

My rule of thumb: if two of these are true, it's worth a proper look.

How a Rails to Elixir migration works

You don't rewrite everything on a Monday. You use the strangler fig pattern: the new app grows next to the old one and takes over piece by piece, until the old one has nothing left to do.

  1. Put a reverse proxy in front. Everything still goes to Rails. Then send one path, say /live or /api/events, to Phoenix.
  2. Share the PostgreSQL database. Keep migrations in one app until the move is done, so the schema has one owner.
  3. Start with the module that hurts most. Usually the real time feature or the job pipeline, that's where the BEAM gives the most back.
  4. Sort out login early. Either Phoenix trusts a signed token from Rails, or you move auth first. It's the fiddliest part, every time.
  5. Move the rest only when it pays. Stopping halfway and keeping Rails for the admin is a fine result.

Ecto can sit on top of existing Rails tables. Rails calls the timestamp created_at, so you tell Ecto:

{@code}

Veeps did a full rewrite. I prefer one module at a time: you see the result of the first module in weeks, and you can stop the day the numbers stop making sense. That's how our migration work runs. If there's also a Python service or a Node frontend next to your Rails app, the legacy modernization guide covers the bigger picture.

FAQ

Is Elixir faster than Ruby?

For concurrent work, yes. The BEAM runs code on all cores in one process, and the GVL lets one Ruby thread per process run at a time. For one request doing simple database work, both mostly wait on the database and the gap is small. Measure your own hot paths.

Is Phoenix LiveView better than Hotwire?

For rich screens with a lot of state, I think so. For pages with the odd update, Hotwire is simpler and keeps no page state on the server. Both render HTML on the server and both are good.

Can I run Elixir and Rails together?

Yes. Phoenix next to Rails, one proxy in front, one PostgreSQL database. That's how a gradual migration starts.

Is Elixir hard to learn for a Rails developer?

The syntax and the framework feel familiar. The new parts are immutability, pattern matching, processes and OTP. Weeks to be productive, months to be comfortable with OTP.

How long does a Rails to Elixir migration take?

Depends on the size. Veeps took eight months for a full rewrite. Our rebuild of a production accounting SaaS, from Python, took three weeks. A first module next to Rails can be live in a few weeks.

More comparisons

Resources

Not sure it pays off for your app?

We start with a paid technical assessment. We look at your Rails app, pick the module where Elixir gives the most back, and tell you if a migration makes sense. Sometimes the answer is "stay on Rails", and we say that too.

Share