JVM performance tuning: young copy vs old generation gc

1.1k Views Asked by At

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?

1

There are 1 best solutions below

0
On BEST ANSWER

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.