Challenges and Opportunities in Sustainable Serverless Computing
This transcript was made by AI. The open source speech recognition model Whisper (large-v3-turbo) transcribed the recording with faster-whisper. Names and technical terms were checked against the paper, but it can still contain mistakes. The recording is the reference.
0:02 Thank you. And our next speaker is Prateek Sharma, who's going to talk about serverless computing as a more sustainable computing activity. All right. Hi, everyone. Thanks for the introduction, Andrew. So my name is Prateek Sharma. I am from Indiana University, and I'm very excited to talk about some of my ideas in making serverless computing sustainable. Unlike the previous speaker, I don't have a long disclaimer. So we have all heard that, you know, cloud data centers are amazing, they're very efficient, and there's this big push towards sort of decarbonizing them. So I'm not going to give you that speed again. But I think it's important to start looking at software and the cloud abstractions that applications and we all use and see what are the energy and carbon implications of these abstractions, right?
1:08 So hardware virtual machines have been the long standing workhorse of infrastructure as a service and clouds, then we move to more lighter and finer grained forms of virtualization with OS containers. And these days, it seems to be all about serverless functions, right? So these functions are a service like Amazon Lambda initially are extremely convenient and popular among applications and users because they allow fine-grained scaling, scale to zero, scale to infinity, fine-grained payment, etc. And users have found it fairly easy to develop cloud-native applications by using this abstraction, right? So for ML inference, IoT, web serving, and these days, even a large amount of scientific computing workflows are using serverless computing.
2:06 Bit of a spoiler there. But let's now take a quick look at how do you actually, how does a cloud provider actually provide these functions as a service? And what are the energy implications of this abstraction, right? So the serverless model has a unique programming and deployment model where the users provide the function source code to the cloud provider, which takes care of all the aspects and headaches of placing this function and running it safely on some cloud server, right? So before it can actually launch this function, it has to sandbox it, typically by using something like Docker, and that creation and that instantiation of a sandbox takes some resources and some time. So the horizontal axis here is the amount of time that each of these steps is taking, right?
3:03 And the function actually only runs after this amount of time, right? So it's a fairly small proportion of time that the actual user product function is taking computing resources, right? Before a function can even be launched on a server, it has to go through the functions as a service control plane, uh, like OpenWhisk, which is the most popular open source, uh, FaaS control plane, right? This control plane itself is a fairly large, intricate, highly distributed. It's composed of many controllers, a distributed load balancer, distributed message queues, and a lot of small databases, as this function makes its way, uh, through this control plane, actually starts to finally run. So this control plane overhead can also be very significant and very frustratingly, very high variance, uh, up to about two orders of magnitude, uh, in terms of time that is spent just to be able to run this function.
4:04 So this sandbox invocation time is typically, uh, called the cold start problem, because you create the sandbox for every, uh, every single function invocation, if that is not already resident in memory. So a lot of people have looked at, uh, uh, reducing the sandbox, uh, the sandbox overhead, uh, but that is only this small part of this entire timeline. So what are the energy implications of functions as a service compared to the more classical deployment models, where you just run a fast CGI HTTP server? So, uh, yes. So let's look at the figure on the right, which looks at what is the energy per request for a very simple HTTP request, uh, deployed on a simple static HTTP server, uh, with, uh, with Docker as a sandbox.
5:06 And then you start the HTTP server, make a response and shut that down. And then with Firecracker, which is a lightweight KVM based virtual machine, which is becoming quite popular. You see that without the serverless computing abstractions, you get about 0.6 joules per request. This is measured on my laptop and with Docker is about nine. So that's close to 15 times higher than native and Firecracker is of course, much worse because it has to create a full, full fledged virtual machine.
5:39 So there are, uh, this is only an initial thing. There are many caveats to this number. First, these, these two are cold starts. So you have to create the sandbox. However, this container does not have a FaaS runtime or any dependencies. So effectively we are only accounting for this first portion of the cold start overhead. The other two, the other three components are not applicable in the scenario. So it's the best case cold start that you can get for serverless functions. This also does not account for this entire blue control plane overhead. So there is no OpenWhisk running again for expediency because that's a distributed control plane. And in my sort of my experiments, the, the variance and the jitter in terms of energy footprint of a distributed control plane, like OpenWhisk is very high and very challenging because of some of the issues presented in the previous session.
6:39 You effectively have to monitor the energy usage of a large distributed system at a fine grain level, which has many challenges. So it seems that the, so the takeaway message here is yes, this abstraction is good. Many applications are using it, but it has this very severe energy penalty. So are we stuck with this, right? Like, do we have to make a strict trade-off between, you know, abstractions, this specific abstraction and the energy overhead? Or can these two somehow work together, right? Can we have serverless computing and sort of low carbon cloud computing at the same time? So that's the kind of a question that I've been looking at. So I think that we can achieve, or at least mitigate the carbon overhead of serverless abstractions by using sort of two key principles.
7:40 The first is to use this programming model, which has an overhead, but use it in new ways to give us new control knobs for energy optimizations across clouds and across distributed edge clouds. That's the first one. And the second is sort of maybe also rethink how applications use functions as a service in order to help decarbonize. So I'm going to talk about briefly two main techniques that I'm excited by and I'm working on. The first is sort of brand new control plane with carbon pricing for sort of each function invocation. So you can charge each function for the amount of carbon that it produces. And the second is a technique inspired by smart grids, which is demand response, make functions and applications more agile in terms of how they can respond to energy changes.
8:41 So we need a new FaaS control plane, both for sustainability research and for serverless computing research. Because the currently available ones like OpenWhisk have too much of a performance overhead and variance, which makes it very hard to do sort of efficiency research. So this control plane has to have energy as a first class resource for accounting and monitoring and optimizations. This is challenging because again, doing this fine grain attribution on a per invocation basis is difficult for distributed systems. And also fairly accounting for this control, this shared control plane among many concurrent function invocations is challenging. And we can look at very different techniques to maybe address this, some kind of tracing, sampling, and maybe some kind of Shapley value based attribution of how much of the control plane overhead should be attributed to which function.
9:43 We may also need to leverage the fact that functions are repeatedly called and are often having the same resource footprint. So we may be able to provide carbon pricing at an average level, so we can have a running average of the carbon footprint for a given function, instead of focusing on what is the invocation, what is the footprint of a single invocation. And I think this might be one place where some simple statistical learning techniques may be effective. The second thing I'm excited by is to build up some kind of function level demand response, which as I said earlier is a key technique in smart grids, wherein the energy consumer can get to decide and react to dynamic energy pricing and availability. So in our case, and that's typically done by shifting the load around in time or reducing consumption.
10:45 So can we have something similar for functions? So I envision this again, this energy aware control plane, which gets the supply side dynamics about the energy. What is the energy price, what is its carbon footprint, carbon mix, etc. Feeds that to the FaaS control plane and the individual functions, which can then get to decide whether they want to shift the load, you want to do peak shaving or load shaping, which are sort of standard techniques from smart grids. So the FaaS programming model gives us sort of many and new control knobs, which previous abstractions do not or only have with various levels of difficulty. So the first axis is you can shift functions around in time in terms of when they get to finish. So we can have different scheduling algorithms depending on the energy and carbon availability of the system.
11:48 At some point in time, you can delay some delay tolerant functions. You can also aggressively scale your cluster if you are running out of renewable energy, for example, and slow all the functions down. The second axis is in terms of moving functions around in space. So in distributed clouds, you can have some data centers or some edge sites powered by different mix of renewable energy and different carbon footprint. So you can fairly easily compared to previous abstractions, move functions around to the correct place of execution, which has a lowest carbon footprint. Of course, this has to be combined with the latency trade offs, the users, the place where this function runs has to be also close to the original source or the user. So I think these latency and carbon aware policies represents this new exciting area to work on.
12:46 And the last knob is that because of the programming model, you can have different implementations of the same function, which takes the same input and produces same or similar output. And these different implementations can have different energy footprint. For example, you can run a simpler or lighter weight machine learning model for inference, which will have some accuracy trade off compared to the time and the energy usage. So these are sort of ideas from approximate computing, which are also going to be relevant here. So we can have users provide us or way to generate different variants of the same function. And the control plane can then pick based on energy availability, which implementation to run. So I think these three axes and a combination of these three dimensions presents a wide range of policy design space for systems researchers.
13:48 So to conclude, I think that functions as a service is sort of an important and a growing cloud workload, which we should take seriously from an energy standpoint because of its current overheads. But this programming model also provides new and I think fairly exciting control knobs for us to play around and reduce the overall carbon footprint of our cloud applications. Through carbon pricing, the fact that functions are more or less location independent demand response and new energy based scheduling and scaling policies. And I think that this is the right time to do this FaaS control planes are not fully developed or ossified. So there is still time, the right time to make important changes to make energy as a first class parameter for tracing and accounting throughout the control plane.
14:42 Implement this at scale and the FaaS control plane also has the right visibility. It processes millions of functions, so it can use learning techniques to reduce overall footprint. I'll be sort of happy to talk about more later on, but I'm working on these two things currently, which is we really need a good empirical understanding of the energy footprint of functions. The data, the data that I presented is obviously an initial very 0th order version and the trade-offs in energy and performance. And yeah, we need a new control plane, which is low overhead, which has distributed energy tracing. And that is something that I'm currently actively working on. And please ask me any questions now or later about that or anything else. Thank you. Thanks, Prateek.
15:34 Any questions for Prateek? I have one. Yeah. So I tend to think of these serverless or function as a service platforms as being this complicated mix of all kinds of applications mixed together. So how does that make easier or make harder, you know, the kinds of challenges you're talking about? Yeah, I think that's a good point. That makes it, I think, more challenging the heterogeneity of the workload mix because of the scale of execution. Some can take a few milliseconds, some can take several minutes and coming up with general policies that work across different classes of functions and also at different frequencies. I think that's going to be a major challenge. It, I don't think it makes a problem easier. And I think that's one factor why some prior work on which addresses similar issues in context of microservices may not directly apply.
16:29 Because we need to deal with this heterogeneity, which internal microservices workloads may not have had to. Yeah. Other questions from Prateek? Hi, it's Yibo from UC San Diego. So I kind of want to ask a follow-up question, which is, as we move to this FaaS model, you're relying on more and more cloud services like storage or external networking or replication. So, and I think this kind of makes the track energy tracking harder because you're depending on many different other services that the cloud is providing. Right. And do you think like this kind of requires a whole redesign of every aspect of the cloud offering? I hope not, but I think that's absolutely right. That's a major challenge. And I think the other thing I forgot to mention is sort of, you know, energy disaggregation, which is also a common problem in things like NILM, et cetera.
17:30 Right. So by looking at the aggregate energy consumption of a service or a server, can we tell which components are responsible for what fraction? And I think we may have to use a combination of sort of hardware tracing and these software models for coming up with the best guess or a close estimate to a fair power estimation for different cloud components. Perfect. The next speaker set up here. Anyone have a last question for Prateek? Please. Please.