Last active
August 29, 2015 14:10
-
-
Save cambridgemike/f925779887fd5417a61c to your computer and use it in GitHub Desktop.
hosted graphite/statsd performance
This file contains 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 'benchmark' | |
require 'hosted_graphite' | |
HostedGraphite.api_key = 'API-KEY' | |
HostedGraphite.protocol = HostedGraphite::UDP | |
require 'hosted_graphite/statsd' | |
def do_single | |
HostedGraphite.increment "benchmark.incrementer" | |
end | |
def do_double | |
HostedGraphite.increment "benchmark.incrementer" | |
HostedGraphite.increment "benchmark.incrementer" | |
end | |
def do_gauge | |
HostedGraphite.gauge "benchmark.gauge", 25 | |
end | |
n = 1000 | |
Benchmark.bmbm do |x| | |
x.report("single inc") { n.times do; do_single; end } | |
x.report("double inc") { n.times do; do_double; end } | |
x.report("single gauge") { n.times do; do_gauge; end } | |
end | |
# user system total real | |
# single inc 0.110000 0.220000 0.330000 ( 5.949952) | |
# double inc 0.250000 0.450000 0.700000 ( 13.743122) | |
# single gauge 0.120000 0.210000 0.330000 ( 6.791644) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment