Source code used to evaluate the Kscaler CPu autoscaler in the following paper:
P. Sampat, T. Xu, S. Ghose. "CPU Autoscaling With a Kernel of Truth." In Proceedings of the 16th ACM SIGOPS Asia-Pacific Workshop on Systems (APSys), October 2025
Cloud computing paradigms such as microservices and functions-as-a-service have made autoscaling an essential component of cloud application management. However, existing autoscalers struggle at capturing application dynamics, and have difficulties with precisely allocating quotas of shared system resources to the applications. We argue that one fundamental issue is the gap between native OS resource interfaces and surrogate user metrics that existing autoscalers use. In this paper, we take CPU autoscaling as an example: the cloud interface treats CPU resources as a percentage of the host CPU (e.g., millicore), while the OS kernel interprets CPU resources as time-shared quota slices allowed to run within a set period. We advocate for OS kernel support for CPU autoscaling to close the semantic gap, as it allows the autoscaler to perform precise, highly responsive resource allocation. We demonstrate the idea by developing Kscaler, a millisecond-scale CPU autoscaler for Linux. With kernel-level observability of fine-grained scheduler behavior, Kscaler outperforms state-of-the-art CPU autoscalers in responsiveness, precision, and efficiency while employing simple statistical methods.
The testbed for this is using a QEMU VM setup with this custom kernel. The guest has Kubernetes installed with docker as it's container runtime.
Ensure that along the default kernel options, CONFIG_CFS_BANDWIDTH is also enabled
make defconfig
make -j
Kscaler exposes the following interfaces in the cgroupfs subsystem for CPUs
trace.status
trace.period_bound_history
trace.period_agnostic_history
trace.max
trace.status.: Enables / Disables Kscaler. A disabled Kscaler has no runtime overhead.
- 0 => off. All tracing and recommendation is short-circuited.
- 1 => Recommend only mode. Trace and make recommendations
- 2 => Auto mode. Trace, recommend and apply the recommendations
trace.period_agnostic_history: Period agonostic history is maintained to observe runtime within regardless of the period. Default size: 5
trace.period_bound_history: Period bound history is maintained to observe runtime within the current period. Default size: 5. This is not used much since period agnostic history captures most of the data. Still during high degrees of throttle this information can proven useful. Also it is useful to compare recommendations between the two before making a recommendation.
trace.max: Read-only file that shows what recommendations that Kscaler makes.
To enable the autoscaling, first locate the cgroupfs directory that is connected to the container/pod that needs to be observed. Then, echo to the trace.status file to start observing and potentially autoscaling.