8000 amqp: allow multiple hosts for failover by mbakhoff · Pull Request #3410 · collectd/collectd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

amqp: allow multiple hosts for failover #3410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 27, 2020
Merged

Conversation

mbakhoff
Copy link

ChangeLog: amqp plugin: allow multiple hosts to support failover

With this implementation all the hosts must use the same port number. Specifying a different port for each host would be tricky wrt config backwards compatibility and it's not clear how important it is.

@mbakhoff mbakhoff requested a review from a team as a code owner March 13, 2020 13:21
Copy link
Member
@octo octo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Märt,

thank you very much for your PR!

I'm wondering whether round-robin, i.e. trying the hosts in order, would be a better strategy. If the number of hosts is small (two or three), the chances of trying to reconnect to the failing host are high. If we moved on to the next host, we'd avoid that.

This would also allow the user to specify a preference, which would make sense for a broker running locally. For a set of external brokers, this might create an imbalance since all clients (with the same config) are going to use the same broker …

What do you think?

Best regards,
—octo

@@ -540,6 +540,7 @@ B<Synopsis:>
# Send values to an AMQP broker
<Publish "some_name">
Host "localhost"
# Host "amqp1.example.com" "amqp2.example.com" "amqp3.example.com"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this comment a bit distracting. How about amending the existing line, e.g. to:

Host "localhost"
Host "fallback-amqp.example.com"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea. pushed

@octo octo added the Feature label Apr 26, 2020
@octo octo added this to the Features milestone Apr 26, 2020
@mbakhoff
Copy link
Author

Thank you @octo for the review!

I considered round robin and thought that using random might balance the load better. It was also a bit easier to implement. I'm not aware of any use cases where setting a preference for a clustered broker node is useful. However if you think that round robin would be better, then I can make the change. Should be quite simple and I don't have a strong preference.

Copy link
Member
@octo octo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback @mbakhoff!

Preferring one instance over others is typically done when one instance is running in the same data center or metro, while others are "far away" (from the network's POV). That said, we'd only have this benefit until the connection fails for the first time, i.e. you can't really rely on it.

FTR, we could get the best of both worlds by randomizing the order after reading the config, then doing round-robin on the randomized list. If anybody thinks this is a good idea, send a PR :)

Thanks for your work Märt!
—octo

@octo octo merged commit af3e316 into collectd:master Apr 27, 2020
@mbakhoff
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0