cf-for-k8s icon indicating copy to clipboard operation
cf-for-k8s copied to clipboard

Allow applications to specify CPU requests

Open braunsonm opened this issue 4 years ago • 18 comments

Is your feature request related to a problem? Please describe. For our usecase, the default CPU requests for CF apps is a little aggressive. We're having to scale up to more nodes than we should because of CPU requests but very low CPU utilization.

Describe the solution you'd like Similar to being able to specify memory requests, we'd like to be able to specify CPU requests in the manifest:

---
applications:
- memory: 1G
  cpu: 100m

Describe alternatives you've considered There are none since these requests are made during the staging process.

Additional context Some of our applications do not see a lot of web traffic thus do not need a lot of CPU requests. However it seems these requests are static and based on the buildpack.

braunsonm avatar Jan 13 '21 18:01 braunsonm

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/176485588

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar Jan 13 '21 18:01 cf-gitbot

Side question regarding this, where is the CPU limit calculated and set, in Eirini? Is this based on a formula that we can change similar to the CPU Weight in Garden and Diego for CF-for-VMs?

mymasse avatar Jan 15 '21 15:01 mymasse

Hey @braunsonm, thanks for the feature request here--we agree this would be great to have.

Unfortunately, we think this will be fairly challenging to implement because CF for VMS and cf-for-k8s share the same app manifest interface and Diego isn't going to be able to honor CPU limits/requests in this manner.

jamespollard8 avatar Feb 02 '21 22:02 jamespollard8

Do you see anyway we could configure this? As @mymasse said, CF for VMs has a weight that can be adjusted. Even that would help. Right now we see 10x the CPU requests over utilization.

braunsonm avatar Feb 02 '21 23:02 braunsonm

Do you see anyway we could configure this? As @mymasse said, CF for VMs has a weight that can be adjusted. Even that would help. Right now we see 10x the CPU requests over utilization.

We'll discuss this as a team at techro this week and get back to you.

jamespollard8 avatar Feb 02 '21 23:02 jamespollard8

@braunsonm

  1. We think it'd make the most sense to open an issue for this against the cloud_controller_ng repo, since that's where the changes would come in. x-linking to this issue would be great

Additional context Some of our applications do not see a lot of web traffic thus do not need a lot of CPU requests. However it seems these requests are static and based on the buildpack.

FWIW, we at first assumed that Eirini held logic about setting CPU requests but upon further inspection, we believe the CPU allocation is linked to memory as written here and is just passed-through via Eirini here

  1. For your use case, would it be possible to cf push with reduced memory? If so, that should help a bit with CPU requests.

jamespollard8 avatar Feb 03 '21 21:02 jamespollard8

@jamespollard8

Thanks James. I've created an issue here, it's also great you linked me to the code so we could modify this ourselves in a fork.

  1. Unfortunately, for apps in this use case we are requesting the minimum amount of memory possible for the Java buildpack (it requires about 850MB just to boot) and still seeing the CPU requests too high.

braunsonm avatar Feb 04 '21 01:02 braunsonm

Thanks James. I've created an issue here, it's also great you linked me to the code so we could modify this ourselves in a fork.

For sure - I'm really glad that's helpful for you.

Also, I forgot to say before, we think this is a great feature request. But it's a pretty challenging change for us so we may not be able to prioritize and complete this work for a while.

jamespollard8 avatar Feb 04 '21 19:02 jamespollard8

Eirini is tackling this one. The story with further details is here: https://www.pivotaltracker.com/n/projects/2172361/stories/177225389

braunsonm avatar Mar 09 '21 16:03 braunsonm

It looks some work has been delivered on this, so it's in flight. We'll try to fast track this work into a release as soon as the Eirini team has validated it and cut a release.

Birdrock avatar Mar 16 '21 20:03 Birdrock

@Birdrock I'm about to accept that story. If that goes well, I plan to release Eirini 3.1 and create a consolidated PR with all changes needed to bump cf-for-k8s to it:

  • #625
  • #630
  • Bump to Eirini 3.1 in vendir.yml How does that sound?

gcapizzi avatar Mar 18 '21 10:03 gcapizzi

Sounds good to me!

Birdrock avatar Mar 19 '21 00:03 Birdrock

Done: #643!

gcapizzi avatar Mar 19 '21 14:03 gcapizzi

@gcapizzi @braunsonm Does the Eirini 3.1.0 release provide enough functionality for your purposes? The title seems to indicate a desire for a more extensive feature, so I'm still hesitant to close this once we publish a release with Eirini 3.1.0.

Birdrock avatar Mar 24 '21 18:03 Birdrock

@Birdrock from my understanding my goal with this issue was a little too ambitious as it would require changes to the manifest spec and wouldn't be applicable to CF-for-vms. Which is unfortunate, however the current solution is "good enough" for us right now.

braunsonm avatar Mar 24 '21 18:03 braunsonm

Thanks for the followup. Do we have a separate feature request issue for this to keep track of appetite and feasibility?

Birdrock avatar Mar 24 '21 18:03 Birdrock

Not that I'm aware of @Birdrock

braunsonm avatar Mar 24 '21 18:03 braunsonm

I'll leave this open for now to track this feature request.

Birdrock avatar Mar 24 '21 20:03 Birdrock