[rabbitmq-discuss] reading time extending on persistent messages
Arno Puschmann
arno.puschmann at acodeas.de
Wed Jun 29 14:34:08 BST 2011
I'm using rabbitmq 2.4.1 on a Ubuntu 10.04. I tested to write a large number (300k) of messages to an persistent queue. Alle messages are the same and have a size of 1KB. After this I restartet my system and rabbitmq, to go save that nothing is on the memory but all on disk. After restarting all, I startet a consumer to readout the messages. Now I noticed that reading out the persistent messages took always longer. I measured the time for reading out every interval of 3k messages. For example, to readout the first 3k messages it took under 1sec. After 45k messages it took over 10sec. to readout the next 3k messages. After reading 165k messages it took about 30sec. to read the next 3000 messages. I have repeat these test several times always with a similar result.
Can anybody explain these behaviour or have a solution for this problem?
I tried also ActiveMQ and HornetQ under the same requirements without such behaviour.
Thanks.
Here my programmcode
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.exchangeDeclare(EXCHANGE_NAME, "direct", true);
channel.queueDeclare(QUEUE_NAME, true, false, false, null);
channel.basicConsume(QUEUE_NAME, true, consumer);
channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, "111");
System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
int i=0;
long start = System.currentTimeMillis();
while (true)
{
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
String message = new String(delivery.getBody());
i++;
if(i == 3000)
{
System.out.println("The last 3000 Messages needed " + (System.currentTimeMillis() - start));
start = System.currentTimeMillis();
i=0;
}
}
More information about the rabbitmq-discuss
mailing list