Fully featured low overhead profiler for Java EE and Java SE platforms.
Ultimate profiling and monitoring solution for Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Long pause after profiler attaching

Moderators: Vladimir Kondratyev, Anton Katilin

Long pause after profiler attaching

Postby gromopetr » Wed Jul 29, 2015 3:39 pm

I attach from YourKit 15 to a large Java application (IntelliJ IDEA Ultimate), that's started without an agent. The attachment is successful and I can see CPU usage telemetry. But after 2-3 seconds the application is frozen, and that can last 30-120 seconds. And only thereafter can I profile. Can I (or you) do anything to get rid of this pause?

BTW I'm not very happy with YourKit 15 usability:
1. In method list, filtering is now done with speed search. While saving some screen space, it's quite inconvenient because now it's not obvious where the focus is. Besides, accidentally pressing Esc clears this speed search filter.
2. When I do CPU profiling from the profiler, previous versions used to show CPU telemetry which I found quite useful. Now the view is always switched to collapsed "call tree" which in the default state shows nothing useful at all. Is there a way to change that?
gromopetr
 
Posts: 6
Joined: Wed Jul 29, 2015 3:32 pm

Re: Long pause after profiler attaching

Postby Anton Katilin » Thu Jul 30, 2015 10:05 am

Hello gromopetr

Can I (or you) do anything to get rid of this pause?

It's a known issue that JVM needs time to retransform (instrument) loaded classes if you attach to a running instance.

There are two possible solutions:

1. Don't use the attach mode but run with the profiler agent instead. This approach is less convenient since an extra step is required, but it totally eliminates all attach mode limitations. For detail, please see
https://www.yourkit.com/docs/java/help/attach_agent.jsp
Once you've specified -agentpath in the command line you can forget this issue.

2. With attach, specify startup option "disableall" (or a less strict subset of options) to disable bytecode instrumentation. The options can be entered if you attach with corresponding popup menu item in the application list instead of a direct click.

You still will be able to use profiling modes which do not depend on bytecode instrumentation, e.g. CPU sampling, memory snapshots, telemetry etc.

1. In method list, filtering is now done with speed search. While saving some screen space,
Saving space is not the only advantage of the new approach. For instance, it also indicates matched symbols, as well as allows a keyboard navigation through matched lines, even folded ones in case of trees.

it's quite inconvenient because now it's not obvious where the focus is.

The focused component should be indicated. What OS do you use?

Besides, accidentally pressing Esc clears this speed search filter.
It's a normal behaviour that a popup is hidden when you press Esc. However, I think your need could be addressed by adding some "un-hide" functionality, e.g. a hot key to reopen the search popup pre-filled with its previous value.

2. When I do CPU profiling from the profiler, previous versions used to show CPU telemetry which I found quite useful. Now the view is always switched to collapsed "call tree" which in the default state shows nothing useful at all. Is there a way to change that?
The tree is shown collapsed by default and that's bad; we have a request to fix this, i.e. to show it expanded. Anyway, you can always expand it manually. The telemetry graph can also be selected explicitly ("CPU usage telemetry" link).

Best regards,
Anton
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: Long pause after profiler attaching

Postby gromopetr » Thu Jul 30, 2015 10:24 am

Anton, thanks for the reply and for the suggestions. Do I have to enter this "disableall" and use popup menu each time I attach, or it can be remembered as a default somewhere? Starting with an agent is an option, but it might get a bit complicated in our dev setup and sometimes I want to be really sure that the profiler doesn't add any overhead to some operations while I still want to do sampling profiling for other operations.

Matched symbols can be indicated without speed search. I see your point about keyboard navigation and I agree it can be useful. But I still miss the text field with an ability to select text parts, correct typos by typing or removing letters in the middle, and see clearly where the focus is. I use Ubuntu, light scheme. Now that you've told me, I've found a tiny light-blue border around the focused tree. But I wouldn't say it's obvious from the first sight. A blinking caret or a selected text in a text field is a more noticeable visual cue.

I do switch to telemetry each time (when I don't forget and regret that later), and I'd appreciate if this choice was remembered. My use case is that I stop profiling when application finishes a busy operation which is clearly visible by the CPU activity. The additional bonus is that I see the GC fraction and if it's very high I decide to do a memory snapshot instead of CPU one. Call tree doesn't offer any of this functionality.
gromopetr
 
Posts: 6
Joined: Wed Jul 29, 2015 3:32 pm

Re: Long pause after profiler attaching

Postby Anton Katilin » Thu Jul 30, 2015 11:48 am

Do I have to enter this "disableall" and use popup menu each time I attach,

Unfortunately, yes.
or it can be remembered as a default somewhere?
You can specify this option as a part of starting with the profiler agent as -agentpath:<full path>=disableall
I want to be really sure that the profiler doesn't add any overhead to some operations while I still want to do sampling profiling for other operations.
If you add "disableall" the overhead will practically be zero. It's OK to run with the agent.

Matched symbols can be indicated without speed search. I see your point about keyboard navigation and I agree it can be useful. But I still miss the text field with an ability to select text parts, correct typos by typing or removing letters in the middle, and see clearly where the focus is.
We can consider a field-like UI for that, but unfortunately I cannot promise this request will get a high priority.

I use Ubuntu, light scheme. Now that you've told me, I've found a tiny light-blue border around the focused tree. But I wouldn't say it's obvious from the first sight.
Could you please provide a screenshot of how this looks on your machine?

I do switch to telemetry each time (when I don't forget and regret that later), and I'd appreciate if this choice was remembered. My use case is that I stop profiling when application finishes a busy operation which is clearly visible by the CPU activity. The additional bonus is that I see the GC fraction and if it's very high I decide to do a memory snapshot instead of CPU one. Call tree doesn't offer any of this functionality.
Thank you for the explanation. We can easily add an internal option (-Dxxx specified in ui.ini) to disable switching of the currently selected view in the next build. Should we? Will this be OK for you as a workaround?
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: Long pause after profiler attaching

Postby gromopetr » Thu Jul 30, 2015 12:00 pm

Do I have to enter this "disableall" and use popup menu each time I attach,

Unfortunately, yes.

Pity. When I want to attach, it usually happens when I see the application being slow and I need to start CPU sampling as fast as possible.

Am I mistaken or earlier versions (12 or 13) didn't instrument classes after attach and provided exactly the possibilities I need, like CPU sampling and memory snapshots (but no tracing/allocations/etc)? Could you please consider adding a (possibly internal) option about this?

Matched symbols can be indicated without speed search. I see your point about keyboard navigation and I agree it can be useful. But I still miss the text field with an ability to select text parts, correct typos by typing or removing letters in the middle, and see clearly where the focus is.
We can consider a field-like UI for that, but unfortunately I cannot promise this request will get a high priority.

I see. I'd be grateful, even if for me as well it's not a killer issue.

Could you please provide a screenshot of how this looks on your machine?

https://www.dropbox.com/s/56nwqfycuamec ... 2.png?dl=0

An internal -Dxx options is fine for me, especially as a workaround. Although I still believe that just remembering the selected view by default is an intuitive behavior and can be implemented without any options.
gromopetr
 
Posts: 6
Joined: Wed Jul 29, 2015 3:32 pm

Re: Long pause after profiler attaching

Postby Anton Katilin » Mon Aug 03, 2015 11:12 am

Hello,

Am I mistaken or earlier versions (12 or 13) didn't instrument classes after attach and provided exactly the possibilities I need, like CPU sampling and memory snapshots (but no tracing/allocations/etc)?
Sorry, you are mistaken. Bytecode instrumentation was always enabled by default on attach.

Could you please consider adding a (possibly internal) option about this?
I've added a request.

An internal -Dxx options is fine for me, especially as a workaround. Although I still believe that just remembering the selected view by default is an intuitive behavior and can be implemented without any options.
The idea behind the switching to the call tree or, with call counting, to method list is to show profiling results immediately as soon as CPU profiling starts. We do find this approach makes sense, yours makes sense too. We didn't get reports from other users who wanted to disable the switching, so we may conclude that the current behavior is generally OK for the majority, and that the opposite behavior should, if ever, be implemented with an option.

Best regards,
Anton
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: Long pause after profiler attaching

Postby gromopetr » Mon Aug 03, 2015 1:53 pm

Thanks. So will you add a (possibly internal) option for not switching the views on profiling start?

How do I know when a request is fixed?
gromopetr
 
Posts: 6
Joined: Wed Jul 29, 2015 3:32 pm

Re: Long pause after profiler attaching

Postby Anton Katilin » Thu Aug 06, 2015 3:06 pm

Hello,

We've just released build 15070. Please specify -Dyjp.auto-select-cpu-view=false in ui.ini to disable the switching.
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: Long pause after profiler attaching

Postby gromopetr » Thu Aug 06, 2015 6:03 pm

That's better, thanks!
gromopetr
 
Posts: 6
Joined: Wed Jul 29, 2015 3:32 pm

Re: Long pause after profiler attaching

Postby gromopetr » Wed Aug 12, 2015 3:30 pm

Would it be possible to do the heavy class instrumentation when the functionality that requires it is actually needed? E.g. when I start tracing/allocation profiling.
gromopetr
 
Posts: 6
Joined: Wed Jul 29, 2015 3:32 pm

Re: Long pause after profiler attaching

Postby Anton Katilin » Wed Aug 12, 2015 4:21 pm

Would it be possible to do the heavy class instrumentation when the functionality that requires it is actually needed? E.g. when I start tracing/allocation profiling.

This should already work this way. The only instrumentation that is performed immediately on attach is for the classes to which the built-in probes are applied. Normally, this affects a small number of classes, and the retransform process completes in milliseconds.

If you can reproduce a long pause immediately after attach, could you please provide corresponding agent log file <user home>/.yjp/<session name>-<pid>.log

Please either paste it here or send by email to support@yourkit.com
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 10 guests