为什么即使在未使用的情况下我也会在Heroku上获得超出内存配额的错(play2 /阶)

时间:2013-04-03 23:26:29

标签: scala heroku playframework-2.0

只是坐着没有请求,我得到内存不断增加,最终超出内存配额。我不明白有很多事情要做。

  1. 为什么没有请求时内存使用会不断增加?
  2. "处理运行内存的价值"来自(似乎不是我可以告诉的Heap和Non-Heap用法的任何数字组合的总和)。
  3. 即使我有推荐的JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops -javaagent:heroku-javaagent-1.2.jar=stdout=true,为什么它会超过?
  4. 以下是日志文件的示例

    app/web.1:  heroku-javaagent: JVM Memory Usage     (Heap): used: 275M committed: 349M max:349M 
    app/web.1:  heroku-javaagent: JVM Memory Usage (Non-Heap): used: 37M committed: 37M max:219M 
    app/web.1:  heroku-javaagent: JVM Threads                : total: 37 daemon: 7 non-daemon: 21 internal: 9 
    app/web.1:  heroku-javaagent: JVM Memory Usage     (Heap): used: 276M committed: 349M max:349M 
    app/web.1:  heroku-javaagent: JVM Memory Usage (Non-Heap): used: 37M committed: 37M max:219M 
    app/web.1:  heroku-javaagent: JVM Threads                : total: 37 daemon: 7 non-daemon: 21 internal: 9 
    app/web.1:  heroku-javaagent: JVM Memory Usage     (Heap): used: 277M committed: 349M max:349M 
    app/web.1:  heroku-javaagent: JVM Memory Usage (Non-Heap): used: 37M committed: 37M max:219M 
    app/web.1:  heroku-javaagent: JVM Threads                : total: 37 daemon: 7 non-daemon: 21 internal: 9 
    app/web.1:  heroku-javaagent: JVM Memory Usage     (Heap): used: 277M committed: 349M max:349M 
    app/web.1:  heroku-javaagent: JVM Memory Usage (Non-Heap): used: 37M committed: 37M max:219M 
    app/web.1:  heroku-javaagent: JVM Threads                : total: 37 daemon: 7 non-daemon: 21 internal: 9 
    app/web.1:  heroku-javaagent: JVM Memory Usage     (Heap): used: 278M committed: 349M max:349M 
    app/web.1:  heroku-javaagent: JVM Memory Usage (Non-Heap): used: 37M committed: 37M max:219M 
    app/web.1:  heroku-javaagent: JVM Threads                : total: 37 daemon: 7 non-daemon: 21 internal: 9 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    app/web.1:  heroku-javaagent: JVM Memory Usage     (Heap): used: 212M committed: 349M max:349M 
    app/web.1:  heroku-javaagent: JVM Memory Usage (Non-Heap): used: 37M committed: 37M max:219M 
    app/web.1:  heroku-javaagent: JVM Threads                : total: 37 daemon: 7 non-daemon: 21 internal: 9 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    app/web.1:  heroku-javaagent: JVM Memory Usage     (Heap): used: 213M committed: 349M max:349M 
    app/web.1:  heroku-javaagent: JVM Memory Usage (Non-Heap): used: 37M committed: 37M max:219M 
    app/web.1:  heroku-javaagent: JVM Threads                : total: 37 daemon: 7 non-daemon: 21 internal: 9 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    app/web.1:  heroku-javaagent: JVM Memory Usage     (Heap): used: 213M committed: 349M max:349M 
    app/web.1:  heroku-javaagent: JVM Memory Usage (Non-Heap): used: 37M committed: 37M max:219M 
    app/web.1:  heroku-javaagent: JVM Threads                : total: 37 daemon: 7 non-daemon: 21 internal: 9 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    app/web.1:  heroku-javaagent: JVM Memory Usage     (Heap): used: 214M committed: 349M max:349M 
    app/web.1:  heroku-javaagent: JVM Memory Usage (Non-Heap): used: 37M committed: 37M max:219M 
    app/web.1:  heroku-javaagent: JVM Threads                : total: 37 daemon: 7 non-daemon: 21 internal: 9 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    heroku/web.1:  Process running mem=517M(101.1%) 
    heroku/web.1:  Error R14 (Memory quota exceeded) 
    

4 个答案:

答案 0 :(得分:5)

这个问题不应该特定于Heroku,并且(理想情况下)应该能够在本地复制。首先,我建议您以与Heroku相同的方式在本地运行您的应用程序:

然后我会使用内存分析器(例如VisualVM)附加到本地运行的应用程序,以查看正在发生的事情。

如果这不起作用或者您希望更好地分析Heroku上的内存使用情况,我建议启用log-runtime-metrics。这也可以与Log2Viz一起使用以获得实时内存可视化。

答案 1 :(得分:2)

刚遇到类似的问题。我无法在本地重现问题。 原来我们的日志记录配置中有一个文件追加器。写入日志使内存增长。 您可以通过编写一个记录很多的小应用程序来验证这一点。如果启用log-runtime-metrics,您将看到memory_cache和memory_total增长。

答案 2 :(得分:0)

在heroku中启用log-runtime-metrics:

$ heroku labs:enable log-runtime-metrics
Enabling log-runtime-metrics for myapp... done
$ heroku restart

这将允许您查看日志中的内存使用情况

heroku logs -t

https://devcenter.heroku.com/articles/log-runtime-metrics

答案 3 :(得分:0)

我在grails应用程序中有相同的错误消息,我读了这个article解决方案很简单,使用此 java.runtime在根文件夹中创建 system.property 文件。版本= 1.7 作为内容,然后我重新部署应用程序并错误R14它已经消失

我希望它有用