You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What's the best way to achieve service location awareness?
Consider an example of small toy stack that consists of a load balancer and two services: a web server and a database server. Considering that intra-host communications are almost always cheaper than inter-host ones, what would be the best way to optimize the general performance?
From what I understand, right now, Rancher DNS basically returns all IPs it knows about, in no particular order. So, in theory, it may happen that request will be served by LB, web and database from three completely different hosts. Which sometimes may be a sensible scenario, but sometimes may be considered undesirable and only cause longer response times, especially if the hosts are more than few milliseconds away from each other. Ideally, I would prefer to have some optional mode in which requests would get routed to the same-machine containers (if healthy), but failover to other instances.
I see a few approaches I could try to take, but not sure which one makes sense and whenever I'm not missing something obvious:
One way I thought of, is creating per-host twin stacks. The obvious downside is that I'll have to manage multiple copies and keep them in sync (and manually tell about each other or hack some automatic discovery).
Another way seems to put everything in a single service and its sidekicks, but then things cannot be scaled independently. I.e. would I want to scale up webserver containers, I would have to spawn two databases as well, which may not always make sense.
Then, there's a hard option of not using built-in DNS but query rancher API (project/1aN/containers) instead to see which container's running where, and build configs (primaries and failovers lists) based on this information. Then somehow listen for updates, or, at least, poll periodically. The downsides are that this requires providing container access to Rancher API, and that this basically a kludge.
I believe, I must be not the one who had thought of possible latency issues, and there's probably an already established general approach for dealing with such things. If there is, can someone please suggest me something? If not - are there any plans for this?
Thanks a lot!
The text was updated successfully, but these errors were encountered:
@drdaeman have you explored the rancher-metadata service? You'd be able to query the container's info, namely the host it resides on. From there you could query the service local to your container you want to hit.
What's the best way to achieve service location awareness?
Consider an example of small toy stack that consists of a load balancer and two services: a web server and a database server. Considering that intra-host communications are almost always cheaper than inter-host ones, what would be the best way to optimize the general performance?
From what I understand, right now, Rancher DNS basically returns all IPs it knows about, in no particular order. So, in theory, it may happen that request will be served by LB, web and database from three completely different hosts. Which sometimes may be a sensible scenario, but sometimes may be considered undesirable and only cause longer response times, especially if the hosts are more than few milliseconds away from each other. Ideally, I would prefer to have some optional mode in which requests would get routed to the same-machine containers (if healthy), but failover to other instances.
I see a few approaches I could try to take, but not sure which one makes sense and whenever I'm not missing something obvious:
project/1aN/containers
) instead to see which container's running where, and build configs (primaries and failovers lists) based on this information. Then somehow listen for updates, or, at least, poll periodically. The downsides are that this requires providing container access to Rancher API, and that this basically a kludge.I believe, I must be not the one who had thought of possible latency issues, and there's probably an already established general approach for dealing with such things. If there is, can someone please suggest me something? If not - are there any plans for this?
Thanks a lot!
The text was updated successfully, but these errors were encountered: