You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Kuppe <ku...@360t.com> on 2006/06/22 12:47:19 UTC

Connection questions

Hi guys,

hopefullly a simple one for you. i am using ActiveMQ RC2 to create a broker
and multiple pub/sub clients.

for the clients i use failover(tcp:) transport and on the broker i use the
default broker configuration without persistence. I create all client
connections using the createConnection() method of the
ActiveMqConnectionFactory which has prefetch policy defined and asynch send
and dispatch set. No other methods are called on the connection or factory
for configuration. Specifically i do not explicitly set a client id.

i notice the following symptom - some clients enter into an endless
reconnect loop whilst establishing connections to the broker (actually many
clients, and more regularly when connecting through a proxy server). on the
broker i notice exceptions from inactivity monitor showing no activity, but
nothing explicit regarding the specific client.

After scanning through your forum, i noticed a possible link to the
maxInactivityDuration and have set it to 0 for the tcp transport on the
broker. This SEEMS to help but it SEEMS not to help in the case when clients
are connecting through a proxy server.

Firstly, can you help me with resolving this issue? Is there further
optimization to be made on the broker/client?

Ok, my second question is more general. When i have a number of clients
connected to a broker which is embedded in a VM with some other service
which the clients communicate with over the broker, it is often necessary to
restart the services. Obviously this will also restart the broker. Should i
expect that the clients will reconnect cleanly including recreating all
queues/topics? 

Again i have looked through your forums and it SEEMS that this should work
and am sure i have tested this. At the same time though, when i do this in
the case where there are many more clients connected i receive many
exceptions in the broker with the message : Client:
ID:test-45964-1150966470288-1:5 already connected.

Can you please explain the reconnect process? What can i expect and what
should i definitely NOT expect?

Finally, when i set a prefetch policy to 1000 (which is recommended in your
documentation for high throughput on fast connections) i often receive the
error message that the message queue is full with 300 messages and that
other threads may block. 

I am wondering where this message limit size is set and how this could ever
be smaller than a prefetch limit for my connection? Any information that
will give me a better understanding of this topic would also be appreciated.

Many thanks in advance.
--
View this message in context: http://www.nabble.com/Connection-questions-t1829431.html#a4990875
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Connection questions

Posted by James Strachan <ja...@gmail.com>.
On 6/22/06, Kuppe <ku...@360t.com> wrote:
>
> Thanks James for the reply.
>
> Regarding the client reconnection issue, can you please explain the
> relationship between the tcp transport option connectionTimeout in relation
> to wireFormat option maxInactivityDuration? And then again in relation to
> the tcp transport option soTimeout?

connectionTimeout is the timeout used to establish a TCP connection.
soTimeout is the socket configuration option for timeouts on an open
socket. maxInactivityDuration is a transport level timeout we use to
decide if a transport is dead - which has nothing to do with sockets
per se - its a good way to double check your sockets are doing what
they think (as some OSSs do funny things with socket timeouts etc)

-- 

James
-------
http://radio.weblogs.com/0112098/

Re: Connection questions

Posted by Kuppe <ku...@360t.com>.
Thanks James for the reply.

Regarding the client reconnection issue, can you please explain the
relationship between the tcp transport option connectionTimeout in relation
to wireFormat option maxInactivityDuration? And then again in relation to
the tcp transport option soTimeout?

Thanks again...
--
View this message in context: http://www.nabble.com/Connection-questions-t1829431.html#a4997033
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Connection questions

Posted by James Strachan <ja...@gmail.com>.
On 6/22/06, Kuppe <ku...@360t.com> wrote:
>
> Hi guys,
>
> hopefullly a simple one for you. i am using ActiveMQ RC2 to create a broker
> and multiple pub/sub clients.
>
> for the clients i use failover(tcp:) transport and on the broker i use the
> default broker configuration without persistence. I create all client
> connections using the createConnection() method of the
> ActiveMqConnectionFactory which has prefetch policy defined and asynch send
> and dispatch set. No other methods are called on the connection or factory
> for configuration. Specifically i do not explicitly set a client id.
>
> i notice the following symptom - some clients enter into an endless
> reconnect loop whilst establishing connections to the broker (actually many
> clients, and more regularly when connecting through a proxy server). on the
> broker i notice exceptions from inactivity monitor showing no activity, but
> nothing explicit regarding the specific client.
>
> After scanning through your forum, i noticed a possible link to the
> maxInactivityDuration and have set it to 0 for the tcp transport on the
> broker. This SEEMS to help but it SEEMS not to help in the case when clients
> are connecting through a proxy server.
>
> Firstly, can you help me with resolving this issue? Is there further
> optimization to be made on the broker/client?

more on this below...


> Ok, my second question is more general. When i have a number of clients
> connected to a broker which is embedded in a VM with some other service
> which the clients communicate with over the broker, it is often necessary to
> restart the services. Obviously this will also restart the broker. Should i
> expect that the clients will reconnect cleanly including recreating all
> queues/topics?

Yes - that should work fine.  Clients resume any
connections/sessions/producers/consumers after faling over to another
broker


> Again i have looked through your forums and it SEEMS that this should work
> and am sure i have tested this. At the same time though, when i do this in
> the case where there are many more clients connected i receive many
> exceptions in the broker with the message : Client:
> ID:test-45964-1150966470288-1:5 already connected.

I think this could be caused by the broker not noticing a client has
reconnected in time. BTW can you preproduce this on 4.0?

A workaround could be for a more aggresive inactivity timeout.


> Can you please explain the reconnect process? What can i expect and what
> should i definitely NOT expect?

See above - basically cilents drop their connection and connect again.

It could be you see errors where clients try to connect too quickly
and the broker thinks its a duplicate clientID so rejects it. Maybe we
should be more clever and when a duplicate connection comes in; we
wait and see if there is any activity on the existing duplicate before
failing.



> Finally, when i set a prefetch policy to 1000 (which is recommended in your
> documentation for high throughput on fast connections) i often receive the
> error message that the message queue is full with 300 messages and that
> other threads may block.

For non-persistent messaging, the UsageManager defines the number of
messages that can be kept in RAM in the broker (since non-persistent
messaging doesn't spool to disk).

So try increasing the amount of RAM you are prepared to use for
RAM-buffering of non-persistent messaging. Or if you wanna handle
massive queues/topics you could consider using persistent messaging to
get the spooling & massive queue handling - but then just disable
synchronous sending

http://incubator.apache.org/activemq/async-sends.html

to get fast performance

-- 

James
-------
http://radio.weblogs.com/0112098/