About

What Is Solid Queue? Rails 8 Background Jobs Without Redis

How FOR UPDATE SKIP LOCKED keeps workers from colliding

GitHub: rails/solid_queue

Solid Queue is a DB-based ActiveJob backend created by 37signals, included by default starting with Rails 8. It started from the question: "Do we really need Redis?"

Please refer to the Korean version for the detailed architecture analysis, including: the core idea of managing state via separate tables instead of status columns, the 10-table DB schema, the job lifecycle (enqueue → dispatch → claim & execute), 3 process types (Worker/Dispatcher/Scheduler), FOR UPDATE SKIP LOCKED for non-blocking polling, and transaction safety with enqueue_after_transaction_commit?.

Architecture Diagram

Job State Table Separation (ERD)

📋 solid_queue_jobs GitHub ↗
queue_name, class_name, arguments, priority, scheduled_at, finished_at
ON DELETE CASCADE
✅
ready_executions
Ready
⏰
scheduled_executions
Scheduled
🔄
claimed_executions
Processing
❌
failed_executions
Failed
🔒
blocked_executions
Concurrency wait
🔑
semaphores
Concurrency control
Key point: <strong>State-specific tables</strong> instead of a <strong>status column</strong>
Optimized indexes per table = fast polling

Job Lifecycle

MyJob.perform_later(args) Job.rb ↗
↓
solid_queue_jobs INSERT + after_create :prepare_for_execution
↓ Run now?
↓ Scheduled?
↓ Concurrency limit?
ready_executions
scheduled_executions
blocked_executions
Dispatcher moves scheduled → ready dispatcher.rb ↗
↓
Worker: claim (FOR UPDATE SKIP LOCKED)
ready → claimed (transaction)
worker.rb ↗
↓
ActiveJob::Base.execute(arguments)
↓
Success
finished_at updated
↓
Failed
failed_executions

3 Process Types

⚙️
Worker
Poll ready_executions
↓
claim (SKIP LOCKED)
↓
Execute in thread pool
worker.rb ↗
📡
Dispatcher
Poll scheduled_executions
↓
Move due jobs → ready
↓
Concurrency maintenance
dispatcher.rb ↗
🔁
Scheduler
Check cron schedule
↓
Enqueue recurring jobs
↓
Prevent duplicate execution
scheduler.rb ↗

Key Points

1

Open rails/solid_queue repository on GitHub

2

db/migrate/ → check 10 table schemas (state-per-table separation pattern)

3

lib/solid_queue/worker.rb → analyze polling loop and claim logic

4

lib/solid_queue/dispatcher.rb → analyze scheduled job dispatch logic

5

app/models/solid_queue/job.rb → check enqueue flow

6

app/models/solid_queue/ready_execution.rb → check FOR UPDATE SKIP LOCKED

7

app/models/solid_queue/claimed_execution.rb → execution/success/failure handling

8

lib/solid_queue/supervisor.rb → Fork vs Async process management

Pros

  • ✓ No Redis needed — complete job system with DB only
  • ✓ Rails 8 default — ready to use without separate installation
  • ✓ ActiveJob compatible — switch without changing existing job code
  • ✓ FOR UPDATE SKIP LOCKED — non-blocking competition between workers
  • ✓ Built-in concurrency control — semaphore-based concurrency limit
  • ✓ Puma plugin — no separate process needed in development

Cons

  • ✗ May have lower throughput than Redis-based Sidekiq
  • ✗ Increased DB load — heavy write burden with many jobs
  • ✗ SKIP LOCKED not supported in SQLite (graceful fallback)
  • ✗ Sidekiq/Redis still advantageous for large-scale services
  • ✗ Web UI less mature than Sidekiq (Mission Control separate)

Use Cases

Email sending: UserMailer.welcome.deliver_later Data processing: CsvImportJob.perform_later(file) Scheduled tasks: generate daily midnight reports with Scheduler Concurrency control: sequential execution of same user payment jobs Sidekiq → Solid Queue migration Background job processing without Redis in self-hosted apps
← Reading Writebook's Code: delegated_type and Edit History What Is Solid Cache? Rails 8 Caching on the Database, Not Redis →