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.
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?
If starting the application with the spring-boot
plugin:
mvn spring-boot:run -Drun.jvmArguments="-Xmx512m" -Drun.profiles=dev
Otherwise if running java -jar
:
java -Xmx512m -Dspring.profiles.active=dev -jar app.jar