Book Image

Hands-On Serverless Applications with Kotlin

By : Hardik Trivedi, Ameya Kulkarni
Book Image

Hands-On Serverless Applications with Kotlin

By: Hardik Trivedi, Ameya Kulkarni

Overview of this book

Serverless is a cloud computing execution model where the cloud provider dynamically manages the allocation and provisioning of servers. Many companies now use serverless architectures to cut costs and improve scalability. Thanks to its concise and expressive syntax and a smooth learning curve, Kotlin is a great fit for developing serverless applications. With this book, you’ll be able to put your knowledge to work by implementing serverless technology in your applications and become productive in no time. Complete with detailed explanation of essential concepts and examples, this book will help you understand the serverless architecture fundamentals and how to design serverless architectures for your applications. You’ll also explore how AWS Lambda functions work. The book will guide you in designing, building, securing, and deploying your application to production, along with implementing non-functional requirements such as auditing and logging. Furthermore, you’ll discover how to scale up and orchestrate serverless applications using an open source framework and handle distributed serverless systems in production. By the end of the book, you’ll be able to build scalable and cost-efficient Kotlin applications with a serverless framework.
Table of Contents (11 chapters)
3
Designing a Kotlin Serverless Application

The serverless computing ecosystem

Now that we have explored what the serverless paradigm is in detail – its evolution, and its pros and cons – let's take a look at the current serverless ecosystem and its landscape.

Serverless computers and infrastructure providers

The most important entity in the serverless world is the provider. A serverless cloud provider is an entity that takes care of hardware provisioning, runtime configuration and bootstrapping, creating turnkey solutions, and all of the plumbing required to support a serverless system and offer it as a packaged solution.

The following sections will cover the current big players in the ecosystem.

AWS Lambda

AWS Lambda is perhaps the most complete and well-known FaaS provider on the market. Since it's a great contribution to the serverless world, it is often mistakenly considered as the only serverless offering on the market. Although there are other providers, the adoption of AWS and Lambda's deep integration with other AWS offerings often make this the de facto choice of provider, all of the other factors, like budget, notwithstanding.

It only supports 64-bit binaries, and the OS version is the Amazon flavored, Linux-based on CentOS.

It offers the following runtime to code your functions:

  • Node.js: v8.10, 4.3.2, and 6.10.3

  • Java: 8

  • Python: 3.6 and 2.7

  • .NET Core: 1.0.1 and 2.0

  • Go: 1.x

IBM OpenWhisk

IBM OpenWhisk is the Apache Incubator open source serverless platform that IBM has adopted, and it offers FaaS as a part of its IBM Cloud offering. The official name of the service is IBM Cloud Functions.

It supports the following runtime environments: JavaScript (Node.js), Swift, Python, PHP, Java, Binary Compatible Executable, and Docker.

Microsoft Azure Cloud Functions

Microsoft's cloud offering, Azure, has its own FaaS offering, called Azure Cloud Functions.

There are two versions of its runtime, as follows:

  • Version 1.x is the only one approved for production use, and is general availability (GA)
  • Version 2.x is experimental, and in preview

Overall, it offers the following runtime: C#, JavaScript, F#, Java, Python, PHP, TypeScript, batch executables, bash executables, and PowerShell executables.

As of the time of writing this book, most of them are in experimental and preview states. The versions 1.x for Javascript, C#, and F#, are GA, and approved for production use. Microsoft has big plans for Azure Cloud Functions. Check the roadmap for the current status of the Azure Cloud Functions.

Google Cloud Functions

Google Cloud platform's FaaS offering is called Google Cloud Functions. It is in the beta stage, and the API will change for the better.

At the time of writing this literature, it only supports Node.js as a runtime.

Auth0 Webtasks

Auth0 is a BaaS offering, providing a solution for identity management. Recently, it moved into FaaS by offering Webtask as a serverless platform.

It offers Node.js as a runtime environment, for functions that can be triggered via an HTTP endpoint.

Others

Other serverless providers include the following:

  • Spotinst: Spotinst is an interesting provider that automates cloud-agnostic FaaS orchestration. It also provides Containers as a Service across multiple cloud providers, like AWS, Azure, Alibaba Cloud, and so on.
  • Kubless: This is a Kubernetes native FaaS framework that allows ephemeral functions to be developed on top of Kubernetes.
  • Iron.io: Iron.io is a serverless provider, offering solutions like message queue, caching, functions, and Containers as a Service, at a scale that was recently open sourced.

Serverless toolkits

As discussed earlier in this chapter, the biggest chink in the armor of the serverless promise is the absence of standardization in implementing and tooling. This is not a drawback so much as a work in progress.

The traction that serverless architecture is gaining is spawning a lot of innovation, and startups are coming up with interesting offerings to fill the gaps that the current ecosystem has. The gaps that the tooling platforms have to fill are the deployment, configuration, and monitoring concerns.

Serverless is the biggest player, actively blazing a trail while creating a toolkit that eases up the aforementioned tasks of serverless computing. It enables you to focus on your code, and not on the operations of your FaaS environments.

The other toolkits in this ecosystem are Clay, NodeLambda, Back&, Synk, and so on, each aimed at solving niche and overlapping problems in the serverless ecosystem.

There is so much traction in this space that we will continue to see newer and more powerful tools at a breakneck speed. Cautious evaluation and due diligence are a must while selecting the right platform and toolkit to adopt the serverless paradigm.