{{announcement.body}}
{{announcement.title}}

Serverless Is Taking Off: Here’s Why It’s Worth Hopping On

DZone 's Guide to

Serverless Is Taking Off: Here’s Why It’s Worth Hopping On

In this blog post, we explain what serverless is, dive into some of its major advantages, and point out some factors contributing to its growing popularity.

· Cloud Zone ·
Free Resource

Just a couple of years ago, serverless was a sparsely used technology, recognized mostly for its cost-efficiency. Today, we’re seeing a radical shift in the attitude towards serverless. Developers have begun to realize that serverless not only minimizes operational overhead but can considerably enhance core applications in production. As cloud vendors continue to develop their serverless offerings, serverless is being used in production more than ever before.

In this blog post, we explain what serverless is, dive into some of its major advantages, and point out some factors contributing to its growing popularity.

What Is Serverless?

Serverless is an execution model in cloud computing. With serverless, the cloud provider provisions and manages infrastructure components for you. Developers using serverless no longer need to worry about components, such as servers, databases, containers, and queues. By abstracting away infrastructure issues, serverless leaves developers who formerly spent a lot of time implementing, maintaining, troubleshooting, and monitoring infrastructure-free to focus on actual business goals and applications. So how does it work?

Serverless applications consist of three pillars: client-side logic; third-party services. It also functions as a Service (FaaS), remote procedure calls hosted on the cloud. Serverless applications run in fully-managed compute containers that are stateless and are triggered by events. They are also ephemeral, sometimes lasting just one invocation. Pricing is based on the number of executions, not compute capacity purchased ahead of time.

Many cloud providers have serverless offerings, including AWS Lambda, IBM OpenWhisk, Google Cloud Functions, and Azure Functions. 

Serverless Is on a Roll

A dramatic shift is taking place. In 2018, less than 5 percent of enterprises were using serverless, which was mainly employed for specific narrow tasks because it was cheaper than more traditional options. But now, more and more developers are realizing that serverless isn’t just cost-efficient; it can serve as an extremely powerful tool to incorporate in production and core applications. 

Serverless is being widely adopted, and companies, such as Reuters, Netflix, Telenor, and AOL are already using it in production. Over the past year-and-a-half, serverless has experienced an annual growth rate of 75 percent, making it the fastest-growing cloud service model. A 2019 report that analyzed serverless activity over the previous twelve months found that serverless adoption increased by 206 percent during that period and that companies had expanded their serverless footprint, with the number of functions per account increasing by 178 percent. Let’s take a look at AWS Lambda, one of the market leaders in serverless, and see what makes it so popular.

The Benefits of AWS Lambda

AWS Lambda, Amazon’s serverless computing platform, provides its users with some major benefits:

Managed infrastructure - Developers can focus on the front-end business logic while AWS Lambda automatically handles tasks such as server provisioning, security patches, and scaling.

Integration with AWS tools - AWS Lambda seamlessly integrates with other native AWS services, such as Amazon SQS. Not only does this mean more functionality at the tip of your fingers, but it also makes it much easier to harness the power of event-driven architecture. 

Event-driven architecture - A1WS Lambda is event-driven. This means that Lambda functions are only invoked when a particular event occurs. This creates seamless, effortless, and less-wasteful processes. Take, for example, a payment platform. When a user wants to pay, this triggers a payment-processing function. The confirmation sent then triggers another function, which creates and sends out an invoice. This entire process is completed automatically, without developers having to create new servers or worry about patches or security updates. 

Low costs - AWS Lambda users pay only for what they use. This means that developers can forget about reserved instances and provisioning ahead of time to meet maximum capacity levels. The event-driven platform allows you to use only the resources you need, exactly when you need them. This can lead to a serious reduction in operational costs.

Automatic scaling - AWS Lambda scales automatically, adapting to the rate of incoming requests as they come in. The number of requests has no upper limit and can increase with zero impact on application performance. 

Higher modularity - With AWS Lambda, your applications are extremely modular, split into microservices that can easily be reused for different features, saving valuable coding time. In addition, the modular nature of serverless makes it much easier to test and refactor code without breaking other parts of the system, enabling faster changes and shorter development cycles.

A Closer Look at AWS Lambda: Two Serverless Success Stories

In this section, we’ll look at how two companies, Vacation Tracker and Lego, successfully use AWS Lambda in production. 

Vacation Tracker, an application that manages employee vacation days, runs almost entirely on AWS Lambda. By moving to serverless, the company gained several major benefits. First, their developer teams were freed up to focus on business logic. Second, by reusing microservices, they increased efficiency. For example, in binding a new product to an existing billing service, they managed to cut development time by 95 percent. 

In addition, the company leveraged the event-driven architecture to minimize wasted resources and operate at a much lower cost. Using serverless, they pay a mere $107 to serve 400,000 active users every month. Finally, the highly layered architecture allows the enterprise to more easily refactor code and accelerate the development lifecycle. 

Lego also adopted serverless in production. Just two years ago, the company was still dealing with outdated on-premises infrastructure. One Black Friday, Lego experienced a system-wide catastrophic failure. Shaken up and looking to launch a global online shopping platform, the company decided to make the move to AWS. After getting familiar with S3, DynamoDB, and SQS, Lego decided to switch to serverless and started by migrating their e-commerce platform to AWS Lambda. 

By moving to serverless, Lego was able to instantly leverage the many AWS managed services without having to reinvent the wheel. Embracing an event-driven approach and using EventBridge to trigger and filter events, Lego could flexibly build highly-scalable architectures. Finally, serverless encouraged Lego to create a decoupled and loosely coupled architecture, making testing and feature creation faster and easier. For the full Lego journey, check out this podcast.

What’s Paving the Way to AWS Lambda Adoption?

Recent AWS Lambda developments are significantly easing the transition to serverless:

  • AWS Lambda supports most major languages out-of-the-box, including Java, Python, Node.js, Go, and C#, with functions written in any runtime.
  • Provisioned concurrency, launched in December 2019, keeps functions initialized as well as hyper-ready to respond, partially solving the cold start problem. 
  • EventBridge manages event traffic based on custom business logic. When used well, EventBridge grants developers the ability to use decoupled services to create more flexible and scalable event-driven architecture.
  • Lambda destinations, launched in November 2019, is a feature that provides visibility into function invocations. This allows you to orchestrate functions more flexibly and reduce complexity.
  • AWS step functions have increased the maximum timeout to fifteen minutes for each individual Lambda function, making the decision to move to serverless less controversial. 
  • Finally, AWS Lambda users are not alone. There is an extremely rich and supportive serverless community out there with meetups, talks, articles, user groups, and podcasts, not to mention some prominent serverless heroes, such as Jeremy Daly and Slobodan Stojanović

Despite the points listed above, serverless is still regarded by many as uncharted territory, making the cultural shift to serverless challenging and even daunting. Serverless requires expertise, troubleshooting can be difficult, and existing tooling doesn’t always integrate easily with it. In addition, some microservices, like containers, don’t function optimally with serverless. Despite Amazon’s provisioned concurrency feature, for example, cold starts — e.g. when a container isn’t readily available to serve a function — remain a serverless weak point.

A Final Note

Serverless has become widespread over the past year-and-a-half. Developers are beginning to recognize that beyond being a low-cost, nice-to-have solution, serverless comes with some awesome capabilities that can enhance core operations in production. In recent years, Amazon has widened the pathway into serverless, providing users with an array of features to smooth over the transition to AWS Lambda. That being said, moving to serverless is still a complex and challenging task. 

Topics:
aws lamdba, cloud, devops, microservice, serverless

Published at DZone with permission of Emrah Samdan . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}