Skip to content
Danial Asghar
  • Writing
  • Projects
  • Tools

    Jobs & Queues

    • Sidekiq Retry Schedule Calculator
    • Job Queue Capacity Calculator

    Postgres

    • Postgres Lock Mode Lookup
    • Postgres Deadlock Analyzer
    • Sidekiq & Puma Connection Pool Calculator

    Developer utilities

    • Cron Expression Explainer & recurring.yml Generator
    All 6 tools →Runs in your browser · nothing uploaded
  • About
Services
  • Writing
  • Projects
  • Tools
    • Postgres Lock Mode Lookup
    • Sidekiq Retry Schedule Calculator
    • Job Queue Capacity Calculator
    • Postgres Deadlock Analyzer
    • Sidekiq & Puma Connection Pool Calculator
    • Cron Expression Explainer & recurring.yml Generator
  • About
Services →
  • All writing
  • Background Jobs & Async
  • Database Reliability
RSS
  1. Home
  2. /
  3. Writing

Writing

Deep dives on Rails reliability: background jobs, Postgres concurrency and AI-powered backends, each grounded in systems I build and ship.

Rails Connection Pool Exhaustion: Fixing ActiveRecord::ConnectionTimeoutError

ActiveRecord::ConnectionTimeoutError means threads outnumber pool connections. Size the pool per process, find hidden consumers, stay under max_connections.

Danial Asghar·Nov 17, 2026·Database Reliability·10 min read

Fixing Rails Deadlocks: ActiveRecord::Deadlocked (40P01) in Production

Why Postgres kills one transaction on a deadlock, how to read the 40P01 log, the lock-ordering rule that prevents it, and the SQL to diagnose it live.

Danial Asghar·Nov 17, 2026·Database Reliability·13 min read

Fixing Postgres Race Conditions & Row-Level Deadlocks in Production Rails

Why read-modify-write leaks race conditions in Rails, how SELECT FOR UPDATE blocks, and when to use advisory locks — with real production code.

Danial Asghar·Oct 20, 2026·Database Reliability·4 min read

Solid Queue vs Sidekiq: How to Actually Decide (Rails 8)

Solid Queue vs Sidekiq isn't a throughput threshold — it's about where your complexity lives and whether your database can absorb the queue. A decision framework.

Danial Asghar·Aug 17, 2026·Background Jobs & Async·14 min read

Why Your Rails Background Jobs Are Slow: Queue Latency vs. Execution Time

Slow job? It either waited in the queue or ran slowly. Measure which with Sidekiq::Queue#latency before you tune — a diagnostic method, not guesswork.

Danial Asghar·Aug 10, 2026·Background Jobs & Async·14 min read

How Solid Queue Works Under the Hood (Rails 8)

Solid Queue runs jobs on Postgres, not Redis. How the dispatcher, SKIP LOCKED claims, and polling actually work under the hood — and the trade-offs.

Danial Asghar·Aug 4, 2026·Background Jobs & Async·17 min read

Sidekiq Retry Strategy: Transient vs Permanent Failures

Sidekiq's default retry count, the backoff formula, and when to stop. Set retry intervals right — and skip jobs that can never succeed.

Danial Asghar·Jul 30, 2026·Background Jobs & Async·13 min read

Why Your Sidekiq Job Runs Twice (At-Least-Once Delivery Explained)

Sidekiq runs jobs at least once, so duplicates happen. The 5 windows where a job re-runs — and how to stop double-charges with idempotent workers.

Danial Asghar·Jul 20, 2026·Background Jobs & Async·15 min read

Designing Idempotent Background Workers for LLM Calls in Rails

An LLM call behind a Sidekiq job runs at least once. Make workers idempotent so a retry never double-classifies — or double-bills your OpenAI calls.

Danial Asghar·Jul 7, 2026·Background Jobs & Async·16 min read

Need help in production?

I run fixed-scope reliability audits for production Rails teams: Sidekiq, Solid Queue and Postgres concurrency.

See services and prices

Fixed scope, from $1,000.

Get new articles by email

Deep dives on Rails reliability, when they're published. No spam.

Danial Asghar

Reliability engineering for Rails and AI backends.

Writing

  • All writing
  • Topics
  • RSS

Work

  • Services
  • Tools
  • Projects

About

  • About
  • Contact
  • Privacy

© 2026 Danial Asghar

GitHubX (Twitter)Email