我想问一下如何远程分析 Java 应用程序.对于调试,我可以说 JVM 必须侦听哪个端口等,因为我尝试访问的机器在 ssh 网关后面,所以我手动创建了一个 SSH 隧道,但我一直在搜索同样的事情,但是在分析时我不能'好像没找到基本上我正在寻找与此命令等效的命令:
I'd like to ask how I can profile REMOTELY a java application. For debugging I can say which port the JVM must listen etc since the machine I'm trying to access is behind an ssh gateway so I manually create an SSH tunnel but I've been googling about the same thing but when profiling and I couldn't seem to find. Basically I'm looking for the equivalent of this command:
java -agentlib:jdwp=transport=dt_socket,server=y,address=8000 -jar /bla/bla但用于分析,以便我可以远程附加分析器.
but for profiling so that I can remotely attach a profiler.
推荐答案免责声明:我公司开发JProfiler
Disclaimer: My company develops JProfiler
使用 JProfiler,VM 参数是这样的:>
With JProfiler, the VM parameter is like this:
-agentpath:/path/to/libjprofilerti.so=port=8849"/path/to/libjprofilerti.so" 是本地代理库的路径,在 Linux x86 上,对于 32 位 JVM,它将是 [JProfiler 安装目录]/bin/linux-x86/libjprofilerti.so.使用 port 参数,您可以告诉代理侦听特定端口.您可以将其设置为 SSH 隧道的端口.
"/path/to/libjprofilerti.so" is the path to the native agent library, on Linux x86, for a 32-bit JVM it would be [JProfiler installation directory]/bin/linux-x86/libjprofilerti.so. With the port parameter, you can tell the agent to listen on a specific port. You can set this to the port of your SSH tunnel.
您可以通过调用 JProfiler 主菜单中的 Session->Integration Wizards->New Remote Integration 轻松生成此 VM 参数:
You can easily generate this VM parameter by invoking Session->Integration Wizards->New Remote Integration in JProfiler's main menu:
在您的本地机器上,您创建一个类型为Attach to profiled JVM"的新会话并选择您的 SSH 隧道的本地端口(屏幕截图中的 10022):
On your local machine, you create a new session of type "Attach to profiled JVM" and choose the local port of your SSH tunnel (10022 in the screen shot):
更多推荐
远程分析 Java 应用程序
发布评论