Skip to content

Databases and messaging ยท Practice and architecture

RabbitMQ and Valkey: choosing a queue or a cache

RabbitMQ and Valkey can coexist in the same system, but they solve different problems. Ask whether the goal is to hand work between services or to access data quickly with an application-defined lifetime.

RabbitMQ: delivering work to consumers

When a task must reach a consumer, routing, acknowledgement and redelivery matter. The application should anticipate receiving a message more than once and temporary consumer outages.

Valkey: fast access to state

A cache entry can often be rebuilt from a source of truth. Session state or another value whose loss affects users has a different risk profile. Memory policy, replication and persistence then become design decisions.

When both tools belong

An application can dispatch tasks through RabbitMQ and cache recent results in Valkey. Still, name the system of record. Test key eviction and task redelivery separately, because the application should treat those as different situations.

Example: generating a report

The queue can carry a request to generate a report while the cache holds status for the dashboard. A missing cache entry should not on its own trigger another costly run. A durable task identifier and a reliable way to check completion belong in the application design.

Official documentation

Discuss your infrastructure

Choose a deployment, audit or maintenance scope for your environment. HLS works remotely with teams across Poland.

Service catalog