Serverless — The Future

Back in the day, developers only had physical hardware available to run their code, and the process of obtaining a new compute unit can take months. Scaling took a lot of detailed planning, time, and money. The invention of virtual machines reduced the time to provision a new compute unit down to minutes through virtualization, leading to the era of cloud computing. Cloud computing is changing the face of the IT industry. Cloud computing presents a shift from expensive physical IT resources to a much smoother, high security, and controllable online resource that benefits everyone. Today, containers give us a new compute unit in seconds. Containerization breaks our large monolithic application into small, decoupled, independent microservices that connect back together to run our application. The next major shift in cloud computing is commonly known as “Serverless”.

Serverless can also be described as Functions as a Service (FaaS) goes one step further and are smaller than microservices, think one microservice can contain multiple functions. These functions run on-demand in response to events. When you use a serverless architecture you only pay for the resources your application consumes, not an entire virtual machine. In certain scenarios, this could save a lot of money. Scaling and deploying individual functions is much easier. Let’s imagine that one specific function is computationally heavier than another, in serverless architecture, that function can be individually scaled instead of having to scale the entire application.

“Serverless” doesn’t mean servers are no longer involved. It simply means that developers no longer need to think that much about them. Computing resources get used as services without having to manage around physical capacities or limits.

One of the main problems we face while hosting our servers in traditional cloud hosting is, we will either end up over-provisioning or under-provisioning our servers. Because it is very difficult to forecast or guess how much traffic we will receive all the time. Over-provisioning servers will cause us huge additional costs for that unused idle capacity of servers. If you under-provision the servers to cut the cost, during high traffic your site will crash, this will affect your reputation and you will lose your viewers.

Operational Management in traditional server hosting is high and difficult. You have to regularly update your server OS, patching, and configurations.

You need to architect your infrastructure in the cloud.

You may face a lot of confusions and questions like,

What type of virtual machine I should use?

What OS I should use?

How much memory do I need?

How much CPU do I need?

How many virtual machines do I need?

How should I scale my application?

Serverless provides answers to all these questions and the answer is simple “you don’t need to worry about these questions”.

Serverless computing is an execution model where the cloud provider (AWS, Azure, or Google Cloud) is responsible for executing a piece of code by dynamically allocating the resources. And only charging for the number of resources used to run the code. Serverless provides the following benefits,

No server management

You don’t have to worry about all server-related issues like OS configurations or runtime patching.

Inherently scalable

The services scale up or down in response to the load. A serverless application will handle an unusually high number of requests just as well as process a single request from a single user. A traditionally structured application with a fixed amount of servers can be overwhelmed by a sudden increase in usage.

Code can run closer to the end-user

Because the application is not hosted on an origin server, its code can be run from anywhere. It is therefore possible, depending on the vendor used, to run application functions on servers that are close to the end-user. This reduces latency because requests from the user no longer have to travel all the way to an origin server.

Pay as you go

You pay only for the resources you use to run the code. You don’t need to pay for an entire virtual machine. If the resource isn’t used, there won’t be any ongoing cost.

Development

In a Serverless architecture, your developers can take advantage of as many environments as they require. You can create independent demo environments for every single feature branch of your application.

Disadvantages of serverless architecture

  • Vendor lock-in: Allowing a vendor to provide all backend services for an application inevitably increases reliance on that vendor.
  • Architectural Complexity: The learning curve for Serverless is pretty steep. You’ll have to deal with containers, microservices, and functions.
  • Difficult to Debug: It is difficult to replicate the serverless environment to see how code will perform once deployed.
  • Cold start: Typically when a particular serverless function has not been called in a while, the provider shuts down the function to save energy and avoid over-provisioning. The next time a user runs an application that calls that function, the serverless provider will have to spin it up fresh and start hosting that function again. This startup time adds significant latency.

Example: Serverless thumbnail generation

A typical example is an image or video uploaded to an object store like an S3 bucket, this event calls a serverless function which creates a thumbnail and stores this thumbnail back into the S3 Bucket as well as recording the thumbnail location in NoSQL databases like Dynamo DB. The insert into the NoSQL database could then trigger further functions. This thumbnail creation function only runs on demand and the only cost incurred is how many times the function is invoked. The function will scale out in real-time if many people are uploading images and then scale to zero once they are done.

Conclusion

Major cloud providers are pushing heavily to make their platforms more Serverless-oriented and to ease Serverless adoption by enterprises. Serverless will continue to develop rapidly and, if you’re going to strengthen your cloud computing skills, learning how to tackle Serverless is definitely recommended.

--

--

--

DevOps Engineer | Technical Blogger | Serverless Evangelist | Cloud Architect

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

4+1 architectural view model

The Spike Protection Bundle with Index Rate Alerting ⬢ LogDNA

OVHcloud partners with Cloud 66

Giving our boss a proper send-off

Update: The APPICS Android Testnet is now available again for everyone!

How to configure SMTP server and sender email in your WordPress site?

Brief of OpenCV — Python

Lesson 2: Value Types in Solidity

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mounick

Mounick

DevOps Engineer | Technical Blogger | Serverless Evangelist | Cloud Architect

More from Medium

Best Practices of Advanced Serverless Developers

How to win cloud and influence people

cx_oracle in AWS lambda layer

Save up to 60% on your DynamoDB bill instantly