[rabbitmq-discuss] Starts slow, but then fast.

Robert robert.weissmann at web.de
Tue Jun 14 15:33:20 BST 2011


Hi,

I did the "Hello, World" - Example from  
http://www.rabbitmq.com/tutorials/tutorial-one-java.html

and only added to send the message 100000 times.

Any ideas on the following behaviour:

The first couple of hundred messages being received pretty slowly (per 100  
messages 2-3 seconds), then it improves up to a couple thausand messages a  
little bit (per 1000 messages 2-3 seconds), but then - peng - from around  
8000 messages it is extremly fast (rest in about 1 second !!!).

And it doesn't matter if I ran the producer code 1 time or a couple times.  
It is always the same bahaviour. (Also, the producers loop is done much  
before all messages being consumed - so, it looks as the sending is fast).

What is going on. Any ideas ?

Cheers, Rob.

Here my code (but in Scala):



object ConsumerTest {
   val QUEUE_NAME = "robs_queue"

   def main(args: Array[String]) {
     val factory = new ConnectionFactory();
     factory.setHost("localhost");
     val connection = factory.newConnection();
     val channel = connection.createChannel();
     channel.queueDeclare(AMQPTesterRaw.QUEUE_NAME, false, false, false,  
null)

     val consumer = new QueueingConsumer(channel)
     channel.basicConsume(AMQPTesterRaw.QUEUE_NAME, true, consumer)

     while(true){
       val del = consumer.nextDelivery();
       println("arrived = " + new String(del.getBody))
     }

   }
}

object ProducerTest {
   def main(args: Array[String]) {
     val factory = new ConnectionFactory();
     factory.setHost("localhost");
     val connection = factory.newConnection();
     val channel = connection.createChannel();
     channel.queueDeclare(AMQPTesterRaw.QUEUE_NAME, false, false, false,  
null)

     for(x <- 1 to 100000){
       val msg = "Hello World(" + x + ")"
       channel.basicPublish("", AMQPTesterRaw.QUEUE_NAME, null,  
msg.getBytes)
     }

     channel.close()
     connection.close()

   }
}


-- 
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/


More information about the rabbitmq-discuss mailing list