[论文解读] On-demand Cold Start Frequency Reduction with Off-Policy Reinforcement Learning in Serverless Computing
本文提出一种基于Q-learning的强化学习智能体,通过动态调整函数实例数量(基于CPU利用率、可用实例数和响应失败率)来主动减少无服务器计算中的冷启动问题。在Kubeless上使用矩阵乘法工作负载进行评估,与默认策略和保持活跃策略相比,该智能体将吞吐量最高提升8.81%,资源浪费减少高达37%。
Function-as-a-Service (FaaS) is a cloud computing paradigm offering an event-driven execution model to applications. It features serverless attributes by eliminating resource management responsibilities from developers, and offers transparent and on-demand scalability of applications. To provide seamless on-demand scalability, new function instances are prepared to serve the incoming workload in the absence or unavailability of function instances. However, FaaS platforms are known to suffer from cold starts, where this function provisioning process introduces a non-negligible delay in function response and reduces the end-user experience. Therefore, the presented work focuses on reducing the frequent, on-demand cold starts on the platform by using Reinforcement Learning(RL). The proposed approach uses model-free Q-learning that consider function metrics such as CPU utilization, existing function instances, and response failure rate, to proactively initialize functions, in advance, based on the expected demand. The proposed solution is implemented on Kubeless and evaluated using an open-source function invocation trace applied to a matrix multiplication function. The evaluation results demonstrate a favourable performance of the RL-based agent when compared to Kubeless' default policy and a function keep-alive policy by improving throughput by up to 8.81% and reducing computation load and resource wastage by up to 55% and 37%, respectively, that is a direct outcome of reduced cold starts.
研究动机与目标
- 解决函数即服务(FaaS)平台中频繁冷启动导致的性能下降问题,冷启动会延迟响应时间并降低吞吐量。
- 克服基于阈值的反应式自动扩缩容机制(如Kubernetes HPA)的局限性,这些机制仅在需求激增后才触发冷启动。
- 开发一种无模型、离策略的强化学习智能体,学习预测工作负载需求,并提前初始化函数实例以最小化冷启动。
- 通过主动扩缩容提高平台效率,减少资源浪费并提升请求成功率。
提出的方法
- 设计一个Q-learning智能体,通过以下环境状态观测值获取环境状态:平均CPU利用率、现有函数实例数量以及响应失败率。
- 定义自定义奖励函数,对高失败率和过度资源使用进行惩罚,同时对稳定性能和低冷启动频率进行奖励。
- 在Kubeless无服务器框架上建模强化学习环境,使用Apache JMeter模拟真实世界中的函数调用模式。
- 采用离散化状态空间和延迟加载依赖项的方法,以管理状态空间复杂度并避免状态爆炸。
- 通过与环境的试错交互,在500个训练周期内训练智能体,学习最优扩缩容动作,而无需预先了解工作负载模式。
- 将智能体与基线策略(默认Kubernetes HPA和函数保持活跃策略)进行对比评估,采用吞吐量、资源使用率和失败率作为关键指标。

实验结果
研究问题
- RQ1基于实时指标(CPU利用率、实例数和失败率)主动扩缩容函数实例的Q-learning智能体,能否有效减少无服务器环境中的冷启动频率?
- RQ2与反应式HPA和函数保持活跃策略相比,基于强化学习的智能体在吞吐量和资源效率方面的表现如何?
- RQ3CPU利用率、可用实例数和失败率在多大程度上影响智能体预测和预防冷启动的能力?
- RQ4该强化学习智能体是否能在不重新训练的情况下泛化到不同工作负载和请求模式,还是对特定需求特征敏感?
主要发现
- 与默认HPA策略和函数保持活跃策略相比,基于强化学习的智能体将平台吞吐量最高提升了8.81%。
- 由于减少了不必要的函数实例创建,资源浪费降低了高达37%,这直接源于冷启动次数的减少。
- 智能体通过在需求激增前主动扩缩容函数实例,显著降低了请求失败率,从而提升了服务可靠性。
- 奖励函数有效引导智能体在过度配置和配置不足之间取得平衡,同时最小化资源浪费和冷启动发生次数。
- 在所有评估指标上,智能体均优于两个基线,证明了离策略、无模型强化学习在主动缓解冷启动问题中的有效性。
- 尽管训练迭代次数有限(500个周期),智能体仍能通过利用已获取的知识在后续步骤中补偿失败,表明其具备良好的学习鲁棒性。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。