Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit a5dc7c331a631a85b5ca2f818e6ca9c52717a613 @lethain committed Aug 21, 2010
Showing with 61 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +30 −0 set_memory.py
  3. +29 −0 sorted_set_memory.py
@@ -0,0 +1,2 @@
+*~
+*.pyc
@@ -0,0 +1,30 @@
+import redis
+import uuid
+import time
+
+r = redis.Redis(host='localhost', port=6379, db=0)
+
+
+# number of sets
+for num_sets in (100, 1000, 10000):
+ for set_size in (100, 1000, 10000):
+ r.flushall()
+ time.sleep(1.0)
+ initial_size = r.dbsize()
+ initial_info = r.info()
+
+ for i in xrange(0, num_sets):
+ # number of items per set
+ for j in xrange(0, set_size):
+ r.sadd("set.%s" % (i,), str(uuid.uuid4()))
+
+ final_size = r.dbsize()
+ final_info = r.info()
+
+ print "For %s sets with %s values." % (num_sets, set_size)
+ print "Keys: %s => %s" % (initial_size, final_size)
+ print "Memory: %s => %s" % (initial_info['used_memory_human'],
+ final_info['used_memory_human'])
+ r.flushall()
+
+
@@ -0,0 +1,29 @@
+import redis
+import uuid
+import time
+
+r = redis.Redis(host='localhost', port=6379, db=0)
+
+
+# number of sets
+for num_sets in (100, 1000,10000):
+ forset_size in (100, 1000,10000):
+ r.flushall()
+ time.sleep(1.0)
+ initial_size = r.dbsize()
+ initial_info = r.info()
+
+ for i in xrange(0, num_sets):
+ # number of items per set
+ for j in xrange(0, set_size):
+ r.zadd("set.%s" % (i,), str(time.time()), str(uuid.uuid4()))
+
+ final_size = r.dbsize()
+ final_info = r.info()
+
+ print "For %s sets with %s values." % (num_sets, set_size)
+ print "Keys: %s => %s" % (initial_size, final_size)
+ print "Memory: %s => %s" % (initial_info['used_memory_human'],
+ final_info['used_memory_human'])
+ r.flushall()
+

0 comments on commit a5dc7c3

Please sign in to comment.