Skip to content

Instantly share code, notes, and snippets.

@steinnes
Created March 19, 2015 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steinnes/212f3273d17a7549ac46 to your computer and use it in GitHub Desktop.
Save steinnes/212f3273d17a7549ac46 to your computer and use it in GitHub Desktop.
redis workload player
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
@zecke
Copy link

zecke commented Jan 21, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment