Skip to content

Instantly share code, notes, and snippets.

@72squared
Created November 22, 2015 17:16
Show Gist options
  • Save 72squared/bd279a28feb68f29c627 to your computer and use it in GitHub Desktop.
Save 72squared/bd279a28feb68f29c627 to your computer and use it in GitHub Desktop.
from rediscluster import RedisCluster
import time
print "starting"
startup_nodes = [{"host": "127.0.0.1", "port": 7000}]
r = RedisCluster(startup_nodes=startup_nodes, max_connections=32, decode_responses=True)
start = time.time()
for i in xrange(1000):
d = str(i)
pipe = r.pipeline(transaction=False)
for x in xrange(100):
key = "_test-%s-%s" % (d, x)
pipe.set(key, d)
pipe.incrby(key, 1)
pipe.expire(key, 5)
pipe.execute()
stop = time.time()
elapsed = stop - start
print "elapsed %.3f" % elapsed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment