-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Enabling reusing probe connection in activator #10228
Enabling reusing probe connection in activator #10228
Conversation
When a pod starts up, the activator probes it with the "K-Network-Probe" header to establish readiness before proxying the actual request. Since the probe (before this change) did not share a transport with the proxy, the probe connection couldn't be reused, meaning we pointlessly (and quite expensively) connected twice on pod startup. Sharing the transport allows the probe connection to be reused by the actual requests, avoiding the extra connect overhead.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: julz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report
@@ Coverage Diff @@
## master #10228 +/- ##
==========================================
+ Coverage 88.13% 88.15% +0.02%
==========================================
Files 184 184
Lines 8606 8606
==========================================
+ Hits 7585 7587 +2
+ Misses 786 784 -2
Partials 235 235
Continue to review full report at Codecov.
|
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.
We need both transports. Since for the case when there's mesh and we're talking to the k8s service we historically needed one that would be recreated on each requests.
the mesh case already uses a connection with keep-alive for probing here - that isn't changed by this PR. Also, Im pretty sure we only need to avoid keep-alive for the stats scraping case where we want to retry and get different backends each time: in activator even for the mesh case we just wait for it to be healthy at all in checkDests. |
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
/retest |
Good one! |
When a pod shows up in endpoints, the activator probes it with the
K-Network-Probe
header to establish readiness before it proxies over requests. Since the probe (before this change) did not share atransport
(and therefore a keep-alive connection pool) with the proxy, the probe connections couldn't be reused for the actual requests, meaning we're ending up pointlessly doing the (relatively expensive) connection dance twice on pod startup.This change shares the
transport
(and therefore the keep-alive pool) between the throttler and the activator handler, allowing probe connections to be reused for actual requests, and avoiding the extra reconnect.Note: before and after this change all transports are created via
pkg/network.NewAutoTransport
, so the actual transport options should be the same (other than the keep alive pool size and the fact it's now being shared) after this PR as before./assign @markusthoemmes @vagababov