Bun: cgroup-aware AvailableParallelism / HardwareConcurrency on Linux (github.com)

Bun PR #28801 makes Linux’s `navigator.hardwareConcurrency` and `os.availableParallelism()` cgroup-aware so containers report constrained CPU limits instead of host core counts. It routes CPU core detection through a WebKit-side `WTF::numberOfProcessorCores()` that considers `sched_getaffinity` and the cgroup `cpu.max` quota, aiming to prevent containers from spawning too many threads and hitting throttling/latency issues. The change also updates Bun’s internal thread/JSC sizing to use the same core-count source, with notes that cgroup CPU limit changes at runtime are not automatically re-detected.

April 03, 2026 16:41 Source: Hacker News