You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Brandon Pedersen <bp...@gmail.com> on 2011/09/30 07:30:20 UTC

session management

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?

Thanks,

-Brandon

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: session management

Posted by Gordon Sim <gs...@redhat.com>.
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:users-subscribe@qpid.apache.org