cloudfoundry / cflinuxfs4

Apache License 2.0
1 stars 6 forks source link

Optimize memory requirements for linuxfs4 stack #19

Closed CzernyJ closed 3 months ago

CzernyJ commented 5 months ago

For my app I switched from linuxfs3 stack to linuxfs4 stack. But now the required app memory has increased from 512MB to 2GB just to satisfy the build step.

Is there some way to optimize the memory requirements for the linuxfs4 stack? Overprovisioning 1,5 GB seems wasteful to me.

The app is vendoring its nodejs dependencies and is deploying its own version of node in combination with a binary buildpack.

The error log shown with less than 2GB memory is:

  2024-05-06T12:04:45.37+0200 [API/0] OUT Scaling process: "web"
   2024-05-06T12:04:45.40+0200 [API/0] OUT Updated app with guid 6f045afb-4996-4670-99ba-8b6a9e0d7f33 ({"lifecycle"=>{"data"=>{"buildpacks"=>["https://github.com/cloudfoundry/binary-buildpack"], "stack"=>"cflinuxfs4"}}})
   2024-05-06T12:04:45.42+0200 [API/0] OUT Updated app with guid 6f045afb-4996-4670-99ba-8b6a9e0d7f33 ({"environment_variables"=>"[PRIVATE DATA HIDDEN]"})
   2024-05-06T12:05:53.14+0200 [API/0] OUT Uploading app package for app with guid 6f045afb-4996-4670-99ba-8b6a9e0d7f33
   2024-05-06T12:08:21.60+0200 [API/3] OUT Creating build for app with guid 6f045afb-4996-4670-99ba-8b6a9e0d7f33
   2024-05-06T12:08:22.67+0200 [STG/0] OUT Cell 9e3dc1a4-1f34-4a24-a6cc-66062ffc7b6b creating container for instance db051920-5f87-405c-b34e-f63e6aca68fe
   2024-05-06T12:08:23.08+0200 [STG/0] OUT Security group rules were updated
   2024-05-06T12:08:23.10+0200 [STG/0] OUT Cell 9e3dc1a4-1f34-4a24-a6cc-66062ffc7b6b successfully created container for instance db051920-5f87-405c-b34e-f63e6aca68fe
   2024-05-06T12:08:23.30+0200 [STG/0] OUT Downloading build artifacts cache...
   2024-05-06T12:08:23.30+0200 [STG/0] OUT Downloading app package...
   2024-05-06T12:08:36.87+0200 [STG/0] OUT Downloaded build artifacts cache (165.1M)
   2024-05-06T12:08:44.34+0200 [STG/0] OUT Downloaded app package (213.1M)
   2024-05-06T12:08:47.12+0200 [STG/0] OUT -----> Download go 1.19
   2024-05-06T12:08:52.28+0200 [STG/0] OUT -----> Running go build supply
   2024-05-06T12:08:52.28+0200 [STG/0] OUT /tmp/buildpackdownloads/17054d1ac63ed6f7 ~
   2024-05-06T12:08:53.55+0200 [STG/0] OUT ~
   2024-05-06T12:08:53.70+0200 [STG/0] OUT -----> Binary Buildpack version 1.1.11
   2024-05-06T12:08:54.41+0200 [STG/0] OUT -----> Running go build finalize
   2024-05-06T12:08:54.41+0200 [STG/0] OUT /tmp/buildpackdownloads/17054d1ac63ed6f7 ~
   2024-05-06T12:08:55.33+0200 [STG/0] OUT ~
   2024-05-06T12:09:04.56+0200 [STG/0] OUT Exit status 137 (out of memory)
   2024-05-06T12:09:05.08+0200 [STG/0] OUT Cell 9e3dc1a4-1f34-4a24-a6cc-66062ffc7b6b stopping instance db051920-5f87-405c-b34e-f63e6aca68fe
   2024-05-06T12:09:05.08+0200 [STG/0] OUT Cell 9e3dc1a4-1f34-4a24-a6cc-66062ffc7b6b destroying container for instance db051920-5f87-405c-b34e-f63e6aca68fe
   2024-05-06T12:09:05.15+0200 [API/0] ERR Failed to stage build: staging failed
sophiewigmore commented 4 months ago

Hey @CzernyJ this is a strange issue, but there's no way to modify this through the stacks. After talking with @robdimsdale, we're not convinced that this issue is coming from the stacks/buildpacks as they're not dealing with the space allocation. It might be an issue with another component (Rob had suggested CAPI possibly).

robdimsdale commented 3 months ago

As sophie mentioned, I think this is probably a setting in the Cloud Controller where it defaults to 2GB for apps on the cflinuxfs4 stack but only 512MB on the cflinuxfs3 stack.

As this isn't something we can fix at the stack level I am going to close this issue.