Cold starts are a big challenge in Function-as-a-Service (FaaS). While most solutions focus on optimizing the runtime environment and FaaS scheduling, they often overlook the impact of FaaS implementation on cold-start latency. Dynamic languages like Python, with their extensive dependency imports and dynamic building processes, can particularly suffer from longer startup times. We propose LightLoader, an approach to accelerating Python-based FaaS (i.e., PyFaaS) cold start by debloating them and optimizing their dynamic build. LightLoader rewrites PyFaaS by converting potentially unused functions to on-demand dynamic loading, thereby reducing loading time. It also delays third-party package loading until its first use instead of importing these all at the beginning. Notably, to ensure that these rewrites do not compromise the original PyFaaS’s functionalities, we utilize a large language model (LLM) to test and repair the optimized PyFaaS iteratively. We implemented a prototype on the popular open-source serverless platform OpenFaaS and conducted an extensive evaluation with PyFaaS of various sizes and functionalities. The experimental results show that LightLoader effectively accelerates PyFaaS cold starts, reducing end-to-end latency by 11.44% on average, a 9.32% improvement over the state-of-the-art solution. It also decreases the runtime memory utilization by an average of 9.28% and up to 43.27%. LightLoader is platform-independent and can be a supplement to the optimizations of other layers.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

LightLoader: Accelerate Python FaaS Cold-Start via Multi-level Source Code Optimization

  • Pengyu Chen,
  • Wei Chen,
  • Guoquan Wu,
  • Jun Wei

摘要

Cold starts are a big challenge in Function-as-a-Service (FaaS). While most solutions focus on optimizing the runtime environment and FaaS scheduling, they often overlook the impact of FaaS implementation on cold-start latency. Dynamic languages like Python, with their extensive dependency imports and dynamic building processes, can particularly suffer from longer startup times. We propose LightLoader, an approach to accelerating Python-based FaaS (i.e., PyFaaS) cold start by debloating them and optimizing their dynamic build. LightLoader rewrites PyFaaS by converting potentially unused functions to on-demand dynamic loading, thereby reducing loading time. It also delays third-party package loading until its first use instead of importing these all at the beginning. Notably, to ensure that these rewrites do not compromise the original PyFaaS’s functionalities, we utilize a large language model (LLM) to test and repair the optimized PyFaaS iteratively. We implemented a prototype on the popular open-source serverless platform OpenFaaS and conducted an extensive evaluation with PyFaaS of various sizes and functionalities. The experimental results show that LightLoader effectively accelerates PyFaaS cold starts, reducing end-to-end latency by 11.44% on average, a 9.32% improvement over the state-of-the-art solution. It also decreases the runtime memory utilization by an average of 9.28% and up to 43.27%. LightLoader is platform-independent and can be a supplement to the optimizations of other layers.