问题描述
我正在尝试将 Spring Boot 支持的 Web 应用程序部署到生产环境中.该应用程序使用 Spring Boot 1.0.1 构建,并嵌入了默认的 Tomcat 7 作为应用程序服务器.使用 java -jar myapp.jar
命令行启动应用程序时,我想为应用程序分配更大的内存.
I am trying to deploy a Spring Boot powered web app to production. The app is built with Spring Boot 1.0.1 and has the default Tomcat 7 embedded as application server. I want to allocate larger memory to the app when start the app with java -jar myapp.jar
command line.
我应该使用 JVM 参数,例如 -Xms -Xmx
或使用环境变量,例如JAVA_OPTS
?我试图在文档或谷歌中寻找答案,但没有得到答案.谁能给点提示?
Should I use JVM parameter such as -Xms -Xmx
or use environment variable such as JAVA_OPTS
? I have tried to look for the answer in documentation or google it, but I did not get an answer. Can anyone give some hints?
推荐答案
只需使用任何常规机制来设置 JVM.可在命令行上获取文档:
Just use whatever normal mechanism you would to set up the JVM. Documentation is available on the command line:
$ java -X
...
-Xms<size> Set initial Java heap size
-Xmx<size> Set maximum Java heap size
...
这篇关于使用嵌入式 Tomcat 启动 Spring Boot 应用程序时,如何配置堆大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!