[rabbitmq-discuss] performance
Ryan Pratt
ryan.pratt at gmail.com
Fri Aug 29 23:17:20 BST 2008
I have been running some small performance tests and have not seen the
throughput I was expecting. I want to see if my numbers are similar to what
others have seen, or if something else (setup, etc) is causing my
performance to be not so good.
I have a single broker running with a sender and receiver all on the same
machine. The machine is a dual quad core 2.66 GHz Xeon with 8 gigs of
memory. I have to throttle the sender to keep the queue from backing way up,
which then causes the broker to basically go to a crawl. The sender sends 40
messages then sleeps for 5 millseconds, and loops doing this continually. If
a run a receiver that continuously calls basicGet I am seeing a max of about
4000 messages per second. The message I am sending is "Hello, World!"
If I add a second Receiver on the same queue I end up getting it up to about
6000 messages per second. 3 Receivers is about the same as 2. Maybe my
expectations are off but I was hoping to see at least 20000 messages per
second going through. The sender and receiver code is attached. Is there
anything obviously wrong with my setup, or is this throughput what I should
expect to see? Thanks
package com.optionshouse.test;
import java.io.IOException;
import com.rabbitmq.client.*;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.AMQP;
import java.util.*;
public class TestSender {
public static boolean doStop = false;
public static void main(String[] args) {
try {
ConnectionParameters params = new ConnectionParameters();
params.setUsername("guest");
params.setPassword("guest");
params.setVirtualHost("/");
params.setRequestedHeartbeat(0);
ConnectionFactory factory = new ConnectionFactory(params);
Connection conn = factory.newConnection("localhost", 5672);
Channel channel = conn.createChannel();
int ticket = channel.accessRequest("/data");
channel.exchangeDeclare(ticket, "TEST", "direct");
channel.queueDeclare(ticket, "action.test");
channel.queueBind(ticket, "action.test", "TEST",
"action.test");
byte[] messageBodyBytes = "Hello, world!".getBytes();
int counter = 0;
while (!doStop) {
channel.basicPublish(ticket, "TEST", "action.test",
null, messageBodyBytes);
counter++;
if (counter == 30) {
try {
counter = 0;
Thread.sleep(5);
}
catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
}
catch (IOException ex) {
ex.printStackTrace();
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080829/29198ebe/attachment.htm
More information about the rabbitmq-discuss
mailing list