Have you been using MULTI/EXEC pipelines, or just plain client-side
pipelines (the latter doesn't use the MULTI/EXEC pair, it merely
batches up all of the commands and sends them with a single
round-trip).
- Josiah
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
>
>
>>> len(k)
>>> def f1():
... s1 = stats.Stats()
... for i in xrange(100):
... t = time.time()
... x = rc.mget(10*k)
... s1.add(time.time()-t)
...
... s2 = stats.Stats()
... for i in xrange(100):
... p = rc.pipeline(False)
... for kk in 10*k:
... p = p.exists(kk)
... t = time.time()
... c = p.execute()
... s2.add(time.time()-t)
...
... s3 = stats.Stats()
... for i in xrange(100):
... t = time.time()
... p = rc.pipeline(False)
... for kk in 10*k:
... p = p.exists(kk)
... c = p.execute()
... s3.add(time.time()-t)
...
... print s1
... print s2
... print s3
...
>>> f1()
<min:0.13 max:0.37 avg:0.15 std:0.03 gavg:0.15 gstd:0.34 n:100>
<min:0.12 max:0.22 avg:0.14 std:0.02 gavg:0.14 gstd:0.31 n:100>
<min:0.21 max:0.31 avg:0.24 std:0.03 gavg:0.23 gstd:0.26 n:100>
We get 10,000 keys (each of which are duplicated 10x), 100 times for
each of the different versions. If you don't count the time it takes
to set up the pipelined call in Python, the pipeline is a little bit
faster. If you do count the time it takes to set up the pipeline,
then it's about half the speed. I suspect that your client, like
mine, spends a lot of time setting up the state for pipelining
everything out (and really, just making all of the calls). If you
write your own command for bulk requests, that just manipulate the
pipeline's internal state in a single call, I suspect that you could
get the pipeline to perform about the same speed, if not a little
faster than the mget call.
... which gives me some ideas. :)
- Josiah
- Josiah