What is serverless computing?
Wikipedia describes serverless computing as: “a cloud computing execution model in which the cloud provider allocates machine resources on demand, taking care of the servers on behalf of their customers.” While this is accurate, it’s a bit dry and requires a fair amount of technical savvy to decipher. On the other hand, a few years ago I had the fortune of hearing serverless computing described to a group of students at Notre Dame University by a brilliant young engineer using a laundry analogy. It went something like this.
When it comes to laundry, you have a couple of options to get it done. You can buy your own washing machine, install it in your home and with that take on the conveniences alongside the expenses and maintenance of appliance ownership. Another option is to take your clothes to a laundromat, which doesn’t require you own a washing machine, but you still have to provide the soap and dryer sheets and a basket. Lastly, you may choose to drop your clothes off at a dry cleaner, let them know how much starch you’d like, and then come back later to pick up the finished product.
In this laundry analogy, buying your own washing machine is similar to traditional on-premises computing options. You put up some capital and then are responsible not just for the code that runs on the server, but also the hardware, network and OSlevel burden that comes with that server.
The laundromat example aligns nicely with running a virtual or containerized environment to host your application in the cloud. Think of AWS EC2. You don’t have to worry about the cleaning crew tripping over a cable and bringing down your entire application, but you are still responsible for things like configuring the operating system, security patches, etc.
Finally we get to the dry cleaner metaphor, and the point of this article. With serverless computing, you don’t normally worry much about “how the laundry gets done.” You provide your instructions (ie, the code), hand it off to your provider of choice, and then wait to get back the finished work product. While it’s not perfect for every situation, it definitely has a growing list of advantages for developers, as well as the businesses they support.
What are the benefits of serverless computing?
No server management
While serverless computing does actually run on a server — it’s not your server. It’s managed by a service provider who specializes in managing servers at scale. This means they are going to be more efficient and cost effective at these tasks than most businesses, and developers can concentrate on what they are truly good at: developing code.
Pay as you go/inherent scalability
Taking a cue from some phone plans, serverless computing typically runs under a pay as you go model. Your code runs only when it’s needed, and you don’t pay for the memory, storage or CPU when your application is idle. What’s more, serverless compute is “horizontally scalable.” This means if 10 people try to run your application at the same time, 10 separate instances of your serverless functions are “spun up” simultaneously to meet the demand.
With serverless architectures, there is no need to do mass application deployments or any sort of “backend” configuration. Developers can update parts or all of the application as independent functions. This can greatly reduce the time it takes to update, patch and add new features.
SEE: AWS Lambda, a serverless computing framework: A cheat sheet (free PDF) (TechRepublic)
Serverless computing: The best tools of the trade
As businesses and engineers embrace a serverless approach, the number of vendors providing serverless capability continues to grow. While most are built with a common set of architectural goals, there are some distinct differences among approach and implementation.
A pioneer of serverless compute, AWS Lambda is the serverless solution for some of the largest companies in the world. Originally focused heavily on Node.js, now AWS Lambda can support Node, Java, Go, PowerShell, C#, Python and Ruby out of the box and has a runtime API that will let you add more languages if required. It’s well documented, easy to get started with, and you get 1 million free requests to your resulting API every month.
Google Cloud Functions
Google Cloud Functions operates similarly to AWS Lambda, though the number of supported development languages isn’t quite as expansive. It also has a free tier; in this case, your first 2 million requests each month are covered. One way in which Google is trying to differentiate this product, is by focusing on the open source FaaS (function as a service) framework to protect its customers from vendor lock-in. In practice, most serverless applications can be written in a vendor agnostic way regardless of the service provider, but it’s often time consuming and you have to balance the tradeoffs between time to market vs the ability (and reality) that at some point you will need to lift and shift your code between service providers.
Serverless offerings like AWS Lambda haven’t hit the big time, but Kubernetes can help (TechRepublic)
Microsoft’s Azure App Service
Microsoft’s Azure has gained a lot of ground in the past few years and its App Service is no exception. Like AWS Lambda, App Service offers a wide array of development language options. The programming model itself tends to be a little more sophisticated, which means flexibility at the cost of complexity. While most of its competitors work off a straightforward model of inputs and outputs (usually JSON blocks), App Service relies on a series of triggers and bindings. The ramp-up can be a little steeper if you are used to traditional RESTful APIs, but as you come to understand it you’ll see there are advantages as well.
In terms of pricing, Azure App Service does support a pay as you go model but it also has some scenarios where you pay an hourly rate. Again this may provide another level of flexibility, but it makes deciphering the pricing plan something of a mystery. While there clearly is some kind of free tier, it’s not obvious without talking to a salesperson what that free tier consists of.
I might get some flak for including Airtable as a serverless option, because it’s a much more single-purpose solution versus a general serverless compute provider. That said, if you are only looking for simple serverless CRUD operations, Airtable offers a low-code/no-code option you might want to check out.
Final thoughts about serverless computing options
The serverless vendors listed in this article represent just a handful of what’s available in the market. There are plenty of others out there, and which one is best for you depends on your development experience, your larger computing environment and your end goals. Serverless architecture is not a magic bullet. However, the number of situations where it can provide instant scale, low up-front investment and faster development cycles is significant and growing every day.