]> git.saurik.com Git - redis.git/blobdiff - client-libraries/ruby/benchmarking/suite.rb
client libraries synched in git
[redis.git] / client-libraries / ruby / benchmarking / suite.rb
diff --git a/client-libraries/ruby/benchmarking/suite.rb b/client-libraries/ruby/benchmarking/suite.rb
new file mode 100644 (file)
index 0000000..f03694b
--- /dev/null
@@ -0,0 +1,24 @@
+require 'fileutils'
+
+def run_in_background(command)
+  fork { system command }
+end
+
+def with_all_segments(&block)
+  0.upto(9) do |segment_number|
+    block_size = 100000
+    start_index = segment_number * block_size
+    end_index = start_index + block_size - 1
+    block.call(start_index, end_index)
+  end
+end
+
+#with_all_segments do |start_index, end_index|
+#  puts "Initializing keys from #{start_index} to #{end_index}"
+#  system "ruby worker.rb initialize #{start_index} #{end_index} 0"
+#end
+
+with_all_segments do |start_index, end_index|
+  run_in_background "ruby worker.rb write #{start_index} #{end_index} 10"
+  run_in_background "ruby worker.rb read #{start_index} #{end_index} 1"
+end
\ No newline at end of file