Skip to content

Instantly share code, notes, and snippets.

@joshnabbott
Created May 9, 2012 21:54
Show Gist options
  • Save joshnabbott/2649194 to your computer and use it in GitHub Desktop.
Save joshnabbott/2649194 to your computer and use it in GitHub Desktop.
# Some benchmarking I did on a local redis instance
# Tested using:
# Mac OSX Lion
# Ruby 1.9.3
# IRB
# Redis 2.4.8
# 10_000
>> r.info['used_memory_human']
# "909.97K"
# HMSET
>> Benchmark.bmbm { |b| b.report("r.hmset") { 100_000.times { |i| r.hmset(i, :id, i) } } }
# Rehearsal -------------------------------------------
# r.hmset 3.070000 1.640000 4.710000 ( 8.666214)
# ---------------------------------- total: 4.710000sec
# user system total real
# r.hmset 3.160000 1.690000 4.850000 ( 8.880478)
# [3.160000 1.690000 4.850000 ( 8.880478)]
>> r.info['used_memory_human']
# "9.52M"
>> r.flushall
# "OK"
>> r.info['used_memory_human']
"910.11K"
# SET
>> Benchmark.bmbm { |b| b.report("r.set") { 100_000.times { |i| r.set(i, i) } } }
# Rehearsal -----------------------------------------
# r.set 2.970000 1.740000 4.710000 ( 8.622319)
# -------------------------------- total: 4.710000sec
# user system total real
# r.set 2.920000 1.690000 4.610000 ( 8.375985)
# [2.920000 1.690000 4.610000 ( 8.375985)]
>> r.info['used_memory_human']
# "7.84M"
# 1_000_000
>> r.info['used_memory_human']
# "910.39K"
# HMSET
>> Benchmark.bmbm { |b| b.report("r.hmset") { 1_000_000.times { |i| r.hmset(i, :id, i) } } }
# Rehearsal -------------------------------------------
# r.hmset 30.980000 16.580000 47.560000 ( 87.134337)
# --------------------------------- total: 47.560000sec
# user system total real
# r.hmset 33.790000 18.070000 51.860000 ( 95.284257)
# [33.790000 18.070000 51.860000 ( 95.284257)]
>> r.info['used_memory_human']
# "85.18M"
>> r.info['used_memory_human']
# "910.53K"
# SET
>> Benchmark.bmbm { |b| b.report("r.set") { 1_000_000.times { |i| r.set(i, i) } } }
# Rehearsal -----------------------------------------
# r.set 31.350000 18.220000 49.570000 ( 92.203876)
# ------------------------------- total: 49.570000sec
# user system total real
# r.set 33.680000 19.670000 53.350000 (100.274870)
# [33.680000 19.670000 53.350000 (100.274870)]
>> r.info['used_memory_human']
# "69.77M"
>> r.config("set", "hash-max-zipmap-entries", 1000)
# "1000"
# HMSET
>> r.info['used_memory_human']
# "910.72K"
>> Benchmark.bmbm { |b| b.report("r.hmset") { 1_000_000.times { |i| r.hmset(i, :id, i) } } }
# Rehearsal -------------------------------------------
# r.hmset 31.650000 16.940000 48.590000 ( 89.578904)
# --------------------------------- total: 48.590000sec
# user system total real
# r.hmset 33.580000 17.970000 51.550000 ( 94.286302)
# [ 33.580000 17.970000 51.550000 ( 94.286302)]
>> r.info['used_memory_human']
# "85.18M"
# SET
>> r.info['used_memory_human']
# "910.86K"
>> Benchmark.bmbm { |b| b.report("r.set") { 1_000_000.times { |i| r.set(i, i) } } }
# Rehearsal -----------------------------------------
# r.set 29.070000 16.950000 46.020000 ( 83.134533)
# ------------------------------- total: 46.020000sec
# user system total real
# r.set 29.770000 17.290000 47.060000 ( 85.235749)
# [ 29.770000 17.290000 47.060000 ( 85.235749)]
>> r.info['used_memory_human']
# "69.77M"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment