-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Investigate removing Activator from data path #3276
Comments
/cc @vvraskin I agree, let's try to do better 🙂 |
This has been on @tcnghia TODO list for a while, I'd love to see something better :) |
Thanks for tackling this. Yes, I think a lot of the existing quirks from golang's ReverseProxy would have be avoided if activator / queue-proxy were Envoys instead of our own homebrew proxies. So this is certain a good direction to go. |
Update: HTTPRoute mirror-ing is a dead end. The idea was to add the
The activator would call Unfortunately this returns a 503 "no healthy upstream" from Envoy immediately. Getting the impression that Istio/Envoy retries apply on the selected upstream host, and not on the route as a whole. That is, if there are 3 endpoints are available for a route, and endpoint 2 is chosen for a given request, then Envoy will only retry the request on endpoint 2. Will investigate the retries a bit more: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/http_routing#retry-semantics |
Internal redirection is a no-go. From the conditions:
We cannot guarantee the fourth condition. |
Lua filters are promising, but with a few caveats and obstacles: apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: activator
namespace: default
spec:
filters:
- filterConfig:
inlineCode: |
function envoy_on_request(handle)
headers, body = handle:httpCall(
"outbound|80||activator-service.knative-serving.svc.cluster.local",
{
[":method"] = "GET",
[":path"] = "/",
[":authority"] = handle:headers():get(":authority"),
["knative-serving-revision"] = "helloworld-test-image-w5cvg",
["knative-serving-namespace"] = "default",
},
"",
60000)
end
filterName: envoy.lua
filterType: HTTP
listenerMatch:
listenerProtocol: HTTP
listenerType: GATEWAY This filter will execute before a request and block until the target revision is activated. Obstacles:
Caveats:
Update: |
Route retries are not as promising. Modifying the activator to 1) activate the revision, and then 2) return a 503 to trigger a retry does indeed trigger a retry. However, the updated Going to explore the Envoy code to better understand if and how the cluster configuration can be updated mid-route. Update:
Looks like route retries are a dead-end as well. |
Update: Pausing until Istio 1.1 lands. |
The following Lua filter works with Istio 1.1: apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: lua-test
namespace: istio-system
spec:
filters:
- listenerMatch:
listenerType: GATEWAY
listenerProtocol: HTTP
filterName: envoy.lua
insertPosition:
index: BEFORE
relativeTo: envoy.router
filterType: HTTP
filterConfig:
inlineCode: |
function envoy_on_request(handle)
op = handle:headers():get("x-envoy-decorator-operation")
rev, ns = string.match(op, "([^.]+)%.([^.]+)")
host, port = string.match(op, "([^:]+)%:([^/]+)/")
headers, body = handle:httpCall(
"outbound|" .. port .. "||" .. host,
{
[":method"] = "GET",
[":path"] = "/",
[":authority"] = handle:headers():get(":authority"),
["knative-serving-revision"] = rev,
["knative-serving-namespace"] = ns,
},
"",
60000)
end Unfortunately, the obstacles mentioned earlier still apply. The Lua filter is not able to get route information from the virtual service. |
Interesting update: with SKS, http retries work very well: Replacing the current reverse proxy: httpStatus = a.proxyRequest(w, r.WithContext(reqCtx), target) with httpStatus = http.StatusServiceUnavailable gets us the exact same functionality. Will send in a PR to discuss. |
It is attractive to remote both activator and queue-proxy if we can, but it so then we will rely on the envoy sidecar too much, what should we do if we changed the sidecar? |
Yes, this is the discussion I want to provoke. Should we lean into Istio/Envoy and take advantage of all of its features, or do we decouple from Istio/Envoy and re-implement the features ourselves? There are pros and cons to both. That being said, it's a bit too early to say we can replace both the
|
@tanzeeb given the blockers I'd put this in Ice Box and will revisit after 0.8/v1. |
Related is this presentation of a prototype effort by @zachidan and @elevran. |
Looking at the presentation, an adapter for Mixer sounds very promising. This would be similar to the Envoy filter approach, but would have the additional route metadata from Istio that is missing in Envoy. |
Issues go stale after 90 days of inactivity. Send feedback to Knative Productivity Slack channel or file an issue in knative/test-infra. /lifecycle stale |
Stale issues rot after 30 days of inactivity. Send feedback to Knative Productivity Slack channel or file an issue in knative/test-infra. /lifecycle rotten |
@tanzeeb I think our general architecture gears towards keeping activators and enhancing their functionality. |
Rotten issues close after 30 days of inactivity. Send feedback to Knative Productivity Slack channel or file an issue in knative/test-infra. /close |
@knative-housekeeping-robot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
In what area(s)?
/area networking
Describe the feature
Currently, the activator has the following responsibilities:
Arguably, only "Reporting metrics to the autoscaler" is a problem specific to Serving.
Are there Istio/Envoy features we can leverage to reduce the work done by the activator?
The receiving, buffering and retrying of requests accounts for the majority of the code in the activator. Since the activator is in the data path on cold start, there are a lot of edge cases that the activator has to account for (eg. handling both http1 and http2, retrying on 503s, buffering and rewinding request bodies) that are handled by Istio/Envoy in the warm start data path.
Some approaches to explore:
UseHTTPRoute mirror
to mirror traffic to the activator on cold start, but use Istio/Envoy retries to handle retriesUse Istio/Envoy internal redirection to redirect the request once the revision has been activated/assign
cc @tcnghia @markusthoemmes
Edit: Updated with more approaches
The text was updated successfully, but these errors were encountered: