Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
java [2012/12/04 23:47] a |
java [2012/12/05 00:07] a [Tunning] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Java (jvm) tips and tricks ====== | ====== Java (jvm) tips and tricks ====== | ||
+ | |||
+ | |||
+ | ===== Enviroment settings ===== | ||
+ | |||
+ | ==== Linux (with multiple java enviroments) ==== | ||
+ | |||
+ | '' | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | ===== Tunning | ||
{{ : | {{ : | ||
Line 15: | Line 28: | ||
| **-XX: | | **-XX: | ||
| **-XX: | | **-XX: | ||
+ | |||
+ | |||
+ | <note important> | ||
+ | **A nice gotcha...** \\ | ||
+ | Major collection don't run until tenured is full. | ||
+ | This mean that using -Xmx1024, current heap could be 750MB with 500MB of " | ||
+ | </ | ||
+ | |||
<note tip> | <note tip> | ||
* It is good practice with server-side Java applications like Resin to set the minimum **'' | * It is good practice with server-side Java applications like Resin to set the minimum **'' | ||
* For efficient garbage collection, the **'' | * For efficient garbage collection, the **'' | ||
</ | </ | ||
+ | |||
+ | ==== Good/best practices ==== | ||
+ | |||
+ | ==== Examples ==== | ||
+ | |||
+ | tying to limit jvm to ~2G of RAM (java x86_64) | ||
+ | java -Xms512m -Xmx2G -XX: | ||
+ | | ||
+ | java (i386) | ||
+ | java -Xms1400m -Xmx2G -XX: | ||
+ | ==== Troubleshooting ==== | ||
+ | |||
+ | === Resolving java.lang.OutOfMemoryError: | ||
+ | if you get an error like: | ||
+ | |||
+ | | ||
+ | |||
+ | The PermGen space is used for things that do not change (or change often). e.g. Java classes. | ||
+ | |||
+ | To increase the PermGen space use something like: **-XX: | ||
+ | |||
+ | (Note that Xmx is separate from the PermGen space, so increasing Xmx will not help with the PermGen errors). \\ | ||
+ | **The PermGen memory in addition to the Xmx memory. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||