GAURAV VARMA
Rails 8 quietly revolutionizes real-time features with Solid Cable, a new database-backed adapter for ActionCable that eliminates the need for Redis.
Why Solid Cable?
Before Rails 8, real-time updates via ActionCable typically required Redis as the pub/sub layer. But not every app needed that complexity. Solid Cable now lets you run ActionCable using just your existing database.
How it Works
Solid Cable stores connection and subscription state in your database, and uses polling to check for new messages to broadcast. It’s fast enough for most use cases and especially helpful when keeping deployments lean.
In cable.yml, simply set the adapter to solid_cable:
1production:
2 adapter: solid_cable
3 connects_to:
4 database:
5 writing: cable
6 polling_interval: 0.1.seconds
7 message_retention: 1.dayYou can configure:
polling_interval– how often to check the DB (default: 0.1s)message_retention– how long to keep messages (default: 1 day)autotrim– whether to automatically delete old messages (default: true)
Installation
For new Rails 8 apps, it’s already there. For older versions, you can add it manually:
1bundle add solid_cable
2bin/rails solid_cable:installThis sets up:
- The
config/cable.ymlfile - A cable-specific schema in
db/cable_schema.rb
To use a separate database for Solid Cable (recommended), add the following to config/database.yml:
1production:
2 primary:
3 <<: *default
4 database: app_production
5 cable:
6 <<: *default
7 database: app_production_cable
8 migrations_paths: db/cable_migrateThen run:
1RAILS_ENV=production bin/rails db:prepareSingle Database Setup (Optional)
If you prefer to use just one DB:
- Copy the content of
db/cable_schema.rbinto a regular migration - Delete
db/cable_schema.rb - Remove
connects_tofromcable.yml - Run
bin/rails db:migrate
Performance and Use Cases
Solid Cable performs well under most conditions — even with polling — and supports MySQL, PostgreSQL, and SQLite. It’s ideal for:
- Apps with moderate real-time usage
- Deployments on Heroku, Fly.io, or serverless
- Teams looking to reduce external dependencies
If you're building high-frequency features like chat apps or live games, Redis may still offer better throughput. But for dashboards, notifications, or UI updates, Solid Cable is more than capable.
You can even turn off autotrim and manually manage old messages using:
1SolidCable::TrimJob.perform_laterReferences
- Rails PR #52889 – Adds Solid Cable
- Rails Solid Cable Overview
- Solid Cable - A database backed ActionCable adapter
Summary
Solid Cable makes real-time Rails easier than ever—no Redis required. It's a built-in, production-ready solution for teams who want modern UI updates without extra services or deployment complexity.