I'm still hitting a problem with parallel sends and receives running
causing the Ruby VM to fail. But I did manage to get some decent
results for simply sending or receiving messages with a local broker.
I modified my test_receiver_get_and_fetch.rb to either send n messages,
or else receive messages until the queue was drained. For sending
1,000,000 messages I had the following result:
mcpierce@mcpierce-laptop:ruby (Nonblocking-IO-without-Tracker) $ ruby -I lib ext/nonblockio/test_receiver_get_and_fetch.rb 1000000 S
Sending 1000000 iterations, waiting for 'dfedsqpaluxbplse'...
Sent 1000000 messages.
Received 0 messages.
Runtime: from 2012-04-20 11:32:10 -0400 to 2012-04-20 11:34:05 -0400 (114.740958337 seconds)
Just under two minutes to send one million messages.
Afterward I fired off the receiver functionality to receive and
acknowledge the messages in the queue with the following results:
mcpierce@mcpierce-laptop:ruby (Nonblocking-IO-without-Tracker) $ ruby -I lib ext/nonblockio/test_receiver_get_and_fetch.rb R
No message to fetch
ext/nonblockio/test_receiver_get_and_fetch.rb:38:in `block (2 levels) in <main>'
ext/nonblockio/test_receiver_get_and_fetch.rb:36:in `block in <main>'
Sent 0 messages.
Received 1000000 messages.
Runtime: from 2012-04-20 11:40:43 -0400 to 2012-04-20 11:42:00 -0400 (76.586425021 seconds)
(Ignore the stack trace and the "No message to fetch" error. Those
happen when the queue is empty and receiver.get doesn't get a message.)
We can drop one second from the total time since Receiver.get is called
with a duration of one second. So that's one million messages received
in 75.5 seconds.
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.