Blog
Temporal Server Cheat Sheet: The Decision Trees, Knobs, Metrics and Checklists I Keep Open On Call
The whole Running Temporal Server in Production series on one page: the shelf/desk/server triage tree, the scaling tree that checks PostgreSQL before any Temporal role, the knob pairs people mix up, the formulas worth carrying, a metrics checklist with labelled starting thresholds, one-line failure drills, and the go-live checklist.
Temporal in Production: Failure Drills, a Reference Architecture, and the PostgreSQL Wall
What really happens when a Temporal host, the PostgreSQL primary, a disk or the worker fleet dies; why the recovery burst and the slow-but-alive host hurt more than the outage; the 3-host + dedicated PostgreSQL HA layout I'd start with; consolidating two clusters without merging databases; and why one primary caps it all.
Growing a Temporal Cluster: Membership, Horizontal Scaling, and the Config You Can't Take Back
How Temporal hosts find each other through a PostgreSQL seed table and SWIM gossip, why a wrong broadcastAddress turns two hosts into two clusters of one, why per-host limits silently multiply when you add hosts, when splitting roles onto their own machines pays off, and which settings are fixed forever, need a restart, or hide a restart inside the dynamic config file.
Temporal Metrics, the Four-Number Triage, and Capacity Planning on PostgreSQL
When someone says 'Temporal is slow', four numbers asked in a fixed order tell you whether the time is on the queue, in your workers, in your code or inside the server. This post covers that triage, the five server checks behind it, the delta-counter trap that makes rate() lie, and how to size a cluster from writes per workflow, the ladder of ceilings and a step-ramp benchmark.
Temporal on PostgreSQL: Two Commits per Step, Queue-Table Vacuum, and the Cache That Ate the CPU
What self-hosted Temporal actually writes to PostgreSQL — every table, the two flushed commits behind each workflow step, why the outbox tables need their own autovacuum settings and history_node keeps growing — and the memory side: a History cache that filled a 2 GiB node until the Go GC burned 3.6 cores, and two look-alike incidents.
Temporal Timeouts, Retries and Determinism: Why Workflows Get Stuck Instead of Failing
The server cannot see inside a worker, only time passing. This post covers Temporal's four activity clocks, heartbeats, the default retry policy that quietly retries a permanent bug about 860 times a day, how every timeout becomes a timer_tasks row, a 70-second stall caused by pm2, and why non-determinism errors and history limits leave workflows stuck in Running.
Temporal Matching and Workers: Task Queues, Partitions, Sticky Queues, Pollers and Slots
How a Temporal task actually reaches your code: sync match vs a backlog in PostgreSQL, task queue partitions as the real unit of parallelism, the sticky queue that turns a SIGKILL into a 5–10 s stall, a one-line config that made 795 writes/s, and how to size pollers and slots with Little's law instead of guessing.
Temporal History Shards: The Ring, the range_id Stamp, Picking numHistoryShards and shardIOConcurrency
How Temporal splits workflows into a fixed number of history shards, how the ring and the range_id fencing token stop a frozen History host from corrupting state, why numHistoryShards can never change, and how shardIOConcurrency and Little's law explain workflow starts going from 46 ms to 1.4 s on a fast PostgreSQL.
Temporal Frontend and History: The Stateless Door, Its Rate Limits, and the Two-Commit Workflow Step
Every call into Temporal passes a stateless Frontend whose rate limits are mostly per host, so they multiply when you add nodes and halve when one dies, and SDK retries turn throttling into silent slowness. Behind it, History turns each workflow step into two fsync'd PostgreSQL commits plus a transactional outbox that never loses a task, even mid-crash.
Why Temporal Exists, and the Four Services Behind Every Workflow Step
The Temporal server never runs your code: it remembers (event history in PostgreSQL) and hands out jobs (task queues). This opener of a series on self-hosting Temporal on PostgreSQL covers replay and determinism, then traces one request hop by hop through Frontend, History and Matching, counting every database transaction along the way.
Flattened Tables vs Denormalized Tables vs Materialized Views: the Decision Guide, and How Incremental Flattened Tables Fixed Superset
Three patterns make a dashboard query cheap — a denormalized table, a materialized view, and a flattened snapshot table — and they look alike until one of them takes the production database down. Measured story: a BI tool with stored-SQL virtual datasets was pushing 961 MB/s of buffer traffic into a shared primary from two open browser tabs. This post is the decision guide (including where each pattern breaks, and a rank-by-measurement rule for choosing) plus the production fix that took dashboards off the primary entirely: a dedicated reporting database, a resource-restricted ETL role, and incremental 15-minute refresh that recomputes only what changed.
PgBouncer From First Principles: Why a Busy Primary Needs a Pooler, and Every Line of Its Config
PostgreSQL forks a whole OS process per connection, so a dozen eager client pools can push a primary past 500 backends while under 6% of them run a query. This post builds PgBouncer from the wire up — transaction pooling and the per-backend state it breaks, named prepared statements, SCRAM pass-through so no password touches disk, a second HBA because Docker's published ports bypass iptables, and the sizing arithmetic that finally lowered the backend count — with the four things that broke along the way.
VACUUM vs VACUUM FULL vs pg_repack: Getting Disk Back, Holding Off Wraparound, and Keeping the Planner Honest
Plain VACUUM 'never shrinks the file'. VACUUM FULL shrinks it but is an outage. pg_repack does the same rewrite online for seconds of locking. When each one is the right call, how to measure bloat cheaply (including TOAST, which everyone forgets), the capacity arithmetic so you don't PANIC mid-run — and the two jobs that share VACUUM's name but not its purpose: the anti-wraparound FREEZE that keeps the 32-bit transaction clock from running out, and the ANALYZE statistics pass that keeps the planner honest. All of it grounded in a real incident.
Building a Zero-Downtime Load Balancer: Active-Passive HA with nginx, keepalived, and Go
How I built a complete active-passive high-availability load balancer — two nodes running nginx + a Go backend + keepalived/VRRP, with a floating virtual IP, full observability, and an automated test suite that proves failover actually works. The five design decisions that matter, how failure detection is layered, and why your availability claim is worthless without CI to back it up.
Running AWX on Docker Compose: A Stand-Alone Alternative to Kubernetes
AWX's official deployment assumes Kubernetes — but what if your org isn't ready for K8s? This guide walks through building a custom AWX Docker image, crafting the Docker Compose configuration, and running 14 job templates with 7 schedules on a single host, complete with ansible-vault credential injection and the AWX-as-code approach.
Controlled Linux Patch Management: From Supply Chain Risk to Fleet-Isolated Package Delivery
Every server downloading directly from public repos is a supply chain risk — amplified by AI-powered malware targeting Linux infrastructure. After unattended-upgrades auto-rebooted a prod server multiple times, I created a controlled patch management system: fleet-isolated Aptly mirror, immutable snapshots, SQL-gated dev→staging→prod promotion, and a PostgreSQL governance database with Grafana dashboards for fleet-wide CVE visibility.
Systemd in Production: Service Management Beyond the Basics
How I use systemd for production services — writing good unit files, managing services day-to-day, logging with journald, and hardening for security. Practical patterns from real deployments.
Temporal SDK Metrics: Prometheus Exporter vs OTLP for Multi-Worker Deployments
How to choose between Prometheus exporter and OTLP for Temporal SDK metrics, especially when running multiple worker instances on the same host. A practical guide with real configuration.
A PostgreSQL 17 Migration Postmortem: WAL Recycling, Silent Timeouts, and the False Economy of Conservative Configs
What I learned migrating tens of GB across two PostgreSQL nodes — WAL starvation breaking async replication, timeouts murdering index builds mid-restore, and how conservative configs ironically made everything worse. With a config cheat sheet and a pre-migration checklist you should not skip.
sed for Emergency Debugging: When vim and nano Are Not an Option
It was 11 PM. I was debugging self-hosted PostgreSQL HA setup and vim wasn't available in the container. This is the story of how sed became my go-to tool for quick fixes in production environments.
Automating Docker PostgreSQL Backups with Cron: Complete Guide (Part 3 of 3)
Part 3: Eliminate manual backups with automated cron jobs. Learn scheduling strategies, environment setup, monitoring, alerting, troubleshooting, and complete working examples for production-grade PostgreSQL backup automation.
Restoring Docker PostgreSQL Safely: Zero Data-Loss Procedures (Part 2 of 3)
Part 2: Master PostgreSQL database restoration in Docker with safety-first procedures. Learn pre-restore checks, pg_restore techniques, automatic rollback, and emergency recovery to ensure zero data loss.
Docker PostgreSQL Backups: Production-Ready Strategy (Part 1 of 3)
Part 1: A comprehensive guide to backing up PostgreSQL databases in Docker containers. Covers container identification, database discovery, compression, checksums, manifests, and retention policies with production-ready scripts.
My Backup Strategy: Tar, Rsync, and Cron
How I automated daily, weekly, and monthly backups of my Code and Work directories to my Android phone via Termux.
Server-Sent Events: The Simple Alternative to WebSockets
Learn when to use SSE instead of WebSockets for one-way real-time streaming, with Node.js code examples
Secure User and Sudo Management on Production Ubuntu Servers
A step-by-step guide to creating new users, granting sudo privileges securely, and configuring passwordless sudo on a production Ubuntu server.
Production Linux Deployment Guide: Where to Put Your Files
A practical guide to file placement on production Linux servers following the Filesystem Hierarchy Standard (FHS). Learn where to place applications, configs, logs, and data for consistent and maintainable deployments.
Docker Installation on Ubuntu Server: A Complete Guide
Step-by-step guide to manually installing Docker Engine on Ubuntu servers with Docker Compose, GPG key management, and user group configuration
Setting Up SMTP Email with Nodemailer in Next.js
Learn how to configure a contact form with Gmail's free SMTP service using Nodemailer in your Next.js application
SSH into Server with Tailscale
Learn how to securely SSH into your servers during CI/CD workflows using Tailscale