On 09/30/2011 06:30 AM, Brandon Pedersen wrote:
I am wondering what the best practices are for session management. I will be sending messages every few seconds from a couple different threads. Right now I am opening a new session for each message but I am wondering if that could slow things down (obviously every couple seconds isn't a big deal, but what if it were much quicker and more threads). Would it be better to keep a single session open for every write? Or maybe a thread-local session? Or should I just keep doing what I am doing and closing the session as soon as I am done sending a message?
Opening and closing a session is not *that* expensive (not as much to do as opening and closing a connection), so if its working there is no real need to change. That said, I would tend to re-use a session or session-per-thread in this case.
--------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
