Serverless architecture is a cloud-native development approach that allows developers to build and run applications without having to worry about managing the servers. In serverless, all the management responsibilities for backend cloud infrastructure and operational tasks such as scheduling, provisioning, patching, scaling, and more, are handled by the cloud provider.
Serverless cloud computing execution model handles-
- In case of a demand or response to a specific event, it automatically triggers the computing resources that are required to run the application code.
- In response to an increase or decrease in demand, it automatically scales the resources that are required to run the application code.
- Once the application stops running, it automatically scales the resources down to zero.
Moreover, serverless computing is an approach that provides backend services based on usage. In simple terms, a user does not have to reserve and pay for a fixed number of servers or a fixed amount of bandwidth. Note that contrary to what the name suggests- being serverless doesn’t mean that a server in a physical sense does not exist. It just means that there is a server but the developers do not need to know or care about its existence.
So far we’ve only discussed what serverless architecture is and how it works. Now we’re going to dig deeper and understand its many benefits and limitations. It is required so that one must make an informed decision only after understanding all the pros and cons of serverless architecture.
First, let’s start with the positive.
Key Benefits of Serverless Architecture
1. Reduced Cost
- Operational Cost
Serverless architecture, first and foremost, is an outsourcing solution. Instead of having to manage databases, servers, and even application logic on your own, it allows you to pay someone else to do it for you. As you’re using a predefined service that a lot of other people/companies are using as well, as per Economy of Scale, it automatically reduces your operational cost. Here, as one vendor is running thousands of similar databases, you automatically pay less for your managed database. It helps with infrastructure cost gains which you get by sharing the infrastructure such as hardware, networking, etc. with other people.
Moreover, serverless allows the development team to only focus on writing code and not care about the infrastructure. This helps your developers to focus more on front-end work and also increases the labor cost gains as you save a lot of time by not having to manage the server on your own.
- Scaling Cost
One of the many benefits of serverless architecture is that its horizontal scaling is completely elastic, automatic, and managed by the provider. Thus, in serverless, you only pay for the computation that you need.
Here, the user only pays for the execution. A user’s cost meter starts when a request is made and it ends when execution finishes. In other methods, a user has to pay for the resources required to run applications, from the time they provision those resources, till the time they decommission them. In such cases, the user ends up paying unnecessarily for idle CPU time or unused space.
2. Easier Operational Management
As already discussed above, the scaling functionality of FaaS reduces cost but it also helps with reducing the operational management as scaling is automatic. If you’re a company that had a manual scaling process, where a human being was required to add or remove instances to an array of stacks. Now, with FaaS you can leave it to the vendor to scale your application for you.
When it comes to packing and deploying the developer only needs to send a function instead of deploying an entire server. All you have to do is package all your code into a zip file and upload it. It requires no start/stop shell scripts, no Puppet/Chef, and no decision about whether one should deploy how many containers on a machine.
Serverless architecture gives the programmer ample time for market and experimentation. The new-idea-initial-deployment capability of serverless allows the programmer to try new experiments with minimal cost and low friction.
3. Greener Computing?
There is a massive increase in the numbers and sizes of data centers around the world in the last couple of decades. The physical resources required for building these data centers and the associated energy requirement with it is so large that big names like Google, Apple, and others are talking about hosting their data centers in locations that have renewable energy sources nearby in an attempt to fossil-fuel burning impact of such sites.
When servers are idle but powered up, they consume an insane amount of this energy and are the main reason why need data centers of such large amount and size. According to Forbes “Typical servers in business and enterprise data centers deliver between 5 and 15 percent of their maximum computing output on average over the course of the year.” This is quite inefficient and creates an adverse impact on the environment.
When we are taking care of our servers on our own then there are huge chances that we become extra cautious and end up provisioning too much server space which ends up being idle and wasted. Thus, with a serverless approach, such decisions are taken away from the user. Now, it’s up to the serverless vendor to provision just enough computing space to the user in real time.
Limitations of Serverless Architecture
Serverless architecture has a lot of benefits but they come with a certain trade-off with drawbacks. Some of these drawbacks are inherent but others can be resolved over time. Let’s discuss these drawbacks in detail-
1. Vendor Control
Like any outsourcing strategy, with serverless architecture, you’re giving up control of some of your systems to a third-party vendor. This lack of control may lead to issues such as system downtime, cost changes, unexpected limits, forced API upgrades, loss of functionality, and more.
According to Charity Majors, if a vendor service is smart then they’ll put limitations on how you can use their service to fulfill their own reliability goals. If a customer has more power then it gives rise to chaos and unreliability. Thus, if a vendor has to choose between your happiness and the happiness of thousands of their other clients, then there’s no doubt that the vendor would choose them over you every time- as they should.
2. Multitenancy Problems
When multiple instances of software for several tenants (customers) are run on the same system, or within the same hosting application, then it leads to multitenancy problems. A lot of vendors use such tactics for cost-benefit. Although most vendors try their best to make the customers feel like they are the only customer using the system, sometimes even the best vendors can falter and that may lead to a lot of problems such as Security (one customer being able to see other customer’s data), performance (one customer with a high-load slowing down the other customer), robustness ( an error in one customer’s software creating problems and failing other customer’s software), and more.
Although these problems are not unique to serverless systems as many other systems also face issues of multitenancy, but must always are on the lookout for these problems.
3. Vendor Lock-in
IIt’s quite possible that whatever serverless feature you’re using can differ from one vendor to another and it will be implemented differently by another vendor. So, if you have to switch your vendors it’s going to require a lot of effort on your part such as updating operational tools like deployment, monitoring, etc., and changing codes to satisfy a different FaaS interface. One might even be required to change design or architecture if there are differences in how the new vendor’s implementations behave.
A lot of people are not comforted by this idea and would much rather adopt a multi-cloud approach than face changing a vendor.
4. Security Concerns
Adopting a serverless approach can give rise to a lot of security concerns. Let’s discuss some of these concerns in brief before hopping on the serverless bandwagon-
- With every vendor that you change your system’s ecosystem has to embrace its security implementations which leave your system vulnerable to various sources. Having your system accept so many vendors increases the area of malicious intent and the chances of a successful attack increase.
- When using a traditional application there is a protective barrier that the server-side application provides, this is no longer in existence if you are using a BaaS database directly from your mobile platforms.
The serverless architecture approach is not perfect. It has its fair share of limitations as well as benefits- just like any other approach. In the end, one has to weigh the pros against the cons and make a calculative, well-thought decision.