By: Shankar
June 14 2019

Serverless 101: A Comprehensive Guide

At first, it was the physical server that hit the ground running. Subsequently, the virtual machine took over with better functionalities. Now, the adoption of serverless computing is happening at an astonishing pace in the developer ecosystem. The significant hurdle that you see with physical servers is their management which is rectified by the virtualisation via emulation of real system and thereby streamlining the management of different functions. Now, serverless architecture is making life even easier for developers.

Illustration showing serverless architecture and people standing with their laptops and phones


Basically, in serverless architecture, you will have servers running code out there somewhere and won’t have to bother yourself about those servers. It might sound beneficial for the developers but not so much as revolutionary. Now ponder over the intricacies of modern software development where programmers have to encounter the burden of issues related to performance, scalability, security, user privacy, and many more. Serverless helps in the provision of simplistic ways for developers to develop new software along with an accepting community that assists them along the path for gaining a better understanding of their craft and also become professional developers. Furthermore, experienced programmers, with the help of serverless, are able to focus upon writing code rather than the governance of servers or sharding databases.

Serverless architecture alters the way developers create, deploy, and govern applications but also has implications for business decision making and organisational structure. Understanding all of that would require you to press the green button on your time machine and go back a few years down the line to see how this concept evolved in the first place

Evolution of serverless

The long road to serverless has been compiled in Serverless is More: From PaaS to Present Cloud Computing. It analyses the evolution of computer technology, which dates back to 1960, that resulted in the concept called serverless computing. It distinguishes the main dimensions (Containerised Resources, Code as Functions, Naming and Discovery, Functions as Computation, Execution Flows, Events to Trigger Functions) of the critical breakthroughs that made serverless possible.

Flowchart showing boxes and arrows to explain serverless history
ResearchGate

Martin Fowler states that the term ‘Serverless’ had first appeared around 2012 (for instance, this piece by Ken Fromm). The term was also heard by Badri Janakiraman around this time vis-à-vis continuous integration and source control systems that are hosted as a service rather than on a company’s own servers. It grew in popularity in 2015 after Amazon Web Services (AWS) Lambda was launched in 2014 and Amazon’s API Gateway in 2015. The preeminence of serverless grew even stronger by 2016 as Google Cloud Functions and Microsoft Azure Functions entered the market, Serverless Conferences were being held and Serverless vendors started adopting the term in their product marketing and job descriptions.

Serverless: A paradigm shift

Google Cloud states that “serverless computing is a paradigm shift in application development that enables developers to focus on writing code without worrying about infrastructure”.

Serverless computing is a paradigm shift in application development that enables developers to focus on writing code without worrying about infrastructure

According to Martin Fowler, Serverless was first used to explain applications that significantly or fully incorporate the third party, cloud hosted applications and services for governing server-side logic and state. Typically, these are rich client applications that leverage cloud-accessible databases, authentication services and so on. Such kinds of services are known as (mobile) Backend as a Service (BaaS). Also, serverless can refer to the applications where server-side logic is written by the developer and is run in stateless compute containers that are event-triggered, short-lived, and fully managed by a third party known as Functions as a Service (FaaS).

Advancements in computing technology have enabled the serverless environment and new business models and the paradigm shift in the organisational mindset are driving the adoption of serverless by enterprises.

Serverless vs Containers

Table with rows and columns to compare serverless and container


Pros and Cons

As serverless computer services, that constitutes small snippets of code for the execution of a single function, are executed on pre-existing servers, you do not have to worry about any infrastructure to govern. Serverless does not necessarily mean that you get NoOps for the service consumers but it can, of course, mean Less-Ops as debugging, troubleshooting, testing and other such operations do exist and infrastructure governance is fully outsourced to cloud service provider.

In comparison to other cloud services, serverless architecture incurs minimal costs. Things like presence detection, access authorisation, security, image processing, and other costs incurred when operating a server get nullified in a serverless architecture.

Bar graph in blue and grey colours showing serverless cost benefits
Cloudfare

Serverless offers immense scalability and high availability out of the box. Serverless functions can scale horizontally in an entirely automatic and elastic manner depending upon the user traffic and everything is managed by the cloud service provider. Moreover, Serverless functions can minimise latency to a great extent as they do not operate from an origin server which means that there is no single location to which end user’s traffic has to be directed to. Serverless computing functions are not just easy to build but need minimal coding knowledge thereby minimising software intricacy.

Security concerns like function event data injection, unsafe serverless deployment configuration, insufficient monitoring and logging of functions, unsafe third party dependencies and DDoS attacks can be problematic in serverless architecture.

Serverless computing puts you in the situation of vendor lock-in. Also, everytime a serverless instance is created, it leads to new version of itself and that means it is a formidable task to collect data required to debug and fix a serverless function.

Considerations related to architecture

There are significant architectural considerations that you must adhere to. Serverless functions are stateless i.e. that any sort of resource inside a function won’t exist after the function stops to exist. Serverless functions are also short-lived so you should persist only for a certain time period. You should also consider the different languages for development that the serverless services support. For instance, NodeJS, Python, and Java are supported by AWS Lambda. Languages like C# and JavaScript are supported by Azure functions. Only JavaScript is supported by Google functions. Therefore, platform selection also dictates the preference of language for development.

Cold start, which happens when, for the first time, an inactive or cold function is invoked, can skyrocket the execution time and affect the performance of application if not governed well. Making sure that functions are alive or hot before execution is paramount. Also, using relational database in serverless computing can lead to scalability and performance challenges. Serverless functions don’t give you file systems level access too. Having out-of-the-box logging and monitoring mechanisms can be an architectural and operational shift if an enterprise has been leveraging custom tools for similar purposes.

Best practices

As serverless functions are stateless and ephemeral, writing single-purpose codes for function is a good practice. And it is of great importance to design push-based and event-driven architecture patterns in addition to the execution of intricate functionality at the frontend via rich client side application framework. The latter results in the reduction of cost as the function calls and execution times are minimised.

Integration of relevant security mechanisms at the API Gateway layer and at the FaaS layer is necessary. Furthermore, look out for functions that are acting as a speed-barrier and are slowing down a particular service. Determining which functions are acting as a hindrance to great performance is essential for the provision of awesome customer experience. Selecting the right third party tools is important too for better utilisation of serverless features.

Use cases

Serverless is a marvellous option for automation and swift deployment processes. The notion of running the code only when an event is triggered aligns well with Continuous Integration principles. Segregation of your codebase into functions assists in fixing bugs and rolling out updates. Serverless applications are also great for resizing images, altering video transcoding or cognitively assess data on photos taken by drones.

With the ability to process events in parallel and easily cope with heavy workloads, serverless frameworks turn out to be an amazing solution for virtual assistants and chatbots. Also, going serverless way helps you to extract the power of its real time response nature for Internet of Things use cases. For instance, motion-activated cameras in combination with apps that react to alterations in weather or health conditions are a great fit for serverless approach that makes sure that your services are available 24x7.

What the future holds for serverless?

Serverless has seen staggering growth. The future looks bright as well. MarketsandMarkets, in a report, states that the serverless architecture market is anticipated to reach USD 14.93 billion by 2023 at a Compound Annual Growth Rate (CAGR) of 28.6% during the forecast period of 2018 to 2023. And as per RightScale’s State of the Cloud report, Serverless is the fastest growing cloud service model with an annual growth rate of 75%.

Conclusion

Nick Rockwell, Chief Technology Officer, revealed that when he argued that serverless architecture is “a huge innovation and will take over” at O’Reilly Media’s Velocity Conference in 2017, it was not very well received back then. It wasn’t long before the world saw the stunning growth of serverless.

Now, the astonishing rise of serverless is dramatically enhancing the productivity of applications developers and infrastructure and operations (I&O) administrators responsible for governing public cloud services.

We have been in the constant pursuit of offering ambitious digital experience and have been doing that via a suite of services.

Contact us at [email protected] to get the best out of serverless computing and revel in its amazing benefits.