This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import time | |
import rediscluster | |
CHANNEL = 'chat' | |
COUNT = 1000 | |
SLEEP = 0.01 | |
startup_nodes = [{'host':'127.0.0.1', 'port': 7000}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import unittest | |
import sys | |
from functools import wraps | |
import time | |
class Async(threading.Thread): | |
def __init__(self, target, args=(), kwargs=None): |