
Who Redis is for#
SaaS backend engineers caching PostgreSQL reads
A SaaS platform backend engineer uses Redis as an application cache in front of PostgreSQL, storing frequently read API responses with TTL-based expiry to reduce database load during traffic spikes
Gaming infrastructure teams running leaderboards
A gaming company infrastructure team stores live leaderboard rankings in a Redis sorted set, updating player scores in real time and reading the top 100 with a single ZREVRANGE command
Fintech developers enforcing rate limits
A fintech startup developer implements distributed rate limiting across multiple API servers by incrementing a Redis counter per user per time window using atomic INCR and EXPIRE commands
DevOps engineers coordinating microservice events
A DevOps engineer running a microservices architecture uses Redis Streams as a lightweight event log, allowing services to consume and acknowledge events independently without a full Kafka setup
The problem it solves#
Applications that rely on disk-based databases hit latency ceilings when they need real-time read/write performance, session storage, or event-driven data pipelines. Backend engineers and platform teams need a fast, flexible data layer that can serve cached results, coordinate distributed state, and handle high-throughput message streams without the overhead of a traditional RDBMS. Redis solves this by keeping data in memory with optional persistence, giving teams a single tool that replaces multiple specialized services. It is widely adopted by startups and large-scale platforms alike for anything requiring predictable low-latency data access.
How it solves it#
Rich data structures
Store and query rich data structures including strings, hashes, lists, sets, sorted sets, bitmaps, hyperloglogs, geospatial indexes, and streams
Configurable persistence
Persist data to disk via RDB point-in-time snapshots or AOF (Append-Only File) logging, with configurable durability tradeoffs
Redis Cluster scaling
Scale horizontally with Redis Cluster, which automatically shards data across nodes with built-in failover
Pub/Sub messaging
Publish and subscribe to channels for lightweight real-time messaging between application components
Atomic transactions and Lua scripts
Execute atomic multi-command transactions and server-side Lua scripts to avoid race conditions on shared state
Strengths and trade-offs#
Strengths
- Sub-millisecond hot-data latencyDelivers sub-millisecond latency for reads and writes because the entire working dataset lives in RAM, outperforming any disk-bound cache or database for hot data
- Broad native data structuresSupports a broad set of native data structures so teams can model leaderboards, rate limiters, queues, and time-series counters without a separate specialized service
- Simple deployment shapeShips as a single binary with no external dependencies, making local development, Docker deployment, and bare-metal installs equally straightforward
- Large client ecosystemHas a massive ecosystem of client libraries covering every major language and framework, reducing integration friction compared to proprietary managed alternatives
Trade-offs
- -RAM-bound datasetsDataset size is bounded by available RAM, so storing large or rarely accessed data sets requires careful eviction configuration or a hybrid architecture with a disk-based store
- -Persistence tuning mattersPersistence options (RDB and AOF) add I/O overhead and do not guarantee zero data loss in all crash scenarios without careful durability tuning
- -Cluster operations add complexityRedis Cluster adds operational complexity: resharding, slot migration, and multi-key operations across shards require deliberate design work
- -Version-dependent licensingRedis licensing now depends on version: Redis 7.2 and earlier remain BSD 3-Clause, Redis 7.4.x through 7.8.x use RSALv2/SSPLv1, and Redis 8+ adds AGPLv3 as an OSI-approved option. Teams that need BSD-style permissive licensing should evaluate Valkey or pin to Redis 7.2.
Redis vs alternatives#
Redis vs Redis Cloud
Redis Cloud is the official managed version of Redis, offering automatic scaling, built-in high availability, and active-active geo-distribution across cloud regions. It removes operational overhead: no cluster management, failover configuration, or hardware provisioning. The tradeoff is cost and vendor lock-in. Redis Cloud pricing scales with dataset size and throughput, which becomes significant at production scale. Self-hosted Redis gives you full control over hardware, eviction policies, and networking at no licensing cost beyond infrastructure. Teams with the operational capacity to manage Redis themselves typically choose the open source version; teams that want to move fast without an ops burden lean toward Redis Cloud.
Redis vs AWS ElastiCache
ElastiCache for Redis is Amazon's managed Redis service, deeply integrated with AWS networking, IAM, and CloudWatch. It offers Multi-AZ replication, automatic failover, and serverless scaling with ElastiCache Serverless. The integration with VPC, Security Groups, and AWS Parameter Store makes it the path of least resistance for AWS-native stacks. However, it is locked to AWS, adds per-node and data-transfer costs, and limits access to certain Redis configurations that self-managed deployments expose. Open source Redis self-hosted on EC2 or ECS gives the same performance characteristics with more configurability, but requires teams to own patching, replication setup, and monitoring.
Install and self-host#
# Docker (quickest start)
docker run -d --name redis -p 6379:6379 redis:latest
# Ubuntu/Debian via apt
sudo apt-get install -y redis-server
sudo systemctl enable --now redis-server
# macOS via Homebrew
brew install redis
brew services start redis
# Verify connection
redis-cli ping
# Expected output: PONGWhat it's built on#
- Languages
- CPython
- Cache
- Redis
FAQ#
Is Redis a database or just a cache?
Redis is both. It started as a cache but has evolved into a full data structure server with optional persistence, transactions, and cluster support. Many teams use it as their primary database for specific workloads like sessions, leaderboards, or queues alongside a relational store.
What happens to my data if Redis restarts?
By default, Redis is in-memory only and loses data on restart. You can enable RDB snapshots (periodic point-in-time saves) or AOF logging (write every command to disk) to survive restarts. The trade-off is disk I/O and a small window of potential data loss depending on the flush interval you configure.
How does Redis compare to Memcached?
Both are in-memory caches, but Redis supports far more data types, optional persistence, Pub/Sub, Lua scripting, and clustering. Memcached is simpler and uses slightly less memory per key for basic string caching. Redis is the default choice for new projects unless you specifically need Memcached's multi-threaded architecture.
What is the current Redis license?
Redis licensing depends on version. Redis 7.2 and earlier remain BSD 3-Clause, Redis Community Edition 7.4.x through 7.8.x uses RSALv2 or SSPLv1, and Redis 8+ adds AGPLv3 alongside RSALv2 and SSPLv1. AGPLv3 is OSI-approved, but teams that require BSD-style permissive terms should use Redis 7.2 or evaluate Valkey.
Can Redis handle millions of operations per second?
Yes. A single Redis instance on commodity hardware can handle hundreds of thousands of operations per second. Redis Cluster distributes load across shards linearly, and pipelining or connection pooling further increases throughput for high-volume workloads.
Similar open-source tools#
KeyDB
Faster, multithreaded Redis drop-in with no API changes required
Supabase
Open source Firebase: Postgres database, auth, and file storage
Apache CouchDB
NoSQL database with multi-primary sync and HTTP API
Nhost
Firebase alternative: GraphQL, Postgres auth, and file storage
Kuzzle
Self-hosted backend with real-time API and search built in
Zoneless
Open source payout platform for global marketplace payments

