8000 outbound: TCP discovery and load balancing by olix0r · Pull Request #652 · linkerd/linkerd2-proxy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

outbound: TCP discovery and load balancing #652

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

Merged
merged 15 commits into from
Sep 9, 2020
Merged

outbound: TCP discovery and load balancing #652

merged 15 commits into from
Sep 9, 2020

Conversation

olix0r
Copy link
Member
@olix0r olix0r commented Sep 7, 2020

The proxy only forward TCP connections to the original destination address, never
using the mesh's mTLS.

This change modifies the outbound TCP forwarding stack to do discovery based on
the original destination address, resolving service IPs to the individual endpoint IPs
(and their associated identities). This enables mTLS for meshed TCP connections.
When the endpoint cannot be discovered (i.e. due to an InvalidArgument response
from the controller), the connection is forwarded as before.

The PeakEWMA balancer is repurposed for this, using connection latency (and
pending connections) as the load metric. In the future, this should be modified
to count active connections towards the load (but this won't Just Work with the
PeakEwma balancer, so this is deferred for now).

This has been tested manually.
In follow-up changes, we'll extend the transparency tests to validate this behavior.

Copy link
Contributor
@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pleasantly surprised by how little is going on here! this looks good so far.

8000
Comment on lines 5 to 8
#[derive(Clone, Debug)]
pub struct MakeThunk<M> {
make: M,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be nice to have a comment explaining what this thing does exactly, for future readers?

i agree that MakeThunk describes what it does in a general sense, but it might be worth naming it something that uses tower/linkerd-specific language? e.g., when i wrote a version of this for the control plane connector (which we no longer use), i initially named it Curried, and then thought that seemed too abstract, and called it WithTarget.

sorry for bikeshedding, it fundamentally doesn't matter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I documented it. I don't think WithTarget is all that clear, personally (especially when compared with MapTarget -- I'd expect WithTarget to take a constant target to be reused for all requests, or something...). Anyway, we can easily change this later.

@olix0r
Copy link
Member Author
olix0r commented Sep 9, 2020

Tested via https://github.com/olix0r/init-net-test/blob/b3860861c54344667a797ece5b685a0574798fb3/k8s.yml -- appears to work. We'll want to do some deeper burnin testing, and we'll definitely need to improve metrics, etc; but I don't think any of that needs to block this moving forward.

@olix0r olix0r marked this pull request as ready for review September 9, 2020 21:58
@olix0r olix0r requested a review from a team September 9, 2020 21:58
Copy link
Contributor
@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall, this looks good to me, though i had a few nits.

@olix0r olix0r requested a review from hawkw September 9, 2020 22:40
Copy link
Contributor
@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@olix0r olix0r merged commit 4bac424 into main Sep 9, 2020
@olix0r olix0r deleted the ver/tcp-lb branch September 9, 2020 23:00
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Sep 10, 2020
This release includes several major changes to the proxy's behavior:

- Service profile lookups are now necessary and fundamental to outbound
  discovery for HTTP traffic. That is, if a service profile lookup is
  rejected, endpoint discovery will not be performed; and endpoint
  discovery must succeed for all destinations that are permitted by
  service profiles. This simplifies caching and buffering to reduce
  latency (especially under concurrency).
- Service discovery is now performed for all TCP traffic, and
  connections are balanced over endpoints according to connection
  latency.
- This enables mTLS for **all** meshed connections; not just HTTP.
- Outbound TCP metrics are now hydrated with endpoint-specific labels.

---

* outbound: Cache balancers within profile stack (linkerd/linkerd2-proxy#641)
* outbound: Remove unused error type (linkerd/linkerd2-proxy#648)
* Eliminate the ConnectAddr trait (linkerd/linkerd2-proxy#649)
* profiles: Do not rely on tuples as stack targets (linkerd/linkerd2-proxy#650)
* proxy-http: Remove unneeded boilerplate (linkerd/linkerd2-proxy#651)
* outbound: Clarify Http target types (linkerd/linkerd2-proxy#653)
* outbound: TCP discovery and load balancing (linkerd/linkerd2-proxy#652)
* metrics: Add endpoint labels to outbound TCP metrics (linkerd/linkerd2-proxy#654)
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Sep 10, 2020
This release includes several major changes to the proxy's behavior:

- Service profile lookups are now necessary and fundamental to outbound
  discovery for HTTP traffic. That is, if a service profile lookup is
  rejected, endpoint discovery will not be performed; and endpoint
  discovery must succeed for all destinations that are permitted by
  service profiles. This simplifies caching and buffering to reduce
  latency (especially under concurrency).
- Service discovery is now performed for all TCP traffic, and
  connections are balanced over endpoints according to connection
  latency.
- This enables mTLS for **all** meshed connections; not just HTTP.
- Outbound TCP metrics are now hydrated with endpoint-specific labels.

---

* outbound: Cache balancers within profile stack (linkerd/linkerd2-proxy#641)
* outbound: Remove unused error type (linkerd/linkerd2-proxy#648)
* Eliminate the ConnectAddr trait (linkerd/linkerd2-proxy#649)
* profiles: Do not rely on tuples as stack targets (linkerd/linkerd2-proxy#650)
* proxy-http: Remove unneeded boilerplate (linkerd/linkerd2-proxy#651)
* outbound: Clarify Http target types (linkerd/linkerd2-proxy#653)
* outbound: TCP discovery and load balancing (linkerd/linkerd2-proxy#652)
* metrics: Add endpoint labels to outbound TCP metrics (linkerd/linkerd2-proxy#654)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0