Earlier quoted context omitted.
Is this really "unlike most databases"? I remember MySQL posting profiling data years ago showing that for looking up by primary-key, 3/4 of the time was spent parsing SQL. (They went on to introduce support for querying with the Memcached protocol to address this)
That's really surprising if true, considering the SQL should only need to be parsed once. SELECT foo FROM Table WHERE key = @mykey; Then you bind the parameter to whatever you're interested in.
A multithreaded fork of Redis that is faster
151–160 of 164 posts
Re: A multithreaded fork of Redis that is faster
#152Earlier quoted context omitted.
Couldn't you just rollback the change or fix the lua script?
Or just embrace modern hardware and use threads. This is the experience many people have running Redis in production with 21st-century hardware: https://twitter.com/rbranson/status/540565059337195520
Re: A multithreaded fork of Redis that is faster
#153Earlier quoted context omitted.
> ...it's rarely just raw performance. KeyDB has other advantages like multi-threading... What are the advantages of "multi-threading" other than for performance?
Taking advantage of all your cores. Redis is awkward at high capacity since most servers scale CPU with RAM and you'll end up with most cores doing nothing. You can manually run multiple instances on the same server but now they're separate databases with operations and sharding overhead. Multithreading IO also reduces the latency hit from disk-persistence and provides more concurrency and throughput, which is a grea…
> Taking advantage of all your cores.
Uh, is there any reason you'd want to "take advantage of all your cores" other than performance?
The question/proposal/dialog we started from, don't forget, was:
1. Redis is already as performant as I want, it's not even close to being a bottleneck, so I have no need for multi-threading, and this is a _very very common_ case, as redis is performant enough for a lot.
2. There are other advantages of multi-threading than performance. (Ie, other reasons you'd want it despite 1).
You seem to just be going around in circles. If 1, why would you care about "taking advantage of all your cores"?
Re: A multithreaded fork of Redis that is faster
#154Earlier quoted context omitted.
That's really surprising if true, considering the SQL should only need to be parsed once. SELECT foo FROM Table WHERE key = @mykey; Then you bind the parameter to whatever you're interested in.
Prepared statements are per-connection and a lot of time you want to use connections from a single pool that's used for all you different queries, so you can't really use them.
Re: A multithreaded fork of Redis that is faster
#155Earlier quoted context omitted.
Prepared statements are per-connection and a lot of time you want to use connections from a single pool that's used for all you different queries, so you can't really use them.
Even with that, the SQL would be parsed once per connection? So, the costs should be de minimis, unless the benchmark were short indeed?
In a webserver-like context it's once per query one way or another - the server process is stateless-ish between page loads, so each page load is either a from-scratch connection or a connection taken from a pool, but even if you're pooling you can't use prepared statements in practice (you can't leave a prepared statement on a connection that you return to the pool because you'll eventually exhaust the database server's memory that way, and you'd have to resubmit the prepared statement every time you took a connection out of the pool anyway because there's no way to know whether this connection has run this page already or not).
If you assume a page that's just displaying one database row, which is not the only use case but a common one, then each page load is one query and that query will have to be parsed for each page load, short of doing something like building a global set of all your application's queries and having your connection-pool logic initialise them for each connection.
Re: A multithreaded fork of Redis that is faster
#156Earlier quoted context omitted.
Even with that, the SQL would be parsed once per connection? So, the costs should be de minimis, unless the benchmark were short indeed?
> Even with that, the SQL would be parsed once per connection? In a webserver-like context it's once per query one way or another - the server process is stateless-ish between page loads, so each page load is either a from-scratch connection or a connection taken from a pool, but even if you're pooling you can't use prepared statements in practice (you can't leave a prepared statement on a connection that you return…
I'm somewhat surprised at the mechanism you're describing, but now I read the documentation it does seem to be the case. I wonder if a small piece of middle-ware might be sufficient to replicate the behavior I'm describing on a connection pool, and whether that would be desirable.
Re: A multithreaded fork of Redis that is faster
#157Earlier quoted context omitted.
As the Sidekiq maintainer, I’ve seen many customers need to shard Redis around 5000-10000 jobs/sec. Sharding is a major operational headache so this could be very useful to heavy job processors if it does prove to scale better. I also find it interesting that the BSD license enables this 3rd party company to fork Redis and build closed source commercial software on top of it. One of the trade offs to consider when li…
I'm not sure if you're referring to KeyDB or something else as "closed source commercial software", but KeyDB is BSD licensed like Redis: https://github.com/JohnSully/KeyDB/blob/unstable/COPYING
Re: A multithreaded fork of Redis that is faster
#158Earlier quoted context omitted.
From Antirez's (Redis Maintainer) blog: > Another thing to note is that Redis is not Memcached, but, like memcached, is an in-memory system. To make multithreaded an in-memory system like memcached, with a very simple data model, makes a lot of sense. A multi-threaded on-disk store is mandatory. A multi-threaded complex in-memory system is in the middle where things become ugly: Redis clients are not isolated, and da…
Is there a milestone the multi-threaded implementation could achieve that would make it a candidate to merge into core Redis?
Re: A multithreaded fork of Redis that is faster
#159Earlier quoted context omitted.
Taking advantage of all your cores. Redis is awkward at high capacity since most servers scale CPU with RAM and you'll end up with most cores doing nothing. You can manually run multiple instances on the same server but now they're separate databases with operations and sharding overhead. Multithreading IO also reduces the latency hit from disk-persistence and provides more concurrency and throughput, which is a grea…
>> What are the advantages of "multi-threading" other than for performance? > Taking advantage of all your cores. Uh, is there any reason you'd want to "take advantage of all your cores" other than performance? The question/proposal/dialog we started from, don't forget, was: 1. Redis is already as performant as I want, it's not even close to being a bottleneck, so I have no need for multi-threading, and this is a _ve…