Skip to content

Instantly share code, notes, and snippets.

from rediscluster import RedisCluster
startup_nodes = [{"host": "127.0.0.1", "port": 7000}]
r = RedisCluster(startup_nodes=startup_nodes, max_connections=32, decode_responses=True)
for i in xrange(1000000):
d = str(i)
r.set(d, d)
r.incrby(d, 1)
from rediscluster import RedisCluster
startup_nodes = [{"host": "127.0.0.1", "port": 7000}]
r = RedisCluster(startup_nodes=startup_nodes, max_connections=32, decode_responses=True)
for i in xrange(1000000):
d = str(i)
r.set(d, d)
res = r.get(d)
if res != d:
from rediscluster import RedisCluster
startup_nodes = [{"host": "127.0.0.1", "port": 7000}]
r = RedisCluster(startup_nodes=startup_nodes, max_connections=32, decode_responses=True)
for i in xrange(1000000):
d = str(i)
pipe = r.pipeline(transaction=False)
pipe.set(d, d)
pipe.incrby(d, 1)
diff --git a/rediscluster/pipeline.py b/rediscluster/pipeline.py
index 2106e70..a13e867 100644
--- a/rediscluster/pipeline.py
+++ b/rediscluster/pipeline.py
@@ -175,6 +175,8 @@ class StrictClusterPipeline(StrictRedisCluster):
if i in ask_retry:
track_cmds[node_name].append(None)
cmds.append((['ASKING'], {}))
+ print "ASKING ... threaded"
+
import rediscluster
import threading
import time
import random
startup_nodes = [
{'host':'127.0.0.1', 'port': 7000},
{'host':'127.0.0.1', 'port': 7001},
{'host':'127.0.0.1', 'port': 7002},
#!/usr/bin/python
import time
import rediscluster
CHANNEL = 'chat'
COUNT = 1000
SLEEP = 0.01
startup_nodes = [{'host':'127.0.0.1', 'port': 7000}]
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)
import random
import sys
import ws
from connectors import redis_connection_settings
from txredis.client import RedisSubscriber
from autobahn.twisted.websocket import WebSocketServerFactory, listenWS
from twisted.python import log
from twisted.internet import reactor, protocol
# download pypy
wget "https://bitbucket.org/pypy/pypy/downloads/pypy-5.1.1-linux64.tar.bz2" -O - | tar -xj
# create virtual env with pypy
virtualenv -p pypy-5.1.1-linux64/bin/pypy .venv
# activate virtual environment
source .venv/bin/activate
# install uwsgi and gevent
import threading
import unittest
import sys
from functools import wraps
import time
class Async(threading.Thread):
def __init__(self, target, args=(), kwargs=None):