-
Notifications
You must be signed in to change notification settings - Fork 408
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
RandomDestination at first & round-robin #195
Conversation
…logfellow#125 - randomDestination at first - round-robin
* | ||
* When null (the default), disabled round-robin. | ||
*/ | ||
private Integer roundRobinSize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand why a size is needed. It seems like you would want to either round robbin, or not. Why would you want to not round robin for a while, and then start round robin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you know, if you do round robin, a reconnection occurs.
When reconnecting each time, a big cost was introduced, and the "roundRobinSize" was introduced as a concept of buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhhh, I thought it would just round-robin the next time a connection was needed (i.e. if a connection was broken). I didn't notice that your change forces a reconnect after every N log messages. Makes sense now. If this is the case, I think it would make more sense to use a time based round-robin, rather than message count based. That way sudden increases of load don't trigger a reconnection storm.
This is kind of similar to the secondaryConnectionTTL
already implemented. However, it applies to any connection. So, maybe it would just be connectionTTL
.
I think we need to introduce a I can see three strategies at the moment:
Would those satisfy your use cases? From the changes in the current PR, it is not obvious (without studying the code pretty hard) which strategy is being used for any given set of configuration values. For example, how does |
+1 |
@philsttr |
# Conflicts: # src/main/java/net/logstash/logback/appender/AbstractLogstashTcpSocketAppender.java Introduced DestinationSelectionStrategy - PreferPrimary, RoundRobin, Random
@philsttr |
…eferPrimary, roundRobin, random strategies into three implementations of that interface. Allow custom strategies.
Hey @withccm, I've refactored your code a bit to extract a strategy interface, with three implementations. This pulls the logic out the appender, and allows people to develop custom strategies. I've committed it to the destination_connection_strategy branch. I still have more testing and documentation to do, but this will provide a preview of how I'm thinking this should work. |
@philsttr, Thank you for your positive review. |
4.10 released with this change |
Thanks @philsttr |
Hello.
Logstash-logback-encoder is woking by primary and secondary.
I need a balanced request to each destination.
@brenuart registered the issue #125
I hope to review the code.
Thanks.