Closed josephburnett closed 4 years ago
This is better than how the VPA works today (AIUI), but I don't think that the PA controller should alter the Deployment (the Revision controller would simply undo it). I think we should surface the recommendation in the PA's status and have the Revision controller incorporate the recommendation into the desired Deployment, which would prompt it to perform the update.
A couple of lingering concerns:
thanks for writing this up, @josephburnett
I think we should surface the recommendation in the PA's status and have the Revision controller incorporate the recommendation into the desired Deployment, which would prompt it to perform the update.
Agree.
Recommendations don't carry over from one Revision to the next (as a baseline to start from), which could lead to rocky rollouts as the new Revision is recalibrated.
They will. Maybe you missed this last sentence under the diagram:
When a new Revision is created, iff it is controlled by a Service in RunLatest or Rollout modes, and both Revisions have VPA enabled, the recommendations from the previous VPA will be used for the Revision.
(doing some triage with @mdemirhan ) Putting out of scope for "v1" with the guidance that we can chase this, but GAing this "feature" is separate (and perhaps beyond) GAing the core part of serving.
I believe a reason VPA doesn't update the deployment is due to a potential high volume of churn, is the interval of new recommendations configurable?
We need to back-propagate the VPA recommendations to the Deployment at lower rate than the recommendations are updated. Just when it will be likely that the VPA webhook will fail / elect-not-to update Pods. That is, after scale-to-zero.
Issues go stale after 90 days of inactivity.
Mark the issue as fresh by adding the comment /remove-lifecycle stale
.
Stale issues rot after an additional 30 days of inactivity and eventually close.
If this issue is safe to close now please do so by adding the comment /close
.
Send feedback to Knative Productivity Slack channel or file an issue in knative/test-infra.
/lifecycle stale
/remove-lifecycle stale
Issues go stale after 90 days of inactivity.
Mark the issue as fresh by adding the comment /remove-lifecycle stale
.
Stale issues rot after an additional 30 days of inactivity and eventually close.
If this issue is safe to close now please do so by adding the comment /close
.
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.
Mark the issue as fresh by adding the comment /remove-lifecycle rotten
.
Rotten issues close after an additional 30 days of inactivity.
If this issue is safe to close now please do so by adding the comment /close
.
Send feedback to Knative Productivity Slack channel or file an issue in knative/test-infra.
/lifecycle rotten
Rotten issues close after 30 days of inactivity.
Reopen the issue with /reopen
.
Mark the issue as fresh by adding the comment /remove-lifecycle rotten
.
Send feedback to Knative Productivity Slack channel or file an issue in knative/test-infra.
/close
@knative-housekeeping-robot: Closing this issue.
/reopen /remove-lifecycle rotten
@yashbhutwala: You can't reopen an issue/PR unless you authored it or you are a collaborator.
@vagababov @markusthoemmes is this something Autoscaling WG tracking and want to keep open?
Currently it's not on our charter.
Design Proposal
Background
The default autoscaling strategy for a Knative Revision is concurrency-based, meaning the Autoscaler tries to maintain a
target
number of requests in-flight on average for all pods. The default concurrencytarget
is100
. Knative also provides a default resource request to Kubernetes of500
millicpu.However 1/2 a cpu might not be the right resource request for an application handling 100 requests at a time. The developer can add resource requests to the Revision template, but a more "serverless" solution would be to adjust the resource requests according to the observed resource usage. That's what the Kubernetes Vertical Pod Autoscaler does.
Previous Work
We previously implemented vertical pod autoscaling in Knative by creating an Alpha VPA resource for each Revision. This had a few shortcomings that have been addressed:
200
millicpu to all containers instead of dividing it among the pod's containers. So with a concurrency of1
and aHello World
workload, VPA recommendations were too small. They have since fixed that bug and the Knative concurrency target default is much higher (100
).(See Vertical Pod Autoscaling integration with Alpha API)
There is another shortcoming that this design proposal intends to address:
Proposal
I propose that when the
autoscaling.knative.dev/vpaEnable: true
annotation is present on a PodAutoscaler (inherited from Revision template) and the Revision's Container does not include resource requests, then the PodAutoscaler controller will create aautoscaling.k8s.io/v1beta1
VPA object.Periodically (every 30 minutes at resync) the PodAutoscaler controller will back-propagate the resource recommendations from the VPA status to the PodAutoscaler status under a new field (in red below)
resourceRecommendations
.When the Revision is scaled to zero and all pods are gone, the Revision or PodAutoscaler will update the Deployment's template with the recommended resource requests and limits. This ensures that if the Revision is invoked after a long period of time (> 2 weeks) the pods will start with the resources they left off with, even if the VPA webhook doesn't have confidence to update the requests.
When a new Revision is created, iff it is controlled by a Service in RunLatest or Rollout modes, and both Revisions have VPA enabled, the recommendations from the previous VPA will be used for the Revision.