When an application needs Redis: measurable signals before adding caching or queues

Published on 2026-11-14 by frfrand

Criteria for deciding whether to incorporate Redis for caching, sessions, and jobs, with metrics, alternatives, and operational costs.

When an application needs Redis: measurable signals before adding caching or queues

Redis should not be added just because other applications use it. Its value appears when it solves a measurable problem: repeated queries that can be cached, shared ephemeral state, or job coordination. Before adding another dependency, identify what bottleneck you intend to remove and how you will measure the improvement.

1. Start with metrics

Measure API p50/p95/p99 latency, SQL time, number of identical requests, CPU and memory, error rate, and number of pending jobs. Redis does not speed up incorrect queries nor eliminate the need for indexes; sometimes the simplest solution is to fix a query and keep only PostgreSQL.

2. Signals in favor of using cache

If the same response is calculated hundreds of times from data that changes little, a cache with TTL can reduce load. Example: public catalog, shared configurations, or precalculated statistics. Define key, per-client scope, expiration, and invalidation on write.

Do not place private data from multiple clients under a generic key like dashboard. A key should include tenant ID, structure version, and other relevant parameters. Expired information also has a cost: determine what errors a stale response produces.

3. Shared sessions

When multiple API instances need to share short-lived sessions, Redis can be an option. But signed cookies and other stores also exist. Evaluate revocation, expiration, availability, and state loss risks. Do not store unnecessary secrets and protect the instance with private access and authentication.

4. Queues and background tasks

Redis can back certain queue libraries. It is not essential for any job: PostgreSQL with a jobs table can be sufficient for modest loads. If you choose Redis, define retries, duplication, job visibility, persistence, recovery, and memory limits.

A queue does not guarantee exactly one execution: the code must be idempotent when redelivery is possible.

5. Costs of adding Redis

| Cost | Question | |---|---| | Memory | How large can keys grow? | | Persistence | What data can you lose on a restart? | | Operation | Who manages patches, backups, and alerts? | | Security | Is the port restricted to trusted networks? | | Logic | How to invalidate, retry, and recover? |

6. Decision test

Create a baseline without Redis. Implement a prototype in a test environment and compare p95 latency, queries per second, PostgreSQL load, and errors. Introduce Redis only if the improvement justifies the effort and you can handle its failure with controlled degradation.

As a rule of thumb, start by optimizing PostgreSQL, paginating responses, and measuring queries. Consider Redis afterwards, when it is a tool for a proven problem and not a preventive bet.

Read what Redis is and what it is for, how to invalidate Redis cache and ArduMaker services.

Frequently asked questions

### Does Redis replace PostgreSQL? No for most transactional applications; they usually serve different purposes.

Does Redis always improve performance?

No. It adds a network hop and operations that must be justified with measurements.

Do I need Redis for queues?

It depends on the library, job frequency, and desired guarantees.

Reference: Redis Documentation and PostgreSQL.

  • Redis
  • caché
  • colas
  • rendimiento
  • arquitectura

On ArduMaker

  • Redis: Install Redis, tune memory and persistence, and search, edit and delete keys from the panel.

Keep reading

All articles · VPS plans