Skip to content

Instantly share code, notes, and snippets.

@roidrage
Created December 6, 2009 12:39
Show Gist options
  • Save roidrage/250201 to your computer and use it in GitHub Desktop.
Save roidrage/250201 to your computer and use it in GitHub Desktop.
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