I don't understand any potential contention issues in ActiveMQ so I thought I may as well use a connection for the incoming and another connection for the outgoing.
I do not create a connection/session/producer per request. They are created only once. It just seems that sending messages to a temp queue that you specify in the send call is slow? i.e. The following are only created once: connection = connectionFactory.createConnection(); session = connection.createSession(false,Session.CLIENT_ACKNOWLEDGE); producer = session.createProducer(null); // set as null since we do not know the destination connection.start(); Each call does....... producer.send(tempQueue, jmsResponse); Any idea why this is significanly slower then a call to a pre-defined known queue. James.Strachan wrote: > > On 2/17/07, Paul French <[EMAIL PROTECTED]> wrote: >> I am using the defualt install of activeMQ 4.1.0 >> I've turned off persistence and increased memory-manager setting to 500MB >> I've also updated the startup script so that the java heap can increase >> to >> 1G of memory if required >> >> The messaging layer of my app is simple. The client creates a temp queue >> on >> the broker and then sends messages async to a named main queue where each >> message has the JMS reply to set to the temp queue. >> >> The server consumes messages from the main queue does some processing and >> then sends the resulting message to the temp queue. The client then >> consumes >> the messages off the temp queue. >> >> On the server consuming messages is fast. However sending the results >> back >> to the temp queue is slow. >> >> The server consumes messages by creating a single connection, a single >> session and a single consumer. > > BTW why is the server single threaded? Why not create a bunch of > sessions & listeners. > >> All of these objects are created on startup >> and the consumer has the main queue set on it when created. e.g. >> >> connection = connectionFactory.createConnection(); >> session = >> connection.createSession(false,Session.CLIENT_ACKNOWLEDGE); >> consumer = session.createConsumer(mainQueueName); >> connection.start(); >> >> In the appropriate place the following gets called >> >> jmsRequest = consumer.receive(); >> jmsRequest.acknowledge(); >> >> >> The server produces messages by creating another connection, a session >> and a >> single producer. > > Why? Thats gonna be very slow. Why not just reuse the same session > that you are using for consuming and just cache a MessageProducer you > can use for sending (and do async sends) > > -- > > James > ------- > http://radio.weblogs.com/0112098/ > > -- View this message in context: http://www.nabble.com/Sending-Async-messages-to-temp-queue-really-slow-tf3242950s2354.html#a9040119 Sent from the ActiveMQ - User mailing list archive at Nabble.com.