6

I'm having some serious problems regarding my Play! Applications performance. I already tried to change the server and the data base, but the slowness persists.

Using Firebug to measure my http requests I found out that they are taking around 20 seconds just to start replying.

So my last hope is to use VisualVM to profile my application and find its bottle necks. But I don't know the proper way of passing some arguments like "-Dcom.sun.management.jmxremote" without messing with the global JAVA_OPTS variable.

Thanks again!

4

2 回答 2

6

看起来Metrics会自动处理这个问题。

将以下内容添加到您的 Build.scala 应用程序依赖项中:

"com.yammer.metrics" % "metrics-core" % "2.1.2"

并开始检测您的代码。然后使用“play run”启动应用程序——VisualVM 应该显示你的 JVM 进程,你可以直接连接到它(假设你有 VisualVM-MBeans 插件)。检查您是否至少有 1.3.4。这是我启动时看到的:

视觉虚拟机

xsbt.boot.Boot 进程是 Play。

更一般地说,这篇文章在调试 Play 等基于 Akka 的框架时确实很有帮助。

于 2012-07-30T03:24:39.970 回答
4

如果有人需要分析 Play 2.3.x 应用程序:

  1. 将您的 JAVA_OPTS 设置放入 ~/.activator/activatorconfig.txt (参见https://typesafe.com/activator/docs):

    -Dcom.sun.management.jmxremote.port=1234
    -Dcom.sun.management.jmxremote.rmi.port=1234
    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false
    -Djava.rmi.server.hostname=127.0.0.1
    
  2. 在 VisualVM 中,添加到 localhost:1234 的本地 JMX 连接

于 2014-07-04T10:56:26.670 回答