Serverless architecture is growing rapidly for good reasons. Developers, for the most part, do not enjoy provisioning or managing infrastructure. For applications with intermittent traffic and long idle times, provisioning becomes a moving target. Overprovision and you risk paying for idle resources. Underprovision and you risk slow response times, poor UX, and high app abandonment rates. Serverless architecture abstracts away server, storage, and network provisioning, plus management so developers can focus on building differentiating features and creating great app experiences. Enough developers and IT organizations are embracing serverless architecture that uptake is expected to grow from $7 billion in 2020 to $37 billion by 2028.
History and Evolution of Serverless
The concept of serverless is older than its name. At this year's MongoDB World conference, Jeremy Daly, GM of Serverless Cloud at Serverless Inc., provided a brief history of serverless architecture—before it was called serverless—and explained why today's implementations are different from those early iterations.
Serverless architecture represents the evolution of server environments from virtualization to containerization to cloud computing. In his presentation, Daly traces the beginning of serverless to the launch of Amazon Simple Storage Service (Amazon S3) in 2006. Then came services such as Amazon’s CloudWatch, Simple Notification Service (SNS), CloudFront, Route 53, CloudFormation, DynamoDB, and Kinesis, which were all serverless solutions before the term existed. In 2014, Amazon released what it called "functions as a service" in the form of AWS Lambda, which was the first serverless solution to see widespread adoption.
But limitations with these early iterations prevented serverless from really taking off. The primary drawback was cold starts. "If something isn't pre-provisioned, then when you request it, it has to set up a container or function to make that available to respond to your request," Daly explained. "That's still a thing today but to a much lesser degree." He also cited resource restrictions and limitations—such as the inability to call a Lambda function with an HTTP API request or connect to virtual private clouds and access a database—and limited orchestration workflows as reasons why developers were slow to adopt serverless.
The Serverless Future
Serverless solutions have evolved significantly from those early iterations. Over the past several years, new services have come from AWS, Google, and Azure. And now MongoDB has announced the general availability of MongoDB Atlas Serverless at World 2022. Today's solutions solve many of the issues that existed early on.
According to Daly, today's serverless solutions share five common traits:
No server management — Serverless eliminates routine administrative tasks such as having to SSH into a Linux box or provision Amazon Elastic Compute Cloud (Amazon EC2) instances.
Flexible scaling — Although there are autoscaling groups in Amazon EC2, there's still a minimum amount that you must provision. With current serverless implementations, you can and should be able to scale down to zero.
Pay for value — Sometimes referred to as "pay for use," this could entail paying for storage in a database or provisioning concurrency to eliminate cold starts, but ultimately, you're paying for the value of the services you're using.
High availability — Services are automatically provisioned across multiple availability zones for redundancy.
Event driven — When something happens, like a change in the database, it triggers a workflow, such as creating a new user account.
While the automation and functionality are there, developers will still need to know how to use the services to take advantage of serverless. They have to know how to use different cloud services and SaaS solutions, infrastructure and cloud architecture, build and deployment pipelines, monitoring and observability, and security and compliance. These are things that a DevOps team used to handle, but now are more likely to fall on the shoulders of developers.
Regardless of the responsibilities on developers to learn how to use the functionality, Daly says serverless is the future of how developers will build apps. That's because all the functionality can be spun up in an independent stack without having to worry about services that anyone else is running. Any developer can have their own version of the application that they can build off of and test with. This provides fast, high fidelity feedback loops, it enables isolated stacks for different parts of the business, and it ensures that development environments are running the same resources as production.
Daly also points out that serverless architecture doesn't replace the database as the backbone of the application. Although it's hard to build a serverless database, MongoDB Atlas for Serverless has figured it out, he said. Daly cites the key characteristics developers need from a serverless database:
Fast and responsive (no cold starts)
Scale up and down quickly
Integration with serverless tools
Cloud flexibility and proximity (close to your application)
Consumption-based pricing (pay only for what you're using)
MongoDB Atlas Serverless
MongoDB Product Manager Kevin Jernigan, who co-presented with Daly, put a finer point on delivering the requirements developers are looking for in a serverless database. To create a serverless database in Atlas, the process takes only a few steps and your database spins up in seconds.
"What you have is an endpoint that will scale up and down automatically based upon the workload," Jernigan said. "It will scale down to zero when you're not using it."
That essentially means you're not getting billed for anything except the storage you're using. And there's no cold start penalty.
"There's always infrastructure there ready to respond to the next call you make to your database endpoint. We always have infrastructure running, waiting to respond," Jernigan said.
Jernigan listed several capabilities that differentiate MongoDB Atlas Serverless from other solutions in the market. Atlas Serverless includes the full power of MongoDB, including the flexibility of the document model. There are no scaling trade-offs so you don't have to worry about cold starts when you scale to zero. It's also available with tiering-based pricing models with discounts for higher usage. There's also deployment flexibility that allows you to move workloads back and forth between serverless and dedicated infrastructure. And you can deploy in all of the major public cloud providers.