Created
February 27, 2012 20:09
-
-
Save Fitzsimmons/1926694 to your computer and use it in GitHub Desktop.
Bunny benchmarking
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 'rubygems' | |
require 'bunny' | |
m = "<event> | |
<string1>123456790123456790123456790123456790</string1> | |
<string2>123456790123456790123456790123456790</string2> | |
<string2>123456790123456790123456790123456790</string2> | |
<string2>123456790123456790123456790123456790</string2> | |
</event>" | |
b = Bunny.new | |
b.start | |
b.tx_select | |
Benchmark.bm do |x| | |
x.report do | |
q = b.queue('cpi-test-durable', :durable => true) | |
direct_exchange = b.exchange('') | |
10000.times do | |
direct_exchange.publish(m, :key => "cpi-test-durable") | |
b.tx_commit | |
end | |
end | |
end | |
b.stop |
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 'rubygems' | |
require 'bunny' | |
b = Bunny.new | |
b.start | |
b.tx_select | |
q = b.queue('cpi-test-durable', :durable => true) | |
Benchmark.bm do |x| | |
x.report do | |
while true | |
msg = q.pop(:ack => true) | |
break if msg[:payload] == :queue_empty | |
q.ack | |
b.tx_commit | |
end | |
end | |
end | |
b.stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment