I've always considered the single-threaded nature of Redis to be one of its greatest features.
Is it because of the consistency guarantees you can get from single threaded operation? Because it seems like this guarantees that. It mostly parallelizes the command parsing and networking side. The actual core hash table is guarded by a global lock, so you could still get all those single-threaded guarantees.
A multithreaded fork of Redis that is faster
11–20 of 164 posts
Re: A multithreaded fork of Redis that is faster
#12I've always considered the single-threaded nature of Redis to be one of its greatest features.
Only one thread can access the data at any given time, so it seems like most of the things you'd expect to be guaranteed by a single thread still are. I found this comment particularly interesting Unlike most databases the core data structure is the fastest part of the system. Most of the query time comes from parsing the REPL protocol and copying data to/from the network. I wonder if anyone in the Redis ecosphere ha…
I can see cases where a really optimized system could benefit from a binary protocol, but I suspect it'd be a loss for most people.
Re: A multithreaded fork of Redis that is faster
#13Earlier quoted context omitted.
Can you elaborate on why? As someone who works on parallel/concurrent algorithms and data structures a single-threaded system design seems anathema to most research over the past decade (maybe excluding H-Store, which uses local single-threadedness in an interesting way).
Not parent but the single threaded approach really shines when executing Lua scripts in Redis. Except for some very specific edge cases, the execution of a script is atomic and since no command is ever processed concurrently you can rule out data races. I am sure it would be possible to provide these guaranties while offering concurrent execution but most likely at the expense of a simple design.
The goal is 100% Redis compatibility so I can’t compromise on atomicity.
Re: A multithreaded fork of Redis that is faster
#14Re: A multithreaded fork of Redis that is faster
#15I've always considered the single-threaded nature of Redis to be one of its greatest features.
Can you elaborate on why? As someone who works on parallel/concurrent algorithms and data structures a single-threaded system design seems anathema to most research over the past decade (maybe excluding H-Store, which uses local single-threadedness in an interesting way).
https://www.martinfowler.com/articles/lmax.html
I believe other (grown-up/legacy!) exchanges work the same way.
I wonder how much of the direction of concurrency research is driven by the fact that there is much more publishable work to be done in managing concurrency rather than avoiding it!
Re: A multithreaded fork of Redis that is faster
#16Re: A multithreaded fork of Redis that is faster
#17Earlier quoted context omitted.
Same! I'd also be curious to hear about production scenarios that would really benefit from Redis going 5x faster. It's pretty darn fast to start with!
At my job we're currently re-building our website in django, and we make heavy use of redis caching. Our website is definitely not "high traffic" but we get somewhere around 300,000 requests a day, mostly concentrated around business hours (We're a local clothing wholesaler). I haven't tested it under production loads, but just swapping our redis for keydb (THANKS DOCKER!) I saw no improvement in my artificial load t…
Re: A multithreaded fork of Redis that is faster
#18I've always considered the single-threaded nature of Redis to be one of its greatest features.
Only one thread can access the data at any given time, so it seems like most of the things you'd expect to be guaranteed by a single thread still are. I found this comment particularly interesting Unlike most databases the core data structure is the fastest part of the system. Most of the query time comes from parsing the REPL protocol and copying data to/from the network. I wonder if anyone in the Redis ecosphere ha…
One related choice that Redis makes (or made at the time) is to rely extremely heavily on the malloc implementation, rather than doing work to manage it's memory internally. Even a very trivial, naive free list provided a modest speed-up, for example.
There are a lot of these choices in the code base, largely owing to maintainability concerns (though antirez can surely speak for himself). Given how easy it is for an otherwise uninitiated C programmer such as myself to hack on it, I struggle to disagree with the prioritization. :)
Re: A multithreaded fork of Redis that is faster
#19Since this has been around for awhile, why hasn't Redis adopted this strategy into core?
Re: A multithreaded fork of Redis that is faster
#20Replacing Redis with "something faster" is a bit like removing the doors on a car because "lighter means faster!". It might look good on a racetrack, but it's about as pragmatic as climbing through a window every morning before setting off for work.