opened
cosnicolaou
username_0
This PR addresses issue #138. In particular, servers can connect to one or more proxies using one of three policies:
1. use the first proxy, which is the current policy
2. use a randomly chosen proxy
3. use all proxies simultaneously with an optional upper bound (e.g. use 3 proxies out of the entire set).
x/ref/services/xproxy: add support for various policies for connecting to one or more proxies.
issue
created
alexeiser
username_1
With the default left to first, and limit=0 it's maintaining the existing model... but wouldn't either random, or all be a better default? My preference would be all. 

I don't see any issues from the code review.
comment
created
cosnicolaou
username_0
I chose the default to match the existing behaviour, but I agree that one of the others is a better choice. I'd prefer random to all since it avoids your original problem without using additional resources.
comment
created
alexeiser
username_1
Did you want to change the default mode to Random and the limit to `1`?

I can't tell from the code - but I can test it locally if thats the easiest way. Currently when using proxy services, the resulting clients expose both endpoints attached. 

For example if the mount table had
`/proxy` => with 2 endpoints [`127.0.0.1`, `8.8.8.8`] that are both the same physical service :  when attempting to use the new first or random limit 1 models, does it only expose the one that is reachable by the service, or both like it does today?

vs if their were 2 physical services `/proxy` => with 4 endpoints [`127.0.0.1`, `8.8.8.8`,`127.0.0.2`, `8.8.4.4`]?
comment
created
cosnicolaou
username_0
There are two entries to keep in mind here, one for the proxy service itself, the other for the service being proxied. Actually there are three since the proxy offers two interfaces, one for the proxy service and the new one I added for the proxy stats. Let's say the proxy is called 'proxy', then the stats interface is called 'proxy-mon'. If the service being proxied is called 'myservice' then it will also have an entry in the mounttable. The entry for myservice will contain the addresses of the proxies actually being used for it, so for the random policy it will contain the address of the proxy chosen and not all of the proxies. This is the same behaviour as before. The only difference in the implementation is that for the case of multiple proxies the server implementing myservice needs to be aware of the fact that it's using and hence advertising multiple addresses, one for each proxy it's using. I'm not sure it answers your exact question, but it's certainly the case that clients will only experience temporary hiccups when the set of proxies changes and not in any other circumstance (such as connecting to a proxy only to find that it's not the one selected by the server etc).
comment