JavaPerformanceAndTuning Ateendees
JavaPerformanceAndTuning Ateendees
Operating System
– Java Virtual
– Machine
–
–
–
–
Hardware
–
–
–
–
–
–
Class (.class) File Class Loader
Java Native
Method Code
Heap Thread Method PC Registers
Area Cache
Stacks Stacks
Stack Frame
Thread 2
Native
Thread 3 Stack Frame Stack Frame Stack Frame Method
Stacks
Metadata
Stack Frame
Runtime
Local Variable Array Constant Pool
Return Value Operand Stack Reference
Runtime Constant Pool
Field Data
Constant Class
Constant FieldRef
Constant MethodRef
Constant String Method Data
Constant Integer
Constant Float
.. Method Code
Operating System
Java JVM
Source
Code Class Loader
Execution JIT
Interpreter
Java Engine Compiler
Bytecode
Hardware
Linking
Loading Verifying
Preparing
Resolving Initializing
–
Bootstrap
Class Loader
Launcher$ExtClassLoader
Launcher$AppClassLoader
ClassLoader
Runtime
Local Variable Array Constant Pool
Return Value Operand Stack Reference
– Thread
PC Register
Stack Frame
Heap Space
From To
Eden
Survivor Survivor Tenured
–
Method Area
Permanent Generation
Method Code
MMAP
From To
Eden
Survivor Survivor Tenured Field & Method Data
Permanent Generation
Compressed
Method Code
Class Space *
–
Native Area
Code Cache
–
–
–
PermGen replacement
Non-reachable
objects - Garbage
–
–
– Reachable
objects
–
–
GC Roots
–
–
allocations
Minor GC Young
Generation
promotions
Major / Full GC
Old
Generation
Permanent Generation /
Metaspace
Eden
allocations
Young
Generation
From To
Survivor Survivor
Old
Generation
after Minor GC
Eden
Young
Generation
From To
Survivor Survivor
swap
Old
Generation
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
synchronized (object) {
/* critical section */
}
synchronized (object) {
{ /* critical section */
/* non-critical section */ /* non-critical section */
} /* critical section */
}
synchronized (object) {
/* critical section */
}
–
Thread 1 Thread 1
function: g()
locals: []
... ...
Space Address
–
non-direct
java.nio.ByteBuffer
direct
java.nio.ByteBuffer
–
–
1. log.debug("First argument = [" + arg1 + "], second argument = [" + arg2 + "], third argument = [" + arg3 + "]");
2. if (log.isDebugEnabled()) {
log.debug("First argument = [" + arg1 + "], second argument = [" + arg2 + "], third argument = [" + arg3 + "]");
}
3. if (log.isDebugEnabled()) {
log.debug("First argument = [{}], second argument = [{}], third argument = [{}]", arg1, arg2, arg3);
}
4. log.debug("First argument = [{}], second argument = [{}], third argument = [{}]", arg1, arg2, arg3);
5. log.debug(() -> "First argument = [" + arg1 + "], second argument = [" + arg2 + "], third argument = [" + arg3 + "]");