Serverless computing has been fast gaining momentum over the past couple of years, with AWS in particular talking up enterprise adoption. So what is serverless and who is using it today?
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.\”
Other serverless options
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.
Then, at Google Cloud Next in April 2019, Google Cloud committed further to serverless computing with the announcement of the public beta availability of Cloud Run, a fully managed environment for customers to deploy applications in a \’serverless\’ way.
In a blog post published at the time, Eyal Manor, VP of engineering and Oren Teich, product management director at Google Cloud said: \”Traditional serverless offerings come with challenges such as constrained runtime support and vendor lock-in. Developers are often faced with a hard decision: choose between the ease and velocity that comes with serverless or the flexibility and portability that comes with containers. At Google Cloud, we think you should have the best of both worlds.\”
Previously Google customers could effectively run serverless using Google Cloud Functions, but with Run customers can \”run stateless HTTP-driven containers, without worrying about the infrastructure,\” according to the blog post. Customers are then charged per 100 milliseconds of usage, for \’true\’ pay as you go billing.
Cloud Run essentially spins up a Docker container on request, meaning developers can write and submit their code to the Cloud Run environment and GCP will take care of provisioning, configuring and managing servers, as well as auto-scaling to ensure customers genuinely pay for what they use.
\”There\’s all kinds of proprietary pieces of caching and performance enhancements we are able to do,\” Teich said, \”so Cloud Run manages to take advantage of the very best of everything we have built over the last 10 years to give this level of scale and flexibility without, really, any compromises.\”
Cloud Run is also being rolled out to work in tandem with the Google Kubernetes Engine (GKE), meaning customers \”can run serverless workloads on your existing GKE clusters\”. The blog post explains: \”You can deploy the same stateless HTTP services to your own GKE cluster and simultaneously abstract away complex Kubernetes concepts.\”
Oracle also announced the cloud-agnostic 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.\”
Serverless momentum
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.\”