Healthy garbage collection rates?

i profiled batch importer jdbc / hibernate. it takes csv, converts it to an array, and imports it into a database sitting on the local host.

to my surprise, the operation was not related to I / O, but rather cpu-bound.

according to jmx / jconsole, as well as the netbeans profiler, it seems that 60% of the processor time was spent on the “old generation” garbage collector, the rest is used for geometric transformations (this is reasonable) and for managing the hibernation session.

other applications used around 5-10% according to jconsole so what is the "typical" relationship for the processor / young GC / old GC for such insertion tasks in the package?

+3
source share
4 answers

Sixty percent are really high. This often indicates that someone is using a lot of temporary lines or something like that. The fact that this is happening in the “old generation” suggests that this may happen at the end of the database, possibly in anticipation of database transactions. But it's just riding.

You probably want to make more detailed run profiles.

+1
source

In addition to what Charlie said, another thing that I think can lead to you having a lot of objects with finalizers (some libraries actually do this), as I recall, it actually makes them quickly bypass VM path to free an object.

+1
source

afer, netbeans/heap walker, , String, SQL-. log4jdbc. .

log4jdbc , - INFO. sql, .

- log4jdbc .

cpu% 1-2% 20-50% ( ) 5000 , 100 SECONDS , 5000 1-2 SECONDS.

GC 6-7% , .

conclusio:

GC > 20% , - .

+1

I agree that up to 10% is usually great for GC time. If you have an old generation problem, try adding the < XX: NewSize = 300m parameter , where you can increase the young generation. This helps to avoid large heaps of used objects (garbage) in the old area. Especially when you just have a lot of local objects and you don’t intentionally save anything longer.

0
source

Source: https://habr.com/ru/post/1708960/


All Articles