Is AWS Lambda a Replacement For Servers?
It’s so tempting to jump on the cloud bandwagon and think that the latest and greatest cloud services are the magic pill for all your tech troubles. But, just like any new tech, knowing when and where to use it is essential to making it work properly for you.
Such is the situation with function-as-a-service (FaaS) offerings such as AWS Lambda and Azure Functions. The allure of being able to write an application that “just runs” in the cloud without having to worry about server provisioning, maintenance or scaling is quite appealing. This allure has driven FaaS cloud offerings, such as Lambda, to the success they now enjoy.
But such dedication to a new technology is problematic. The problem isn’t the premise of serverless computing. The problem is the adoption of specific FaaS offerings as an exclusive replacement for all your computing needs.
You see, function-as-a-service is great for certain classes of problems, but it’s not great for all computation problems. In fact, for some types of computation, FaaS is, quite simply, a bad fit.
I’ve written about serverless computation, such as FaaS, in the past. So, when I hear comments like “Lambda will take over the world—it solves all our server management problems,” I have to pause. But what bothers me the most is when someone comes up to me at a trade show and boasts, “Our new application is built 100% on Lambda—we don’t need any servers!”
When I hear statements like this, I cringe outright. This isn’t something to brag about; rather, it’s a demonstration of someone who is force-fitting a technology that wasn’t designed for a particular problem into solving that problem.
Why is FaaS not appropriate for all types of applications? Because FaaS is optimized for a specific type of computation problem, namely relatively small tasks that must happen repeatedly at a very large scale, usually in response to a stimulus or an event. If this describes your particular service need, then FaaS may be a great offering for you.
But if your application has any of the following characteristics, then FaaS may be a poor choice for you:
- Consists of compute-heavy tasks, such as crunching large amounts of data.
- Consists of tasks that are large, complex, or have complex interactions or logic.
- Requires working with large data sets or large state management systems.
- Requires consistent, reliable performance.
- Requires fine-tuning to optimize how the application operates.
When faced with applications with these requirements, FaaS fails because it:
- Makes large systems much more complex than they otherwise would have to be.
- Is expensive with large computation tasks or when managing large quantities of data.
- Has inconsistent performance that is—for the most part—outside of your control to manage.
- Does not allow you to adjust or tune your performance requirements as effectively as other computation solutions do.
FaaS is most efficient when it can take a large number of small tasks and determine holistically how to effectively process all of the requests as quickly and efficiently as possible. This holistic approach means that individual functions may or may not perform as expected. If a task requires resources beyond this controlled environment, the FaaS system cannot optimize its entire environment as effectively and hence is more costly to operate—costs that are passed on to those who create these non-typical tasks.
This isn’t to say that all serverless computing is bad. That’s just plain not true. When it comes to building cloud-native applications, many serverless cloud offerings can help you build and maintain your modern application. This is because there are many different types of serverless offerings, and I will be talking about several of these in future articles. But FaaS isn’t the solution for all problems.