Home Resources Blog Serverless Computing vs Containers: Which Should You Use?

Serverless Computing vs Containers: Which Should You Use?

Admin Globaldots
image 5 Min read

Both serverless computing and containers enable developers to build applications with far less overhead and more flexibility than applications hosted on traditional servers or virtual machines. Which style of architecture a developer should use depends on the needs of the application, but serverless applications are more scalable and usually more cost-effective.

In this article we take a look at the debate: serverless computing vs containers, and offer our insights on both models.

A study conducted last year by New Relic revealed 70 percent of enterprises have migrated a significant number of workloads to the public cloud. From this group 39 percent were using serverless, 40 percent used containers and 34 percent used some sort of container orchestration. This points to how adoption of serverless technologies now matches that of containers, but what is not yet quite clear is the extent of use in production applications.

Cloud Cost Optimization Case Study
Cloud Cost Optimization Case Study

What is serverless computing?

Serverless is a development approach that replaces long-running virtual machines with compute power that comes into existence on demand and disappears immediately after use.

Despite the name, there certainly are servers involved in running your application. It’s just that your cloud service provider, whether it’s AWS, Azure, or Google Cloud Platform, manages these servers, and they’re not always running.

Rather, you configure events, such as API requests or file uploads, that trigger your serverless function to execute. And when that action is complete, the server goes idle until another action is requested, and you are not billed for the idle time.

In other words, serverless computing is another abstraction on top of the operating system which provides a mechanism to run the application in a lot of smaller pieces. It provides functions or modules to execute application tasks that can be executed on-demand without worrying about underlying operating system and hardware infrastructure. These tasks are generally short-lived and run periodically as per the application requirements. Similar to the way cloud computing need physical hardware, serverless computing need servers as well for any application execution.

Adopting serverless lowers costs, speeds time to deployment, increases scalability and decreases management time for overworked IT teams. Serverless is also great for supporting various microservices and popular with developers for DevOps.
Benefits serverless computing offers tom businesses include:

  • Lower costs
  • No server management
  • Simplified scalability
  • Quick deployment and updates
  • Simplified backend code
  • Quicker turnaround

What is a container?

According to Docker, a container 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, and settings.

Containers solve the problem of running software when it has been moved from one computing environment by essentially isolating it from its environment. For instance, containers allow you to move software from development to staging and from staging to production, and have it run reliably regardless of the differences of all the environments.

Instead of virtualizing the hardware stack as with the virtual machines approach, containers virtualize at the operating system level, with multiple containers running atop the OS kernel directly. This means that containers are far more lightweight: they share the OS kernel, start much faster, and use a fraction of the memory compared to booting an entire OS.

There are many container formats available. Docker is a popular, open-source container format that is supported on Google Cloud Platform and by Google Kubernetes Engine.

serverless vs containers

Image Source

Adoption for both serverless and containers are growing at a rapid rate, according to several surveys and studies. Here are some of the highlights I picked out.

  • A study by Cloudability found that container adoption amongst AWS users grew 246% during Q4 2017, up from 206% in Q3. Meanwhile, the same study found that serverless adoption by AWS users grew 667% in Q4 2017, up from 321% in Q3.
  • A recent survey by Serverless Inc. found that 82% of correspondents use serverless at work in 2018, up from 45% in 2017. And over 53.2% said their use of serverless technologies are critical for their job.
  • The Serverless Inc. survey also reports that 24% of correspondents had limited or zero experience with public clouds before adopting serverless. And that 20.2% of correspondents worked for large enterprises with over 1000 employees.
  • Logz.io’s DevOps Pulse survey found that 60.71% of correspondents have adopted container orchestration in 2018, up from 42.11% in 2017.

According to Rightscale, serverless is a trop growing cloud service:

Image Source

How should developers choose between serverless architecture and containers?

Developers who choose a serverless architecture will be able to release and iterate new applications quickly, without having to worry about whether or not the application can scale. In addition, if an application does not see consistent traffic or usage, serverless computing will be more cost-efficient than containers, because the code does not need to be constantly running.

Containers give developers more control over the environment the application runs in (although this also comes with more maintenance) and the languages and libraries used. Because of this, containers are extremely useful for migrating legacy applications to the cloud, since it is possible to more closely replicate the application’s original running environment.

The hybrid approach

It is also possible to use a hybrid architecture, with some serverless functions and some functions deployed in containers. For instance, if an application function requires more memory than allotted by the serverless vendor, if a function is too large, or if certain functions but not others need to be long-running, a hybrid architecture enables developers to reap the benefits of serverless while still using containers for the functions serverless cannot support.

Instead of choosing one or the other, serverless and containers can also be used side by side. Indeed, many companies have found success with a hybrid approach. They:

  • Use serverless for workloads where serverless meets their needs
  • Use containers for where it doesn’t, for example, for workloads that:
    • Are long-running
    • Require more predictable performance
    • Require more resilience than can be easily achieved with serverless
    • Run at significant scale constantly, and the pay-per-invocation pricing model becomes too costly


Both serverless computing and containers offer advantages to businesses looking to scale their workloads. If you have questions about which approach is best for your business, feel free to contact us today to help you out with your performance and security needs.

Read More

Inform every aspect of your product & business with CDN Monitoring
Monitoring, Logging & Observability
Snir Ambar, Head of AI & Innovation @ GlobalDots 22.09.22

Extract actionable real-time insights, optimize performance and identify issues before they become problems – by unlocking the hidden value of CDN logs! Get 14 days free access to all features right now.

Watch more
Cybersecurity takes center stage
DevOps as a Service
Artem Mescheryakov, Senior DevOps Engineer, GlobalDots 20.09.22

In recognition of National Coding Week, Geektime.com, a top media channel covering tech, startup, venture capital, internet, mobile, development and more – featured a guest post by Artem Mescheryakov, Senior DevOps Engineer at GlobalDots:  “National Coding Week is about learning the value and importance of digital skills as well as nurturing the increasingly important skill of coding. Developer shortages […]

Read more
A CISO’s Essential Guide to API Security
API Security
Admin Globaldots 15.09.22

Learn how to reduce the business risk of API attacks – and maximize the value of digital innovation.  APIs are the entry point to your organization’s most critical data and services. Their protection is crucial to reduce risks, maximize program value, and generate growth. In this guide, we take a close look at the special […]

Read more
Unlock Your Cloud Potential
Schedule a call with our experts. Discover new technology and get recommendations to improve your performance.
Book a Demo