SlideShare a Scribd company logo
Is your profiler speaking the
same language as you?
Simon Maple
@sjmaple
@sjmapleSimon Maple -
Agenda
• Performance Tools
• Performance by numbers
• Sampling vs Tracing
• XRebel
• JRebel
3
Is your profiler speaking the same language as you? -- Docklands JUG
Performance Tools
• Java Monitoring Tools
• Java Profilers
• Java Testing Tools
5
Performance report
6
RebelLabs reports
7
8
9
10
11
12
13
14
15
The Journey of Performance
16
https://twitter.com/shipilev/status/578193813946134529
A
B
C
D E
Performance
Code complexity
Improving
Optimizing
Last 5%
Last 1%
A
B
C
D E
Profiling
CPU
Tracing Sampling
Memory
Usage Allocation
We are only talking about this part today
JVM has ability to produce thread dump:
Press Ctrl+Break on Windows
kill -3 PID on *nix
"http-nio-8080-exec-1"#40 daemon prio=5 os_prio=31 tid=0x00007fd7057ed800 nid=0x7313 runnable
java.lang.Thread.State: RUNNABLE
at o.s.s.p.w.OwnerController.processFindForm(OwnerController.java:89)
at s.r.NativeMethodAccessorImpl.invoke0(Native Method)
at s.r.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at s.r.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at j.l.r.Method.invoke(Method.java:497)
What is a sample?
Sampling interval : 20 ms
Sample count: 4
Sampling interval : 1 ms
Sample count: 100+
Sampling
main()
foo()
bar()
baz()
never captured :(
Safepoint bias
Safepoints
main()
foo()
bar()
baz()
Safepoint bias
Safepoints
main()
foo()
bar()
baz()
Taming safepoint bias
Java Mission Control
Proprietary protocol
Java 7u40
Honest Profiler
https://github.com/RichardWarburton/honest-profiler
AsyncGetCallTrace
JVMTI
NB! not documented
public	
  void	
  businessMethod()	
  {

	
  	
  long	
  start	
  =	
  System.currentTimeMillis();

	
  	
  work();

	
  	
  Profiler.log(System.currentTimeMillis()-­‐start);	
  
}
Tracing
(Instrumentation)
Tracing
public	
  void	
  businessMethod()	
  {

	
  	
  long	
  start	
  =	
  System.nanoTime();

	
  	
  work();

	
  	
  Profiler.log(System.nanoTime()-­‐start);

}
Tracing
public	
  void	
  businessMethod()	
  {

	
  	
  Profiler.start(“businessMethod");	
  
	
  	
  try	
  {

	
  	
  	
  	
  work();

	
  	
  }	
  finally	
  {

	
  	
  	
  	
  Profiler.log("businessMethod");

	
  	
  }

}
System.nanoTime
System.currentTimeMillis
Parallel thread updating easily accessible
memory location
sleep-wakeup-update
yield-wakeup-update
busy-loop-update
class	
  Profiler	
  {	
  


	
  	
  Loop	
  loop;



	
  	
  public	
  static	
  void	
  start(String	
  method)	
  {

	
  	
  	
  	
  long	
  now	
  =	
  loop.getTime();	
  
	
  	
  	
  	
  …

	
  	
  }	
  
public	
  class	
  Loop	
  implements	
  Runnable	
  {

	
  	
  	
  	
  private	
  volatile	
  long	
  time;

	
  	
  	
  	
  public	
  void	
  run()	
  {

	
  	
  	
  	
  	
  	
  	
  	
  while	
  (running)	
  {

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  time	
  =	
  System.nanoTime();

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sleep();

	
  	
  	
  	
  	
  	
  	
  	
  }

	
  	
  	
  	
  }	
  
	
  	
  	
  	
  public	
  final	
  long	
  getTime()	
  {

	
  	
  	
  	
  	
  	
  	
  	
  return	
  time;

	
  	
  	
  	
  }	
  
Busy Loop
Nano seconds put into perspective
Reading memory is not free.
It takes cycles = nanoseconds
Each (software) layer is not free.
JVM,JNI,OS,HW
http://shipilev.net/blog/2014/nanotrusting-nanotime/
Nanotrusting the NanoTime
Nano seconds put into perspective
http://shipilev.net/blog/2014/nanotrusting-nanotime/
Nanotrusting the NanoTime
granularity_nanotime: 26.300 +-0.205 ns
latency_nanotime: 25.542 +-0.024 ns
granularity_nanotime: 29.322 +-1.293 ns
latency_nanotime: 29.910 +-1.626 ns
granularity_nanotime: 371,419 +-1,541 ns
latency_nanotime: 14,415 +-0,389 ns
Linux
Solaris
Windows
Sleep timer: time-slicing & scheduling
Minimum sleep times:
Win8: 1.7 ms (1.0 ms using JNI + socket poll)
Linux: 0.1 ms
OS X: 0.05 ms
VirtualBox + Linux: don’t ask :)
Still uses 25-50% of CPU core
Yield?
Windows scheduler skips yielded threads in case of
CPU starvation
public	
  class	
  Loop	
  implements	
  Runnable	
  {

	
  	
  	
  	
  private	
  volatile	
  long	
  time;

	
  	
  	
  	
  public	
  void	
  run()	
  {

	
  	
  	
  	
  	
  	
  	
  	
  while	
  (running)	
  {

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  time	
  =	
  System.nanoTime();

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sleep();

	
  	
  	
  	
  	
  	
  	
  	
  }

	
  	
  	
  	
  }	
  
	
  	
  	
  	
  private	
  void	
  sleep()	
  {

	
  	
  	
  	
  	
  	
  if	
  (!MiscUtil.isWindows())	
  {

	
  	
  	
  	
  	
  	
  	
  	
  	
  Thread.yield();

	
  	
  	
  	
  	
  	
  }

	
  	
  	
  	
  }
Busy Loop
public	
  class	
  Loop	
  implements	
  Runnable	
  {

	
  	
  	
  	
  private	
  volatile	
  long	
  time;

	
  	
  	
  	
  public	
  void	
  run()	
  {

	
  	
  	
  	
  	
  	
  	
  	
  while	
  (running)	
  {

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  time	
  =	
  System.nanoTime();

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sleep();

	
  	
  	
  	
  	
  	
  	
  	
  }

	
  	
  	
  	
  }	
  
	
  	
  	
  	
  private	
  void	
  sleep()	
  {

	
  	
  	
  	
  	
  	
  if	
  (!MiscUtil.isWindows())	
  {

	
  	
  	
  	
  	
  	
  	
  	
  	
  Thread.yield();

	
  	
  	
  	
  	
  	
  }

	
  	
  	
  	
  }
Busy Loop
Busy Loop
public	
  class	
  Loop	
  implements	
  Runnable	
  {

	
  	
  	
  	
  private	
  volatile	
  long	
  time;

	
  	
  	
  	
  public	
  void	
  run()	
  {

	
  	
  	
  	
  	
  	
  	
  	
  while	
  (running)	
  {

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  time	
  =	
  System.nanoTime();

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sleep();

	
  	
  	
  	
  	
  	
  	
  	
  }

	
  	
  	
  	
  }	
  
	
  	
  	
  	
  private	
  void	
  sleep()	
  {

	
  	
  	
  	
  	
  	
  if	
  (!MiscUtil.isWindows())	
  {

	
  	
  	
  	
  	
  	
  	
  	
  	
  Thread.yield();

	
  	
  	
  	
  	
  	
  }

	
  	
  	
  	
  }
public	
  class	
  Loop	
  implements	
  Runnable	
  {

	
  	
  	
  	
  private	
  volatile	
  long	
  time;

	
  	
  	
  	
  public	
  void	
  run()	
  {

	
  	
  	
  	
  	
  	
  	
  	
  while	
  (running)	
  {

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  time	
  =	
  System.nanoTime();

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sleep();

	
  	
  	
  	
  	
  	
  	
  	
  }

	
  	
  	
  	
  }	
  
	
  	
  	
  	
  private	
  void	
  sleep()	
  {

	
  	
  	
  	
  	
  	
  if	
  (!MiscUtil.isWindows())	
  {

	
  	
  	
  	
  	
  	
  	
  	
  	
  Thread.yield();

	
  	
  	
  	
  	
  	
  }

	
  	
  	
  	
  }
Busy Loop
main()
foo()
bar()
baz()
Tracing
relatively higher overhead for fast methods :(
Database access
Web Services
RMI
Various application layers
3rd-party components
HTTP session
Exceptions
Caches
File system access
View rendering
Serialization
GC
What other performance
considerations should we have?
Questions you should be asking
……..
……..
……..
……..
Questions you should be asking
Where was most of the time spent?
How many SQL queries were executed?
How much time did the external calls take?
What’s my HTTP session state?
Is caching working properly?
Is there any excessive work done by the app?
Most improvement gained here!
This is where we should focus first!
A
B
C
D E
Is your profiler speaking the same language as you? -- Docklands JUG
Download trials and get FREE
shirts :)
JRebel: http://0t.ee/docklandsjr
XRebel: http://0t.ee/docklandsxr
47

More Related Content

PDF
DevoxxPL: JRebel Under The Covers
Simon Maple
 
PPTX
Performance is a feature! - London .NET User Group
Matt Warren
 
PPTX
Performance is a feature! - Developer South Coast - part 2
Matt Warren
 
PPTX
Scheduling in Linux and Web Servers
David Evans
 
ODP
Java Garbage Collection, Monitoring, and Tuning
Carol McDonald
 
PPTX
From 'dotnet run' to 'hello world'
Matt Warren
 
PDF
devday2012
Juan Lopes
 
PDF
Storm Anatomy
Eiichiro Uchiumi
 
DevoxxPL: JRebel Under The Covers
Simon Maple
 
Performance is a feature! - London .NET User Group
Matt Warren
 
Performance is a feature! - Developer South Coast - part 2
Matt Warren
 
Scheduling in Linux and Web Servers
David Evans
 
Java Garbage Collection, Monitoring, and Tuning
Carol McDonald
 
From 'dotnet run' to 'hello world'
Matt Warren
 
devday2012
Juan Lopes
 
Storm Anatomy
Eiichiro Uchiumi
 

What's hot (20)

PPTX
Where the wild things are - Benchmarking and Micro-Optimisations
Matt Warren
 
PDF
GTAC 2014: What lurks in test suites?
Patrick Lam
 
PPTX
Performance and how to measure it - ProgSCon London 2016
Matt Warren
 
PDF
Embedded systems
Katy Anton
 
PPTX
Performance is a Feature! at DDD 11
Matt Warren
 
PPTX
How to write memory efficient code?
Tier1 app
 
PDF
Profiling Ruby
Ian Pointer
 
PDF
Real-time streams and logs with Storm and Kafka
Andrew Montalenti
 
PPTX
Real Time Analytics - Stream Processing (Colombo big data meetup 18/05/2017)
mahesh madushanka
 
PPTX
Lets crash-applications
Tier1 app
 
PPTX
How & why-memory-efficient?
Tier1 app
 
PDF
streamparse and pystorm: simple reliable parallel processing with storm
Daniel Blanchard
 
PPTX
7 jvm-arguments-v1
Tier1 app
 
PPTX
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Sergey Platonov
 
PPTX
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
David Evans
 
PDF
Storm - As deep into real-time data processing as you can get in 30 minutes.
Dan Lynn
 
PPTX
Profiling & Testing with Spark
Roger Rafanell Mas
 
PPTX
Beirut Java User Group JVM presentation
Mahmoud Anouti
 
PPTX
Stream Processing Frameworks
SirKetchup
 
PDF
JVM Garbage Collection Tuning
ihji
 
Where the wild things are - Benchmarking and Micro-Optimisations
Matt Warren
 
GTAC 2014: What lurks in test suites?
Patrick Lam
 
Performance and how to measure it - ProgSCon London 2016
Matt Warren
 
Embedded systems
Katy Anton
 
Performance is a Feature! at DDD 11
Matt Warren
 
How to write memory efficient code?
Tier1 app
 
Profiling Ruby
Ian Pointer
 
Real-time streams and logs with Storm and Kafka
Andrew Montalenti
 
Real Time Analytics - Stream Processing (Colombo big data meetup 18/05/2017)
mahesh madushanka
 
Lets crash-applications
Tier1 app
 
How & why-memory-efficient?
Tier1 app
 
streamparse and pystorm: simple reliable parallel processing with storm
Daniel Blanchard
 
7 jvm-arguments-v1
Tier1 app
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Sergey Platonov
 
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
David Evans
 
Storm - As deep into real-time data processing as you can get in 30 minutes.
Dan Lynn
 
Profiling & Testing with Spark
Roger Rafanell Mas
 
Beirut Java User Group JVM presentation
Mahmoud Anouti
 
Stream Processing Frameworks
SirKetchup
 
JVM Garbage Collection Tuning
ihji
 
Ad

Similar to Is your profiler speaking the same language as you? -- Docklands JUG (20)

PDF
Devoxx PL: Is your profiler speaking the same language as you?
Simon Maple
 
PDF
Devoxx PL: Is your profiler speaking the same language as you?
Simon Maple
 
PDF
DevoxxUK: Is your profiler speaking the same language as you?
Simon Maple
 
PPT
JAVA MULTITHREDED PROGRAMMING - LECTURES
rm170484
 
PDF
Nodejs - A quick tour (v6)
Felix Geisendörfer
 
PDF
Basic Understanding and Implement of Node.js
Gary Yeh
 
PPTX
introduction to node.js
orkaplan
 
PPT
JavaScript Event Loop
Thomas Hunter II
 
PDF
Server Side JavaScript - You ain't seen nothing yet
Tom Croucher
 
PDF
Direct Code Execution - LinuxCon Japan 2014
Hajime Tazaki
 
PDF
LibOS as a regression test framework for Linux networking #netdev1.1
Hajime Tazaki
 
PDF
Microservices with Micronaut
QAware GmbH
 
PDF
OS scheduling and The anatomy of a context switch
Daniel Ben-Zvi
 
PDF
Nodejs a-practical-introduction-oredev
Felix Geisendörfer
 
PPT
Hs java open_party
Open Party
 
PDF
Apache Submarine: Unified Machine Learning Platform
Wangda Tan
 
PDF
May2010 hex-core-opt
Jeff Larkin
 
PPT
Nodejs Intro Part One
Budh Ram Gurung
 
PDF
1032 cs208 g operation system ip camera case share.v0.2
Stanley Ho
 
Devoxx PL: Is your profiler speaking the same language as you?
Simon Maple
 
Devoxx PL: Is your profiler speaking the same language as you?
Simon Maple
 
DevoxxUK: Is your profiler speaking the same language as you?
Simon Maple
 
JAVA MULTITHREDED PROGRAMMING - LECTURES
rm170484
 
Nodejs - A quick tour (v6)
Felix Geisendörfer
 
Basic Understanding and Implement of Node.js
Gary Yeh
 
introduction to node.js
orkaplan
 
JavaScript Event Loop
Thomas Hunter II
 
Server Side JavaScript - You ain't seen nothing yet
Tom Croucher
 
Direct Code Execution - LinuxCon Japan 2014
Hajime Tazaki
 
LibOS as a regression test framework for Linux networking #netdev1.1
Hajime Tazaki
 
Microservices with Micronaut
QAware GmbH
 
OS scheduling and The anatomy of a context switch
Daniel Ben-Zvi
 
Nodejs a-practical-introduction-oredev
Felix Geisendörfer
 
Hs java open_party
Open Party
 
Apache Submarine: Unified Machine Learning Platform
Wangda Tan
 
May2010 hex-core-opt
Jeff Larkin
 
Nodejs Intro Part One
Budh Ram Gurung
 
1032 cs208 g operation system ip camera case share.v0.2
Stanley Ho
 
Ad

Recently uploaded (20)

PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 

Is your profiler speaking the same language as you? -- Docklands JUG

  • 1. Is your profiler speaking the same language as you? Simon Maple @sjmaple
  • 3. Agenda • Performance Tools • Performance by numbers • Sampling vs Tracing • XRebel • JRebel 3
  • 5. Performance Tools • Java Monitoring Tools • Java Profilers • Java Testing Tools 5
  • 8. 8
  • 9. 9
  • 10. 10
  • 11. 11
  • 12. 12
  • 13. 13
  • 14. 14
  • 15. 15
  • 16. The Journey of Performance 16
  • 20. Profiling CPU Tracing Sampling Memory Usage Allocation We are only talking about this part today
  • 21. JVM has ability to produce thread dump: Press Ctrl+Break on Windows kill -3 PID on *nix "http-nio-8080-exec-1"#40 daemon prio=5 os_prio=31 tid=0x00007fd7057ed800 nid=0x7313 runnable java.lang.Thread.State: RUNNABLE at o.s.s.p.w.OwnerController.processFindForm(OwnerController.java:89) at s.r.NativeMethodAccessorImpl.invoke0(Native Method) at s.r.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at s.r.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at j.l.r.Method.invoke(Method.java:497) What is a sample?
  • 22. Sampling interval : 20 ms Sample count: 4
  • 23. Sampling interval : 1 ms Sample count: 100+
  • 27. Taming safepoint bias Java Mission Control Proprietary protocol Java 7u40 Honest Profiler https://github.com/RichardWarburton/honest-profiler AsyncGetCallTrace JVMTI NB! not documented
  • 28. public  void  businessMethod()  {
    long  start  =  System.currentTimeMillis();
    work();
    Profiler.log(System.currentTimeMillis()-­‐start);   } Tracing (Instrumentation)
  • 29. Tracing public  void  businessMethod()  {
    long  start  =  System.nanoTime();
    work();
    Profiler.log(System.nanoTime()-­‐start);
 }
  • 30. Tracing public  void  businessMethod()  {
    Profiler.start(“businessMethod");      try  {
        work();
    }  finally  {
        Profiler.log("businessMethod");
    }
 }
  • 31. System.nanoTime System.currentTimeMillis Parallel thread updating easily accessible memory location sleep-wakeup-update yield-wakeup-update busy-loop-update
  • 32. class  Profiler  {   
    Loop  loop;
 
    public  static  void  start(String  method)  {
        long  now  =  loop.getTime();          …
    }  
  • 33. public  class  Loop  implements  Runnable  {
        private  volatile  long  time;
        public  void  run()  {
                while  (running)  {
                        time  =  System.nanoTime();
                        sleep();
                }
        }          public  final  long  getTime()  {
                return  time;
        }   Busy Loop
  • 34. Nano seconds put into perspective Reading memory is not free. It takes cycles = nanoseconds Each (software) layer is not free. JVM,JNI,OS,HW http://shipilev.net/blog/2014/nanotrusting-nanotime/ Nanotrusting the NanoTime
  • 35. Nano seconds put into perspective http://shipilev.net/blog/2014/nanotrusting-nanotime/ Nanotrusting the NanoTime granularity_nanotime: 26.300 +-0.205 ns latency_nanotime: 25.542 +-0.024 ns granularity_nanotime: 29.322 +-1.293 ns latency_nanotime: 29.910 +-1.626 ns granularity_nanotime: 371,419 +-1,541 ns latency_nanotime: 14,415 +-0,389 ns Linux Solaris Windows
  • 36. Sleep timer: time-slicing & scheduling Minimum sleep times: Win8: 1.7 ms (1.0 ms using JNI + socket poll) Linux: 0.1 ms OS X: 0.05 ms VirtualBox + Linux: don’t ask :) Still uses 25-50% of CPU core Yield? Windows scheduler skips yielded threads in case of CPU starvation
  • 37. public  class  Loop  implements  Runnable  {
        private  volatile  long  time;
        public  void  run()  {
                while  (running)  {
                        time  =  System.nanoTime();
                        sleep();
                }
        }          private  void  sleep()  {
            if  (!MiscUtil.isWindows())  {
                  Thread.yield();
            }
        } Busy Loop
  • 38. public  class  Loop  implements  Runnable  {
        private  volatile  long  time;
        public  void  run()  {
                while  (running)  {
                        time  =  System.nanoTime();
                        sleep();
                }
        }          private  void  sleep()  {
            if  (!MiscUtil.isWindows())  {
                  Thread.yield();
            }
        } Busy Loop
  • 39. Busy Loop public  class  Loop  implements  Runnable  {
        private  volatile  long  time;
        public  void  run()  {
                while  (running)  {
                        time  =  System.nanoTime();
                        sleep();
                }
        }          private  void  sleep()  {
            if  (!MiscUtil.isWindows())  {
                  Thread.yield();
            }
        }
  • 40. public  class  Loop  implements  Runnable  {
        private  volatile  long  time;
        public  void  run()  {
                while  (running)  {
                        time  =  System.nanoTime();
                        sleep();
                }
        }          private  void  sleep()  {
            if  (!MiscUtil.isWindows())  {
                  Thread.yield();
            }
        } Busy Loop
  • 42. Database access Web Services RMI Various application layers 3rd-party components HTTP session Exceptions Caches File system access View rendering Serialization GC What other performance considerations should we have?
  • 43. Questions you should be asking …….. …….. …….. ……..
  • 44. Questions you should be asking Where was most of the time spent? How many SQL queries were executed? How much time did the external calls take? What’s my HTTP session state? Is caching working properly? Is there any excessive work done by the app?
  • 45. Most improvement gained here! This is where we should focus first! A B C D E
  • 47. Download trials and get FREE shirts :) JRebel: http://0t.ee/docklandsjr XRebel: http://0t.ee/docklandsxr 47