Presented by:

64061c19a85c648aa72c9be20e34ee35

Hemendra Sharma

from Squadstack

Platform engineer who loves building and optimizing systems to keep things running smoothly

Checkout the slides

This proposal outlines how to use PostgreSQL as a message broker, addressing memory issues encountered with AmazonMQ and observability limitations in Redis. The system design incorporates a robust database schema, efficient worker processes, and additional features for task scheduling and management. Key components include:

Database Schema: Utilizes tables for queues, tasks, task instances, and workers, with a visibility timeout mechanism to prevent duplicate processing. Worker Design: Implements concurrent task processing using "SELECT FOR UPDATE SKIP LOCKED" queries, complemented by a sidecar process for monitoring and task recovery. Metrics: Focuses on tracking total messages, worker count, consumption rate, and ingestion rate for comprehensive system observability. Additional Features: Incorporates a cron task scheduler for periodic tasks and supports ETA-based task execution.

This architecture aims to provide a scalable, observable, and reliable message brokering solution using PostgreSQL's robust features and transactional capabilities.

Date:
2025 March 6 - 14:45
Duration:
45 min
Room:
Grand Ballroom 2
Conference:
PGConf India, 2025
Language:
Track:
Application Developer
Difficulty:
Medium

Happening at the same time:

  1. Unleashing the Power of Azure Database for PostgreSQL Flexible Server
  2. Start Time:
    2025 March 6 14:00

    Room:
    Neptune

  3. Pushing PostgreSQL to the Limits: Tackling Analytics Workloads with Extensions
  4. Start Time:
    2025 March 6 14:45

    Room:
    Jupiter

  5. PostgreSQL : Page Buffer Overview
  6. Start Time:
    2025 March 6 14:45

    Room:
    Grand Ballroom 1