Serverless computing is an emerging cloud paradigm that offers an elastic and scalable allocation of computing resources with pay-as-you-go billing. In the Function-as-a-Service (FaaS) programming model, applications comprise short-lived and stateless serverless functions executed in isolated containers or microVMs, which can quickly scale to thousands of instances and process terabytes of data. This flexibility comes at the cost of duplicated runtimes, libraries, and user data spread across many function instances, and cloud providers do not utilize this redundancy. The memory footprint of serverless forces removing idle containers to make space for new ones, which decreases performance through more cold starts and fewer data caching opportunities. We address this issue by proposing deduplicating memory pages of serverless workers with identical content, based on the content-based page-sharing concept of Linux Kernel Same-page Merging (KSM). We replace the background memory scanning process of KSM, as it is too slow to locate sharing candidates in short-lived functions. Instead, we design User-Guided Page Merging (UPM), a built-in Linux kernel module that leverages the madvise system call: we enable users to advise the kernel of memory areas that can be shared with others. We show that UPM reduces memory consumption by up to 55% on 16 concurrent containers executing a typical image recognition function, more than doubling the density for containers of the same function that can run on a system.
翻译:无服务器计算是一种新兴的云计算范式,能够以按需付费的方式实现计算资源的弹性可扩展分配。在函数即服务(FaaS)编程模型中,应用程序包含在隔离容器或微型虚拟机中执行的短生命周期无状态无服务器函数,这些函数可快速扩展至数千个实例并处理数TB数据。这种灵活性导致运行时环境、库文件及用户数据在众多函数实例间重复分布,而云提供商并未利用这种冗余性。无服务器架构的内存占用迫使系统移除空闲容器以释放空间,进而因冷启动增加与数据缓存机会减少而降低性能。针对此问题,我们提出基于Linux内核同页合并(KSM)的内容页共享概念,对内容相同的无服务器工作节点内存页进行去冗余处理。由于KSM后台内存扫描进程在短生命周期函数中定位共享候选页的效率过低,我们将其替换为自主设计的用户引导页合并(UPM)——基于madvise系统调用的内核内置模块:允许用户向内核标注可与其他进程共享的内存区域。实验表明,在同时运行典型图像识别函数的16个并发容器场景中,UPM可将内存消耗降低55%,使相同函数的容器在系统中的可承载密度提升一倍以上。