Created
March 19, 2015 01:19
-
-
Save steinnes/212f3273d17a7549ac46 to your computer and use it in GitHub Desktop.
redis workload player
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 sys | |
import redis | |
import time | |
i = 0 | |
conn = redis.Connection('localhost', 6379) | |
start_t = time.time() | |
for line in sys.stdin.xreadlines(): | |
args = line.split(" ") | |
cmd = [c.replace('"', '') for c in args[3:]] | |
conn.send_command(*cmd) | |
i += 1 | |
if i % 1000 == 0: | |
end_t = time.time() | |
print "{} commands took {}s".format(i, end_t - start_t) | |
start_t = end_t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does conn.send_command block? Looks a bit like "coordinated omission" (http://www.azulsystems.com/sites/default/files/images/HowNotToMeasureLatency_LLSummit_NYC_12Nov2013.pdf) but it looks difficult to schedule something every X unit-of-time to avoid it.