2

我为在 Heroku 上运行的 Clojure 应用启用了 New Relic 监控。为了避免将我的应用程序嵌套在 Leiningen 的 JVM 进程中的开销,我从lein trampoline run.

这显然增加了 New Relic 附加到初始 Leiningen 进程的一些开销,该进程然后关闭并启动我的应用程序,导致 New Relic 再次附加延迟。这有时会导致无法在 30 秒的引导超时窗口内启动并导致停机。

显示两个 New Relic 代理启动的日志输出:

heroku/web.1:  Starting process with command `lein trampoline run`
app/web.1: [date] NewRelic 1 INFO: Agent is using Log4j
app/web.1: [date] NewRelic 1 INFO: Loading configuration file "/app/newrelic/./newrelic.yml"
app/web.1: [date] NewRelic 1 INFO: Agent Host: 866e2426-7a0f-4293-ae89-b55c0332253e IP: 10.159.0.212
app/web.1: [date] NewRelic 1 INFO: Setting audit_mode to false
app/web.1: [date] NewRelic 1 INFO: Setting protocol to "http"
app/web.1: [date] NewRelic 1 INFO: Configuration file is /app/newrelic/./newrelic.yml
app/web.1: [date] NewRelic 1 INFO: New Relic Agent v2.9.0 has started
app/web.1: [date] NewRelic 1 INFO: Java version: 1.6.0_20
app/web.1: [date] NewRelic 1 INFO: Agent class loader: sun.misc.Launcher$AppClassLoader@7ea2dfe
app/web.1: [date] NewRelic 5 INFO: JVM is shutting down
app/web.1: [date] NewRelic 5 INFO: New Relic Agent has shutdown
app/web.1: [date] NewRelic 1 INFO: Agent is using Log4j
app/web.1: [date] NewRelic 1 INFO: Loading configuration file "/app/newrelic/./newrelic.yml"
app/web.1: [date] NewRelic 1 INFO: Agent Host: 866e2426-7a0f-4293-ae89-b55c0332253e IP: 10.159.0.212
app/web.1: [date] NewRelic 1 INFO: Configured to connect to New Relic at collector.newrelic.com:80
app/web.1: [date] NewRelic 1 INFO: Setting audit_mode to false
app/web.1: [date] NewRelic 1 INFO: Setting protocol to "http"
app/web.1: [date] NewRelic 1 INFO: Configuration file is /app/newrelic/./newrelic.yml
app/web.1: [date] NewRelic 1 INFO: New Relic Agent v2.9.0 has started
app/web.1: [date] NewRelic 1 INFO: Java version: 1.6.0_20
app/web.1: [date] NewRelic 1 INFO: Agent class loader: sun.misc.Launcher$AppClassLoader@7ea2dfe

有没有办法避免将 New Relic 附加到 leiningen 进程?

4

1 回答 1

0

与其在 Heroku 配置的 JVM_OPTS 中设置,不如在-javaagent:newrelic/newrelic.jar您的生产配置文件中设置它?:jvm-optsproject.clj

于 2013-01-20T19:22:35.307 回答