-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Improve service name lookup on TCP routers #7370
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
Conversation
|
@kopaygorodsky yes, but a config reload is not a solution when working with a DNS name external service, as kubernetes will never trigger a config update since the object never changes (service definition without endpoints). In this case you would have to rely on restarting Traefik or deleting and creating the router again to update the actual addresses. |
|
I thought we can watch for Endpoints resource, can't we? It has the same name as the external service. Update event is fired every time IP list is changed. |
|
@kopaygorodsky an external name service generates no endpoints in kubernetes. You can create them manually but it would be ignored by Traefik in this case anyway. For external name services Traefik resolves the TCP based services will usually connect once and keep the connection until the work is done, like databases for example, and for that reason I guess it won't have a negative impact. Even for multiple distinct requests I did not see a noticeable increase in latency, but I would like validation from more community members or senior maintainers. |
|
oh, I got where I was wrong. Thanks a lot for answering :) |
|
@ddtmachado Thanks for your PR, It looks promising! I wonder if it wouldn't be a more understandable behavior to not have a default value for Also, what do you think about changing the |
|
@ddtmachado After discussing with the team, we think having a cache adds more complexity than it helps. Right now the current implementation has some concurrency issues around the What do you think about doing the resolution only if the given |
|
@jspdown yes, it is not synced but it does not cause any race condition as well, in the worst case scenario it will trigger more lookups than necessary. Being so I agree that the complexity to add synchronicity is not worth in this case but I wouldn't mind keeping it like that.
I wouldn't mind doing this instead, but then I would prefer to do it outside the Proxy to properly resolve the name into multiple ip addresses and avoid relying on the DNS round robin to load balance, wdyt? |
This reverts commit 16924c56126e7c7ca7a960ee5c631ef5f85ded68.
This reverts commit 89cdf6f6fbcc3a07cd28204020617d6626acaa87.
jspdown
left a comment
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.
LGTM 👍
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.
LGTM 👍
kevinpollet
left a comment
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.
LGTM
|
woohoo! Thx for your effort! |
What does this PR do?
Fix the service name resolution to IP addresses for TCP services referenced by hostname/DNS.
Fixes #7167 #7354
Motivation
Currently, for TCP routers the service name resolution is done during the router setup (Proxy object) and never updated again, in this case, any changes to the actual addresses behind that hostname will have no effect unless the Traefik instance is restarted.
Moving the resolution to the connection handling allows for a fast reaction upon address changes, every connection to the server will trigger a lookup of the hostname.
Pros of this approach:
Cons:
Adds an address lookup per connectionMore
Additional Notes
I didn't notice any meaningful impact in latency while testing (basic checks with ncat), compared with v2.2, but a more intensive performance check with thousands of short-lived connections could be done if needed.