Pg-status
lastmod 2026-01-31created 2026-01-311 edits
Lightweight microservice for checking PostgreSQL host status
About
- Sidecar-style microservice designed to detect the state of a PostgreSQL cluster in real time
- Instantly check whether a host is alive, whether it is a master or a replica, and replica lag
- Lightweight, high-performance design: about 9MiB of memory usage, low CPU load per request, handles up to 9000 requests per second
- All data is served from memory, minimizing request latency
- Periodically polls PostgreSQL host status in the background and exposes the results through an HTTP API (Plain/JSON responses)
- Main API endpoints
- /master: returns the current master host
- /replica: returns a replica selected with a round-robin algorithm
- /sync_by_time, /sync_by_bytes: returns a replica based on synchronization status measured in time or bytes
- /hosts: status list of all hosts (JSON)
- /status: detailed status of a specific host
- Optimizes response speed at the cost of possible temporary data inconsistency