user84592
user84592

Reputation: 4882

JVM performance tuning: young copy vs old generation gc

Hi: I have a multi thread Java application. There are many temporary objects.
-XX:MaxTenuringThreshold=1, we put above parameter when starting JVM. This means all the objects would be survive once during gc, then it would be promoted to old generation. Could we put this -XX:MaxTenuringThreshold=10 for example, so that object would be promoted to old JVM old generation after 10 times gc. But will that cause unnecessary copy operation during young gc (since objects are copied 'from 'eden' to 'from', from 'from' to 'to', 'from','to' are two survivor buffer)?

The questions might also mean if a) there are multiple times copy in young generation,less old generation gc, b) long old generation garbage collection but few young generation copy, which one is better for good performance?

Upvotes: 3

Views: 1141

Answers (1)

JUST MY correct OPINION
JUST MY correct OPINION

Reputation: 36107

Which one is "better for good performance" depends very much on your application and the conditions under which it operates. Your best hope is to try various garbage collection options and then do runtime and memory profiling to get the best trade-off between memory usage and speed.

There is, sadly, no silver bullet for garbage collection settings.

Upvotes: 6

Related Questions