romange / helio

A modern framework for backend development based on io_uring Linux interface
Apache License 2.0
453 stars 50 forks source link

Missing cgroups support #236

Open rofafor opened 8 months ago

rofafor commented 8 months ago

The current CPU count detector in Linux only uses affinity: https://github.com/romange/helio/blob/ceaa6f844b2a72e03c1535939d21aa3fbd3c4e98/util/fibers/proactor_pool.cc#L39-L44

Modern containerized systems require use of cgroups that is used to limit resource usage and therefore it should be taken account also in Helio's CPU detection. Please, take a look at e.g. OpenJDK's implementation: https://github.com/openjdk/jdk/blob/37c2279148fa91627137e3af362bfcffde61acd0/src/hotspot/os/linux/cgroupSubsystem_linux.cpp#L449-L513

romange commented 7 months ago

wanna send a PR?