[英]playframework 2.3.x heap size
Is there a way to set -Xmx when i start the application with "./activator start" 当我使用“./activator start”启动应用程序时,有没有办法设置-Xmx
I tried (not working): 我试过(不工作):
./activator start -J-Xmx2g
./activator -mem 2048 start
_JAVA_OPTIONS="-Xmx2g" ./activator start
It says 它说
"Picked up _JAVA_OPTIONS: -Xmx2g"
“拿起_JAVA_OPTIONS:-Xmx2g”
but still not working. 但仍然没有工作。
Also tried various values in build.sbt
and application.conf
- no luck 还尝试了
build.sbt
和application.conf
各种值 - 没有运气
The only way i could make it work was to use "stage" and pass -Xmx2g
to the generated shell script, which is fine, but it doesn't detach the console. 我能使其工作的唯一方法是使用“stage”并将
-Xmx2g
传递给生成的shell脚本,这很好,但它不会分离控制台。
I think I tried all I found on google but still no luck. 我想我尝试了所有我在谷歌上找到的但仍然没有运气。 I would like to pass
-Xmx
to the activator start
somehow. 我想以某种方式将
-Xmx
传递给activator start
。
First define an environment variable with your JVM parameters named _JAVA_OPTIONS
首先使用名为
_JAVA_OPTIONS
JVM参数定义环境变量
export _JAVA_OPTIONS="-Xmx2048m"
and then try the play start
or use the activator
. 然后尝试
play start
或使用activator
。
I have found solution. 我找到了解决方案。 There is some bug in activator shell script, so passing -J-Xmx argument does not remove default mem options.
激活器shell脚本中存在一些错误,因此传递-J-Xmx参数不会删除默认的mem选项。 To change mem parameter have a look at your activator script (/usr/local/bin/activator) and have a look how mem parameters are added.
要更改mem参数,请查看激活器脚本(/ usr / local / bin / activator),并查看如何添加mem参数。 Also notice that passing -v argument will print final command to lunch java.
另请注意,传递-v参数会将最终命令打印到午餐java。 Working solution on linux for me is this:
Linux上的工作解决方案对我来说是这样的:
export JAVA_OPTS="-Xmx2700m";activator -v
# Executing command line:
java
-Dactivator.home=/usr/local/bin
-Xmx2700m
-jar
/usr/local/bin/activator-launch-1.3.2.jar
Examples of not working solution: 不工作解决方案的示例:
_JAVA_OPTIONS="-Xmx2048m";activator -J-Xmx2700m -J-Xms1024m -v
# Executing command line:
java
-Dactivator.home=/usr/local/bin
-Xmx2700m
-Xmx2700m
-Xms1024m
-jar
/usr/local/bin/activator-launch-1.3.2.jar
Also not working: 也不工作:
activator -J-Xmx2700m -J-Xms1024m -v
# Executing command line:
java
-Dactivator.home=/usr/local/bin
-Xmx2700m
-Xmx2700m
-Xms1024m
-jar
/usr/local/bin/activator-launch-1.3.2.jar
我认为你需要指定最小和最大堆大小,试试这个:
activator -J-Xmx2048m -J-Xms2048m start
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.