-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipelining using multiple context handles #28
Comments
The reason for only sending the output buffer when |
I understand that what I'm suggesting does blur the lines a bit between A full output buffer flush command is exactly what I need--basically a I understand that an event loop would be the ideal way to implement I hope you warm to the idea of adding an output buffer flush capability. On 3/25/2011 1:40 AM, pietern wrote:
|
I just realized this is already possible :-). The hiredis API exports the function |
Awesome. Thanks, Pieter! On 3/29/2011 5:34 AM, pietern wrote:
|
A slightly-related note from a situation I was wrestling with today. I had a separate thread looping on It appears that since the output buffer is flushed when |
Hi,
I'm using Hiredis and pipelining to improve throughput (a lot!) over traditional blocking calls, without the complexity of going fully async. With the delay of Cluster, I'm looking at coarse-level sharding by "service" to alleviate potential scaling pitfalls in the near term, with the goal of leveraging Cluster when it is available.
I have a series of paired functions, one pair per "service", as follows:
The Pipeline functions use
redisAppendCommand()
and theParseReply
functions callredisGetReply()
. It works great so far when using a common context (i.e. single server handle), as I can fill up the send buffer with all of my queries, the fire it off and sort out the responses in one round trip.If I wanted to allocate a dedicated Redis instance for each "service" in an attempt to add some coarse sharding, I can do this relatively painlessly by simply passing the dedicated handle to each function.
The problem is that Hiredis doesn't send the output buffer until
redisGetReply()
is called, so instead of 3 sets of grouped commands being sent out at nearly the same time, followed by parsing of the responses quickly in series, the effective performance becomes nearly:The send for each handle doesn't happen until the first
redisGetReply()
is called in aParseReply
function, so they become 3 serial, blocking requests instead of being close to the original (single context) implementation.It seems like Hiredis would benefit from a non-blocking
SendOutputBuffer
type of command in order to support "sharded pipelining".The text was updated successfully, but these errors were encountered: