What is Serverless Computing?
We all use mobile phones. Many of us use a fixed data plan that charges us for a threshold amount of data per day or month. Anything above this limit is charged at a premium. Now, it’s not necessary that you will use each byte of data for which you’re paying. In fact, most of the data goes unused.
(Image Source: aws.amazon.com)
This can be compared to the traditional computing system. Companies had to invest bundles of money in buying costly servers. With the advent of cloud computing, companies could rent storage space on the cloud which was cheaper than buying servers, but most companies miscalculated and leased more space than needed.
Now, continuing with our mobile phone analogy. Post-paid or pay-as-you-use plans are the preferred choice of most mobile phone users. You pay only for the quantum of data that you use. You don’t have to shell out a minimum amount, neither are you penalized for overuse.
This can be compared to serverless computing. Developers can code but companies need not purchase servers or rent cloud space. Servers are involved but developers aren’t concerned with them. So, ‘serverless’ computing is not actually ‘serverless.’
Why Serverless Computing?
The main benefit you get from switching to serverless computing is cost savings that you get. You pay only for the services that you use. The entire infrastructure is maintained by the vendor. This turns out not only cheaper but also scales up and down easily. As your backend services expand and you need more server space, you can easily avail it. You won’t have to shell out on servers, physical space, and technicians to maintain the servers.
There are other benefits of serverless computing:
Scalability: Scaling up or down is never an issue with companies that opt for serverless architecture. Their developers can do limitless coding while the server vendors look after increasing or decreasing system capacities.
Easy coding: Independent methods to invoke calls to backend can be written easily by developers. With Function-as-a-Service (FaaS), coding is quick and hassle-free.
Faster delivery: The turnaround time for code deployment and bug fixing reduces considerably. Developers can do testing and fixing on piecemeal basis instead of rolling out complicated overhauls.
Serverless computing is an extended service provided by cloud providers. Many leading cloud providers are the major players in serverless computing. They include AWS Lambda, Azure Functions, IBM OpenWhisk, and Google Cloud Functions.
Serverless computing vs. Traditional Computing
The debate of serverless versus traditional computing goes on. Needless to say, both architectures have their pros and cons. But there is a lot of propaganda by cloud vendors claiming serverless computing as the trend to follow.
Let us know how the two structures compare vis-à-vis some important parameters:
1. Cost Structure
This is a no-contest. Serverless computing wins hands down in the pricing area. Vendors charge you for the number of function executions that you make. You are allocated time slots for running a function. The more executions, more will be your bill. But the greatest saving comes from the staff overheads that you won’t incur now.
Here, traditional computing scores over serverless computing. Serverless systems require you to set up private APIs. Traditional computing lets you access code via regular IPs. Though this can be a deal breaker, it doesn’t affect the overall cost structure of serverless architecture.
If your application depends on using third-party libraries such as for coding or cryptography, you should opt for traditional computing. This is because serverless computing will require you to make these libraries and integrations available within the application, which can make it too heavy and sluggish. But here again all depends on the context. For simple applications, serverless architecture can still make sense with one or two in-app integrations.
4. Multiple Environments
Setting up multiple environments is easy breezy in serverless architecture. You don’t have to bother about setting up different machines for development, staging, and production. So, in the factor, traditional computing takes a rough beating from serverless computing.
Some applications or functions require external referencing or have variable execution times. For such functions, serverless architecture is no good. This is because serverless computing has a stringent timeout of 300 seconds (mostly). Not all applications are able to complete their cycles in this duration. Traditional architecture is a clear winner in timeouts department.
Scaling up and down is not an issue with serverless computing. It happens instantly and seamlessly. This can be perceived as an advantage by many, but actually it has a downside. Coders are not able to address and mitigate glitches when new functions or executions are instantiated. This means a lack of control over the proceedings which can be counted as a major drawback of serverless computing.
Key Highlights of Functions-as-a-Service (FaaS)
FaaS are not any different from functions in general. They involve lines of code that feed some input into the system. The input is processed and output is produced.
The difference lies in the execution of functions. In FaaS, each execution can exist in a separate container. You cannot expect the files to be available for successive executions. Each execution is independent and stateless.
Another difference is that FaaS cease to exist as soon as they finish executing. The container in which they’re executing gets scrapped while the function is underway.
FaaS can be externally and directly invoked. Sometimes, an HTTP request or message notification triggers FaaS. Most external invokes are raised by other cloud services.
A serverless architecture typically has the following components:
Security token service (STS)
Serverless Architecture: The Developer’s Perspective
Serverless architecture can be a boon for developers. They can save precious bandwidth that they used to devote in server management and administration roles. Their responsibility and liability reduces by a big margin. They can focus on building the application while the server vendors look after the backend services for them.
So that’s serverless architecture in a nutshell. Stay tuned for more in-depth articles on serverless computing and other related topics.