简体   繁体   English

吞吐量垃圾收集

[英]throughput garbage collection

I am going through Hotspot JVM garbage collection, i have a question , 我正在进行Hotspot JVM垃圾收集,我有一个问题,

First article says 第一篇文章说

The throughput goal is measured in terms of the time spent collecting garbage and the time spent outside of garbage collection (referred to as application time). 吞吐量目标是根据收集垃圾 所花费的时间和垃圾收集之外所花费的时间 (称为应用程序时间)来衡量的。

Second one says, 第二个人说

Throughput is the percentage of total time not spent in garbage collection , considered over long periods of time. 吞吐量是长时间内未花费在垃圾回收上总时间的百分比。 Throughput includes time spent in allocation (but tuning for speed of allocation is generally not needed). 吞吐量包括分配所花费的时间(但是通常不需要调整分配速度)。

Also the Second article says 还有第二篇文章说

throughput is inversely proportional to the amount of memory available. 吞吐量与可用内存量成反比。

I am confused whether throughput is a measure of time spent in garbage collection or not spent in garbage collection and how does it relate to the total amount of memory available. 我感到困惑的是,吞吐量是衡量浪费在垃圾收集上还是没有花费在垃圾收集上的时间,它与可用内存总量有何关系。

Appreciate your help! 感谢您的帮助!

how does it relate to the total amount of memory available ==> In most cases (non-IO bound systems), as the memory available to any process increases, it's performance and hence throughput increases. 它是如何涉及存储器可用 ==>在大多数情况下(非IO结合系统) 的总量 ,作为提供给任何过程增加存储器,它的性能,并因此可以通过增加。 In case of JVM, as size of heap increases, GC will have little work to do. 对于JVM,随着堆大小的增加,GC将几乎没有工作要做。 Thus, throughput is inversely proportional to memory (not always. Remember this). 因此, 吞吐量与内存成反比(并非总是如此。请记住这一点)。

Next, throughput is the total time available to the non GC threads to do their tasks. 接下来, 吞吐量是非GC线程执行任务所需的总时间。

I think the Oracle guide referenced ("second article") unfortunately has an error in this paragraph, or is very misleading (and define throughput as something different without making this clear). 我认为所引用的Oracle指南(“第二篇文章”)在本段中有错误,或者非常具有误导性(并且在没有明确说明的情况下将吞吐量定义为不同的东西)。 You reference the Java SE 6 HotSpot gc tuning guide, but the error is also in the Java 11 version: Java SE11, HotSpot Virtual Machine Garbage Collection Tuning Guide, chapter 4, Factors Affecting Garbage Collection Performance : 您参考了Java SE 6 HotSpot gc调整指南,但Java 11版本中也存在该错误:Java SE11, HotSpot虚拟机垃圾收集调整指南,第4章,影响垃圾收集性能的因素

Chapter 4, "Factors Affecting Garbage Collection Performance": 第4章,“影响垃圾收集性能的因素”:

Total Heap The most important factor affecting garbage collection performance is total available memory. 总堆影响垃圾收集性能的最重要因素是总可用内存。 Because collections occur when generations fill up, throughput is inversely proportional to the amount of memory available. 由于收集是在世代填满时发生的,因此吞吐量与可用内存量成反比。

The rest of the guide does use the term as application/system throughput , and throughput generally is one of three GC tuning goals, so I consider this to be an error. 本指南的其余部分确实将术语称为应用程序/系统吞吐量 ,并且吞吐量通常是三个GC调整目标之一,因此我认为这是一个错误。 (I think the rest of the guide is good). (我认为指南的其余部分很好)。

As far as I understand this should generally be the opposite: 据我了解,这通常是相反的:

Throughput is generally proportional to the amount of memory available. 吞吐量通常与可用内存量成正比。

(Not considering tuning specific effects, - it is possible in some cases to add memory and get less throughput.) (不考虑调整特定效果,在某些情况下可能会增加内存并减少吞吐量。)

I choose to cite from an authority on this, Java Performance by Charlie Hunt and Binu John , which I think presents the definitions and relations between throughput , memory and latency quite clear in chapter 7 "Tuning the JVM, Step by Step" page 256-257: 我选择从Charlie Hunt和Binu John撰写的Java Performance一书中引用权威,我认为在第7章“逐步调试JVM”(第256页)中非常清楚地介绍了吞吐量内存延迟之间的定义和关系。 257:

Throughput Throughput is a measure of the amount of work that can be performed per unit time. 吞吐量吞吐量是对每单位时间可以执行的工作量的度量。 A throughput requirement ignores latency or responsiveness. 吞吐量要求忽略了延迟或响应能力。 Usually, increased throughput comes at the expense of either an increase in latency and/or an increase in memory footprint. 通常,增加吞吐量是以增加等待时间和/或增加内存占用为代价的。

An example of a performance throughput requirement is “the application shall execute 2500 transactions per second.” 性能吞吐量要求的一个示例是“应用程序应每秒执行2500个事务”。

Latency and Responsiveness Latency, or responsiveness, is a measure of the elapsed time between when an application receives a stimulus to do some work and that work is completed. 延迟和响应性延迟或响应性是对应用程序收到激励以完成某些工作到完成工作之间经过的时间的度量。 A latency or responsiveness requirement ignores throughput. 延迟或响应性要求会忽略吞吐量。 Usually, increased responsiveness or lower latency, comes at the expense of lower throughput and/or an increase in memory footprint. 通常,增加响应速度或降低延迟会以降低吞吐量和/或增加内存占用为代价。

An example of a latency or responsiveness requirement is “the application shall execute trade requests to completion within 60 milliseconds.” 延迟或响应性要求的一个示例是“应用程序应在60毫秒内执行交易请求以完成。”

Memory Footprint Memory footprint is a measure of the amount of memory required to run an application at a some level of throughput, some level of latency, and/or some level of availability and manageability. 内存占用空间内存占用空间是衡量以某个级别的吞吐量,某个级别的延迟和/或某个级别的可用性和可管理性运行应用程序所需的内存量的度量。 Memory footprint is usually expressed as either the amount of Java heap required to run the application and/or the total amount of memory required to run the application. 内存占用量通常表示为运行应用程序所需的Java堆数量和/或运行应用程序所需的内存总量。 Usually, an increase in memory footprint via an increase in Java heap size can improve throughput or reduce latency, or both. 通常,通过增加Java堆大小来增加内存占用量可以提高吞吐量或减少延迟,或两者兼而有之。 As the memory made available for an application is decreased, throughput or latency is generally sacrificed. 随着可供应用程序使用的内存减少,通常会牺牲吞吐量或等待时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM