The Pros and Cons of Serverless Computing.
Serverless computing shares some of the characteristics of microservices and even looks quite similar, but it’s very different in the way it delivers cloud computing. There are pros and cons to both, but serverless is becoming a very attractive option for a number of reasons. Here’s why.
Pricing is the first differentiator. Serverless is pay-as-you-go, making it an attractive option for applications with infrequent or occasional traffic/requests or for start-up organisations. It also reduces operational costs as infrastructure and virtual machines are handled by a service provider/cloud vendor rather than directly on-premise, IaaS or PaaS. There are also reduced software development costs and time to market thanks to Function as a Service (FaaS) – developers create logical single-purpose functions and upload them to an infrastructure that executes them.
Scalability is also outstanding on serverless architecture – by its nature, it can handle spike loads more easily and can be automatically managed quickly and transparently. The only caveat is the maximum number of requests that can be processed making it unsuitable for high load systems.
CON: ARCHITECTURAL COMPLEXITY
Then there are architectural complexities – a mixed bag. Serverless is even more granular than microservices which provides a much higher degree of functionality but on the flip-side, much more complexity – which of course, is a trade-off. Another thing to consider is that serverless has a number of restrictions such as a limited number of requests and operation duration, as well as a limited list of supported programming languages. Its components are also cloud provider-specific meaning there is some vendor lock-in which can be problematic to change. Stateless by design, serverless must manage state strictly outside functions – no more in-memory cache! However, serverless functions can also act as scheduled jobs, event handlers etc, and not just as services. Logic has to be relatively simple, stateless and has to execute very quickly to avoid high costs.
Serverless’ level of granularity also affects tooling and frameworks – the higher the granularity, the more complicated the integration testing, making it more difficult to debug, troubleshoot and test. There should be a fully automated deployment process that includes serverless function scripts. Microservices, by comparison, is a mature approach and is well supported by tools and processes.
PRO: SPEED OF DELIVERY
Time to market also comes into play. Due to the lightweight programming model and operational ease of serverless architecture, time to market is greatly reduced for new features, which is a key driver for many businesses. It also means that prototypes can be quickly created for IoT solutions using Function as a Service (FaaS) for data processing to demonstrate new technology to investors or clients.
Although microservices still provides a solid approach to a service-oriented architecture, serverless is gaining ground in event-based architecture and clearly has advantages in terms of a reduced time to market, flexible pricing and reduced operational costs which are difficult to ignore. But it’s unlikely for now that serverless will or should be the approach for every system – but watch this space as it matures. For now, the best solution is a combination of both architectural approaches to help deliver and take advantage of the benefits the cloud brings to you and your customers.