antirez/redis — Issue #229: No reply when pipelining commands (intermittent)
Author: gerhard
Created: 2011-12-02 17:19:58+00:00
State: open

I'm running redis 2.4.2 built from source as per [redis-cookbook](https://github.com/gchef/redis-cookbook). OS is Ubuntu 10.04.3 LTS, running on EC2.

I'm pipelining the following commands to redis:

(echo -en "ZCARD object:3182:metric\r\nZCARD object:3569:metric\r\nZCARD
object:3161:metric\r\nZCARD object:3126:metric\r\nZCARD
object:2285:metric\r\nZCARD object:959:metric\r\nZCARD
object:2665:metric\r\nZCARD object:3468:metric\r\nZCARD
object:1806:metric\r\nZCARD object:3177:metric\r\nZCARD
object:1397:metric\r\nZCARD object:3280:metric\r\nZCARD
object:1313:metric\r\nZCARD object:2559:metric\r\nZCARD
object:3203:metric\r\nZCARD object:2289:metric\r\nZCARD
object:2911:metric\r\nZCARD object:2810:metric\r\nZCARD
object:1512:metric\r\nZCARD object:3997:metric\r\nZCARD
object:2080:metric\r\nZCARD object:3709:metric\r\nZCARD
object:3301:metric\r\nZCARD object:3242:metric\r\nZCARD
object:3629:metric\r\nZCARD object:3221:metric\r\nZCARD
object:3643:metric\r\nZCARD object:1216:metric\r\nZCARD
object:763:metric\r\nZCARD object:3061:metric\r\nZCARD
object:1537:metric\r\nZCARD object:2129:metric\r\nZCARD
object:2797:metric\r\nZCARD object:3828:metric\r\nZCARD
object:1492:metric\r\nZCARD object:3610:metric\r\nZCARD
object:3593:metric\r\nZCARD object:3994:metric\r\nZCARD
object:1816:metric\r\nZCARD object:2211:metric\r\nZCARD
object:2785:metric\r\nZCARD object:1715:metric\r\nZCARD
object:3851:metric\r\nZCARD object:2058:metric\r\nZCARD
object:2269:metric\r\nZCARD object:345:metric\r\nZCARD
object:971:metric\r\nZCARD object:3926:metric\r\nZCARD
object:2874:metric\r\nZCARD object:2372:metric\r\nZCARD
object:1039:metric\r\nZCARD object:2140:metric\r\nZCARD
object:1475:metric\r\nZCARD object:3804:metric\r\nZCARD
object:2489:metric\r\nZCARD object:3133:metric\r\nZCARD
object:2046:metric\r\nZCARD object:2271:metric\r\nZCARD
object:3991:metric\r\nZCARD object:2461:metric\r\nZCARD
object:274:metric\r\nZCARD object:3053:metric\r\nZCARD
object:3935:metric\r\nZCARD object:3454:metric\r\nZCARD
object:3374:metric\r\nZCARD object:2224:metric\r\nZCARD
object:2681:metric\r\nZCARD object:1348:metric\r\nZCARD
object:2203:metric\r\nZCARD object:3712:metric\r\nZCARD
object:1801:metric\r\nZCARD object:2390:metric\r\nZCARD
object:1953:metric\r\nZCARD object:1932:metric\r\nZCARD
object:3538:metric\r\nZCARD object:2486:metric\r\nZCARD
object:3641:metric\r\nZCARD object:3315:metric\r\nZCARD
object:1:metric\r\nZCARD object:2643:metric\r\nZCARD
object:3920:metric\r\nZCARD object:2795:metric\r\nZCARD
object:1725:metric\r\nZCARD object:376:metric\r\nZCARD
object:99:metric\r\nZCARD object:946:metric\r\nZCARD
object:2673:metric\r\nZCARD object:2230:metric\r\nZCARD
object:2617:metric\r\nZCARD object:2115:metric\r\nZCARD
object:1274:metric\r\nZCARD object:3509:metric\r\nZCARD
object:3755:metric\r\nZCARD object:3966:metric\r\nZCARD
object:2879:metric\r\nZCARD object:2204:metric\r\nZCARD
object:2187:metric\r\nZCARD object:1743:metric\r\nZCARD
object:2581:metric\r\nZCARD object:1473:metric\r\nZCARD
object:1684:metric\r\n") | nc localhost 6379

They're all on a single line, I've split them on multiple lines for formatting reasons. I receive a response some of the times, but not always. You can use the following Ruby helper to build some fake data:

require 'securerandom'

module Fake
extend self

def metric(position, object_id)
App.redis.zadd("object:#{object_id}:metric", position, Helpers.unique)
Helpers.unique
end

def metrics(object_ids)
object_ids.inject({}) do |result, object_id|
result[object_id] = Helpers.random(10).times.map { |position| Fake.metric(position, object_id) }
result
end
end

module Helpers
extend self

def random(num)
1 + rand(num)
end

def unique
SecureRandom.hex
end
end
end

To actually get some fake data in:

Fake.metrics (1...100).to_a