Java远程调试——性能

编程入门 行业动态 更新时间:2024-10-27 19:26:46
本文介绍了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:

  • 调试器端向 VM 端发送 14 个字节,由字符串JDWP-Handshake"的 14 个 ASCII 字符组成.
  • 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 增强的更多详细信息,请参阅 docs.oracle/javase/1.5.0/docs/guide/jpda/jdwp-spec.html

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

    更多推荐

    Java远程调试——性能

    本文发布于:2023-11-25 14:25:11,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1630116.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:性能   Java

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!