Serverless architecture is a step beyond in the technological revolution. Since 2015 (or some say 2012), it has changed the nature of computing. And there is no way back. The real question is, should you consider switching to serverless too?
Summary:
- What is serverless architecture, and how does it work? Scale-to-zero, FaaS, event-driven approach and managed services explained.
- Why is serverless the future of development? Some of the most significant advantages it has.
- What to keep in mind if you’re considering serverless? Risks, cons, and how to get prepared for a new solution.
- Should your business use serverless architecture today? Statistics and forecast for 2025.
What is serverless?
As it is with any new innovation, there is no versatile definition that works for everybody. In the case of serverless, it’s even more real because the concept has developed in a relatively short time. And still, lots of people confuse it with other concepts. Here’s the broad, yet the simple definition of “serverless” we think fits it the best:
Serverless is a paradigm of executing applications in cloud-native environments that influences the way applications are built and deployed and makes use of cloud-computing advantages.
Simon Wardley, a “serverless” advocate, defines it as:
“[Serverless is] an event-driven, utility-based, stateless, code execution environment in which you write code and consume services.”
A couple of words on What Serverless is NOT:
- It’s not a container. “A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings. Available for both Linux and Windows based apps, containerized software will always run the same, regardless of the environment. Containers isolate software from its surroundings, for example, differences between development and staging environments and help reduce conflicts between teams running different software on the same infrastructure,” — shares Docker.com;
- It’s not a PaaS. Unlike serverless, PaaS refers to a system where there is more (compared to serverless) control over deployment environment; applications take a while to spin up; applications need to be configured to scale automatically.
In many sources, you can also find that serverless architecture also means “managed services that scale to zero.” That’s why the scale-to-zero approach or pay for the consumption of computing resources (instead of allocation) is a key concept of the serverless. Let’s dive in.
Scaling to zero as the main concept
“Scale to zero” stops consuming resources when there are no requests. Therefore, computation resources become consumed when in use. Serverless cloud providers automatically scale out the application to handle the increased load.
It reduces the overall costs because customers are only billed for the time that the application is running. It’s also known as pay-per-use (pay for consumption and not for allocation). That’s why scale-to-zero is appropriately seen as the main concept of serverless computing.
Functions as code
Serverless is frequently used in conjunction with a function-as-a-service (FaaS) offering. In this case, the code is written as a function. In turn, the function acts as a small single-purpose piece of code that runs dynamically in response to some event trigger or on schedule.
Besides the fact that FaaS allows developers to run backend code without managing their server systems, here are some more essential aspects of it:
- When it comes to language and environment, FaaS functions are regular applications, but have a range of architectural restrictions;
- Using FaaS with serverless computing requires a different approach to deployment as compared to when you manage your servers. Developers upload code in a FaaS environment to the FaaS vendor who then takes over everything related to deployment. Developers don’t have to do anything;
- A FaaS vendor covers all the scaling needs. Developers write a function to assume horizontal-scaled parallelism, and the FaaS vendor covers everything scaling-related from that point. Horizontal scaling is fully automated and elastic;
- The FaaS provider fully manages resource provisioning and allocation.
To get started with FaaS, developers simply bring their function code and wire up event triggers. This is where an event-driven architecture steps in.
Events as triggers
The event-driven architecture (or simply EDA) is a software architecture paradigm where code runs in response to events. An event means any change of state in the system, for example, a new message in a queue, the changed record in a DB, a file upload, etc.
Simply put, EDA promotes production, consumption, and reaction to any events. In turn, events trigger business functions or code. For example, when a consumer books a hotel room, the room’s state changes from “free” to “booked”. A hotel booking system architecture may treat this state change as an event whose occurrence can be made known to other applications within the architecture.
Services are all managed
In a serverless architecture, developers don’t worry about supporting any related services. Such services can include databases, storage, message queues, stream processing, caches, etc.
In turn, developers can connect managed services together, so they shouldn’t think about provisioning, maintaining, and administering these servers and systems. Also, there is no need to ensure application fault tolerance and availability. Cloud providers handle these aspects for them.
What are the benefits of serverless?
Before considering the serverless approach for your business, let’s take a closer look at the advantages it has.
1 — Lower Operational Costs
With a Serverless architecture, you pay the vendor only for resources your application consumed, meaning you do not need to allocate costs for managing your own servers, databases, and application logic.
While you get the same cost reduction benefits from PaaS (platform as a service) and IaaS (infrastructure as a service), the two do not allow you to pay only for the resources you consume, making Serverless a cheaper option.
Automated & More Cost-Efficient Scaling
Serverless comes with automatic and elastic horizontal scaling that is fully managed by the vendor. In many cases, this allows you to cut budget costs in a big way.
More Optimization — Fewer Expenses
With a Serverless architecture, there is a direct link between code optimization and operational costs. The more you optimize your application’s code, the less you pay.
Say, your app needs a second to process an event; if you reduce the time to 500 ms, you may instantly save 50% percent from what you paid for minute-long processing. The amount you save may change from vendor to vendor, but the overall picture remains the same — you can save a lot).
2 — Simplified Operational Management
Before starting with this section, it is essential to go back to the fact that Serverless has not matured yet, and different operational nuances will arise as you start using it. Still, that does not dismiss the significant benefits of Serverless architecture in operational management. Let’s see what they are.
Next-to-no System Administration
In short, an utterly serverless solution needs zero system administration. The process of packaging and deploying a FaaS function is simple compared to deploying a server — you only need to package your code into a zip file and upload it to the vendor. That’s it. More so, if you are only starting with your application, you can skip the packaging stage and write the code right to the provider’s console.
More Agility
The nature of Serverless allows your team to decrease time to market in a reasonable fashion. Plus, with a faster deployment time, teams can experiment with new features and see if the work quickly at a very low cost and with little friction. This, in turn, lowers the lead time and may result in a better final product.
3 — Faster time to market
Speed is a new big. Every one aims to get their applications to market as soon as possible. With serverless, it’s quicker and easier: no need to worry about wiring up custom components, the code is shipped many times faster, and there’s less to build from scratch. As a result, developers run deployments with less fuss.
4 — Less Impact on Environment
The world has seen a big spike in the number of data centers in the last ten years, which increased the amount of burnt fossil fuel significantly. Tech giants are considering building centers near renewable energy sources. Still, this will not be enough to reduce the impact due to another issue: highly inefficient capacity management.
According to Forbes, standard servers in organizations deliver no more than 5 to 15 percent of their maximum computing output on average in a year. Serverless computing, on the other hand, frees companies from the challenging task of provisioning computing, capacity all the while allowing serverless vendors to allow just the right amount of resources for their clients, and only when they need them. So, serverless may be the one and the only solution to optimize data center resources worldwide, lowering their environmental impact dramatically.
What to keep in mind if you’re considering serverless?
Serverless has not matured yet, and this way of building and deploying applications has its advantages just as it has some drawbacks. There is an array of issues you need to know about before switching to this paradigm. We will take a closer look at the inherent flaws of the concept, the ones that will never be fixed entirely.
Lack of Control
Using Serverless means your vendor is in control of the parts of your system. This may lead to a wide variety of issues, including functionality loss, forced API upgrades, system downtime, and other issues that may affect your application and its users.
Security
Every newly emerged concept always has a list of security issues, and that’s also the case with serverless. From insecure serverless deployment configuration to inadequate monitoring and logging of functions and insecure third-party dependencies, these are some of the security issues to pay attention to before jumping in a serverless world.
BaaS-Only Serverless Architecture Issues
Serverless may decrease your operational resources, but not entirely. In the case of a 100% BaaS-based architecture, all the logic will be in the client. Backend-as-a-Service (or BaaS) is a cloud service model in which developers outsource all the behind-the-scenes aspects of a web or mobile application so that they only have to write and maintain the frontend.
So, for your next platforms, you will need to repeat the implementation of a subset of that logic. If you need to migrate to a new database, this will require code replication or coordination change for all of your clients. Another issue with a full BaaS architecture is that you cannot optimize your server design for client performance in no way.
On the bright side, if your serverless architecture uses only FaaS, these issues are non-existent.
Technology Limitations
Not all technologies can be used due to the scale-to-zero concept. The so-called slow “cold start” (first execution after scaling to zero) can lead to performance issues. Some applications require more time to start and then work fast. And for serverless fast startup time is always crucial.
Doesn’t Suite Some Tasks
There are some tasks where serverless is worse fit than traditional models. For such tasks, the usage of serverless may lead to increasing costs.
FaaS-Only Serverless Architecture Issues
FaaS functions have major local state restrictions, meaning you should not take it as given that the state from one invocation of a FaaS function will be available to another invocation of the same function.
If you cannot store states in memory, using a fast NoSQL database may do the trick alongside a number of other options, but all of them are significantly slower than in-memory or on-machine persistence, and the latter will not fit each and every project.
The Future is Serverless
It’s hard to predict where serverless computing will be a year from now. Looking back at the current state of serverless, its evolution over the last several years, how vendors address existing issues, as well as the growing community, we can expect the following developments in years to come.
Better Tooling. There’s no road ahead for serverless if the existing tooling stops evolving. Luckily, Amazon and other vendors have been improving things like deployment/application bundling and configuration, and we can expect vendors in general to make improvements in other important areas, such as remote debugging and distributed monitoring.
Serverless FaaS Will Fit More Applications. Serverless FaaS doesn’t have a consistent in-server state, so such an architecture will not be able to support high-throughput applications.
While vendors will surely try to make function instances active between events for a longer time, the hybrid approach — an architecture combining serverless and non-serverless execution models — is likely to be the better option for such applications.
Fewer implementation Issues. From deployment to packaging to integration testing to the opaqueness of monitoring support, there is a very long list of issues when it comes to implementing serverless applications as of today. As vendors are gradually fixing implementation-related issues, we can expect them to deal with all the problems existing in this area today as well.
Emergence of First Solid Serverless Practices. Although a lot is clear about nature serverless computing and how it can benefit teams and applications they design, it is still a very, very young field will little-to-no guidelines for the long-term as well as many blank spaces across the board.
So, in the next several years, we can expect the serverless rule book to start shaping up. It will outline where serverless fits best and where traditional ways are more favorable, the best ways to implement serverless, how to build a hybrid serverless architecture, and so on. The answers will come from both sides — the vendors, and the community.
That doesn’t end here, but vendors will surely try to tackle these first. Will serverless become the new normal for application architectures? It has the potential, but, as with many things, only time will tell.
Should your business switch to serverless now?
In 2017 the serverless market was worth around $3 billion. By 2025, it’s predicted to go up to $20 billion. Many giants are already adopting serverless. To name a few, Netflix, Coca Cola, Airbnb, EA, Vevo, MongoDB, Accenture, etc.
If you consider switching to serverless, we suggest keeping in mind two things:
- You should not migrate all your apps to serverless right away. Try and test first;
- Serverless is the right direction for the future for two main reasons: it gives the opportunity to deliver value to customers quickly and lets you pay only for the used resources.
Indeed, there are still numerous pitfalls and execution bottlenecks utilizing serverless. Moreover, security is one of the top issues that should be resolved over time. Yet one thing the entire market knows is that serverless is inevitable, and it will own the market. It’s all just a matter of time.
If you are ready to elevate your business with the serverless paradigm or need an extensive consultation on the matter, get in touch with our experts.