Developing applications used to be an expensive business, requiring upfront capital investment in hardware and software before a single line of code was generated. As we know, cloud computing changed all that, and now online services providing hardware and software resources exist to fit all needs and budgets.
Until recently, however, those cloud-hosted services have looked pretty much like ones that – given the resources and the need – your business could itself have developed. In other words, they have tended to be monolithic chunks of code designed to be run on a single server, whether hosted locally or in the cloud.
The implication is that hardware to run those applications still needs to be provisioned, configured and paid for in order to execute the application. But now there’s a better way forward.
What is serverless?
Serverless computing lets you write and deploy code without the hassle of managing the underlying infrastructure. While servers are of course still required to run the apps – or (more accurately) functions – the architecture is designed so that the developer doesn’t need to worry about server management, or to make capacity planning decisions.
How can this be? A typical serverless app will consist of a number of functions – which is why you will find serverless platform providers offering functions-as-a-service (FaaS). Each function is a component of the app, linked together at the back end by the provider’s platform, or by third-party networks. The mechanics of how that works are the province of the provider, who manages the process and charges on the basis of business functionality delivered, not hardware. In other words, this is pay-as-you-go code execution.
Serverless code is usually event-driven. Developers need only concern themselves with creating code that behaves in a specific manner in response to specific inputs; modular code that runs independently of the rest of the app, in other words. It runs when triggered, and once it has completed its task it spins down, awaiting the next invocation.
Among the core benefits of serverless is greater cost-effectiveness, as you pay only for the time taken to execute code, not for idle time. And because serverless functions can be invoked in fractions of a second, charges can be highly granular. It also enhances developer productivity by focusing on what matters the most: building applications and abstracting away issues around hardware and compatibility, or back-end details such as multi-threading.
For example, instead of paying to run an always-up database server, a FaaS function might respond to an http request from the client. Being serverless, however, it does not need to be running all the time, unlike a traditional database server How that request is routed at the back end is the responsibility of the FaaS provider, thus off-loading a raft of provisioning and management decisions from the developer or SMB. This also means that the function is automatically scalable: a serverless function will run when required, without having to be provisioned.
Serverless offers zero server management, no upfront provisioning, auto-scaling to meet traffic demands, and is cost-effective: you only pay for the resources used. It’s still early days but the signs are clear: serverless saves you money and can cut complexity.