Java 21 虚拟线程 - 伙计,我的锁在哪里?

By Vadim Filanovsky, Mike Huang, Danny Thomas and Martin Chalupa

Vadim FilanovskyMike HuangDanny ThomasMartin Chalupa撰写

Intro

介绍

Netflix has an extensive history of using Java as our primary programming language across our vast fleet of microservices. As we pick up newer versions of Java, our JVM Ecosystem team seeks out new language features that can improve the ergonomics and performance of our systems. In a recent article, we detailed how our workloads benefited from switching to generational ZGC as our default garbage collector when we migrated to Java 21. Virtual threads is another feature we are excited to adopt as part of this migration.

Netflix在我们庞大的微服务群集中使用Java作为我们的主要编程语言,拥有丰富的使用历史。随着我们采用更新版本的Java,我们的JVM生态系统团队寻找可以改善系统人机工程学和性能的新语言特性。在一篇最近的文章中,我们详细介绍了当我们迁移到Java 21时,我们的工作负载从切换到分代ZGC作为默认垃圾收集器中受益的情况。虚拟线程是我们期待作为此迁移的一部分采用的另一个功能。

For those new to virtual threads, they are described as “lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications.” Their power comes from their ability to be suspended and resumed automatically via continuations when blocking operations occur, thus freeing the underlying operating system threads to be reused for other operations. Leveraging virtual threads can unlock higher performance when utilized in the appropriate context.

对于那些对虚拟线程还不熟悉的人,它们被描述为“轻量级线程,极大地减少了编写、维护和观察高吞吐量并发应用程序的工作量”。它们的强大之处在于当发生阻塞操作时,它们能够通过续延自动地挂起和恢复,从而释放底层操作系统线程以便用于其他操作。在适当的上下文中利用虚拟线程可以实现更高的性能。

In this article we discuss one of the peculiar cases that we encountered along our path to deploying virtual threads on Java 21.

在本文中,我们讨论了我们在将虚拟线程部署到Java 21时遇到的一个特殊案例。

The problem

问题

Netflix engineers raised several independent reports of intermittent timeouts and hung instances to the Performance Engineering and JVM Ecosystem teams. Upon closer examination, we noticed a set of common traits and symptoms. In all cases, the apps affected ran on Java 21 with SpringBoot 3 and embedded Tomcat serving traffic on REST endpoints. The instances that exper...

开通本站会员,查看完整译文。

- 위키
Copyright © 2011-2024 iteam. Current version is 2.137.1. UTC+08:00, 2024-11-08 20:25
浙ICP备14020137号-1 $방문자$