For decades, enterprises have developed business-critical applications on various platforms, including physical servers, virtual machines, and cloud environments. The one thing these applications have in common across industries is they need to be continuously available (24x7x365) to guarantee stability, reliability, and performance, regardless of demand. Therefore, every enterprise must be responsible for the high costs of maintaining an infrastructure (e.g., CPU, memory, disk, networking, etc.) even if actual resource utilization is less than 50%.
The serverless architecture was developed to help solve these problems. Serverless allows developers to build and run applications on-demand, guaranteeing high availability without having to manage servers in multi- and hybrid-cloud environments. Behind the scenes, there are still many servers in the serverless topology, but they are abstracted away from application development. Instead, cloud providers use serverless services for resource management, such as provisioning, maintaining, networking, and scaling server instances.
Because of its effectiveness, the serverless development model is now a requirement for enterprises that want to spin up their business applications on-demand rather than running them all the time.
Many open-source projects have been created to manage serverless applications on
Kubernetes
clusters with the Linux container package over virtual machines. The
CNCF's Interactive Serverless Landscape
is a guide to open source projects, tools, frameworks, and public cloud platforms that enable DevOps teams to handle serverless applications.
Developers can write code then deploy it quickly to various serverless environments. Then the serverless application responds to demand and automatically scales up and down as needed.
You may be wondering what programming language and runtime are best suited for serverless application development to integrate with the technologies in the figure above. There's not just one answer to this question, but let's take a step back to discuss the application runtime that is most popular for developing business applications in enterprise production environments: Java.
According to
Developer Economics
, as of Q3 2020, more than 8 million enterprise developers are still using Java to achieve their business requirements. Yet, according to a
2020 NewRelic survey
, Java (at 6%) is clearly not the top choice for forward-thinking developers using a popular cloud service.
Resource usage, response times, and latency are critical in serverless development. Serverless offerings from public cloud providers are usually metered on-demand, charged only when a serverless application is up, through an event-driven execution model. Therefore, enterprises don't pay anything when a serverless application is idle or scaled down to zero.
The State of Java With Containers
With this background, you may be asking: "
Why
don't
developers try to use
the
Java stack for serverless application development
given that
existing business applications are most likely developed on Java technologies?
"
Here is the hidden truth: It's hard to optimize Java applications in the new immutable infrastructure, also known as container platforms (e.g., Kubernetes).
This diagram depicts the differences in memory resource usage between a Java process and competing languages and frameworks, such as
Node.js
and
Go
. Java HotSpot has the largest footprint, which includes the heap memory allocated per Java Virtual Machine (JVM) instance. The middle shows how much smaller each process is on Node.js compared to Java. And finally, Go is a compiled language popular on the cloud due to its low memory consumption.
As you can see, you get higher density as you go from left to right on this diagram. This is the reason developers shy away from Java (including
Spring Boot
, an opinionated microservice Java framework) when writing serverless applications on the cloud, containers, and Kubernetes.
What's Next?
Enterprises can gain significant benefits by implementing serverless applications, but resource-density issues cause them to avoid using the Java stack for developing serverless application development on Kubernetes. But choosing a different language creates a burden on the millions of Java developers worldwide. Therefore, in the next article in this series, I will guide you on how to get started with Java serverless functions instead of choosing a different language.
This article is originally published by myself
here
.