7 ms·
Redis 8.8: New array data structure, rate limiter, performance improvements
- epolanski 5mo agoThere's also a separate blog post that goes into the details of why existing data structures Redis already supported, which could provide array-like behavior, weren't good enough: https://redis.io/blog/diving-deep-into-rediss-new-array-data-type/ https://redis.io/blog/diving-deep-into-rediss-new-array-data...
- neomantra 5mo ago@antirez wrote about the development of that data structure last month, which includes how he used LLMs to do it (which was before ds4 for the co-comment mentioning it ;). The PR he linked goes into the motivation. https://antirez.com/news/164 https://antirez.com/news/164 https://github.com/redis/redis/pull/15162 https://github.com/redis/redis/pull/15162
- 9dev 5mo agoWhile I love Redis as a versatile tool for external data structures, it's still lacking in two areas IMHO: One, it would be cool to be able to embed it, similar to sqlite, directly into applications. Two, the HA story is so much more complicated than it should be. I totally acknowledge that concurrency and distributed computing is hard, but it should not require reading heaps of documentation and understanding two entirely separate multi-node approaches only to figure out there are lots of subtle strings attached that make it impractical for many applications.
- amtamt 5mo agoGenuinely interested why we need HA in redis, just not read round robin from multiple non-HA instances? Redis (and memcache) are memory caches and should be treated like that, not like highly consistent distributed session store.
- 9dev 5mo agoRedis doesn't necessarily have to be used as a cache. Streams, for example, make it a great message queue; but a single-node message queue is a single point of failure and thus not viable for many setups.
- acejam 5mo agoThat's why you run Redis Sentinel in production
- 9dev 5mo agoThat you do. Until you realise that there is only a single writer in that scenario, it doesn’t address any sharding concerns, you need to use compatible clients that opt into the sentinel protocol, during failover you’ll see client errors… there’s lots of room for improvement on redis HA.
- lukaslalinsky 5mo agoWith the amount of problems I had using Redis Sentinel, I really wish there was another way. On multiple occasions, with completely different deployments, it got itself into a non-repairable state where the only option was to drop it and setup the replicas manually. I was hoping someone would do a Patroni-like project for Redis, but I've not found it yet. I've moved all persistent data to PostgreSQL and use a number of Valkeys behind Envoy proxy as a cache.
- dvkashapov 5mo agoI suggest you to take a look at rdsync (https://github.com/yandex/rdsync https://github.com/yandex/rdsync), exactly what you want: Patroni-like high-availability tool for Valkey/Redis. Uses ZooKeeper for external coordination. We use it in our large deployment and with a couple patches you will forged about the need to take manual actions to resolve broken states.
- 5mo ago
- karelpeeters 5mo agoWhat would be the point of embedding Redis into an application? What's the advantage of using Redis over using the builtin (or third party) data structures of the language the application is developed in? I'm asking as a non-webdev who never quite got what Redis actually does, but would love to learn.
- mystifyingpoi 5mo agoFor simple cases, it is probably a total overkill to even consider it, but for something heavier, embedding the database gives you a chance to trivially migrate later to a separate database server.
- thefreeman 5mo agoRedis is not a database. It’s a key / value store.
- theultdev 5mo agothat's still a database. it's not a relational database.
- rytis 5mo agoIt kind of is a database: A key-value database, or key-value store, is a data storage paradigm designed for storing, retrieving, and managing associative arrays, a data structure more commonly known today as a dictionary. https://en.wikipedia.org/wiki/Key–value_database https://en.wikipedia.org/wiki/Key–value_database
- bijowo1676 5mo agoyou are confusing redis with memcached
- freakynit 5mo agoProbably because Redis gives you a very well-defined/understood set of rich data structures with built-in behavior like TTL, atomic operations, eviction, and persistence. These things are otherwise usually scattered across native types, helper classes, or entirely separate libraries.
- deleted 5mo ago[deleted]
- adamcharnock 5mo ago> One, it would be cool to be able to embed it, similar to sqlite, directly into applications. I've found myself wanting this on several occasions too. I.e. wanting all my rust backend processes (k8s pods) to have some minimal shared state, without having to spin up a Redis cluster. I've talked to Claude about it a couple of times, and it descends into something like, "you gotta use Raft or CRDTs, and pick 2 out of 3 from CAP". Which honestly seems pretty fair, and indicates to me that I'm dreaming for something magical. Nonetheless, it is nice to hear someone else asking for this. If this is indeed feasible (even if simple/limited), then I'd be interested to try it.
- williamdclt 5mo agoI don't know if that'll make you feel any better but yeah, you're indeed asking for the impossible! You need consensus between your nodes that store state _somehow_, either these nodes are Redis and it does that for you, or these nodes are your pods and you need to do consensus yourself (zookeeper might help, but you're definitely in "complicated stuff" territory). Spinning up an in-memory (no persistence) Redis cluster in your k8s should be easy enough, hopefully?
- adamcharnock 5mo agoYeah, fair enough. And yes, adding a Redis cluster is fine, it is just another moving part to manage. But given that the alternative is made out of unobtainium, I guess that is just the way of it :-)
- echelon 5mo ago> it's still lacking in two areas This is entirely different than what Redis is and tries to solve. Sqlite is embedded. It's not a distributed SQL. Redis is a distributed data structure store and concurrency primitive. These are worlds apart. > HA story is so much more complicated than it should be It is precisely as complicated as it needs to be. You don't want data loss. If you're in the business of high available fault tolerance, you read the manual and learn how to Redis.
- 9dev 5mo agoWhat kind of an answer is that? This software is perfect the way it is, you’re just to inept to hold it right? A high availability protocol should not leak into the client. It should be able to discover other nodes. It should not land in broken states so easily. It should not limit the number of writers. It should not error during failover. Are these hard problems? Yes. Should we just accept that things are hard because that’s how the gods have given them to us? No.
- echelon 5mo agoHigh availability and abstraction complexity are orthogonal. Redis is a low-level concurrency primitive, and it made certain choices in dealing with CAP. It might be single-threaded, but it can easily absorb 100,000+ requests per second. I've built systems that handle billions of dollars of online payments flow, active-active, with six nines of uptime reliability on top of Redis. It does what it says on the tin, and it doesn't need to be everything for everybody. This is a hard domain and you're going to have to deal with different problems and tradeoffs. If you want something higher level, there are other systems to reach for.
- atmosx 5mo ago> Two, the HA story is so much more complicated than it should be. Really? I am curious, how would simplify it? It’s a very well defined problem and all the “solutions” are very complicated and with many strings attached. I have managed one or two systems that came in different modalities and you had to pick your poison and had to make sure the other engineering teams understand the trade offs. Some were more successful than others, but “easy” never crossed my mind. Redis is single threaded and doesn’t concern itself with these things, directly, exactly because Antitez understood the trade offs and made all the right choices. How would you improve the HA story without sacrificing ease of use and performance on a single thread?
- ncruces 5mo agoRedka can be used embed, in Go: https://github.com/nalgeon/redka https://github.com/nalgeon/redka
- anapeksha 4mo ago[dead]
- tapoxi 5mo agoWhere did everyone end up on the Redis/Valkey split? Is there still a reason to use Redis after the license kerfuffle?
- FunnyLookinHat 5mo agoFor those who may not know, you can cut your costs in AWS by going with Valkey over Redis for about 33% savings. https://aws.amazon.com/blogs/database/reduce-your-amazon-elasticache-costs-by-up-to-60-with-valkey-and-cudos/ https://aws.amazon.com/blogs/database/reduce-your-amazon-ela...
- glouwbug 5mo agoBut what about Geico?
- jihadjihad 5mo agoIt's so easy a grug brain can do it.
- Salgat 5mo agoWe're planning to go to Valkey for exactly that reason.
- hakube 5mo agoWe went with DragonFlyDB
- esafak 5mo agoAre you happy with it? Is it faster as claimed?
- atraac 5mo agoWe use almost exclusively Valkey now, mostly because we host on AWS and Render, which both use Valkey. It's faster, cheaper and compatible. I'd consider Garnet too but I believe it doesn't support LUA(or didn't at the time we needed it).
- focusgroup0 5mo agogiven his ds4 project, likely collaborated with DeepSeek for this release: https://github.com/antirez/ds4 https://github.com/antirez/ds4
- JLO64 5mo agoPossibly, but the array type code was implemented using GPT/Claude models before DS4 was a thing. I really recommend this write up on how he used LLMs which I think is a more sane/safe way to code with them vs the YOLOing even I'm subject to unfortunately... https://antirez.com/news/164 https://antirez.com/news/164
- zozbot234 5mo agoThe experimental SSD streaming feature (author's demo @ https://x.com/antirez/status/2062536214675067322 https://x.com/antirez/status/2062536214675067322 - recently merged into the main branch) is great news for that project, allowing for SOTA inference (DeepSeek V4 Flash and Pro!) on RAM-limited machines. Now we need work on large-ish scale batching in order to recover tok/s under the SSD streaming scenario. It's not helpful when running normally (at least not on Apple Silicon) since thermal/power throttling is the constraint in that case, but SSD streaming is a whole other consideration.
- caraphon 5mo agowindow counter rate limiter! This is awesome! And arrays look great too. Lots to play with.
- simonw 5mo ago> Rate limiting is one of the most common Redis use cases. Traditionally, users implemented rate limiters using server-side Lua scripts combined with client logic. In Redis 8.8, we introduce a window counter rate limiter (by @raffertyyu, together with the Redis team). I had a look for this and it turns out it's slightly mis-described there - it's not a window counter, it's a "GCRA (Generic Cell Rate Algorithm)" - a leaky bucket algorithm. Code here: https://github.com/redis/redis/blob/unstable/src/gcra.c https://github.com/redis/redis/blob/unstable/src/gcra.c The code comments say it was heavily influenced by https://github.com/brandur/redis-cell https://github.com/brandur/redis-cell by Brandur Leach. It's a neat algorithm (I just learned about it today) - it only needs to store a single integer for each rate-limited key, which is the "Theoretical Arrival Time" when the bucket would next be empty.
- willempienaar 5mo agoAlso, the “cell” in Generic Cell Rate Algorithm is an ATM cell. GCRA is 1990s telecom, the scheduling algorithm ATM switches used to check that 53-byte cells were arriving on the wire at the agreed rate.
- b33j0r 5mo agoAsynchronous Transfer Mode (I had to look it up too.) https://en.wikipedia.org/wiki/Asynchronous_Transfer_Mode https://en.wikipedia.org/wiki/Asynchronous_Transfer_Mode
- Xeoncross 5mo agoI've never liked token buckets (vs sliding window counters) due to the extra work CPU cycles required to "fill" them. It seems like doing an atomic incr on a key based on a `time % 1 minute` or something would be more efficient and then let that key TTL expire X duration later. This results in zero work for rate limiters not in use and only a single push change -> resulting count for ones in use. Nothing but setting the TTL extra is required. Thanks for the links, I'll checkout the Generic Cell Rate Algorithm!
- fga_qwrh 5mo agoAnd here we see the reason for the sudden AI enthusiasm of Redis authors: array data structures are used in AI. This was clear weeks ago. The website looks like openclaw's website.
- deleted 5mo ago[deleted]
- Xotic007 5mo ago[dead]
- ShakataGaNai 5mo agoAre we still using Redis? License change, no more Kube operators.