1

When I open a .jfr file(Java Flight Record) with Java Mission Control, I can find 'Stack Trace', 'Longest' and 'Count' in Thread -> Latencies -> Latency Stack Traces tab. I care about the average but not the longest. There's average in Java Latencies tab, but it contains all latencies related to an event type. Some of them is meaningless for me, for example:

sun.misc.Unsafe.park(boolean, long) 
    295,569,155,245 436,427

java.util.concurrent.locks.LockSupport.park(Object) 
    295,569,155,245 344,030

java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await()   
    295,569,155,245 263,418

java.util.concurrent.LinkedBlockingQueue.take() 
    63,773,776,315  257,531

java.util.concurrent.ThreadPoolExecutor.getTask()   
    63,773,776,315  257,511

java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker)    
    63,773,776,315  257,511

java.util.concurrent.ThreadPoolExecutor$Worker.run()    
    63,773,776,315  257,511

java.lang.Thread.run()  
    63,773,776,315  257,511

The above is the idle time of thread pool, it's waiting for the next task. The average of this and all other stack traces mixed is meanlingless. I only care about the latencies of business stack traces. How can I get the average of a specific latency stack trace. Can I export the original data to a csv, then I can calculate by myself.

Kire Haglin
  • 6,569
  • 22
  • 27
lamplet
  • 103
  • 1
  • 1
  • 8
  • 1
    Um, because it wasn't implemented that way – Michael Nov 01 '18 at 11:49
  • Might be a job for ELK. Ingest those log files and use analytics to get the calculations you want. Granted, it's a lot of overkill, but if you're looking at this over the long haul, having a solid logging visualization solution in place is probably worth the effort. – J E Carter II Nov 01 '18 at 11:50
  • 1
    Average is probably the most misleading metric that you can get http://highscalability.com/blog/2015/10/5/your-load-generator-is-probably-lying-to-you-take-the-red-pi.html – Roman-Stop RU aggression in UA Nov 01 '18 at 12:23

1 Answers1

1

To keep overhead low, Flight Recorder only records outliers. For example. if the duration of the latency is below 20 ms, it is not recorded.

It would be possible to sample latencies, to get an aoproximation of the average latency, but that is not available as of today (JDK 11).

Kire Haglin
  • 6,569
  • 22
  • 27
  • Thanks! That explains why some stack traces was not recorded, it's important. And I found: 1.There's 'count' and 'total' in Events -> Stack Traces tab, total/count = avg. Latencies below 20 ms is not recorded, so it may not be an accurate average. 2.jfr can be converted to xml, so a job for ELK is possible, though I won't do it now. java oracle.jrockit.jfr.parser.Parser -xml xxx.jfr > xxx.xml – lamplet Nov 02 '18 at 01:34