Canownueasy`
June 27th, 2010, 08:00
1) Use the server VM tag
Using this tag takes the maximum heap size for a node, and uses it for the process. Note that this can use up to 3x more system resources.
-server
2) Maximize garbage collection (best suited at rate 146ms)
Why not have the fastest and most reliable garbage collection rate? Set your server's garbage collection rate at 146ms.
3) Reduce thread stack size
In Windows, thread stack size is read from java.exe by default. This rate is 320K in Java SE 6. Using this tag reduces the stack size for threads.
-Xss64k
4) Think about speed
Try to use data that is fast and efficient. Research! Look up how fast certain data types are, and think about what your application needs to do to find the fastest solution.
You can use a benchmark to test speeds.
public class Benchmark {
public static void main(String[] arg) {
long before = System.currentTimeMillis();
//stuff to do
long after = System.currentTimeMillis();
System.out.println("Elapsed time: " + Long.toString(after - before) + " milliseconds");
}
}
5) Do all the steps by using these tags!
-Xms512m -Xmx512m -Xss64k -XX:NewSize=128m -XX:MaxNewSize=128m -server
Using this tag takes the maximum heap size for a node, and uses it for the process. Note that this can use up to 3x more system resources.
-server
2) Maximize garbage collection (best suited at rate 146ms)
Why not have the fastest and most reliable garbage collection rate? Set your server's garbage collection rate at 146ms.
3) Reduce thread stack size
In Windows, thread stack size is read from java.exe by default. This rate is 320K in Java SE 6. Using this tag reduces the stack size for threads.
-Xss64k
4) Think about speed
Try to use data that is fast and efficient. Research! Look up how fast certain data types are, and think about what your application needs to do to find the fastest solution.
You can use a benchmark to test speeds.
public class Benchmark {
public static void main(String[] arg) {
long before = System.currentTimeMillis();
//stuff to do
long after = System.currentTimeMillis();
System.out.println("Elapsed time: " + Long.toString(after - before) + " milliseconds");
}
}
5) Do all the steps by using these tags!
-Xms512m -Xmx512m -Xss64k -XX:NewSize=128m -XX:MaxNewSize=128m -server