Redis is arguably the most well regarded tech
of all. My impression is that not even PostgreSQL has the same kind of
positive aura around it. And of all tech available Redis is at the top of
things you “need” to have in your tech stack. Maybe this will change with
their latest
licencing change, but that remains to be seen.
It’s not difficult to see why, Redis is after all a very well architected and
impressive piece of technology and this post is not arguing against any
technical merits of Redis. What I will argue is that despite no technical flaw
in Redis itself you still might not need it!
My Experience
In the last 3 places I worked (10+ years) I have seen the same pattern. A
problem comes up, Redis is seen as a great fit and here we go.
However, when looking closer at the actual use case it turns out that Redis
didn’t improve things, or did not fix the underlying problem. It just added
complexity for complexity’s sake.
First time, at Tantan
First time Redis was proposed was at
Tantan, the second largest dating app in
China and a sort of Chinese Tinder. At the time we had 50-100 very powerful
database servers running PostgreSQL.
To not make this post too long I will simplify the architecture a bit: Each
server stored a subset of the users ‘swipes’, sharded by the UserId so that a
specific user only had data on one server. To add new swipes, the code would
locate the server belonging to the user, and then run an insert SQL statement.
If you are curious I have held a couple of talk of Tantan’s DB architecture,
see here for a more in depth overview.
The need arose to keep track of a little piece of additional data, namely the
count of swipes. Basically a single integer value for each user, with two
important properties: The value would be updated very often since ‘swipe’
where the most
31 Comments
evidencetamper
> Redis is arguably the most well regarded tech of all.
REDIS tradeoffs have been so widely discussed because many, many engineers disagree with them. REDIS is so lowly regarded that some companies ban it completely, making their engineers choose between memcached or something more enterprisey (hazelcast these days, Coherence some time ago).
sorokod
So premature optimization causes Redis?
dinobones
It’s not about Redis vs not Redis, it’s about working with data that does not serialize well or lend itself well to extremely high update velocity.
Things like: counters, news feeds, chat messages, etc
The cost of delivery for doing these things well with a LSM based DB or RDB might actually be higher than Redis. Meaning: you would need more CPUs/memory to deliver this functionality, at scale, than you would with Redis, because of all the overhead of the underlying DB engine.
But for 99% of places that aren’t FAANG, that is fine actually. Anything under like 10k QPS and you can do it in MySQL in the dumbest way possible and no one would ever notice.
dorianniemiec
I have found that for websites that use Joomla, file cache is faster than Redis cache, at least for me.
mannyv
Caching is a funny thing. Just like anything you need to understand if and why you need it.
And one other thing is you should be able to fall back if your cache is invalidated.
In our case we keep a bunch of metadata in redis that’s relatively expensive (in cost and speed) to pull/walk in realtime. And it needs to be fast and support lots of clients. The latter sort of obviates direct-to-database options.
bassp
I agree with the author 100% (the TanTan anecdote is great, super clever work!), but…. sometimes you do need Redis, because Redis is the only production-ready "data structure server" I'm aware of
If you want to access a bloom filter, cuckoo filter, list, set, bitmap, etc… from multiple instances of the same service, Redis (slash valkey, memorydb, etc…) is really your only option
tombert
I have gotten in arguments with people who over-deploy Redis. Redis is cool, I don't dislike it or anything, but a lot of the time when people use it, it actually slows things down.
Using it, you're introducing network latency and serialization overhead. Sometimes that's worth it, especially if your database is falling over, but a lot of the time people use it and it just makes everything more complex and worse.
If you need to share cached data across processes or nodes, sometimes you have to use it, but a lot of the stuff I work with is partitioned anyway. If your data is already partitioned, you know what works well a lot of the time? A boring, regular hashmap.
Pretty much every language has some thread-safe hashmap in there, and a lot of them have pretty decent libraries to handle invalidation and expiration if you need those. In Java, for example, you have ConcurrentHashMap for simple stuff, and Guava Caches or Caffeine Caches for more advanced stuff.
Even the slowest [1] local caching implementation will almost certainly be faster than anything that hits the network; in my own testing [2] Caffeine caches have sub-microsecond `put` times, and you don't pay any serialization or deserialization cost. I don't think you're likely to get much better than maybe sub-millisecond times with Redis, even in the same data center, not to mention if you're caching locally that's one less service that you have to babysit.
Again, I don't hate Redis, there are absolutely cases where it's a good fit, I just think it's overused.
[1] Realistic I mean, obviously any of use could artificially construct something that is slow as we want.
[2] https://blog.tombert.com/posts/2025-03-06-microbenchmark-err… This is my own blog, feel free to not click it. Not trying to plug myself, just citing my data.
jayd16
I agree that Redis can be an architectural smell. You can shoehorn it in where it doesn't belong.
It's easy to work with and does it's job so well that for a certain type of dev it's easier to implement caching than understand enough SQL to add proper indices.
bdcravens
Another category is using Redis indirectly via dependencies. For example in Rails, Sidekiq is a common background job library. However, there are now Postgresql-backed options (like GoodJob and the baked-in Solid Queue, which supports other RDBMSes as well)
sgarland
> 'Why can't we just store this data on the shards in PostgreSQL, next to the swipes?'. The data itself would be microscopic in comparison and the additional load would also be microscopic in comparison to what these servers were already doing.
I'm assuming based on the rest of the article that the author and team knew what they were doing, but if you aren't familiar with Postgres' UPDATE strategy and HOT updates [0], you should familiarize yourself before attempting this, otherwise, you're going to generate a massive amount of WAL traffic and dead tuples at scale.
[0]: https://www.postgresql.org/docs/current/storage-hot.html
igortg
I followed with this rationale in a small project and opted for PostgreSQL pub/sub instead Redis. But I went through so much trouble correctly handling PostgreSQL disconnections that I wonder if Redis wouldn't be the better choice.
phendrenad2
I like to run a single redis server process on each instance that's serving the webapp, and also have a shared redis cluster for shared cached state (like user sessions). That way there's a fast local cache for people to use for caching API calls and other things where duplication is preferable to latency.
kflgkans
You might not need a cache. In my previous company (~7 years) all teams around me were introducing caches left and right and getting into a lot of complexity and bugs. I persevered and always pushed back adding caches to apps in my team. Instead focusing on improving the architecture and seeking other performance improvements. I can proudly say my teams have stayed cached-free for those 7 years.
xyzzy9563
Redis is useful if you have multiple backend servers that need to synchronize state. If you don’t have this problem then improving your caching I.e. using Cloudflare is probably the best approach, along with local caching on a single server.
g9yuayon
When I was in Uber back in 2015, my org was trying to convert zip-code-based geo partitioning with a hexagon-based scheme. Instead of partitioning a city into on average tens of zip codes, we may partition the city into potentially hundreds of thousands of hexagons and dynamically create areas. The first launch was in Phoenix, and the team who was responsible for the launch stayed up all night for days because they could barely scale our demand-pricing systems. And then the global launch of the feature was delayed first by days, then by weeks, and then by months.
It turned out Uber engineers just loved Redis. Having a need to distribute your work? Throw that to Redis. I remember debating with some infra engineers why we couldn't throw in more redis/memcached nodes to scale our telemetry system, but I digressed. So, the price service we built was based on Redis. The service fanned out millions of requests per second to redis clusters to get information about individual hexagons of a given city, and then computed dynamic areas. We would need dozens of servers just to compute for a single city. I forgot the exact number, but let's say it was 40 servers per an average-sized city. Now multiply that by the 200+ cities we had. It was just prohibitively expensive, let alone that there couldn't other scalability bottlenecks for managing such scale.
The solution was actually pretty simple. I took a look at the algorithms we used, and it was really just that we needed to compute multiple overlapping shapes. So, I wrote an algorithm that used work-stealing to compute the shapes in parallel per city on a single machine, and used Elasticsearch to retrieve hexagons by a number of attributes — it was actually a perfect use case for a search engine because the retrieval requires boolean queries of multiple attributes. The rationale was pretty simple too: we needed to compute repetitively on the same set of data, so we should retrieve the data only once for multiple computations. The algorithm was of merely dozens of lines, and was implemented and deployed to production over the weekend by this amazing engineer Isaac, who happens to be the author of the library H3. As a result, we were able to compute dynamic areas for 40 cities, give or take, on a single machine, and the launch was unblocked.
lukaslalinsky
For years I've tried to use Redis as a persistent data store. I've only been dissatisfied, having bad experiences with both sentinel and cluster. Most of my service outages were linked to Redis replication getting broken.
Then I decided to give up and use it only as an empehemral cache. I have a large number of standalone Redis instances (actually, now they are Valkey), no storage, only memory, and have Envoy proxy on top of them for monitoring and sharding. And I'm really happy with it, storing hundreds of GBs of data there, if one goes down, only a small part of the data needs to be reloaded from the primary source, and with the Envoy proxy, applications see it as a single Redis server. I was considering just replacing it with memcached, but the redis data model is more rich, so I kept using it, just not expecting anything put there to be actually stored forever.
progbits
Redis as ephemeral cache is ok, but nothing extra.
Redis as transactional, distributed and/or durable storage is pretty poor. Their "active active" docs on conflict resolution for example don't fill me with confidence given there is no formalism, just vague examples. But this comes from people who not only not know how do distributed locks, they refuse to learn when issues are pointed out to them: https://martin.kleppmann.com/2016/02/08/how-to-do-distribute…
Every time I find code that claims to do something transactional in Redis which is critical for correctness, not just latency optimization, I get worried.
ent101
Shameless plug for my project: https://github.com/HeyPuter/kv.js
Don't kill me :')
vvpan
Really the most useful feature in Redis to me is TTL – so easy to cache things and not worry about them being too stale. The second most useful is that you can attach something like BullMQ to it and get cron/scheduling for a couple lines of code.
superq
The issues that I have with Redis are not at all its API (which is elegant and brilliant) or even its serialized, single-core, single-threaded design, but its operational hazards.
As a cache or ephemeral store like a throttling/rate limiting, lookup tables, or perhaps even sessions store, it's great; but it's impossible to rely on the persistence options (RDB, AOF) for production data stores.
You usually only see this tendency with junior devs, though. It might be a case where "when all you have is a hammer, all you see are nails", or when someone discovers Redis (or during the MongoDB hype cycle ten years ago), which seems like it's in perfect alignment with their language datatypes, but perhaps this is mostly because junior devs don't have as many production-ready databases (from SQL like Postgresql, CockroachDB, Yugabyte to New/NoSQL like ScyllaDB, YDB, Aerospike) to fall back on.
Redis shines as a cache for small data values (probably switch to memcache for larger values, which is simpler key-value but generally 3 to 10 times faster for that more narrow use case, although keep an eye on memory fragmentation and slab allocation)
Just think carefully before storing long-term data in it. Maybe don't store your billing database in it :)
0xbadcafebee
Software development today is largely just people repeating what other people do without thinking. Which is how human culture works; we just copy what everyone else is doing, because it's easier, and that becomes "normal", whatever it is.
In the software world in the mid 00's, the trend started to work around the latency, cost and complexity of expensive servers and difficult databases by relying on the speed of modern networks and RAM. This started with Memcached and moved on to other solutions like Redis.
(this later evolved into NoSQL, when developers imagined that simply doing away with the complexity of databases would somehow magically remove their applications' need to do complex things… which of course it didn't, it's the same application, needing to do a complex thing, so it needs a complex solution. computers aren't magic. we have thankfully passed the hype cycle of NoSQL, and moved on to… the hype cycle for SQLite)
But the tradeoff was always working around one limitation by adding another limitation. Specifically it was avoiding the cost of big databases and the expertise to manage them, and accepting the cost of dealing with more complex cache control.
Fast forward to 2025 and databases are faster (but not a ton faster) and cheaper (but not a ton cheaper) and still have many of the same limitations (because dramatically reinventing the database would have been hard and boring, and no software developer wants to do hard and boring things, when they can do hard and fun things, or ignore the hard things with cheap hacks and pretend there is no consequence to that).
So people today just throw a cache in between the database, because 1) databases are still kind of stupid and hard (very very useful, but still stupid and hard) and 2) the problems of cache complexity can be ignored for a while, and putting off something hard/annoying/boring until later is a human's favorite thing.
No, you don't need Redis. Nobody needs Redis. It's a hack to avoid dealing with stateless applications using slow queries on an un-optimized database with no fast read replicas and connection limits. But that's normal now.
khaki54
I was reading an article last week where the author did a bunch of testing and found Redis is only 3-5x faster than just using a multi model NoSQL. Basically it rarely makes sense to use Redis.
https://adamfowler.org/2015/09/07/hybrid-nosql-marklogic-as-…
harrall
Two things:
I think people forget (or don’t know) that adding data storage system to your architecture also involves management, scaling, retention, and backup. It’s not free.
And second, sometimes you do need to invest in storage to permit failover or to minimize latency but people do it for traffic when they really have little traffic. A server from 20 years ago could push a lot of traffic and systems have gotten only beefier.
antirez
I believe that the issue is that the culture about Redis usage didn't evolve as much as its popularity. To use it memcached alike has many legitimate use cases but it's a very reductive way to use it. For instance sorted set ranking is something that totally changes the dynamics of what you can and can't do with traditional databases. Similarly large bitmaps that allow to retain very fast real time one bit information to do analytics otherwise very hard to do is another example. Basically, Redis helps a lot more as the company culture around it increases, more patterns are learned, and so forth. But in this regard a failure on the Redis (and my) side is that there isn't a patterns collection book: interviewing folks that handled important use cases (think at Twitter) to understand the wins and the exact usage details and data structure usages. Even just learning the writable cache pattern totally changes the dynamics of your Redis experience.
notjoemama
> The first usage was to cache the result of an external API call to lookup geolocation of users, so that the service in question could process location requests quicker, and also run cheaper.
BAAAHHH HAAHA HA HA HA HHHAA. Ok, look. Just because it's in Redis does not disqualify the clause in the geo service's license that you NOT permanently store the data. The author did not say that's what they were doing but a very similar thing came up in a previous work place for me and we chose to call the service for every lookup the way the service company expected their customers to do. I recall the suggestion in using a caching database as a workaround and it was not made by the engineering team. Sorry, I'm still chuckling at this one…
rc_mob
Yeah I just removed redis from my php app. It runs slightly slower but not enough that my user would notice. Redis was overkill
simonw
If you work at a company where teams keep on turning to Redis for different features, there's a chance that it's an indication that the process for creating new database tables in your relational store has too much friction!
alberth
> A single beefy Redis (many cores, lots of RAM type of machine) should be able to handle the load
I thought Redis was single threaded running on a single core.
Having multiple cores provides no benefit (and arguably could hurt since large multicore systems typically have a lower clock)
cyberax
Redis (or Valkey) has a bunch of functionality other than caching. It has a very useful event streaming system and task queueing system.
You can use Postgres instead of them, but then it can easily become a bottleneck.
alberth
This post seems less about Redis, and more broadly about – why you should never introduce new technologies into your existing stack (only do so when your existing stack can’t keep up).
briandear
Rails adding SolidCache and SolidQueue (or Good Job) was what made me not even think of Redis anymore in the rails world.