cloudfoundry / cf-for-k8s

The open source deployment manifest for Cloud Foundry on Kubernetes
Apache License 2.0
300 stars 115 forks source link

Allow applications to specify CPU requests #608

Open braunsonm opened 3 years ago

braunsonm commented 3 years ago

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.

cf-gitbot commented 3 years ago

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.

mymasse commented 3 years ago

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?

jamespollard8 commented 3 years ago

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.

braunsonm commented 3 years ago

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.

jamespollard8 commented 3 years ago

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 commented 3 years ago

@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

  2. 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.
braunsonm commented 3 years ago

@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.
jamespollard8 commented 3 years ago

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.

braunsonm commented 3 years ago

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

Birdrock commented 3 years ago

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.

gcapizzi commented 3 years ago

@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:

Birdrock commented 3 years ago

Sounds good to me!

gcapizzi commented 3 years ago

Done: #643!

Birdrock commented 3 years ago

@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.

braunsonm commented 3 years ago

@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.

Birdrock commented 3 years ago

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

braunsonm commented 3 years ago

Not that I'm aware of @Birdrock

Birdrock commented 3 years ago

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