IO Costs of Redis Multi/Exec

I would like to send Redis a multi/exec command like the following:

redis 127.0.0.1:6379> MULTI
OK
redis 127.0.0.1:6379> LPUSH "JIMMY" "ABC"
QUEUED
redis 127.0.0.1:6379> LRANGE "JIMMY" 0 -1
QUEUED
redis 127.0.0.1:6379> EXEC

However, I'd like to get an idea of the network I/O costs. It seems like there will be 4 trips and back and forwards, although I think Redis will keep the connection open?

Would it not be faster to send all of those commands in one block? Is it even possible to do that?

Answers


Yes, it is possible, and this is called pipelining. You don't have to wait for the server to answer before sending the next command unless you need results of the previous command to do this (i.e. there is a data dependency). You will receive server replies in-order afterwards. Commands in your example could be sent in a single TCP packet with the minimal possible overhead.


You can also use EVAL with a LUA script, commands are executed on the server:

eval "redis.call('lpush',KEYS[1],'abc'); return redis.call('lrange',KEYS[1],'0','-1');" 1 JIMMY

Need Your Help

Could not load file or assembly 'DotNetOpenAuth.Core', No references to 'OAuth' and 'OpenAuth' in solution

asp.net .net asp.net-mvc-4 oauth

I've seen several topics on this site regarding this bug but unfortunately none have succeeded for me. The full error text is:

FPDF error: Some data has already been output, can't send PDF file on 000webhost

php fpdf

I am using FPDF class to generate a pdf on my website. Everything worked well until last few weeks when I started getting error:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.