Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

throughput garbage collection

I am going through Hotspot JVM garbage collection, i have a question ,

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!

like image 781
chebus Avatar asked Aug 04 '15 10:08

chebus


People also ask

Which garbage collection algorithm gives best throughput?

Serial Garbage Collector (-XX:+UseSerialGC) The bump pointer technique for compaction is used by Serial Collector and that is why the allocation is much faster. This collector is generally best for applications that are run on a shared CPU with very small amounts of memory.

Is garbage collection slow or fast?

Impacts On Performance If it was, every language would use it. GC is slow, mostly because it needs to pause program execution to collect garbage. Think of it like this — your CPU can only work on one thing at a time. With C++, it's always working on your code, including the bits that delete memory.

What is the difference between serial and throughput garbage collector?

Serial collector uses one thread to execute garbage collection. Throughput collector uses multiple threads to execute garbage collection. Serial GC is the garbage collector of choice for applications that do not have low pause time requirements and run on client-style machines.

How can I speed up my garbage collection?

Short of avoiding garbage collection altogether, there is only one way to make garbage collection faster: ensure that as few objects as possible are reachable during the garbage collection. The fewer objects that are alive, the less there is to be marked. This is the rationale behind the generational heap.


1 Answers

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). 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:

Chapter 4, "Factors Affecting Garbage Collection Performance":

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. (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:

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.”

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.”

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. Usually, an increase in memory footprint via an increase in Java heap size can improve throughput or reduce latency, or both. As the memory made available for an application is decreased, throughput or latency is generally sacrificed.

like image 135
Are D. Gulbrandsen Avatar answered Nov 15 '22 10:11

Are D. Gulbrandsen