本文介绍了Heroku JVM调优的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  2013-03-21T01:我已经在Heroku的Play2框架上编写了一个应用程序, 28:35 + 00:00 heroku [web.1]:进程运行内存= 543M(106.1%)
2013-03-21T01:28:35 + 00:00 heroku [web.1]:错误R14内存配额超过)

在本地我用Heroku对相同的JVM设置和内存限制进行了配置512MB),但在Heroku发送请求时,它几乎立即运行我们的堆空间。

  JAVA_OPTS:-Xmx384m -Xss512k -XX :+ UseCompressedOops 

如果我可以分析发生了什么,我不会有任何问题,但java-agent doest似乎适用于我。



我没有遇到任何我见过的内存泄漏。我知道我创造的每一件物品都只会被使用一次,所以我可以让我的年轻一代变得更大,我的老一代变得更小。我已经尝试了不同的JVM值,但似乎无法找到正确的组合来在没有正确的分析的情况下正常工作。



我已阅读所有Heroku文档调优等无济于事。有没有人有任何想法,或者可能指向正确的方向?



编辑



我仍然还没有能够得到远程监控的工作,但这里有一些从我的本地测试系统在1次完整的CG之前和之后的转储。

  {Heap before GC invocations = 1747(full 0):
PSYoungGen total 42496K,used 42496K [0x00000000f5560000,0x00000000fded0000,0x0000000100000000)
eden space 42176K,100%used [0x00000000f5560000,0x00000000f7e90000,0x00000000f7e90000)
from space 320K,100%used [0x00000000fde80000,0x00000000fded0000,0x00000000fded0000]
to space 640K,0%used [0x00000000fdd90000,0x00000000fdd90000,0x00000000fde30000)
PSOldGen total 106176K,used 105985K [0x00000000e0000000,0x00000000e67b0000,0x00000000f5560000 )
对象空间106176K,使用99%[0x00000000e0000000,0x00000000e67804c8,0x00000000e67b0000)
PSPermGen总计43712K,使用43684K [0x00000000d5a00000,0x0000 0000d84b0000,0x00000000e0000000)
对象空间43712K,已使用99%[0x00000000d5a00000,0x00000000d84a9338,0x00000000d84b0000)
2013-03-21T14:09:36.827-0700:[GC [PSYoungGen:42496K-> 384K(41536K )] 148481K-> 106450K(147712K),0.0027940秒] [时间:用户= 0.02 sys = 0.00,实际= 0.00秒]
GC调用后的堆= 1747(全0):
PSYoungGen total 41536K,使用384K [0x00000000f5560000,0x00000000fde90000,0x0000000100000000]
eden space 41152K,0%used [0x00000000f5560000,0x00000000f5560000,0x00000000f7d90000)
from space 384K,100%used [0x00000000fdd90000,0x00000000fddf0000,0x00000000fddf0000)
到空间640K,使用0%[0x00000000fddf0000,0x00000000fddf0000,0x00000000fde90000)
PSOldGen总计106176K,使用106066K [0x00000000e0000000,0x00000000e67b0000,0x00000000f5560000)
对象空间106176K,使用99%[0x00000000e0000000,0x00000000e6794968,0x00000000e67b0000)
PSPermGen总计43712K,使用43684K [0x00000000d5a00 000,0x00000000d84b0000,0x00000000e0000000)
对象空间43712K,已使用99%[0x00000000d5a00000,0x00000000d84a9338,0x00000000d84b0000)
}
{GC调用前堆= 1748(满1):
PSYoungGen总共41536K,使用384K [0x00000000f5560000,0x00000000fde90000,0x0000000100000000]
eden space 41152K,0%used [0x00000000f5560000,0x00000000f5560000,0x00000000f7d90000)
from space 384K,100%used [0x00000000fdd90000,0x00000000fddf0000,0x00000000fddf0000)
到空间640K,使用0%[0x00000000fddf0000,0x00000000fddf0000,0x00000000fde90000)
PSOldGen总计106176K,使用106066K [0x00000000e0000000,0x00000000e67b0000,0x00000000f5560000)
对象空间106176K,使用99%[0x00000000e0000000,0x00000000e6794968,0x00000000e67b0000 )
PSPermGen总计43712K,使用43684K [0x00000000d5a00000,0x00000000d84b0000,0x00000000e0000000)
对象空间43712K,使用率99%[0x00000000d5a00000,0x00000000d84a9338,0x00000000d84b0000)
20 [全长GC [PSYoungGen:384K-> 0K(41536K)] [PSOldGen:106066K-> 13137K(52224K)] 106450K-> 13137K(93760K)[PSPermGen: 43684K-> 43684K(87936K)],0.0666250秒] [时间:用户= 0.06 sys = 0.01,实际= 0.07秒]
GC调用后的堆= 1748(满1):
PSYoungGen总计41536K ,使用0K [0x00000000f5560000,0x00000000fde90000,0x0000000100000000]
eden space 41152K,0%used [0x00000000f5560000,0x00000000f5560000,0x00000000f7d90000)
from space 384K,0%used [0x00000000fdd90000,0x00000000fdd90000,0x00000000fddf0000)
到空间640K,使用0%[0x00000000fddf0000,0x00000000fddf0000,0x00000000fde90000)
PSOldGen总计52224K,使用13137K [0x00000000e0000000,0x00000000e3300000,0x00000000f5560000)
对象空间52224K,使用25%[0x00000000e0000000,0x00000000e0cd4528,0x00000000e3300000)
PSPermGen总计87936K,使用43684K [0x00000000d5a00000,0x00000000dafe0000,0x00000000e0000000)
对象空间87 936K,使用了49%[0x00000000d5a00000,0x00000000d84a9338,0x00000000dafe0000)
}



编辑



这就是我可以得到的 - 这不是很多,但这是发生在100次请求后会发生的一切,因为一切都开始降级,你可以看到web.2已经在这个转储

  2013-03-21T22:24:23 + 00:00 heroku [web.1]:source = heroku.13369226.web .1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure = load_avg_1m val = 0.41 
2013-03-21T22:24:23 + 00:00 heroku [web.1]:source = heroku.13369226.web。 1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure = memory_total val = 246.95 units = MB
2013-03-21T22:24:23 + 00:00 heroku [web.1]:source = heroku.13369226。 web.1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure = memory_rss val = 246.91 units = MB
2013-03-21T22:24:23 + 00:00 heroku [web.1]:source = heroku。 13369226.web.1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure = memory_cache val = 0.05 units = MB
2013-03-21T22:24:23 + 00:00 heroku [web.1]:source = heroku.13369226.web.1。 d615093e-77a3-42b1-8da1-a228bd7582a1 measure = memory_swap val = 0.00 units = MB
2013-03-21T22:24:23 + 00:00 heroku [web.1]:source = heroku.13369226.web。 1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure = memory_pgpgin val = 72259 units = pages
2013-03-21T22:24:23 + 00:00 heroku [web.1]:source = heroku.13369226。 web.1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure = memory_pgpgout val = 9039 units = pages
2013-03-21T22:24:25 + 00:00 heroku [web.2]:source = heroku。 13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure = load_avg_1m val = 0.30
2013-03-21T22:24:25 + 00:00 heroku [web.2]:source = heroku.13369226 .web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure = memory_total val = 532.83 units = MB
2013-03-21T22:24:25 + 00:00 heroku [web.2]:source = heroku .13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure = memory_rss val = 511.86 units = MB
2013-03-21T22:24:25 + 00:00 heroku [web.2]:source = heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure = memory_cache val = 0.04 units = MB
2013-03-21T2 2:24:25 + 00:00 heroku [web.2]:source = heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure = memory_swap val = 20.93 units = MB
2013- 03-21T22:24:25 + 00:00 heroku [web.2]:source = heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure = memory_pgpgin val = 145460 units = pages
2013-03-21T22:24:25 + 00:00 heroku [web.2]:source = heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure = memory_pgpgout val = 14414 units = pages
2013-03-21T22:24:25 + 00:00 heroku [web.2]:进程运行mem = 532M(104.1%)
2013-03-21T22:24:25 + 00:00 heroku [ web.2]:错误R14(超过内存配额)
2013-03-21T22:24:29 + 00:00 heroku [web.4]:source = heroku.13369226.web.4.25274242-a3af-4d2e- 9da3-44e5e0a45c09 measure = load_avg_1m val = 1.83
2013-03-21T22:24:29 + 00:00 heroku [web.4]:source = heroku.13369226.web.4.25274242-a3af-4d2e-9da3-44e5e0a45c09 measure = memory_total val = 400.66 units = MB
2013-03-21T22:24:29 + 00:00 heroku [web.4]:source = heroku.13369226.web.4.25274242-a3af-4d2e-9da3- 44e5e0a45c09 measure = memory_rss val = 400.61 units = MB
2013-03-21T22:24:29 + 00:00 heroku [web.4]:source = heroku.13369226.web.4.25274242-a3af-4d2e-9da3- 44e5e0a45c09 measure = memory_cache val = 0.05 units = MB
2013-03-21T22:24:29 + 00:00 heroku [web.4]:source = heroku.13369226.web.4.25274242-a3af-4d2e-9da3- 44e5e0a45c09 measure = memory_swap val = 0.00 units = MB
2013-03-21T22:24:29 + 00:00 heroku [web.4]:source = heroku.13369226.web.4.25274242-a3af-4d2e-9da3- 44e5e0a45c09 measure = memory_pgpgin val = 113336 units = pages
2013-03-21T22:24:29 + 00:00 heroku [web.4]:source = heroku.13369226.web.4.25274242-a3af-4d2e-9da3- 44e5e0a45c09 measure = memory_pgpgout val = 10767 units = pages
2013-03-21T22:24:29 + 00:00 heroku [web.3]:source = heroku.13369226.web.3.2132f01f-94b1-4151-8fa8 -09cdb2774919 measure = load_avg_1m val = 0.25
2013-03-21T22:24:29 + 00:00 heroku [web.3]:source = heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure = memory_total val = 397.70个单位= MB
2013-03-21T22:24:29 + 00:00 heroku [w eb.3]:source = heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure = memory_rss val = 397.64 units = MB
2013-03-21T22:24:29 + 00:00 heroku [web.3]:source = heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure = memory_cache val = 0.05 units = MB
2013-03-21T22:24:29 + 00:00 heroku [web.3]:source = heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure = memory_swap val = 0.00 units = MB
2013-03-21T22:24:29 + 00: 00 heroku [web.3]:source = heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure = memory_pgpgin val = 112163 units = pages
2013-03-21T22:24:29 + 00 :00 heroku [web.3]:source = heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure = memory_pgpgout val = 10353 units = pages


解决方案

我有同样的问题。 Heroku告诉你机器内存不足,而不是Java VM。 Heroku Play 2.2部署中实际存在一个错误,启动脚本读取java_opts,而不是JAVA_OPTS。



我通过设置以下两项来修复它:

  heroku config:add java_opts =' -  Xmx384m -Xms384m -Xss512k -XX:+ UseCompressedOops'
heroku config:add JAVA_OPTS =' - Xmx384m - Xms384m -Xss512k -XX:+ UseCompressedOops'

我还必须设置-Xms,否则我得到一个错误说最小和最大是不相容的。我猜Play2.2使用的默认值高于384米。



要找出您使用的总内存,(pre java 8):


$ b $

最大内存= [-Xmx] + [-XX:MaxPermSize] + number_of_threads * [-Xss]


I've written an application on Play2 framework for Heroku and am having memory issues.

2013-03-21T01:28:35+00:00 heroku[web.1]: Process running mem=543M(106.1%)
2013-03-21T01:28:35+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)

Locally I've profiled it with the same JVM settings and memory restrictions on Heroku (512MB) but almost instantly when I send requests at Heroku it runs our of heap space.

JAVA_OPTS:    -Xmx384m -Xss512k -XX:+UseCompressedOops

I wouldn't have any issues if I could profile what's going on there, but the java-agent doest seem to work for me.

I havent come across any memory leaks that I've seen. I do know that every object I create is and will only be used once so I could make my young gen large and my old gen small. I've tried different JVM values but can't seem to find the right combination to get this working without the correct profiling.

I've read all the Heroku docs on tuning and such with no avail. Does anyone have any ideas on this, or maybe point me in the right direction?

EDIT

I still have not been able to get remote monitoring working, but here is some dumps from my local test system before and after 1 full CG.

{Heap before GC invocations=1747 (full 0):
 PSYoungGen      total 42496K, used 42496K [0x00000000f5560000, 0x00000000fded0000, 0x0000000100000000)
  eden space 42176K, 100% used [0x00000000f5560000,0x00000000f7e90000,0x00000000f7e90000)
  from space 320K, 100% used [0x00000000fde80000,0x00000000fded0000,0x00000000fded0000)
  to   space 640K, 0% used [0x00000000fdd90000,0x00000000fdd90000,0x00000000fde30000)
 PSOldGen        total 106176K, used 105985K [0x00000000e0000000, 0x00000000e67b0000, 0x00000000f5560000)
  object space 106176K, 99% used [0x00000000e0000000,0x00000000e67804c8,0x00000000e67b0000)
 PSPermGen       total 43712K, used 43684K [0x00000000d5a00000, 0x00000000d84b0000, 0x00000000e0000000)
  object space 43712K, 99% used [0x00000000d5a00000,0x00000000d84a9338,0x00000000d84b0000)
2013-03-21T14:09:36.827-0700: [GC [PSYoungGen: 42496K->384K(41536K)] 148481K->106450K(147712K), 0.0027940 secs] [Times: user=0.02 sys=0.00, real=0.00 secs] 
Heap after GC invocations=1747 (full 0):
 PSYoungGen      total 41536K, used 384K [0x00000000f5560000, 0x00000000fde90000, 0x0000000100000000)
  eden space 41152K, 0% used [0x00000000f5560000,0x00000000f5560000,0x00000000f7d90000)
  from space 384K, 100% used [0x00000000fdd90000,0x00000000fddf0000,0x00000000fddf0000)
  to   space 640K, 0% used [0x00000000fddf0000,0x00000000fddf0000,0x00000000fde90000)
 PSOldGen        total 106176K, used 106066K [0x00000000e0000000, 0x00000000e67b0000, 0x00000000f5560000)
  object space 106176K, 99% used [0x00000000e0000000,0x00000000e6794968,0x00000000e67b0000)
 PSPermGen       total 43712K, used 43684K [0x00000000d5a00000, 0x00000000d84b0000, 0x00000000e0000000)
  object space 43712K, 99% used [0x00000000d5a00000,0x00000000d84a9338,0x00000000d84b0000)
}
{Heap before GC invocations=1748 (full 1):
 PSYoungGen      total 41536K, used 384K [0x00000000f5560000, 0x00000000fde90000, 0x0000000100000000)
  eden space 41152K, 0% used [0x00000000f5560000,0x00000000f5560000,0x00000000f7d90000)
  from space 384K, 100% used [0x00000000fdd90000,0x00000000fddf0000,0x00000000fddf0000)
  to   space 640K, 0% used [0x00000000fddf0000,0x00000000fddf0000,0x00000000fde90000)
 PSOldGen        total 106176K, used 106066K [0x00000000e0000000, 0x00000000e67b0000, 0x00000000f5560000)
  object space 106176K, 99% used [0x00000000e0000000,0x00000000e6794968,0x00000000e67b0000)
 PSPermGen       total 43712K, used 43684K [0x00000000d5a00000, 0x00000000d84b0000, 0x00000000e0000000)
  object space 43712K, 99% used [0x00000000d5a00000,0x00000000d84a9338,0x00000000d84b0000)
2013-03-21T14:09:36.830-0700: [Full GC [PSYoungGen: 384K->0K(41536K)] [PSOldGen: 106066K->13137K(52224K)] 106450K->13137K(93760K) [PSPermGen: 43684K->43684K(87936K)], 0.0666250 secs] [Times: user=0.06 sys=0.01, real=0.07 secs] 
Heap after GC invocations=1748 (full 1):
 PSYoungGen      total 41536K, used 0K [0x00000000f5560000, 0x00000000fde90000, 0x0000000100000000)
  eden space 41152K, 0% used [0x00000000f5560000,0x00000000f5560000,0x00000000f7d90000)
  from space 384K, 0% used [0x00000000fdd90000,0x00000000fdd90000,0x00000000fddf0000)
  to   space 640K, 0% used [0x00000000fddf0000,0x00000000fddf0000,0x00000000fde90000)
 PSOldGen        total 52224K, used 13137K [0x00000000e0000000, 0x00000000e3300000, 0x00000000f5560000)
  object space 52224K, 25% used [0x00000000e0000000,0x00000000e0cd4528,0x00000000e3300000)
 PSPermGen       total 87936K, used 43684K [0x00000000d5a00000, 0x00000000dafe0000, 0x00000000e0000000)
  object space 87936K, 49% used [0x00000000d5a00000,0x00000000d84a9338,0x00000000dafe0000)
}

EDIT

This is what I can get -- which isnt much, but this is what happens after 100 requests as everything starts to degrade, you can see web.2 already swapped in this dump

2013-03-21T22:24:23+00:00 heroku[web.1]: source=heroku.13369226.web.1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure=load_avg_1m val=0.41
2013-03-21T22:24:23+00:00 heroku[web.1]: source=heroku.13369226.web.1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure=memory_total val=246.95 units=MB
2013-03-21T22:24:23+00:00 heroku[web.1]: source=heroku.13369226.web.1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure=memory_rss val=246.91 units=MB
2013-03-21T22:24:23+00:00 heroku[web.1]: source=heroku.13369226.web.1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure=memory_cache val=0.05 units=MB
2013-03-21T22:24:23+00:00 heroku[web.1]: source=heroku.13369226.web.1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure=memory_swap val=0.00 units=MB
2013-03-21T22:24:23+00:00 heroku[web.1]: source=heroku.13369226.web.1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure=memory_pgpgin val=72259 units=pages
2013-03-21T22:24:23+00:00 heroku[web.1]: source=heroku.13369226.web.1.d615093e-77a3-42b1-8da1-a228bd7582a1 measure=memory_pgpgout val=9039 units=pages
2013-03-21T22:24:25+00:00 heroku[web.2]: source=heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure=load_avg_1m val=0.30
2013-03-21T22:24:25+00:00 heroku[web.2]: source=heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure=memory_total val=532.83 units=MB
2013-03-21T22:24:25+00:00 heroku[web.2]: source=heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure=memory_rss val=511.86 units=MB
2013-03-21T22:24:25+00:00 heroku[web.2]: source=heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure=memory_cache val=0.04 units=MB
2013-03-21T22:24:25+00:00 heroku[web.2]: source=heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure=memory_swap val=20.93 units=MB
2013-03-21T22:24:25+00:00 heroku[web.2]: source=heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure=memory_pgpgin val=145460 units=pages
2013-03-21T22:24:25+00:00 heroku[web.2]: source=heroku.13369226.web.2.cb423d08-dd15-41c1-9843-95bcdc269111 measure=memory_pgpgout val=14414 units=pages
2013-03-21T22:24:25+00:00 heroku[web.2]: Process running mem=532M(104.1%)
2013-03-21T22:24:25+00:00 heroku[web.2]: Error R14 (Memory quota exceeded)
2013-03-21T22:24:29+00:00 heroku[web.4]: source=heroku.13369226.web.4.25274242-a3af-4d2e-9da3-44e5e0a45c09 measure=load_avg_1m val=1.83
2013-03-21T22:24:29+00:00 heroku[web.4]: source=heroku.13369226.web.4.25274242-a3af-4d2e-9da3-44e5e0a45c09 measure=memory_total val=400.66 units=MB
2013-03-21T22:24:29+00:00 heroku[web.4]: source=heroku.13369226.web.4.25274242-a3af-4d2e-9da3-44e5e0a45c09 measure=memory_rss val=400.61 units=MB
2013-03-21T22:24:29+00:00 heroku[web.4]: source=heroku.13369226.web.4.25274242-a3af-4d2e-9da3-44e5e0a45c09 measure=memory_cache val=0.05 units=MB
2013-03-21T22:24:29+00:00 heroku[web.4]: source=heroku.13369226.web.4.25274242-a3af-4d2e-9da3-44e5e0a45c09 measure=memory_swap val=0.00 units=MB
2013-03-21T22:24:29+00:00 heroku[web.4]: source=heroku.13369226.web.4.25274242-a3af-4d2e-9da3-44e5e0a45c09 measure=memory_pgpgin val=113336 units=pages
2013-03-21T22:24:29+00:00 heroku[web.4]: source=heroku.13369226.web.4.25274242-a3af-4d2e-9da3-44e5e0a45c09 measure=memory_pgpgout val=10767 units=pages
2013-03-21T22:24:29+00:00 heroku[web.3]: source=heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure=load_avg_1m val=0.25
2013-03-21T22:24:29+00:00 heroku[web.3]: source=heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure=memory_total val=397.70 units=MB
2013-03-21T22:24:29+00:00 heroku[web.3]: source=heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure=memory_rss val=397.64 units=MB
2013-03-21T22:24:29+00:00 heroku[web.3]: source=heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure=memory_cache val=0.05 units=MB
2013-03-21T22:24:29+00:00 heroku[web.3]: source=heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure=memory_swap val=0.00 units=MB
2013-03-21T22:24:29+00:00 heroku[web.3]: source=heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure=memory_pgpgin val=112163 units=pages
2013-03-21T22:24:29+00:00 heroku[web.3]: source=heroku.13369226.web.3.2132f01f-94b1-4151-8fa8-09cdb2774919 measure=memory_pgpgout val=10353 units=pages
解决方案

I had the same issue. Heroku is telling you the machine is running out of memory, not the Java VM. There is actually a bug in the Heroku Play 2.2 deployment, the startup script reads java_opts, not JAVA_OPTS.

I fixed it by setting both:

heroku config:add java_opts='-Xmx384m -Xms384m -Xss512k -XX:+UseCompressedOops'
heroku config:add JAVA_OPTS='-Xmx384m -Xms384m -Xss512k -XX:+UseCompressedOops'

I also had to set -Xms otherwise I got an error saying the min and max were incompatible. I guess Play2.2 was using a default higher than 384m.

To find out your total memory used, this is a useful equation (pre java 8):

Max memory = [-Xmx] + [-XX:MaxPermSize] + number_of_threads * [-Xss]

这篇关于Heroku JVM调优的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 02:00