-
-
Notifications
You must be signed in to change notification settings - Fork 180
JVM Options
On Unix machines JVM options are set via the BOOT_JVM_OPTIONS
environment variable:
export BOOT_JVM_OPTIONS='-Xmx2g -client'
or in the local or global boot.properties
:
BOOT_JVM_OPTIONS=-Xmx2g -client
If you're using the boot.exe
executable for Windows you must create a boot.l4j.ini
file
containing your desired options as described in the launch4j documentation,
placing it in the same directory as your boot.exe
.
For further debug information, run boot --l4j-debug
. Besides showing the boot help options, it will write launch4j.log in the directory where your boot.exe
resides in the path.
For example in case you'd like to start boot for remote debugging on Windows, you can create this boot.l4j.ini
:
-agentlib:jdwp=transport=dt_socket,address=localhost:5005,server=y,suspend=n
# -Xmx1024m
# -Xms512m
# -XX:MaxPermSize=600m
You can cut down the initial startup time with these options:
-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xverify:none
At the heart of Boot's design is the single JVM principle. This provides obvious performance benefits, and at the same time doesn't preclude multiple Clojure runtimes (via classpath isolation). But this also means that the JVM options have to be set in the shell, and not in the build configuration file. However, you can easily mimick project-dependent JVM options by wrapping the boot executable.
#!/usr/bin/env bash
if [ -f .boot-jvm-options ]; then
OPTS=`cat .boot-jvm-options`
fi
BOOT_JVM_OPTIONS="$OPTS" boot "$@"
If you're running out of heap space you can add an option to increase the maximum heap space for the JVM:
-Xmx2g
Boot will start multiple Clojure runtimes in Pods. Each one will create a lot of classes, each of which will occupy space in the PermGen (Permanent Generation) of the JVM garbage collector. This means that this space will never be reclaimed when the pod falls out of scope. If you're getting PermGen allocation errors you can try adding these options:
-XX:MaxPermSize=128m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
The
-XX:MaxPermSize
option was removed in Java 1.8, along with PermGen itself.
What was PermGen in Java 7 (see above) is Metaspace in Java 8. Other than PermGen Java 8's Metaspace is not limited by default and will grow until it it's the systems actual memory limit. To prevent Metaspace from taking up significant memory you can limit the size of the Metaspace using -XX:MaxMetaspaceSize
:
-XX:MaxMetaspaceSize=100m
The compiler in the server VM now provides correct stack backtraces for all "cold" built-in exceptions. For performance purposes, when such an exception is thrown a few times, the method may be recompiled. After recompilation, the compiler may choose a faster tactic using preallocated exceptions that do not provide a stack trace. To disable completely the use of preallocated exceptions, use this new flag: -XX:-OmitStackTraceInFastThrow. StackOverflow
-XX:-OmitStackTraceInFastThrow
This is how I have my system configured.
$ uname -mrsv
Darwin 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
$ java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
$ echo $BOOT_JVM_OPTIONS
-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx2g -XX:MaxPermSize=128m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xverify:none
$ uname -msrv
Linux 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64
$ java -version
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)
$ echo $BOOT_JVM_OPTIONS
-Xmx2g -client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:MaxPermSize=128m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xverify:none
You can find other developers and users in the #hoplon
channel on freenode IRC or the boot slack channel.
If you have questions or need help, please visit the Discourse site.
- Environments
- Boot environment
- Java environment
- Tasks
- Built-ins
- Third-party
- Tasks Options
- Filesets
- Target Directory
- Pods
- Boot Exceptions
- Configuring Boot
- Updating Boot
- Setting Clojure version
- JVM Options
- S3 Repositories
- Scripts
- Task Writer's Guide
- Require inside Tasks
- Boot for Leiningen Users
- Boot in Leiningen Projects
- Repl reloading
- Repository Credentials and Deploying
- Snippets
- Troubleshooting
- FAQ
- API docs
- Core
- Pod
- Util