In case of performance troubles :
- don't start with code inspection.
- start with Execution profiling instead (may help to find out code bugs)
- add GC debuggin/loggins options or take a look to JMX GCBeans
Correct performance tuning process
1 Set a baseline
2 Modify only one thing a time
3 Make performane test / create new baseline
4 Restart the process again if performance doesnt increase significantly
Basic things to watch at
cpu utilization (don't waste cpu cycles)
application OS interactions
locks
network io
disk io
Performance monitoring TOOLS TO START with
System monitoring tools (info about CPU, server Memory used , Network IO, Disk IO
Memory monitoring tools
JVM monitoring tools (garbage collection, memory usage, threads)
Example
Free sample tool visual vm for JMV
Memory leaks analysis
thread monitoring (starving threads, blocked threads )
thead dump (shows blocked threads and running code )
Different memory areas usage (Survivor space bigger / hidden space)
Resources
java performance tuning by charlie hunt
http://java.sun.com/performance/reference/whitepapers/tuning.html
Other Presentations
(Also available in you tube at http://www.youtube.com/watch?v=nvvPM2OES58 )
http://presentz.org/jugtorino/201010_gc
Mailing list
hotspot-gc-use@openjdk.java.net
giovedì 6 settembre 2012
mercoledì 5 settembre 2012
VarArgs method samples
/**
*
*/
package test;
/**
* @author Paolo
*
*/
public class VarArgsTest {
public static void method1VarArgs(int ...intsArray){
System.out.println("length =" + intsArray.length);
}
public static void method2VarArgs(String ...stringsArray){
System.out.println("length =" + stringsArray.length);
}
/**
* @param args
*/
public static void main(String[] args) {
method1VarArgs();
method1VarArgs(1,2,3);
method2VarArgs();
method2VarArgs("a", "b");
}
}
And output is :
NOTES: Arrays are never null (neither if method is called without any parameter )
*
*/
package test;
/**
* @author Paolo
*
*/
public class VarArgsTest {
public static void method1VarArgs(int ...intsArray){
System.out.println("length =" + intsArray.length);
}
public static void method2VarArgs(String ...stringsArray){
System.out.println("length =" + stringsArray.length);
}
/**
* @param args
*/
public static void main(String[] args) {
method1VarArgs();
method1VarArgs(1,2,3);
method2VarArgs();
method2VarArgs("a", "b");
}
}
And output is :
length =0
length =3
length =0
length =2NOTES: Arrays are never null (neither if method is called without any parameter )
Iscriviti a:
Post (Atom)