Live data from Hacker News

84% of a single-threaded 1KB write in Redis is spent in the kernel

blog.nullspace.io

11–20 of 51 posts

Re: 84% of a single-threaded 1KB write in Redis is spent in the kernel

#11
This is why techniques like kernel bypass are used in high throughout or low latency systems like finance. Things like http://www.openonload.org/

This does tie you in to a specific network vendor but I can see the argument for moving more commodity networking hardware in this direction too.

Re: 84% of a single-threaded 1KB write in Redis is spent in the kernel

#12
The concept of redis has always baffled me. A hash table is a very fast data structure. As soon as you put that in a dedicated server, the cost of the actual lookup is instantly eclipsed by the need to parse a text protocol and do network I/O to communicate with the client.

So I'd be willing to say that the problem here isn't that the kernel stack is slow per-se, but that workload is too small as to make the overhead look ridiculous, when it'd be very much acceptable if your server did more actual work.

Re: 84% of a single-threaded 1KB write in Redis is spent in the kernel

#13
Rian Hunter, Dropbox's third engineer, talks about the latency incurred by OpenSSL when they were designing and implementing their extremely high-performance Dropbox notification servers in the talk below. Also, the pitch he gives at the end for joining Dropbox is one of the most genuine and heartfelt I've ever seen.

http://www.youtube.com/watch?v=FBRIeoEr8GU

Re: 84% of a single-threaded 1KB write in Redis is spent in the kernel

#14
post #12

The concept of redis has always baffled me. A hash table is a very fast data structure. As soon as you put that in a dedicated server, the cost of the actual lookup is instantly eclipsed by the need to parse a text protocol and do network I/O to communicate with the client. So I'd be willing to say that the problem here isn't that the kernel stack is slow per-se, but that workload is too small as to make the overhead…

I've never used a system like Redis, but clearly the trade-off is one of performance for scalability.

Re: 84% of a single-threaded 1KB write in Redis is spent in the kernel

#15
post #3
post #2

Totally... this is why pipelining makes Redis 10x faster, less syscalls. Basically to make Redis much faster we need to work to three different related things: 1) Less kernel friction. 2) Threaded I/O, this is the part worth threading, with a global lock to execute queries so you don't get crazy with concurrency and complex data structures. Memcached did it right. 3) Pipelining: better client support for pipelining s…

Point (2) makes me think of LMDB. Have you looked into it much? I wonder if it would be an interesting storage substrate for a threaded Redis.

Point "2" better applies when the storage substrate is memory and operations are O(1) or logarithmic, because in that case, the time to serve the query is comparable small compared to the time needed to process the reply and send back the response. With an on-disk storage, I would go for a classic on-disk database setup where different queries are served by different threads.

Re: 84% of a single-threaded 1KB write in Redis is spent in the kernel

#17
post #12

The concept of redis has always baffled me. A hash table is a very fast data structure. As soon as you put that in a dedicated server, the cost of the actual lookup is instantly eclipsed by the need to parse a text protocol and do network I/O to communicate with the client. So I'd be willing to say that the problem here isn't that the kernel stack is slow per-se, but that workload is too small as to make the overhead…

The value of Redis is never going to be found with a single server. It's going to be found when you use Redis to synchronize the state of multiple servers.

Re: 84% of a single-threaded 1KB write in Redis is spent in the kernel

#18

This is why techniques like kernel bypass are used in high throughout or low latency systems like finance. Things like http://www.openonload.org/ This does tie you in to a specific network vendor but I can see the argument for moving more commodity networking hardware in this direction too.

Personally, I see a lot of value in Kernel modules which let you bypass the kernel entirely for simple IO. It requires more work on the applications end, and more libraries to support the disparate hardware, but it would help with many such activities.

Re: 84% of a single-threaded 1KB write in Redis is spent in the kernel

#19
post #12

The concept of redis has always baffled me. A hash table is a very fast data structure. As soon as you put that in a dedicated server, the cost of the actual lookup is instantly eclipsed by the need to parse a text protocol and do network I/O to communicate with the client. So I'd be willing to say that the problem here isn't that the kernel stack is slow per-se, but that workload is too small as to make the overhead…

I took the article as to be more a case of using Redis as an example of a system which is reaching the limits of performance _given the current state of the kernel it's running on_, rather than a direct comment on the performance of Redis itself.

Also, saying that using Redis is slower than using a local hash table is a truism. There are myriad reasons why using a local, in-memory data structure is not viable: scalability and persistence, for example. It's like saying "I don't need a database, I can store everything in a local variable."

Re: 84% of a single-threaded 1KB write in Redis is spent in the kernel

#20
post #2

Totally... this is why pipelining makes Redis 10x faster, less syscalls. Basically to make Redis much faster we need to work to three different related things: 1) Less kernel friction. 2) Threaded I/O, this is the part worth threading, with a global lock to execute queries so you don't get crazy with concurrency and complex data structures. Memcached did it right. 3) Pipelining: better client support for pipelining s…

[deleted]
Post reply on HN