Enterprises are shifting away from building software as a monolith – one large product. They are creating software in small loosely coupled segments, so it’s easier to isolate them and decentralize a suite of software products. Smaller, more nimble teams are embracing microsdervice architecture so they can develop faster and more independently from the infrastructure.
Microservices can be deployed as containers or serverless. Both are being embraced by organizations, driven by the need to be more agile and deliver short time-to-market. The application container market will grow with an estimated CAGR of 40% through 2020, whereas the growth of the serverless market is forecasted with a CARG of 28% until 2023. So, let’s explore the key characteristics of containers and serverless.
Serverless evolved from Platform as a Service (PaaS) that allowed developers to focus on writing their applications and then deploying them to a platform. But developers were still responsible for writing a lot of the logic such as saving an HTTP server, handling a request or handling a message queue. Instead of writing all of that boilerplate code they reduced it down to a function and instead took advantage of the platform functions on demand.
Serverless applications are hosted by a third-party vendor who charges the application developer only based on the amount of time each function runs. The cloud provider dynamically manages the allocation of machine resources. Serverless lets you write and deploy code without the hassle of managing the underlying infrastructure, which increases developer productivity.
One of the most popular serverless platforms is the Function as a Service (FaaS) platform AWS Lambda. You simply upload your code along with dependencies to Lambda as a function, where it automatically gets deployed in a container. You can then run this Lambda function from any application running on an AWS service. It’s designed to be simple, Lambda takes care of provisioning, deploying, and managing the container as a managed service.
Containers are a standard way to package your application’s code, its configurations and dependencies into one single object. Containers share the server’s operating system and run as resource-isolated processes. This enables fast, reliable, and consistent deployments regardless of environment.
The AWS Cloud, Microsoft Azure, and Google Cloud all support the industry leading container vendors. Among several container platforms, Docker is leading the pack with about 48.28% of marketshare. Kubernetes is following with 28.83%. To better understand the difference read Kubernetes? Docker? What is the difference?
In my previous post, “Want to Go Multi-Cloud Without Pain? Go Serverless,” I already pointed out key benefits of serverless. In the context of containers there are several areas that you need to know when to decide whether to use serverless or containers.
Serverless uses standardized programming environments and basically once you upload the code it is ready to run. No need for server or container-deployment, and the serverless function can run as an external service of an application. You can even automate these tasks with workflow automation applications such as Extreme Workflow Composer.
Serverless is a pay-as-you-go computing model, where you only pay for the time and volume of traffic used. No need to lease any servers, there is no idle time.
Serverless allows small teams of developers to run code without relying on infrastructure or support engineers. The cloud-provider is responsible for scaling to the demand of the serverless function.
The use cases best suited for serverless are functions designed to be simple tasks that can run in generic containers. For example, if you have a large set of data that needs to be analyzed, but you don’t have the computing power on site, you can run this as serverless. This often happens in healthcare organizations. Another example of a serverless function are high volume background processes such as customer orders and marketing metric analysis or real-time data streams.
If you want to know more about when to stay away from serverless, read Yan Cui’s post “Not so FaaS”. He describes in detail what you should consider. To learn more about how businesses are using serverless today, listen to Kelsey Hightower in his in-depth discussion of serverless. Let’s now look at what the key benefits of containers are.
The global application container market was valued at $698 million in 2016 and is projected to reach 8,202 million by 2025, that’s strong growth. Why this growth? Largely because it provides portability of applications between physical and virtual machines, and between clouds. As Abby Strong pointed out in her post “Using Container Technology to Deliver Security, Policy, and Visibility to the Access Edge,” we have embraced containers to become more agile and deliver on-demand flexibility and security as part of our applications.
Functions for serverless are great if you want to wrap some business logic and run it. If you want to run something more advanced such as machine learning, where you need for example a custom GPU, then you’re going to want to start looking at application containers.
A container is composed of an entire runtime environment: the application, all its dependencies, libraries, and configuration files. It contains all you need to run an application, that’s why you can run software as a container reliably in different computing. Containers make it easy to move applications into test environments and then production. You can then deploy them into a private or public cloud. If you want to learn more, see this great article from CIO.com that addresses many questions you might be asking yourself about containers.
Beyond portability, there are additional key benefits that make containers a popular option for application developers:
An application is deployed, executed and scaled as an isolated package – a container. And a container-based application can be large and complex and is easily scalable since there are no dependencies on the application infrastructure.
You have full control over the application containers and the infrastructure on which it runs, so you can set granular policies and control security services. Also, since security and policies are platform specific, with containers you can move them out of the application to reduce complexity.
Crucial for any enterprise application, containers allow comprehensive testing and debugging as well as performance monitoring. Microservices can be fine-tuned to meet performance requirements of the underlying system.
The priority for applications is to deliver exceptional user experiences while staying economically viable. With this in mind, you have to consider the pros and cons of serverless and containers. In conclusion, these two models are complimentary to each other and depending on your application you need to choose the model that fits best.
For enterprise applications that you need to debug thoroughly, test in different environments, and scale, containers are the way to go. Simpler tasks with high computing power are ideal for serverless. You can also combine the two models by running a function as serverless services in the cloud triggered by an application in a container.
Want to get more into serverless? Our own Dmitri Zimine recently published a 2 hour follow-along tutorial that teaches you how to learn serverless step-by-step.
To learn more about application containers see “The essential guide to software containers for application development.”