开发者

How large is the -Xdebug flag overhead?

I wonder how large the performance overhead that the -Xdebug flag introduces?

It's very convenient to debug production applications, but I guess it is expensive to leave running all the time?

Also, is there a good开发者_JAVA百科 way to make the already running application to listen via Debug port, without re-launching it?

Thanks.


We haven't found any difference. We run all our production applications with -Xdebug.

is there a good way to add Debug mode to application already running, without re-launch it

It is what -Xdebug does. Debugger actually starts when someone connects to debugging port.


Under Java 6 I would say the cost is about 15% to performance, Under Java 5.0 it was about 40%. This may be fine for you.

Another way to see what is going on in production is to use JMX/JConsole. This takes some work and has a relatively small over head. I guess at 2%.


Depends what your code is doing. If you've got a network-based, database driven application the difference will probably be negligable since the bottleneck probably isn't how fast the JVM can execute instructions. If all your code does is perform scientific computations in-memory, then you can expect a non-trivial hit.

Edit

When I wrote this I thought the debugger itself was being attached. Simply running it with -Xdebug won't in itself impact performance as @stepancheg has noted. However my main motivation wasn't as much to give a technical analysis but rather to say that even if you cause bytecode to take longer to execute it probably won't matter much in a typical Java application since the processors wouldn't be under heavy enough utilization for that to be the determining performance factor. Most apps with a long lifetime are server apps, and the performance of many (if not most) server apps are bounded by I/O limitations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜