Redis vs SQS for n8n Queues: Which Is Cheaper at Scale?

Step by Step Guide to solve redis vs sqs cost comparison n8n 
Step by Step Guide to solve redis vs sqs cost comparison n8n


Who this is for: Teams running n8n workflows in AWS who need to decide between an in‑memory Redis queue (Elasticache) and a managed SQS queue. We cover this in detail in the n8n Cost, Scaling & Infrastructure Economics Guide.


Quick Diagnosis

  • If your n8n instance processes ≤ 5 M messages / month on a single‑node Elasticache Redis, the bill usually lands between $30‑$70 (data‑out included). The same load on AWS SQS Standard costs about $0.40 / M requests plus data‑out, roughly $2‑$5 / month. Pick Redis only when you need sub‑millisecond latency, persistent job state, or very high‑throughput pipelines that would otherwise require many SQS queues and Lambda invocations.

In production, the Redis price tag can creep up once you enable persistence or cross‑AZ replication.


1. How n8n Uses Queues?

If you encounter any why n8n costs explode at scale resolve them before continuing with the setup.

Queue fundamentals

Feature Redis (Elasticache) AWS SQS (Standard)
Type In‑memory list / stream Managed message broker
Persistence Optional AOF/RDB (adds cost) Built‑in durable storage (14 days)
Message size limit 512 MiB (practical ≤ 1 MiB) 256 KB
Typical n8n use Real‑time orchestration, rate‑limited APIs Decoupled fire‑and‑forget jobs

Performance & ops

Aspect Redis SQS
Throughput 100 k+ ops / sec per node (cluster > 1 M) Unlimited (Standard), 300 TPS (FIFO)
Latency (p99) <5 ms (in‑memory) 30‑150 ms (network)
Operational overhead Node patching, backups, failover Zero (fully managed)

EEFA note: A cold restart of a Redis node wipes any un‑persisted jobs. Enabling AOF (appendonly yes) and scheduling snapshots (save 900 1) avoids loss – this adds roughly 10 % extra storage cost on Elasticache.


2. Detailed Cost Model for AWS SQS

2.1 Pricing components (2024 US‑East‑1)

Component Cost
Requests (Standard) $0.40 / 1 M requests
Requests (FIFO) $0.50 / 1 M requests
Data‑out (first 10 TB) $0.09 / GB
Message storage Free (≤ 14 days)
Dead‑letter queues No extra charge

2.2 Example calculation – 5 M messages / month, avg 0.5 KB payload

  1. Requests – 5 M × $0.40 / M = $2.00
  2. Data out – 5 M × 0.5 KB = 2.5 GB → 2.5 GB × $0.09 = $0.23
  3. Total$2.23 / month

EEFA warning: Long‑polling (WaitTimeSeconds=20) still incurs a request charge. Over‑polling can double request costs. Batch ReceiveMessage (max 10 messages) to keep the request count low. If you encounter any cost of retries in n8n resolve them before continuing with the setup.

2.3 Terraform – create a Standard queue (first part)

resource "aws_sqs_queue" "n8n_jobs" {
  name = "n8n-jobs-queue"
  delay_seconds = 0

2.4 Terraform – remaining settings (second part)

  max_message_size          = 262144   # 256 KB
  message_retention_seconds = 1209600  # 14 days
  receive_wait_time_seconds = 20       # long polling
}

3. Detailed Cost Model for Redis (Elasticache)

If you encounter any db cost optimization high volume workflows resolve them before continuing with the setup.

3.1 Node pricing (single‑node, 2024 US‑East‑1)

Node type vCPU Memory Hourly Monthly (730 h)
cache.t3.micro 2 0.5 GiB $0.017 $12.41
cache.t3.small 2 1.55 GiB $0.034 $24.82
cache.t3.medium 2 3.10 GiB $0.068 $49.64
cache.m6g.large 2 13 GiB $0.138 $100.74

3.2 Data‑transfer & backup costs

Item Rate
Data out to Internet $0.09 / GB (first 10 TB)
Cross‑AZ transfer $0.01 / GB
Backup storage (optional) $0.10 / GB‑month

3.3 Example calculation – 5 M messages, avg 0.5 KB, 1 GiB daily traffic

  1. Nodecache.t3.medium$49.64
  2. Data out – 2.5 GB × $0.09 = $0.23
  3. Cross‑AZ (if enabled) – 2.5 GB × $0.01 = $0.03
  4. Total – around $50 / month

EEFA note: Redis doesn’t charge per operation, but a spike in request rate can push you into a larger node class, inflating cost quickly. Stay on a single node unless you exceed ~1 M ops / sec. At that point a Redis cluster usually ends up cheaper than trying to force the same throughput out of a single node.

3.4 Terraform – Redis cluster (first part)

resource "aws_elasticache_cluster" "n8n_redis" {
  cluster_id  = "n8n-redis"
  engine      = "redis"
  node_type   = "cache.t3.medium"
  num_cache_nodes = 1

3.5 Terraform – remaining settings (second part)

  parameter_group_name = "default.redis6.x"
  port                 = 6379
  apply_immediately    = true
}

4. Head‑to‑Head Cost Comparison

Metric AWS SQS (Standard) Redis (Elasticache)
Monthly cost (5 M msgs) $2.23 $50.00
Latency (p99) 30‑150 ms (network) <5 ms (in‑memory)
Scalability ceiling Unlimited (managed) Node‑class limited; clustering required for > 1 M ops / sec
Operational overhead Zero Patch, backup, failover
Persistence guarantee Durable (14 days) Volatile unless AOF/RDB enabled
Best‑fit scenario Simple fire‑and‑forget jobs, cost‑sensitive High‑throughput, low‑latency pipelines, stateful retries

5. Decision Guidance: When to Choose Which Queue?

  • Latency ≤ 10 ms is a hard SLA → Redis covers the extra $48 /mo.
  • You can tolerate 50‑100 ms and want near‑zero ops overhead → SQS wins hands‑down.
  • Hybrid approach – Use SQS for bulk, fire‑and‑forget tasks and a small Redis instance for the few latency‑critical steps.

Quick decision checklist

Question Recommended queue
Message rate > 1 M ops / sec? Redis Cluster (higher cost)
Need sub‑ms latency? Single‑node Redis
Prefer zero‑maintenance, pay‑as‑you‑go? SQS Standard
Exactly‑once processing required? SQS FIFO (≈ $3 /mo)
Want cheap, durable storage up to 14 days? SQS Standard

6. Mitigating Unexpected Charges – EEFA Checklist

Checklist Item Why it matters How to implement
Enable SQS request batching (max 10 msgs) Cuts request count → lower cost Set MaxNumberOfMessages=10 in the n8n SQS node
Set appropriate VisibilityTimeout Prevents duplicate processing → fewer extra messages Match to longest job duration + 10 % buffer
Monitor Redis evicted_keys metric Evictions signal memory pressure → hidden performance loss CloudWatch alarm: Redis.evicted_keys > 0
Turn off cross‑AZ replication if not needed Saves $0.01 / GB cross‑AZ traffic Omit replication_group_id in Terraform
Schedule Redis snapshots off‑peak Avoids IO spikes that could trigger scaling snapshot_window = "03:00-04:00"
Use SQS dead‑letter queues Isolates failing messages → prevents endless retries Configure maxReceiveCount in n8n error handling

7. n8n Configuration Samples

7.1 SQS node – basic receive settings (part 1)

{
  "nodes": [
    {
      "parameters": {
        "queueUrl": "https://sqs.us-east-1.amazonaws.com/123456789012/n8n-jobs-queue",
        "region": "us-east-1",

7.1 SQS node – remaining parameters (part 2)

        "maxNumberOfMessages": 10,
        "waitTimeSeconds": 20,
        "visibilityTimeout": 300
      },
      "name": "Receive SQS Messages",
      "type": "n8n-nodes-base.awsSqs",
      "typeVersion": 1,
      "position": [200, 300]
    }
  ]
}

7.2 Redis node – connection details (part 1)

{
  "nodes": [
    {
      "parameters": {
        "host": "n8n-redis.xxxxxx.0001.use1.cache.amazonaws.com",
        "port": 6379,
        "auth": "YOUR_REDIS_PASSWORD",

7.2 Redis node – command configuration (part 2)

        "command": "lpop",
        "key": "n8n:jobs"
      },
      "name": "Pop Redis Job",
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [200, 500]
    }
  ]
}

EEFA note: LPOP removes the head atomically, giving exact‑once only if you never re‑push on failure. For retry‑safe pipelines, prefer Redis Streams (XREADGROUP) and acknowledge with XACK.


Conclusion

For low‑volume, cost‑sensitive n8n workflows, AWS SQS delivers comparable reliability for under $5 /mo. When your workloads demand sub‑millisecond response times, stateful retries, or massive concurrent jobs, a single‑node Redis (≈ $50 /mo) provides the needed performance edge. Use the checklist above to keep operational overhead and surprise charges in check, whichever queue you pick.

Leave a Comment

Your email address will not be published. Required fields are marked *