mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
translated
20210519 What is serverless with Java is translated by DCOLIVERSUN
This commit is contained in:
parent
71a4304c13
commit
8b3973fb48
@ -1,84 +0,0 @@
|
|||||||
[#]: subject: (What is serverless with Java?)
|
|
||||||
[#]: via: (https://opensource.com/article/21/5/what-serverless-java)
|
|
||||||
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
|
|
||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: (DCOLIVERSUN)
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
What is serverless with Java?
|
|
||||||
======
|
|
||||||
Java is still one of the most popular languages for developing
|
|
||||||
enterprise applications. So, why are serverless developers shying away
|
|
||||||
from it?
|
|
||||||
![Coffee beans and a cup of coffee][1]
|
|
||||||
|
|
||||||
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%.
|
|
||||||
|
|
||||||
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][2] clusters with the Linux container package over virtual machines. The [CNCF's Interactive Serverless Landscape][3] is a guide to open source projects, tools, frameworks, and public cloud platforms that enable DevOps teams to handle serverless applications.
|
|
||||||
|
|
||||||
![CNCF Serverless Landscape][4]
|
|
||||||
|
|
||||||
([CNCF][3], [Apache License 2.0][5])
|
|
||||||
|
|
||||||
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][6], 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][7], Java (at 6%) is clearly not the top choice for forward-thinking developers using a popular cloud service.
|
|
||||||
|
|
||||||
![NewRelic data on serverless runtimes and languages][8]
|
|
||||||
|
|
||||||
Data from NewRelic's Serverless Benchmark Report (Daniel Oh, [CC BY-SA 4.0][9])
|
|
||||||
|
|
||||||
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).
|
|
||||||
|
|
||||||
![Differences in memory resource usage][10]
|
|
||||||
|
|
||||||
(Daniel Oh, [CC BY-SA 4.0][9])
|
|
||||||
|
|
||||||
This diagram depicts the differences in memory resource usage between a Java process and competing languages and frameworks, such as [Node.js][11] and [Go][12]. 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][13], 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.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/21/5/what-serverless-java
|
|
||||||
|
|
||||||
作者:[Daniel Oh][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://opensource.com/users/daniel-oh
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-mug.jpg?itok=Bj6rQo8r (Coffee beans and a cup of coffee)
|
|
||||||
[2]: https://opensource.com/article/19/6/reasons-kubernetes
|
|
||||||
[3]: https://landscape.cncf.io/serverless?zoom=150
|
|
||||||
[4]: https://opensource.com/sites/default/files/uploads/cncf-serverless-landscape.png (CNCF Serverless Landscape)
|
|
||||||
[5]: https://github.com/cncf/landscape/blob/master/LICENSE
|
|
||||||
[6]: https://developereconomics.com/
|
|
||||||
[7]: https://newrelic.com/resources/ebooks/serverless-benchmark-report-aws-lambda-2020
|
|
||||||
[8]: https://opensource.com/sites/default/files/uploads/newrelic_serverlessbenchmarkreport.png (NewRelic data on serverless runtimes and languages)
|
|
||||||
[9]: https://creativecommons.org/licenses/by-sa/4.0/
|
|
||||||
[10]: https://opensource.com/sites/default/files/uploads/java-containers.png (Differences in memory resource usage)
|
|
||||||
[11]: https://nodejs.org/
|
|
||||||
[12]: https://golang.org/
|
|
||||||
[13]: https://spring.io/projects/spring-boot
|
|
82
translated/tech/20210519 What is serverless with Java.md
Normal file
82
translated/tech/20210519 What is serverless with Java.md
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
[#]: subject: (What is serverless with Java?)
|
||||||
|
[#]: via: (https://opensource.com/article/21/5/what-serverless-java)
|
||||||
|
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (DCOLIVERSUN)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
什么是 Java 的无服务器化?
|
||||||
|
======
|
||||||
|
Java 仍是开发企业应用程序最流行的语言之一。那么,为什么<ruby>无服务器<rt>serverless</rt></ruby>开发人员回避它?
|
||||||
|
![Coffee beans and a cup of coffee][1]
|
||||||
|
|
||||||
|
几十年来,企业已经在各类平台上开发了关键业务应用程序,包括物理服务器、虚拟机和云环境。这些应用程序在各行各业都有一个共同点,那就是无论需求如何,它们都需要持续可用(24x7x365),保证稳定性、可靠性和性能。因此,即使实际资源利用率低于 50%,每个企业都必须付出高额成本维护基础架构(如 CPU、内存、磁盘、网络等)。
|
||||||
|
|
||||||
|
无服务器架构是为了帮助解决这些问题而产生的。无服务器允许开发人员按需构建和运行应用程序,保证高可用性,不必在多云和混合云环境中管理服务器。在幕后,无服务器拓扑中仍有很多服务器,但它们是从应用程序开发中抽象出来的。相反,云提供商使用无服务器进行资源管理,例如配置、维护、联网和扩展服务器实例。
|
||||||
|
|
||||||
|
由于其高效性,无服务器开发模式现在是一些企业的需求,这些企业希望按需启动服务,而不是一直运行服务。
|
||||||
|
|
||||||
|
许多新建开源项目用来在 [Kubernetes][2] 集群上通过 Linux 容器包来管理无服务器应用程序。[CNCF 交互式无服务器环境][3]是开源项目、工具、框架和公共云平台的指南,帮助 DevOps 团队处理无服务器应用程序。
|
||||||
|
|
||||||
|
![CNCF Serverless Landscape][4]
|
||||||
|
|
||||||
|
([CNCF][3], [Apache License 2.0][5])
|
||||||
|
|
||||||
|
开发人员可以编写代码,然后将其快速部署到各种无服务器环境中。然后,无服务器应用程序响应需求,并根据需要自动上下扩展。
|
||||||
|
|
||||||
|
你可能想知道什么编程语言和运行环境最适合无服务器应用程序开发,以便与上图中的技术集成。这个问题不只一个答案,但是让我们退一步来讨论在企业生产环境中开发业务应用程序最流行的应用程序运行环境:Java。
|
||||||
|
|
||||||
|
据 [Developer Economics][6] 称,截至 2020 年第三季度,仍有 800 多万家企业开发人员在使用 Java 来实现其业务需求。然而,根据 2020 年的一项调查,Java(6%)显然不是有前瞻意识的开发人员的首选,他们使用当前云服务做开发。
|
||||||
|
|
||||||
|
![NewRelic data on serverless runtimes and languages][8]
|
||||||
|
|
||||||
|
来自 NewRelic 无服务器基准报告的数据(Daniel Oh, [CC BY-SA 4.0][9])
|
||||||
|
|
||||||
|
资源使用、响应时间和延迟在无服务器开发中至关重要。公共云提供商提供的无服务器产品通常是按需计量的,只有在无服务器应用程序启动时,才会通过事件驱动的执行模式收费。因此,当无服务器应用程序闲置或缩减为零时,企业无需支付任何费用。
|
||||||
|
|
||||||
|
### 带有容器的 Java 状态
|
||||||
|
|
||||||
|
在这种背景下,你可能会问:“_既然现有业务应用程序很可能是在 Java 技术上开发的,那么开发人员为什么不尝试使用 Java 栈进行无服务器应用程序开发呢?_”
|
||||||
|
|
||||||
|
隐藏的事实是:很难在不可变更的新基础设施中优化 Java 应用程序,这种基础设施也被称为容器平台(例如 Kubernetes)。
|
||||||
|
|
||||||
|
![Differences in memory resource usage][10]
|
||||||
|
|
||||||
|
(Daniel Oh, [CC BY-SA 4.0][9])
|
||||||
|
|
||||||
|
该图描述了 Java 进程与竞争语言、框架(如 [Node.js][11] 和 [Go][12])之间内存资源使用的差异。Java HotSpot 占用空间最大,其中包括每个<ruby> Java 虚拟机<rt>Java Virtual Machine</rt></ruby>(JVM)实例分配的堆内存。中间显示 Node.js 每个进程要比 Java 小得多。最后,Go 是一种在云上流行的编程语言,因为它的内存消耗最低。
|
||||||
|
|
||||||
|
如你所见,当你在这张图从左到右走,你会看到更密的节点。这就是开发人员在云、容器和 Kubernetes 上编写无服务器应用程序时回避 Java(包括 [Spring Boot][13],一种固定的微服务 Java 框架)的原因。
|
||||||
|
|
||||||
|
### 下一步是什么?
|
||||||
|
|
||||||
|
企业可以通过实现无服务器应用程序获得明显的好处,但是资源密度问题导致他们避免使用 Java 堆栈在 Kubernetes 上开发无服务器应用程序开发。但是选择其他语言会给全球数百万 Java 开发人员带来负担。因此,在本系列的下一篇文章中,我将指导你如何开始使用 Java 无服务器函数,而不是使用其他语言。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/5/what-serverless-java
|
||||||
|
|
||||||
|
作者:[Daniel Oh][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[DCOLIVERSUN](https://github.com/DCOLIVERSUN)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/daniel-oh
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-mug.jpg?itok=Bj6rQo8r (Coffee beans and a cup of coffee)
|
||||||
|
[2]: https://opensource.com/article/19/6/reasons-kubernetes
|
||||||
|
[3]: https://landscape.cncf.io/serverless?zoom=150
|
||||||
|
[4]: https://opensource.com/sites/default/files/uploads/cncf-serverless-landscape.png (CNCF Serverless Landscape)
|
||||||
|
[5]: https://github.com/cncf/landscape/blob/master/LICENSE
|
||||||
|
[6]: https://developereconomics.com/
|
||||||
|
[7]: https://newrelic.com/resources/ebooks/serverless-benchmark-report-aws-lambda-2020
|
||||||
|
[8]: https://opensource.com/sites/default/files/uploads/newrelic_serverlessbenchmarkreport.png (NewRelic data on serverless runtimes and languages)
|
||||||
|
[9]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||||
|
[10]: https://opensource.com/sites/default/files/uploads/java-containers.png (Differences in memory resource usage)
|
||||||
|
[11]: https://nodejs.org/
|
||||||
|
[12]: https://golang.org/
|
||||||
|
[13]: https://spring.io/projects/spring-boot
|
Loading…
Reference in New Issue
Block a user