What is serverless and Why does it matter?
Photo by Magnet.me on Unsplash
In this article, we are going to discuss serverless architecture including how we got here and how to make the best out of this architecture to increase efficiency and reduce our cloud costs. Before we jump into its benefits let’s quickly look at the history of servers to understand how we got here.
As you can see above evolution of the cloud has got us from a point where companies had to have bulky hardware for servers, and have full-time engineers to maintain them to necessarily having no infrastructure and almost zero maintenance cost for most common requirements. Technically, serverless does not mean that there is no server, which is a common misconception for those who are new to the technology.
But serverless architecture simply means that in place of the traditional server setup mentioned above, servers are now managed by third-party vendors like AWS so we don’t have to worry about its hardware, OS, or even maintenance of servers.
Why Serverless
Let’s discuss a few points about how using serverless is more efficient and reduces costs compared to using traditional servers.
1. Set Up and Maintainance
Setting up a server requires time and effort from System engineers who have to basically configure the OS, network, and other required services. Even the high-speed internet connection that is required to keep the servers online can cost huge amounts. Also to ensure 100% uptime without interruptions we may have to think about backup servers and network connections. Many of the physical requirements can be avoided by having a cloud-based server ( which again is just someone else’s machine) but this would still need us to configure services and maintain the server. Going completely serverless allows us to get rid of these dependencies and save a very high amount in terms of costs.
2. Scaling
Imagine if we could predict the exact number of users (or load) that is going to be handled by our servers in a given year or month. We can configure the cloud servers or arrange the physical infrastructure, with only the necessary requirements for the given period, and save costs. If we could more precise predictions down to each day, or even hour of the day, it would mean ideally mean even lesser costs but this is not really possible as it would be a nightmare in terms of logistics and DevOps perspective.
This is where serverless gives us all the power to handle any amount of load without having to worry about up-scaling and de-scaling. In a serverless setup, scaling happens automatically when the load increases. The service provider takes care of deploying more instances or increasing server capacity. This will help us avoid a PR nightmare if the servers were to crash from overload or avoid the loss of precious business hours.
3. Hardware
The first and most obvious difference in a serverless offering is the hardware required and the amount that we would have to invest upfront for any hardware that would be required to run our servers. We also need not have the infrastructure in place to host the machines within the company’s premises. With serverless, we can eliminate the logistics, infrastructure, and machines while saving costs on all these.
4. Pay As you go
This is very closely tied to scaling, as we discussed above the ability to upscale and descale dynamically gives the flexibility to pay only for the actual usage. To put it in simpler terms it is more like a payphone where we pay only for the minutes we use, we only pay for the actual time the server was used. The cost is also dependent on the load we have, more like paying more per minute for an international call vs a local number. These two variables, load and time make serverless one of the most flexible and sensible approaches in terms of spending.
5. Development Time
This is often an overlooked factor when it comes to cost savings in serverless. The number of hours developers need to spend in order to develop applications that run on traditional infrastructure is higher. In serverless, our developers can focus more on developing the actual features without having to worry about configurations or heavy deployment cycles which they would have to give importance to otherwise. Serverless allows small and quick releases which in turn reduces time to go live with a new feature or update.
Most Popular Services
Let’s take a look at some of the most popular serverless services and respective products in the market today and how they work. We are going to consider offerings from AWS as they are one of the leading and best cloud providers right now.
Function As A Service ( Faas) — AWS Lamba
The launch of AWS Lambda has been one of the turning points in making serverless a mainstream and sought-after architecture. It allows you to host functions (small chunks of code) within seconds without having to worry about creating an entire backend or deploying servers. It supports uploading code in almost all popular languages like Java, Go, PowerShell, Node.js, C#, Python, and Ruby while taking care of everything required to run and scale our code.
Storage — AWS S3
Storage of files is one of the major concerns when we don’t have a server in place, and this is where services like S3 which was built to support the serverless architecture come into the picture. S3 allows us to store any type of files in the cloud, like images, videos, user-generated files, or even static web pages, and access them conveniently with simple requests for use within our own applications or direct access to customers. S3 allows a fine grade of control over who gets to access what while providing 99.999999999% durability & industry-standard security for our data and many other useful features.
That’s it I’ve tried to keep it as simple as possible this one. If you’re planning on using serverless architecture for your projects, CI/CD ( continuous integration & continuous deployment) is something that you should definitely try and implement if you haven’t already. It can help save a lot of time and effort just like going serverless.