php-amqplib - read_write_timeout and heartbeat relation

2.1k views Asked by At

While reading php-amqplib configuration, I saw two parameters: "heartbeat" and "read_write_timeout".

On the web I found this (on 2 or 3 forums): read_write_timeout must be at least 2x the heartbeat But I never saw the reason behind this.

Can someone explain me why read_write_timeout must be at least 2x the heartbeat? Did it depends on heartbeat interval?

Thank in advance.

1

There are 1 answers

0
SchizoDuckie On

Some discussion going on here and here

It boils down to the simple reason that the connection could be closed before properly handled, if the heartbeat is not sent just in time to keep it alive. That's millisecond work, so it could be that the connection auto-closes at :30 and the heartbeat should have been sent at :31.