Serverless computing is an emerging trend in software architecture. 2017 is a very exciting year for serverless computing, and adoption will continue to explode in 2018. Here we take a look at the benefits of serverless computing and compare serverless providers.

The popular interpretation of “serverless” is functions as a service (FaaS), where developers can upload code that is run within stateless compute containers that are triggered by a variety of events, are ephemeral and are fully managed by the cloud platform. FaaS eliminates the need to manage, provision, scale or manage availability of your own servers. The most popular FaaS offerings are AWS Lambda, Microsoft Azure Functions and Google Cloud Functions. (Learn more about the basics of serverless computing in Serverless Computing 101.)

What Is Serverless Good For?

Serverless computing is most commonly used for applications such as:

Benefits of Serverless Architecture

Serverless is a good solution for problems like time consumption, cost, unfocused coding and difficulties in scaling up or down. There is no need for updating the latest package versions or dealing with the problems that arise when a server stops working and has to be replaced. Serverless simplifies deployment and packaging, and eliminates the need for system administration.

Cost savings is one of the major benefits of serverless computing. If you are buying a real or virtual server, you pay even when it’s idling. With serverless, the provider’s server estate can serve another clients' requests when it’s not working on yours. If your provider is being reasonable, this means you’re only paying for exactly what you use. If any processes hit errors, you don’t have to worry because only the concerned container will go down and the rest of your web requests will continue to process uninterrupted.

Comparison of Serverless Providers

In the world of serverless computing, there are currently three heavy hitters: AWS Lambda, Azure Functions and Google Cloud Functions. Each has their own set of features and functions, so let's take a look at what each of them has to offer.

AWS Lambda

AWS Lambda supports Java (Java 8 compatible), C#, JavaScript and Python. Developers can create a wrapper that can be added to PHP, Go or Ruby projects, which allows code execution when triggered.

AWS has placed Lambda in such way that it acts as a gateway to other cloud services. Log analysis, image processing and backup can be performed by doing integration with S3 and Kinesis, triggered by activities in these AWS services. DynamoDB integration provides another layer of triggers for operations performed outside the real-time ecosystem. Lambda acts as the full backend services for mobile, web or IoT applications. It receives requests from the client through the Amazon gateway and converts these requests into API calls that are later translated to predefined triggers running specific functions.

Lambda allows development of Lambda frameworks. Developers can use open-source code, created by companies and individuals, that helps building and deploying event-driven functions. These frameworks provide developers a template into which code is inserted, and bring a built-in integration with the other Amazon services. (For more on AWS, check out Are You Missing Out on Amazon Web Services?)

Azure Functions

Microsoft allows native languages – C# and F# – for Functions' coding. Developers are also able to write functions in JavaScript or Python. Azure provides portal-functional IDE in their portal, which helps you prototype and deploy functions. Azure has integrations with Bitbucket and GitHub, allowing simple configuration of a continuous integration process and the deploying of code in the cloud.

Azure Functions supports several types of event triggers. Cron jobs enable timer-based events for scheduled tasks, while events on Microsoft’s SaaS services, for example, OneDrive or SharePoint, can be configured to trigger operations in Functions. Common triggers for real-time processing of data or files add the ability to operate a serverless bot that uses Cortana as the information provider.

Google Cloud Functions

Google was the last serverless provider to step onto the scene. Its current support is somewhat limited, allowing functions to be written only in JavaScript, and triggering events solely on Google’s internal eventbus: Cloud Pub/Sub. HTTP triggers are supported as well, as mobile events from Firebase.

Google is still missing some important integrations with storage and other cloud services that help with business-related triggers, but this isn’t the problematic part. Google restricts projects to having fewer than 20 triggers.

Monitoring is enabled via the Stackdriver logging tool, which is very handy and easy to use, but does not supply all the information and metrics serverless users may require.

Serverless Pricing Comparison

The price of service can be just as important as features when choosing a service. Here's how they currently stack up.

AWS Lambda Pricing

  • 1 million free requests per month and 400,000 GB-seconds of compute time per month
  • $0.20 per 1 million requests
  • $0.00001667 for every GB-second of compute, with every execution rounded up to the nearest 100ms

Azure Functions Pricing

  • 1 million free requests per month and 400,000 GB-seconds of compute time per month
  • $0.20 per 1 million requests
  • $0.00001667 for every GB-second of compute, with every execution rounded up to the nearest 100ms

Google Cloud Functions Pricing

  • 2 million free requests per month and 400,000 GB-seconds of compute time per month
  • $0.40 per 1 million requests
  • $0.0000025 for every GB-second of compute, with every execution rounded up to the nearest 100ms

As you can see, AWS and Azure have identical pricing, while Google Cloud Function provides double the requests per month in the free tier. Determining which plan would be best for you all depends on how (and how much) you plan to use it.

Conclusion

Serverless computing encourages correct coding and pushes for effective and fast execution as a result of its pay-per-use model. Organizations can reduce cost in terms of monthly payment for serverless services by reducing their runtime. Developers who can reduce function runtime and write the smallest independent pieces of code will be able to take greater advantage of serverless computing and significantly reduce costs for their organization.

The Serverless Cost Calculator allows costs to be estimated according to the predicted number of executions and average execution time, and can help developers who would like to introduce serverless in their organization by clearly displaying potential savings.