[rabbitmq-discuss] TCP timeouts

David.Corcoran at edftrading.com David.Corcoran at edftrading.com
Fri May 9 16:03:32 BST 2008

Hey Holger,

Thanks for the response. I've answered some of your queries below.

> A very interesting anomaly indeed, especially considering that it only
> seems to affect 1.5, not 1.4 or 1.6. However, as far as I can tell this
> behaviour can only occur with one CPU. I bet that David's test will run
> fine when he enables more cores and/or starts running "real" code in the
> process() method - meaning: code that creates garbage and doesn't just
> repeatedly busy-waits on a native method, which accidentally must also
> obey special synchronization rules. David, could you please try this if
> is not too inconvenient?

Unfortunately this happens in the real world too. The code with the while
loop was just to have a simple example that exhibited the same problem I
was having. Most of our cpu intensive code is manipulating matrices of
doubles so it uses full cpu and there is little or no garbage collection.
We use Colt (http://acs.lbl.gov/~hoschek/colt/) for most of it and it's so
optimised I'd be surprised if it had slow bits where other threads might
get a look in.

Also my machine is a quad core 3Ghz Xeon and this happens when just running
1 cpu intensive task.

> Ideally process() should run in a separate thread anyway so that the
> controlling thread can properly wait for a result or - more importantly -

> cancel the computation if necessary.

Process doing the calculations inline makes things conceptually a little
easier and each computation takes less than 30 (usually) so there's no need
to cancel them. Also even if it ran in a separate thread the heartbeat
thread wouldn't be scheduled because the computation thread would still be
too busy.

> Unfortunately this might not have the effect that one expects, as yield()

I agree, yield is a complicated beast and I would never rely on it as a
solution. It was more just a way to illustrate the problem.

If RabbitMQ has configurable heartbeat timeouts this problem might
disappear. For example if you could up the disconnect timeout to 5 seconds
or more it's probably more likely the heartbeat thread would have had a
time slice by then. Still, the only real solution is to use Java6. :)



This communication contains confidential information, some or all of which may be privileged. It is for the intended recipient only and others must not disclose, distribute, copy, print or rely on this communication. If an addressing or transmission error has misdirected this communication, please notify the sender by replying to this e-mail and then delete the e-mail. E-mail sent to EDF Trading may be monitored by the company. Thank you. 
EDF Trading Limited
80 Victoria Street, 3rd Floor, Cardinal Place, London, SW1E 5JL
A Company registered in England No. 4255974. 
Switchboard: 020 7061 4000
EDF Trading Markets Limited is a member of the EDF Trading Limited Group and is authorised and regulated by the Financial Services Authority.
VAT number: GB 735 5479 07

More information about the rabbitmq-discuss mailing list