Created
December 6, 2009 12:39
-
-
Save roidrage/250201 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'rubygems' | |
require 'redis' | |
require 'benchmark' | |
redis = Redis.new | |
puts redis['test_counter'] | |
redis['test_counter'] = 0 | |
pids = [] | |
20.times do | |
pids << Kernel.fork do | |
res = Benchmark.realtime do | |
redis = Redis.new | |
30000.times do | |
redis.incr('test_counter') | |
end | |
end | |
puts res | |
exit | |
end | |
end | |
pids.each do |pid| | |
Process.waitpid(pid) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment