Skip to content

Instantly share code, notes, and snippets.

@pmashchak
Last active March 2, 2016 21:39
Show Gist options
  • Save pmashchak/873a701d521720bdb76f to your computer and use it in GitHub Desktop.
Save pmashchak/873a701d521720bdb76f to your computer and use it in GitHub Desktop.
require 'benchmark'
def get_benchmark
c = Aws::DynamoDB::Client.new(region: 'No', credentials: Rails.configuration.api.pulsar.creds, endpoint: Rails.configuration.api.pulsar.base, ssl_verify_peer: false)
ips = ["2001:0558:4030:0002", "2001:0558:6000:0002", "2601:0A40:0100:00A8", "67.164.233.81", "69.247.98.137",
"69.247.99.167", "69.247.99.168", "69.247.99.9", "76.26.116.108", "76.26.116.116"]
ids = ["1416782538086630295-2001:0558:4030:0002", "1416782538086630295-2001:0558:6000:0002",
"1416782538086630295-2601:0A40:0100:00A8", "1416782538086630295-67.164.233.81", "1416782538086630295-69.247.98.137",
"1416782538086630295-69.247.99.167", "1416782538086630295-69.247.99.168", "1416782538086630295-69.247.99.9",
"1416782538086630295-76.26.116.108", "1416782538086630295-76.26.116.116"]
bm = Benchmark.bm(7) do |x|
x.report("primary: ") do
ids.each do |id|
Pair.find(id)
end
end
x.report("secondary:") do
ips.each do |ip|
Pair.find_by_ip(ip)
end
end
end
return bm
end
=> 175 all.count
user system total real
primary: 2.750000 0.490000 3.240000 ( 3.922000)
secondary: 2.030000 0.180000 2.210000 ( 39.481000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment