On-Premises Serverless Architecture

Vineet Agarwal
Jul 19, 2019 · 3 min read

Serverless architecture is one of the most sought after technologies today in Software Architecture world. It refers to applications where server-side logic is run in stateless containers that are event-triggered, ephemeral and fully managed by a third-party service known as Backend as a Service “Bass” or Function as a Service “Fass”. Most of the cloud vendors including Amazon, Google and Microsoft are heavily invested in their Serverless offerings. Despite the name, it does not actually involve running code without servers. The name “serverless computing” is used because the application owner does not have to purchase, rent or provision servers or virtual machines for running the serverless backend.

Serverless Benefits

Serverless computing offers a number of advantages over traditional application development and deployment. With serverless architectures, developers do not need to worry about purchasing, provisioning, and managing backend servers, all at the reduced cost.

  • Lesser cost to scale — the developers need not implement code to scale and the administrators need not upgrade the servers that are existing or add any additional servers.
  • Works with agile development and enables the developers to concentrate on the code and deliver quickly.
  • Fits well with microservices(they can be implemented as functions).
  • Pay per request: your code is using compute resources only while serving requests. For hosted services, you’re only paying for active compute time rather than paying for a virtual machine running 24/7

On-Premise Serverless Architecture

One of the main drawbacks to a Serverless architecture is its dependence on vendor technologies. Most of the serverless offerings are proprietary with features that cannot be ported between providers. The same issue is with programming languages: Right now only Node.js and Python developers have the freedom to choose between existing serverless options. If you have Java functions in AWS Lambda, you might have to rewrite your function entirely if you need to move them to Azure or Google.

Knative presents a standard pattern for building and deploying serverless, event-driven applications on Kubernetes platform. It is an extension of Kubernetes installed as a set of Custom Resource Definitions (CRDs). It provides APIs and runtime environment to run the serverless application anywhere: on-premises or a managed cloud provider. Essentially you can run Knative and your code anywhere you can run Kubernetes.

A key principle of serverless is scaling up to meet demand and down to save resources. Serverless workloads should scale all the way down to zero. That means no container instances are running if there are no incoming requests. Knative uses three key components to achieve this functionality.

  • Build: which automates the process of pulling source code from a repository, building a container image based on it and then running that image within a Kubernetes cluster.
  • Serve: handles scaling of underlying instances from zero to large scale, and back to zero when the service is no longer in use.
  • Events: allows you to set up and define triggers for your functions.
Diagram by Knative
Diagram by Knative

Diagram by Knative

Knative Benefits

Serverless in a Containerized Environment: Knative creates serverless environments using containers, providing you with the benefit of event-based architecture on-premises without the restrictions and limitations imposed by public cloud services.

scale-to-zero: Knative offers features like scale-to-zero, autoscaling mechanism that scales up and down providing capacity based on predefined thresholds

Automates the container build process: Knative automates the container build process by using Kubernetes-native resources to obtain your source code from a repository, build a container image, then run that image.

No Vendor Lock-in: Knative allows to build applications on-premises, in the cloud, or in a third-party data center. Essentially you can run your serverless function in any Kubernetes installation. Since it is cloud-agnostic, you have more flexibility because you aren’t locked into a particular cloud provider’s proprietary serverless offerings.

Conclusion

While serverless leverage third-party services such as AWS Lambda to eliminate the requirement to set up and configure physical servers or virtual machines, it also locks in the application and its architecture to the specific service provider. Knative is a new framework that offers on-premises option to deploy event-based serverless applications with automatic scaling.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade