Serverless computing is an architecture where code execution is fully managed by a cloud provider, instead of the traditional method of developing applications and deploying them on servers.
It means developers don't have to worry about managing, provisioning and maintaining servers when deploying code. Previously a developer would have to define how much storage and database capacity would be needed pre-deployment, slowing the whole process down.
What are functions?
Serverless relies on functions, or more specifically functions-as-a-service, where developers break down their applications into small, stateless chunks, meaning they can execute without any context regarding the underlying server.
One of the most popular function-as-a-service offerings is AWS Lambda from the market leading cloud vendor Amazon Web Services (AWS). Launched all the way back in 2014, Lambda allows developers to do just this: run code without provisioning or managing servers. AWS charges you for the compute power you use according to 100 millisecond increments. Developers can therefore focus on their code and event triggers and AWS takes care of the rest.
Events could include changes to data in an Amazon S3 bucket or an Amazon DynamoDB table; in response to HTTP requests using Amazon API Gateway; or using API calls made using AWS SDKs. For example, when a user requests a car on a ride sharing app this could trigger the code which is written to fetch a car, or clicking the 'buy' button on an app will trigger that buying process.
"Lambda is an event-driven execution environment," explains Ian Massingham, chief evangelist at AWS. "So in very simple terms you have code and events, when the event arrives the code is executed for you automatically. So you don't have to pre-position resources or have any standing infrastructure to provide the execution environment."
He adds that when the event is triggered, a piece of infrastructure is allocated dynamically to execute the code: "What happens under the covers is a Linux container is started on a machine and details - metadata about the event - is passed into the container at the point of execution."
This is opposed to even the 'traditional' deployment model within AWS itself, where "EC2 [Elastic Compute Cloud] instances run web or app servers that wait around for requests and when they come they service them. That gives you floor costs, with Lambda your cost of execution with no traffic is zero and as you start to get traffic you scale up. It is way more cost effective at low levels of usage and way more scalable at high levels of usage, so benefits at both ends of the scale."
Massingham says that it is important to note that Lambda doesn't automatically equate to serverless however. "Lambda is the execution part and serverless is a little bit bigger," he says. "Beyond compute you also want to run things like your data stores in a way which doesn't require you to operate infrastructure, a way to do identity management that doesn't require you to operate infrastructure."
Amazon CTO Werner Vogels Vogels used an old favourite metaphor during his 2016 keynote: "Before, your servers were like pets. If they became ill you had to nurture them back to health. Then with cloud they were cattle, you put them out to pasture and got yourself a new one. In serverless there is no cattle, only your application. You don't even have to think about nurturing back to health or getting new ones, all the execution is taken care of."
Serverless isn't just available to AWS customers though. IBM OpenWhisk is an alternative event-based architecture. Google has Cloud Functions for "developers to create single-purpose, stand-alone functions that respond to cloud events without the need to manage a server or runtime environment". Similarly Microsoft has Azure Functions.
Oracle also announced the serverless Fn project at the JavaOne 2017 conference. In his blog post on the subject Johan Vos, co-founder of Gluon and LodgON, wrote: "One of the key characteristics of Fn is that, although it is intended to run in cloud environments, it is not tied to a specific cloud vendor. The platform itself can be hosted on any cloud environment that supports Docker. That means you can run it on Oracle Cloud, but you can also run it on your own infrastructure or on other cloud systems, for example, Amazon Web Services (AWS), Google Cloud Platform, Microsoft Azure, and so on.
"This is a major benefit for developers. You can develop your functions completely cloud-agnostic."
Speaking on stage for his 2018 re:Invent keynote in November, Amazon CTO Werner Vogels talked about the trajectory of serverless computing, particularly with enterprises.
"We normally expect younger, tech-oriented businesses as the first ones to try this out, but what we are actually seeing is large enterprises are the ones that are really embracing serverless technology," he said. "The whole notion of only having to build business logic and not think about anything else really drives the evolution of serverless."
Vogels was joined on stage by guitar maker Fender, which has certainly swallowed the serverless message whole, using Lambda triggers to underpin its digital content pipelines and talking up its ambition to free up its developers to focus on its digital products and not infrastructure.
"Even traditional organisations, like Fender, are all going serverless," Vogels said. "The advantages are obvious, there is nothing to provision, it scales automatically, it's highly available and secure, and most importantly you only have to pay for what you use."
Going into more detail, Holly Mesrobian, director of engineering for AWS Lambda said: "Today we talk a lot about scalability, reliability, performance, security and cost. As we build out AWS Lambda we optimise for all of that in a serverless way."
Of those enhancements the one that got developers excited during re:Invent 2018 was the open source release of Firecracker, which allows for secure serverless development that doesn't cut back on performance. "We don't want our customers to make hard decisions between security and functionality," Mesrobian said.
Expanding on how it works, she said: "Firecracker provides secure and fast microVMs for serverless computing... To enable security from the ground up, it is built with speed by design, initiating code in less than 125 milliseconds and a creation rate of 150 microVMs per second, per host, it ensures scale and efficiency with low memory overhead of less than 5MB memory footprint per microVM and thousands of microVMs on each host."
The reason this got people so excited is because it brings a performance step change from Fargate, an AWS compute engine which allows customers to run containers without having to manage servers or clusters.
In his Twitch demo of the technology, Anthony Liguori launched 4,000 virtual machines, with the slowest taking 219 milliseconds.
"With Firecracker you can see we are making the same deep investments in our infrastructure to support serverless computing as we have with EC2 instances," Mesrobian added.
One company that has truly bought into the serverless hype is Danish web company Trustpilot.
Speaking during a breakout session at re:Invent 2018, VP of engineering Martin Buberl spoke about how the organisation, which collates independent reviews of products and services online, was going 'serverless first' and would be closing down its last EC2 instances by the middle of 2019.
The company had already been cloud native for five years, running a high-level architecture of event-driven microservices and REST APIs, but wanted to see the addition of serverless functions-as-a-service and event queues before going all in on the modern architecture.
His first move was to establish what Trustpilot calls its 'engineering principles' to add 'serverless first' to its architecture.
The principle reads: "We do this because we strongly believe that serverless (FaaS, BaaS, DBaaS) is the future of the cloud and we'd like to be on the forefront of that movement. Serverless might not necessarily be the right choice for everything today, but start your architecture discussions there. We're in the process of fading out virtual servers and want to avoid creating new ones."
The company has now moved to running 53 percent less virtual servers, from 180 to 95 today; 283 containers, up 354 percent from 80 in 2016, and 252 regular Lambda functions, up from 40. As a result Buberl says his "gut feel" is that its serverless architecture is now "10 times cheaper", thanks in large part to the reduction in operations overhead.
Other enterprise customers that are already moving applications to serverless with Lambda include Thomson Reuters, Finra, Hearst, Vevo and Expedia.
Serverless vendor pricing
In an analysis of serverless cloud pricing (£), Owen Rogers at 451 Research found that serverless offers a lower cost of ownership (TCO) than virtual machines (VMs) and containers for the majority of new applications.
The main cost saving comes in the form of developer time as there is no need to provision, configure and manage infrastructure, and in increased utilisation as users are only charged for the time they are actively using the platform.
The report compared serverless offerings from four main cloud providers - AWS, Google, Microsoft and IBM - and concluded that IBM offers the least expensive service, with Microsoft leading when it comes to certain configurations. IBM also stood out for Rogers because it allows users to choose exact memory requirements, where other providers round figures up.
Rogers notes that the serverless pricing model is "essentially the same model utilised by VMs, in which size and running time are the basis for cost, with the inclusion of number of times to represent the more variable aspect of serverless.
"In fact, the conceptual similarity to VM pricing might aid serverless' adoption with enterprises."
There is more good news for consumers too, as the report concluded: "considering the similarities in pricing methods and offerings between providers, 451 Research believes serverless is poised to undergo a round of price cutting this year." In short: there is no better time to go serverless.