[rabbitmq-discuss] Performance question
Roshan Punnoose
rpunnoose at proteus-technologies.com
Tue May 26 17:31:18 BST 2009
I have a one producer, one consumer queue running locally for a performance
test. In terms of just server and client configuration, what is the best way
to increase performance. For a simple queue publisher and consumer, I¹m
getting about 10k a second for simple byte messages.
Here is some of the code:
Publisher:
channel.exchangeDeclare("exchangename", "direct");
channel.queueDeclare("queuename"); channel
.queueBind("queuename", "exchangename",
"routingKey"); byte[] messageBodyBytes = new byte[0];
int count = 0; long start = System.currentTimeMillis();
String name = Thread.currentThread().getName(); for (int
i = 0; i < 100000; i++) {
channel.basicPublish("exchangename", "routingKey",
null, messageBodyBytes); count++;
if ((System.currentTimeMillis() - start) > 1000) {
System.out.println(name + "-" + count); count =
0; start = System.currentTimeMillis();
} }
Consumer:
channel.basicConsume("queuename", false, new DefaultConsumer(channel) {
int count = 0; long start = System.currentTimeMillis();
@Override public void handleDelivery(String consumerTag, Envelope
envelope, BasicProperties properties, byte[] body) throws
IOException { count++; if
((System.currentTimeMillis() - start) > 1000) {
System.out.println(count); count = 0;
start = System.currentTimeMillis(); }
this.getChannel().basicAck(envelope.getDeliveryTag(), false); }
});
Is there some way I can increase the performance? From the tests I have seen
online, I hear numbers of millions of messages a second.
Roshan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090526/3300372d/attachment.htm
More information about the rabbitmq-discuss
mailing list