-
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
Backup nodes + httpchk #100
Conversation
Can we please have this merged? It has been quite a while, is the project still maintained? Thanks |
Hi, Any updates on the potential merge? Thanks! |
ah sorry about the delay; this could use a rebase. also, we handle this problem for non-default servers with a |
add backup servers & httpchk
Rebase done. The reason it's done without server_options is to assign "backup" labels to individual backup nodes instead of the whole group (if I understand your question correctly). |
We're also adding something like this for the weight change as well in #131. Perhaps we should add something like server_options to the backend registrations themselves to allow this kind of metadata to be propagated from nerve? If we're going to do that it might make senseto keep all this frontend specific metadata in one top level key? |
@jolynch Sure, that's a good approach for ZK-listed servers. However, this particular scenario deals with static default servers, so I don't see an overlap there. |
@Jaykah The static registrations from the default servers should (afaik) be identical to what nerve is registering as far as Synapse can tell. In BaseWatcher's set_backends method they are just merged all together. I guess what I'm saying is that we can solve both use cases with a generic "server_options" top level key in backend registration hashes. |
What I am referring to is the "stub" watcher, rather than any backend discovered via Zookeeper/Docker/etc. My use case is a server in Region A that would use backends from Region B only if all local nodes fail. Those backends are marked as "backup" in the Synapse config. At the same time, region B's backends are primary for their own region (so they won't be marked as "backup" in Nerve), and are discovered through a different path in Zookeeper. A better option would be to discover backup nodes from another Zookeeper path, but that's a different discussion (we would still need default servers if ZK fails). |
Ah, that's good context. We're experimenting with zone failover by using multiple backends and a frontend acl. We've been relying on the implicit backend name for a bit but I opened #135 to make it explicit so you can reference backends in acls. That being said the HAProxy guys recommend combining multiple backends + acl with backups so we should probably support it. Definitely interested in coming up with a good way to do failover. I think I'm starting to see your use case, I'm just trying to find the way to address a few similar feature requests. I feel like adding a bunch of HAProxy specific keys (like httpchk) is the wrong way going forward, especially if we ever want to be able to add more outputs than HAProxy/file output. I'm not sure the right abstraction though, what do you think? Also just FYI you can use the state cache as an additional guard (it's the only guard we use) against zookeeper flakiness. |
So if I understand correctly, in that case we would define two (or more) backends (main and backup) in frontend's Synapse and failover to that backup using ACL? If so, that seems to solve a part of what I am trying to achieve, since your example shows ZK discovery for the backup node, which can be done from a different ZK path. Are there any limitations to such approach?
That's what I meant by
Having the backup option available on a per-node basis for stub watcher is complementary to #135
Sure, having more flexibility is always great, but we should not forget that even per Synapse's readme, "The heart of synapse is actually HAProxy, a stable and proven routing component."
What cache are you referring to? We are not using Curator, if you are talking about the path cache. |
@Jaykah
From my conversations with the HAProxy folks acls are preferred because they give you more control for when failover occurs, but the blog article I linked to seems to indicate they can be used together. In my opinion I think it strictly dominates backups because I can reason about failover really easily (does the backup backend have any traffic).
I agree, I'm just trying to figure out a way that we can unify #100, #131 and other similar features. I really do think that the right way to do this is to attach metadata to backends and we can have well specified behavior per output (HAProxy, files, etc ...)
I can change the readme, but I believe it is in the best interest of the project to not make additional choices that tie us directly to HAProxy. We've already added file output which has been instrumental to getting things like Cassandra bootstrapping off Smartstack. We had to do some crazy stuff to get HAProxy to not drop traffic during reloads. HAProxy might not be the only solution we offer going forwards.
I'm referring to the |
I'm also potentially ok with using a bunch of top level keys as long as we namespace them or somehow make it obvious that |
#83 also is relevant |
Sure, if we can select main and backup paths per Synapse (e.g. main path for the same region as Synapse, and then a separate "backup" block with a different ZK path for another region) that would solve the need for the backup option.
Maybe prefix them with "haproxy" ?
|
@Jaykah I think keeping it flat with well named tags can work going forward. Trying to come up with some kind of well defined nesting structure in the service registrations seems like a losing battle to me, but maybe I'm not creative enough. Let's do this, but let's add some documentation in both nerve and synapse for what backend registrations can actually contain (e.g. right now it's host, port, name, weight?) and what they are. Let's try to keep metadata that could only ever be used for one config generator prefixed with that config generator. |
@@ -717,7 +717,7 @@ def generate_backend_stanza(watcher, config) | |||
config.map {|c| "\t#{c}"}, | |||
backends.keys.shuffle.map {|backend_name| | |||
backend = backends[backend_name] | |||
b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}" | |||
b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}#{' backup' if backend['backup']}#{' check port ' if backend['httpchk']}#{backend['chkport']}" |
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.
Thoughts on having a haproxy_server_options
catch all registration info for backend registrations similar to the watcher's server_options
?
So like, instead of haproxy_backup
and haproxy_httpchk
you just have haproxy_server_options
which can contain weights, httpcheck lines, ports, backup status, etc ...
@jolynch The issue with So in my case it would be:
which would allow different check ports per instance (useful for flat infrastructure with the possibility of having two nodes coexist on the same machine). However if we have |
@Jaykah, yes I mean in addition to the service backend's server options. So you can either set options per backend or per server. Sweet, let's do that and I'll merge it. |
This patch allows to set stub backends as
backup
and adds the ability to use the Haproxyhttpchk
option with custom check ports for those nodes.