Commit Graph

11 Commits

Author SHA1 Message Date
Milos Pesic
ef071ca958 Support CPU request override for containerized deployments (#1500)
* Support CPU request override for containerized deployments

Media processing pods intentionally omit CPU limits to avoid CFS throttling on real-time media workloads. Without a limit, NumCPU() falls back to runtime.NumCPU() which returns the full node CPU count. This could inflate the admission budget — on a 64-core node with a 15-CPU request, the monitor thinks it has 64 CPUs available and accepts too many jobs. Goruntime GOMAXPROC env variable will also be set to too high value which could affect go runtime goroutine scheduling (frequent context switches).

CPU requests are a scheduler-level concept with no cgroup representation, so cgroup-based approaches (automaxprocs, Go 1.25 container awareness) can't help. The Kubernetes Downward API can expose requests.cpu as an env var, which this change reads.

EffectiveCPURequest() in cpu.go reads the env var once at startup and NumCPU() returns it when set, falling back to platform detection otherwise — monitorProcesses picks this up automatically. A new maxprocs package caps GOMAXPROCS down to ceil(request) via init(), never increasing it beyond the current value so explicit settings and cgroup quotas are respected.
2026-04-15 22:06:34 +02:00
Benjamin Pracht
3241c3b410 Store per sub-process memory stats for debugging @biglittlebigben biglittlebigben committed 25 minutes ago (#1443)
Also some refactoring to allow easier unit testing
2026-03-06 10:09:50 -08:00
Milos Pesic
44536b2118 Make sure walking up process hierarchy happens before resource usage aggregation (#1396) 2026-01-31 02:02:26 +01:00
Milos Pesic
f89fa20a25 Make sure memory usage is not undercounted (#1394)
Previously memory usage for CPU idle process were not counted
2026-01-30 12:17:06 +01:00
Raja Subramanian
aa4dc2f24b Adjust memory usage for inactive file. (#1332)
* Adjust memory usage for inactive file.

Inactive file can be reclaimed if necessary. But, croup
memory.usage_in_bytes shows a high value if the memory has grown and
does not need to be reclaimed. So, using that inflates the actual memory
usage.

Adjust usage by discounting reclaimable inactive file memory.

* generated protobuf

* clean up

* fix stupid mistakes, thank you @milos-lk

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-08 21:53:21 +05:30
Raja Subramanian
781992d0c7 Fix paths and simplify. (#1062)
* debug memory v2

* more debug

* simplify

* clean up

* clean up

* Create young-clouds-pull.md
2025-05-05 18:56:18 +05:30
Raja Subramanian
8c4ed46b56 fix memory path for cgroups v2 (#1060)
* fix memory path for cgroups v2

* Create lazy-snails-happen.md
2025-05-05 16:14:41 +05:30
Raja Subramanian
61cc1f628d Use cgroup for memory stats. (#1031)
* Use cgroup for memory stats.

This is not going to work well when limit is not set.
It falls back to go-osstat if limits are not set.

* generated protobuf

* fall back to osstat

* generated protobuf

* maxVal

* generated protobuf

* Create pretty-gifts-look.md

* static check

* generated protobuf

* static check

* generated protobuf

* static check

* generated protobuf

* static check

* generated protobuf

* comment

* generated protobuf

* leading slash

* use physical memory

* static check

* typo, thanks DZ

* generated protobuf

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-05 11:36:55 +05:30
David Colburn
83e359fc95 platform pagesize (#936) 2025-01-06 01:24:25 -05:00
David Colburn
933b7ff014 monitor process memory usage (#914) 2024-12-10 12:20:52 -05:00
Denys Smirnov
4d22b4ce36 Move CPU stats to a separate hwstats package. Fixes #659. (#660) 2024-03-14 22:24:40 +02:00