heroku / heroku-buildpack-python

Heroku's buildpack for Python applications.
https://www.heroku.com/python
MIT License
974 stars 1.84k forks source link

Support cgroups v1 and v2 for memory limits #1599

Closed dzuelke closed 1 week ago

dzuelke commented 3 months ago

For v2, it uses memory.high if available (recommended way of setting a functioning soft limit), then first falls back to memory.max (e.g. from docker run -m), then to memory.low (e.g. from docker run --memory-reservation), and finally to memory.min.

Falls back to direct reading of /sys/fs/cgroup/memory/memory.limit_in_bytes for cases where that exists, but no full cgroupfs is mounted (e.g. on Heroku).

Limit enforcement (now to 8 TB) is still in place this way - a Docker v1 value will be read, and run into the limit for unrestricted containers, without hitting the fallback and getting returned.

GUS-W-16051944

edmorley commented 2 months ago

Cancelling review pending further discussion as a team as to next steps wrt this project.

edmorley commented 1 week ago

Closing this out until we decide the plan here.