-
Notifications
You must be signed in to change notification settings - Fork 251
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
Weights support in Synapse #179
base: master
Are you sure you want to change the base?
Conversation
839a22b
to
ff7da3b
Compare
if watcher.haproxy.fetch('server_options', '').include? 'weight' | ||
log.warn "synapse: weight is defined by server_options and by nerve" | ||
end | ||
if backend['haproxy_server_options'] and backend['haproxy_server_options'].include? 'weight' |
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.
unfortunately, due to how the parsing logic in ServiceWatcher works today, haproxy_server_options
always exists as a key in backend and defaults to value nil
👍 Looks good to me, although it looks like travis flaked out? |
Also are you going to follow up with live update capability via the stats socket, or do we want to keep punting on that? |
Gonna keep punting on the live update part for now. I'll be happy being able to merge this PR and close out the outstanding PRs from the two previous attempts at this. |
be ignored. This commit is based on: airbnb#131 but does the following things differently: 1. By default weights are ignored. This is to maintain current behavior for safety. 2. HAProxy will reconfigure if weights changes.
…s from taking traffic just because they have different weights, add more tests.
…hange log level for duplicate weights.
@jolynch still good to merge this? |
@@ -714,6 +714,11 @@ def generate_backend_stanza(watcher, config) | |||
log.info "synapse: restart required because haproxy_server_options changed for #{backend_name}" | |||
@restart_required = true | |||
end | |||
if (old_backend.fetch('weight', "") != |
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.
so, it looks like this section of code is only invoked if the state file is enabled. i think this needs a little re-thinking...
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.
We detect a restart as long as the output config file is different: https://github.com/airbnb/synapse/blob/master/lib/synapse/haproxy.rb#L844. So you're right to point out this block of code as being out-of-place. I'm writing some tests to see if we even need any of the logic here.
Follow up to #174.
Adds logic to signal HAProxy restart if
weight
has changed.Added an additional warning if
weights
is redefined inhaproxy_server_options
. I would prefer not to implement behavior that strips out any user-definedweight X
statement in HAProxy server options. It seems sufficient to warn about the unexpected behavior in either case.