loading...
Cover image for What is a Serverless Architecture

What is a Serverless Architecture

codecrafttechnologies profile image Codecraft Technologies ・4 min read

To define serverless architecture (SA hereafter), consider what it’s not. SA does not mean the absence of physical infrastructure or machine. SA actually is a term that is from the Enterprises standpoint.

Putting up a backend infrastructure involves time and continuous maintenance. Setting up physical machines or virtual devices, installing applications, versioning, provisioning, scaling, load balancing, fail-safe mechanism, access restrictions..the list is endless. Backend as Service(BaaS) or cloud computing, in general, alleviates much of this task by doing the heavy lifting and hence, unsurprisingly, its popularity in software development. But there exists no silver bullet for any problem.

BaaS/Cloud comes with its own challenges. Imagine a service running on any popular BaaS platform which handles ’N’ number of requests every ’M’ minutes. Let’s assume this results in CPU usage of 5 %. With this rate if you compare the time the service is processing over a period of 24 hours, then a week, month and so on… the cost of usage is extremely inefficient. Enter Function as a Service(FaaS) or Serverless architectures.

FaaS or SA enables an Enterprise to run “on need basis” server components which are:

  • Ephemeral
  • Stateless
  • Auto scalable

1. Ephemeral

A Serverless Architecture essentially comprises of functions that run for a short duration and are triggered or invoked by an event either as a common HTTP request or time-bound (Timer). When such a request rises the FaaS platform kicks in, initializes (if not already) and the function is executed. Once the execution is done the system is closed till the next execution. Hence unlike conventional BaaS “always-on” setup, we have a “not always on” serverless architecture. Please note this process would vary from provider to provider

2. Stateless

SA is best suited for stateless executions. Since the server provisioning and infrastructure is now managed by the cloud provider, there is no guarantee that the state maintained by the previous invocation of the service will be retained. This does not mean that FaaS does not support stateful operations, but just states that any state needs to be handled outside of the FaaS instance. A very good example of a state full operation which is Serverless is uploading to S3 via AWS Lambda.

3. Autoscaling

The benefits of SA are huge when it comes to scaling. Horizontal scaling is automatic and handled by the underlying platform. If the incoming traffic is high on a particular point of time multiple instances of the FaaS is invoked. If there is a lull in the traffic the instances are automatically reduced. The platform even handles the underlying resource management and allocations

Implementation/Deployment

FaaS functions can be implemented across a wide variety of languages and they do not require coding to any specific framework or any library. For eg all major providers support languages like JS, Go, etc The code/function is written and is simply uploaded. With services like AWS lambda, the code can be written in the AWS console itself. There is zero configuration required. For small to mid-sized organizations like product startup, this is a significant thing

Alt Text

Pros

1. FaaS is extremely economical when compared to an existing cloud infrastructure as we saw in the earlier example. The cost of running a FaaS setup is simply based on how often and how long it’s used.

2. Since scaling is automatic and reliable, enterprises do not have to worry about the economy of provisioning new server instances or removing unused ones. Everything is provided by the service provider

3. With the economies of scale taken care of, enterprises or developers can focus on building better solutions. Moreover reduced costs enables enterprises to innovate and test newer products with shorter development cycles

Cons

1. FaaS is completely dependent on the service provider and hence issues on the providers end like an outage, downtime, maintenance, security will have a significant impact on the Enterprises service

2. Since FaaS is essentially a stateless server, the onus for maintaining the state falls on the client. This can result in repetition of logic and data across multiple clients

3. FaaS is essentially a temporal entity. *Google Cloud Functions** for example times out after one minute(can be extended also). AWS Lambda functions are for five minutes. Unlike an “always-on” instance of BaaS, FaaS run only for a short duration*

Conclusion

Serverless architecture is simply a paradigm where the responsibility of setting up, scaling, provisioning server-side systems is delegated to another entity. It offers cost benefits, leaner development time which can have a cascading effect of benefits for an enterprise. At the same time, it simply cannot replace all the existing systems which are built on a different architecture model. What can be implemented as FaaS is context-dependent

How can an enterprise accelerate its growth by using FaaS, and other advanced Cloud architecture? Find out more by visiting us at https://www.codecrafttech.com/

Posted on by:

codecrafttechnologies profile

Codecraft Technologies

@codecrafttechnologies

Based in the Silicon Valley of India, CodeCraft is a digital transformer for enterprises by providing robust, reliable, and scalable solutions across Mobility, web, cloud, and design.

Discussion

pic
Editor guide