Serverless is one of the key benefits of modern cloud computing that has been revolutionizing various industries. It allows you to focus on logic and application building rather than dealing with cloud infrastructure. This means, in a serverless environment, you can completely focus on writing the best applications while the underlying serverless platform handles everything else such as scaling, runtimes, security, resource allocations, etc.
So what is serverless? Does this mean that there’s no servers at all? Let’s find out in this article!
What is serverless?
Serverless is an execution model in cloud computing that shifts all responsibilities of managing infrastructure, such as scaling, scheduling, patching, provisioning, to cloud providers and tools. This takes the burden of infrastructure management off developers and allows them to focus their time and effort on developing the best business logic and code for their applications.
Serverless computing has a handful of attributes as follows:
- The serverless model requires zero management and operation of infrastructure, giving developers more time to optimize code as well as develop innovative new features.
- Serverless provisions computing resources on-demand. This means it runs code on-demand only and scales up transparently with the number of requests being served.
- Serverless computing adopts the pay-as-you-go payment term, which means you pay only for resources being used, and never for idle capacity.
Serverless computing was first introduced by Amazon Web Services in 2014; they named their service AWS Lambda. Today, every leading cloud service provider has followed suit and offered a serverless platform (Microsoft Azure has Azure Functions, Google Cloud has Google Cloud Functions, and IBM Cloud has IBM Cloud Code Engine).
Are there servers in serverless computing?
What the most confusing about serverless computing, especially for beginners, is probably the name itself. Yes, there are definitely servers in serverless computing; it’s the infrastructure that hosts everything above it that allows developers to develop apps.
The term serverless is widely adopted because it describes the users experience of servers. In serverless computing, servers are essentially visible for the user as the user doesn’t see them, manage them or interact with them in any way.
Serverless vs. Traditional Architecture
|Infrastructure management||Taken care of by cloud providers||Handled by the user|
|Execution||Event-driven. Code executed only when thereâ€™s a user request for information.||Code running all the time and consuming machine resources.|
|No hardware and maintenance costs.Pay as you go; charged for the number of requests||Large spendings on hardware and maintenance. Pay for idle capacity|
|Complex networking management because serverless functions can only be accessed via private APIs||Simple networking management because APIs are not required|
|Easy to scale because hardware provisioning is not required||Difficult to scale because hardware provisioning is required|
|Latency is decreased for global businesses, because cloud providers have data centers around the globe that provide access points for the application to run wherever closest to the end user||Latency is higher for global businesses, because the application is hosted on a premises server, and requests have to travel all their ways to the end user|
|Deployment||Quick deployment of new features because serverless applications are not a single monolithic stack.||Slow deployment of new features because applications in the traditional architecture are monolithic.|
Pros and Cons of Serverless
In this section, we’ll take a look at the various pros and cons of serverless computing.
Pros of Serverless
Reduced operational costs
As serverless shifts infrastructure management responsibilities to cloud providers, it reduces operational costs as you don’t need to worry about hardware failures, networking issues, or hiring people to maintain your system.
It also helps reduce risks, especially if you’re a startup operating on a budget. If you deploy a new service and it ends up failing, there’s no hardware you’ll have to sell to recoup your money.
Configuring a large infrastructure is an expensive and time-consuming task. You can save on these costs by using serverless. This is beneficial for new startups who need to test their ideas with minimum viable products (MVP). For established businesses, using serverless means your developers can worry less about infrastructure and focus more on the business logic side of your application.
Leading cloud providers have built up various layers of security over their cloud infrastructure to insure their customers against cyber attack. Unlike with premises architecture where you have to take care of security by yourself, with serverless the cloud provider is responsible for ensuring the security of the operating system, runtime, physical access, networking, as well as any related technology that enables the platform to operate.
This is a great benefit for serverless adopters considering that the cloud provider has a large team of specialists whose sole focus is on implementing the best security practices and fixing bugs on a constant basis to serve their thousands of customers.
Software built with serverless follows the practice of breaking a big application into smaller separate microservices that handle different requests. Deploying a new or updated function in this environment means working on an individual microservice instead of the entire application. This allows for continuous delivery of new features as you can update a function without disrupting the operation of other functions.Â
This is a key advantage of serverless when it’s compared to monolithic architecture where the entire application is developed as a single tightly connected stack, and you’ll have to deal with that entire system every time you want to update a function.
Precise cost model
Serverless allows you to build a precise cost model for your business. Provided that you have built an online application with serverless, and in your application the average user will make some requests to view your products and a few more requests until they place an order.
In serverless, for a given input a single unit of code has a predictable time to execute. Thanks to this, you can predict how much a single user costs on average after you’ve collected some data, and this unit cost will remain almost unchanged as your application increases in usage.
This is important for your business because knowing how much a single user costs and having this number fixed allows you to decide how much you need to charge for a service or ads to be profitable.
Cons of Serverless
Serverless is an event-driven operation, which means your code is not running all the time. When a user makes a request, your function gets activated via a series of steps in the system. The problem here is that those steps take time: up to a few hundreds of milliseconds (which can be a big deal in relation to computing speed).
This issue is called a cold-start delay, and is a trade-off that needs to be made between the benefits of serverless and the lower latency advantage of traditional hosting. Many businesses adopt the hybrid cloud, a flexible execution model in cloud migration, to solve this problem when the higher latency of serverless hinders their business-critical operations.
No cloud provider is perfect, they have their inherent constraints, and you should know what those are if you go serverless. For example, on AWS, you can’t run a Lambda function for more than 5 minutes, so you have to code your functions in a way that meets this requirement. AWS does this on purpose though; serverless is designed to be cost efficient in short bursts, so constant and predictable processing will be expensive. If your code takes a long time to run or must take a long time to run, you are using serverless the wrong way.
Vendor lock-in is a big issue with serverless. A cloud provider can have a completely different implementation from another vendor with regard to the one specific service that you need. This means you will need to make changes to your application, sometimes refactor it, if you want to migrate. This can be a troublesome process. Many businesses use multicloud, another flexible execution model in cloud migration, to mitigate the risk of vendor lock-in.
Steep learning curve
Serverless is a new technology, so it can be a steep learning curve for your organization to get familiar with it. You can face new kinds of challenges in a serverless environment; serverless functions may be hard to manage or debug with existing processes. It’s also sometimes tricky to test your code locally, and your developers need to adapt to a new set of tooling.
Some organizations look to serverless as the path to the cloud, but as a good rule of thumb, if you are not ready for microservices, then you are not ready for serverless.
Use cases of serverless
Serverless has a wide variety of use cases; it is basically good for anything that is event-driven. The list contains IoT, mobile applications, web-based applications and chat bots to name a few. It’s worth noting that the events can come from various sources, such as actions from users (click buttons on an interface), sensor activations or from data flowing through certain points in the system.
One example is Thomson Reutersâ€™ use of AWS Lambda for loading and processing data streaming without having to provision or manage any servers. The company has built a serverless solution that enables it to capture, analyse, and visualise data generated by its offerings. This feature provides insights to help its product teams continuously improve the user experience. AWS Lambda runs Reutersâ€™ code only when triggered by new data entry via integrations with Kinesis and Amazon S3.
Being event-driven means the user is only charged for compute processing when the code is running, so it is very cost efficient.
What is serverless not good for?
As mentioned above, serverless is event-driven, so applications that need to operate all the time wouldn’t be able to benefit from serverless. Serverless charges you based on the number of events triggered, so if you use serverless for constant processing, your bill will go through the roof in no time.
Serverless also isn’t necessarily a drop-in solution for legacy applications that have already been built. If you have got an application that’s already been built as a monolith, you mostly have to refactor it in the form of microservices if you want to run it on serverless.
A serverless case study from PhotoVogue
PhotoVogue is an online photography platform. It allows photographers to showcase their work.
- Around 130,000 photographers are showcasing their work on PhotoVogue. This is a collection of more than 400,000 photos, each of which can be up to 50 MB in size.
- With the number of photos being submitted increasing by the day, the challenge for PhotoVouge was keeping up with this demand.
- The existing premises IT infrastructure of PhotoVogue was limited. The company couldnâ€™t provision resources quickly enough while they wanted to give both photographers and operational staff a better, faster experience.
The serverless solution provided by AWS Lambda:
- PhotoVogue had their entire infrastructure moved to AWS in three months, where it uses Amazon S3, Amazon Simple Storage Service, to store all its photos.
- From Amazon S3, an AWS Lambda function is triggered, and it automatically converts the uploaded image to various digital formats, such as GIF, JPEG, PNG, and TIF, and allows the images to be edited by PhotoVogue staff.
- Amazon API Gateway is used as the caching layer for the REST API, and Amazon CloudFront provides the content delivery network (CDN).
- Quicker provisioning. It would take PhotoVogue days to set up a new infrastructure in their old premises, but AWS allows them to do this in hours. IT is no longer hindering the business.
- Increase speed. Amazon API Gateway and AWS Lambda makes the user experience 90 percent faster. That is for both artists uploading images and the editorial team processing them.
- Reduced costs. VoguePhoto ended up cutting its IT costs by around 30% with AWS. They used to spend their time tending to the infrastructure, but now that time is saved on and being used to explore new services.
- Better stability. The API Gateway and Lambda help their site become more stable and predictable, which helps VoguePhoto make more money as their business model is based on advertising.
- Better scalability. PhotoVogue held an event in Milan In November 2016, to celebrate fashion photography. During the event, they experienced about 20% more uploads than normal daily traffic, but they had no problem with capacity as AWS scaled that up seamlessly.
Serverless offers a cost-effective way of building and operating applications in the cloud, and it can help smoothen the way as you modernize your applications on your journey of migrating to the cloud.
If your company doesn’t have the expertise to execute your cloud migration project in-house, itâ€™s best to find a good cloud migration service provider to help you.
CMC Global is among the top three cloud migration services providers in Vietnam. We operate a large certified team of cloud engineers specializing in Amazon AWS, Microsoft Azure, and Google Cloud who are able to migrate your legacy assets to the cloud in the most cost-effective way and in the least amount of time.
For further information, fill out the form below, and our technical team will get in touch shortly to advise!