Java远程调试——性能 [英] Java remote debugging - performance

查看:62
本文介绍了Java远程调试——性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您启动一个通过 jdwp/socket 启用远程调试的 java 进程并且没有外部进程连接,是否会影响性能?我确实知道当远程客户端实际调试时会有很大的影响,但是如果我只是在特定端口上声明 jdwp,那么它本身会减慢应用程序吗?任何指向文档的链接将不胜感激.

Is there any performance hit if you start a java process with remote debugging enabled via jdwp/socket and no external process connects? I do understand there is a significant hit when there is a remote client actually debugging, but if I simply declare jdwp on a specific port, will that on its own slow the app? Any links to documentation would be greatly appreciated.

推荐答案

,只要没有外部进程连接,只启用调试端口对运行时性能没有影响.

No, by just enabling the debugging port will have no effect on runtime performance as long as no external process connects.

JDWP 是用于调试器与其调试的 Java 虚拟机 (VM) 之间通信的协议.JDWP 是可选的.

JDWP is the protocol used for communication between a debugger and the Java virtual machine (VM) which it debugs. JDWP is optional.

JDWP 启动 - 在建立传输连接之后,在发送任何数据包之前,连接的两端会发生握手:

JDWP Start Up - After the transport connection is established and before any packets are sent, a handshake occurs between the two sides of the connection:

握手过程有以下几个步骤:

The handshake process has the following steps:

  1. 调试器端向 VM 端发送 14 个字节,由字符串JDWP-Handshake"的 14 个 ASCII 字符组成.
  2. VM 端用同样的 14 个字节回复:JDWP-Handshake

在 Java SE 1.4 中,Java HotSpot 虚拟机现在使用全速调试"

In Java SE 1.4 the Java HotSpot virtual machine now uses "full-speed debugging"

在以前的 HotSpot 版本中,当启用调试时,程序仅使用解释器执行.现在,在启用调试的情况下运行的程序可以使用 HotSpot 技术的全部性能优势.改进的性能允许更容易地调试长时间运行的程序.它还允许测试全速进行,并在出现异常时启动调试器:

In the previous version of HotSpot, when debugging was enabled, the program executed using only the interpreter. Now, the full performance advantage of HotSpot Technology is available to programs running with debugging enabled. The improved performance allows long running programs to be more easily debugged. It also allows testing to proceed at full speed and the launch of a debugger to occur on an exception:

有关 JDWP 增强的更多详细信息,请参阅 http://docs.oracle.com/javase/1.5.0/docs/guide/jpda/jdwp-spec.html

For more details regarding JDWP Enhancements, please see http://docs.oracle.com/javase/1.5.0/docs/guide/jpda/jdwp-spec.html

这篇关于Java远程调试——性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆