Created
October 19, 2009 14:18
-
-
Save roidrage/213410 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 'benchmark' | |
require 'redis' | |
require 'memcached' | |
r = Redis.new | |
m = Memcached.new('localhost:11211') | |
watermark = 1000000 | |
Benchmark.bm do |x| | |
x.report("memcached set") {watermark.times {|num| m.set("key_#{num}", "this is just a random value")}} | |
x.report("memcached get") {watermark.times {|num| m.get("key_#{num}")}} | |
x.report("redis set") {watermark.times {|num| r.set("key_#{num}", "this is just a random value")}} | |
x.report("redis get") {watermark.times {|num| r.get("key_#{num}")}} | |
end |
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
100000 key/value pairs | |
user system total real | |
memcached set 1.060000 2.010000 3.070000 ( 8.282598) | |
memcached get 1.090000 1.600000 2.690000 ( 7.219543) | |
redis set 4.570000 1.660000 6.230000 ( 11.257517) | |
redis get 4.230000 1.890000 6.120000 ( 10.983276) | |
1000000 key/value pairs | |
user system total real | |
memcached set 20.370000 17.390000 37.760000 ( 81.732159) | |
memcached get 20.630000 14.880000 35.510000 ( 72.285357) | |
redis set 40.470000 19.380000 59.850000 (112.639295) | |
redis get 41.800000 17.820000 59.620000 (112.828190) | |
1000000 key/value pairs, 2nd run | |
user system total real | |
memcached set 14.050000 17.830000 31.880000 ( 83.326390) | |
memcached get 17.820000 16.470000 34.290000 ( 75.529208) | |
redis set 42.200000 18.890000 61.090000 (114.443061) | |
redis get 32.880000 16.930000 49.810000 (109.049533) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment