简体   繁体   中英

Java -verbose:gc Performance Implications?

Just wondering if enabling verbose GC would have any effect on the performance of an application.

My guess is no not really.

I know that enabling verbose GC can output a fair bit data and was wondering is this realistically going to have any effect on performance?

Anything that outputs to file/console will incur some I/O overhead. Tacking an extra couple ms latency onto every garbage collection event certainly could have some effect on performance.

Realistically speaking though, your application would have to be going through a lot of them and be under quite some load before you'd notice. It's very hard to tell without testing.

Here are some performance benchmarks on this from IBM. Both indicate that, in their benchmark scenarios, that the overhead of verbose GC was pretty minuscule:

This is, of course, on the IBM JVM, so results may differ for Hotspot. However, as with the IBM JVM, most of the metrics that get written to the log are likely internally computed for optimization reasons already, so the only additional overhead would be the act of writing the already-computed data to the log. So as WDS said, you'd have to be collecting with incredible frequency before that overhead started to make a significant dent in your overall performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM