4

Does anyone know if the PrintGCDetails affects java performance much? I've been monitoring our java garbage collecting on a staging server with the same setup as the production server.

I assumed it was safe to say that I shouldn't have this enabled on production but I don't know if there's really any affect on performance.

brad
  • 492
  • 1
  • 10
  • 22

3 Answers3

3

You should definitely enable garbage collection logging in production servers. The benefits far outweigh the negligible performance impact.

You could also monitor GC behaviour using other approaches (see answers).

fglez
  • 326
  • 4
  • 18
1

It will at worst have a minor effect on performance. It depends on how your application behaves. If it requires the garbage collector to run more often then it will be outputting more logging information. The act of logging it doesn't really take much time, but it will fill your log files with a lot of extra information.

Gaz
  • 246
  • 3
  • 7
1

Depending how much your java application logs to disk be very careful that you don't start to see performance issues due to disk IO, i have seen this happen with a couple of different java application where the system works well until it gets bogged down performing logging.

Might be worth looking into using jmx to query how the system is running or enabling SNMP within the JVM ( i have tested this but not used it in production so please use very carefully and test some where before hand.)

Paul
  • 593
  • 2
  • 6