Comparing Message Brokers: Redis vs AMQP vs SQS

TL;DR: A practical cost and feature comparison of three message transports for microservices, including latency benchmarks and when to use each.

When building microservices, choosing the right message transport can significantly impact your system’s cost, reliability, and performance. This article compares three popular options: Redis, AMQP (RabbitMQ via CloudAMQP), and Amazon SQS—specifically in the context of Moleculer.js channels, but the principles apply broadly.

When to Use Channels vs Events

Before diving into the comparison, let’s understand when you need a dedicated channel/queue system versus simple event emission:

ScenarioPrefer EventsPrefer Channels
Simple, ephemeral notifications
High-throughput pub/sub
Message durability needed
Ordered or prioritized messages
Integration with external systems
Long-lived messages / retries

Cost Comparison Assumptions

For accurate cost estimation, we used these parameters:

  • Month = 30 days (2,592,000 seconds)
  • Average message size = 1 KB
  • SQS batching: up to 10 messages per API call
  • Redis node price: cache.m6g.large @ $0.149/hour (regional prices vary)
  • SQS request prices based on AWS SQS pricing tables

Redis Adapter (Serverless ElastiCache)

Setup: 10 channels mapped to a single serverless Redis cluster with Pub/Sub (in-memory, no persistence).

Estimated Load:

  • Total throughput: 500 msg/s × 1 KB = 0.5 MB/sec → ~43 GB/month
  • Serverless auto-scales with throughput

AWS Cost Estimate (Serverless):

ComponentPrice/month
Usage-based (compute & memory)~$50 (est.)
Backup & I/O~$5
Total~$55

Pros:

  • Extremely low latency (<1 ms)
  • Automatic scaling

Cons:

  • No built-in message durability
  • Throttling during bursts above max capacity

CloudAMQP (RabbitMQ) - VPC vs Non-VPC

VPC Peering Cost

CloudAMQP’s VPC (peering) is an add-on cost of $99/month for dedicated plans, independent of node count.

ScenarioCluster cost (3-node)VPC add-onTotal (USD/month)
Without VPC~$147$0~$147
With VPC~$147$99~$246

Latency Characteristics

TypeLatency EstimateVariabilityData Transfer Cost
Public Internet (without VPC)~10–30 msHighPossibly internet egress
VPC Peering (private)~2–5 msLowFree within same AZ

Amazon SQS Cost Calculation

Queue configurations:

  • High (FIFO): 100 msg/s, polling 1s, batch 10
  • Medium (FIFO): 150 msg/s, polling 5s, batch 10
  • Low (Standard): 200 msg/s, polling 30s, batch 10

Request Count Math

High (100 msg/s, 1s poll):

  • Messages per poll = 100 → requests per poll = 10
  • Requests/month ≈ 25,920,000

Medium (150 msg/s, 5s poll):

  • Messages per poll = 750 → requests per poll = 75
  • Requests/month ≈ 38,880,000

Low (200 msg/s, 30s poll):

  • Messages per poll = 6,000 → requests per poll = 600
  • Requests/month ≈ 51,840,000

Total: 116,640,000 requests/month

SQS Pricing (ap-south-1)

  • Standard: $0.40 per 1M requests
  • FIFO: $0.50 per 1M requests

Cost breakdown:

  • High (FIFO): 25.92M × 0.50/1M=0.50/1M = **12.96/month**
  • Medium (FIFO): 38.88M × 0.50/1M=0.50/1M = **19.44/month**
  • Low (Standard): 51.84M × 0.40/1M=0.40/1M = **20.74/month**

Total SQS monthly cost ≈ $53.14

Important: FIFO queues have throughput limits. Without high-throughput mode: up to 300 API calls/sec per partition (3,000 messages/sec with batching).

Complete Cost Comparison

AdapterSetupNodesEst. Monthly CostNotes
Redis (ElastiCache)cache.t3.medium1$48.96Low-latency (<1 ms), no persistence
cache.t3.medium3$146.88HA recommended (1 primary + 2 replicas)
CloudAMQPSingle node1$49–55Basic shared plan, minimal HA
HA cluster3$147Add VPC peering → $246 total
Amazon MQSingle Node1~$207.36mq.m5.large + storage
Multi Node3~$622.08+ storage costs
Amazon SQS2×FIFO + 1×Standardn/a$53.1410-msg batching, highly durable

Summary

  • Lowest Cost: Redis (1-node) at ~$49/month—but single point of failure
  • Best Value: Redis (3-node) or SQS (~147vs147 vs 53)—depends on durability needs
  • AMQP (CloudAMQP): More expensive but offers flexible routing and durability; add VPC for private connectivity (~$246/month)
  • SQS: Cheapest durable and fully managed option, ideal for high throughput with no ops overhead

Implementation Considerations

Adapter Availability

  • Redis & AMQP: Official channel adapter implementations available
  • AWS SQS: No official adapter exists, but the framework allows custom adapters

Debuggability

  • Redis: Limited visibility, no manual retry support
  • AMQP: No built-in dead-letter queue (DLQ)
  • SQS: Clean UI for queue management, full visibility with custom implementation

Flexibility

  • SQS Custom Adapter: Full control over queue design, priorities, and batching
  • Redis & AMQP: Out-of-the-box adapters offer limited tuning flexibility

Recommendation

Choose based on your primary constraint:

  1. Latency-critical: Redis (sub-millisecond)
  2. Durability-critical: SQS (fully managed, cheap)
  3. Routing flexibility: RabbitMQ/AMQP (complex routing patterns)
  4. Zero ops: SQS (no infrastructure management)

A custom SQS adapter provides the best visibility, control, and flexibility, but requires careful implementation and hardening.

Acknowledgements
  • Vinayak — Assembling pricing information