Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Profiling Problems in 4.4"

(new attempt results)
m (Second try from scratch, with better results)
 
Line 60: Line 60:
 
* Anyone know if this works with all current Java5 vms?
 
* Anyone know if this works with all current Java5 vms?
 
** If it works, it could avoid needing to change scripts...
 
** If it works, it could avoid needing to change scripts...
== Second try from scratch, with better results ==
+
==Second try ==
I tried this all again with a better understanding of the capabilities provided by Eclipse and TPTP. The various things needed to set up and run using scripts simply seem too tedious and are not typically required by commercial tools. Even with the various suggested workaround, I was still getting variable behavior. It turns out that not all profiling types are supported in the attach scenario and this was another part of my problem. So I use Eclipse more as it was intended.
+
I moved this content to the squiggly scenario  [[Profiling_Problems_in_4.4_Squiggly|here]].
 
+
===The good news===
+
For the Batik profiling, I simply used the Eclipse "Run" action for an external Java application. I set the class name to "org/apache/batik/apps/svgbrowser/Main" and the classpath to "D:\batik\batik-1.7\batik-squiggle.jar;D:\batik\batik-1.7;D:\batik\batik-1.7\lib". When doing this via the profile action I set the monitor tab for execution time analysis and set the filters as needed. When I selected run, squiggle came up and ran. When I selected profile it took a while due to the applying of instrumentation, but it also came up and ran. This is the same as running in "controlled mode" had i used scripts and attached. So the need for scripts to profile squiggle is unnecessary.
+
 
+
For the tomcat scenario, I used the WTP extensions. First I created a "server" and configured it to be my version of tomcat (5.5) and I could successfully run the server, although there were no applications running. By double clicking the server when it is stopped, I could edit the properties and selected the server location to be the server install "take control of the server". The next time I started the server it had all the default applications running and I could run my squiggle and jsp example.
+
 
+
To profile the server I simply selected the server and the profile action, and was then prompted to set profiling type and the filters. This then brought up the server and I was all set.
+
 
+
Now from the workbench I could launch and run both applications, and did not require attach support to get to this point. This is good progress, so now I can assess the stack time as originally intended.
+
===The not so good news===
+
I still have the basic profile on server problem. That is that until I trick the embedded agent controller to start it is not active. This is a bug that needs to be fixed asap.
+
 
+
Once I launched both applications as noted above, my use case was to see where time was spent when an SVG stream was created on the server and then rendered on the client (squiggle in this case). Because I started profiling at application start time, I already had data from both applications in the various profiling views and a needed a clean baseline. I noticed that the tabular views all supported and delta indicator at each refresh but refreshes where happening every few seconds, so this was useless to me until I saw that I could manually refresh. Once I did that I could control the delta but I could not see what the delta was so I was still not being helped. So I selected "unload profiling data" which did clear the views but after that no more data was seen in the views. This is another serious bug.
+
 
+
At this point I tried various things to get a baseline including re-attaching to the agent etc.. I took the following note about problems I saw:
+
 
+
**tomcat had two execution time profiler both collecting what appears to be the same events, only one has the filter as defined and the other has no filters therefor star exclude an in both the name is _JVMPI_. The second has all unknown threads
+
**clear data and memory is not reduced but views do go empty (intention is to get a clean baseline from each agent)
+
***trigger more events and nothing appears to be loaded
+
**detach and reattach new execution statistics agent is added bu the filter has no values and never loads any data, however the "terminated" agent toggles back and forth with monitoring and loads the data and populates the views
+
***detach the agent with no data and no more data is collected
+
 
+
reset the workbench by detaching and deleting all resources, and then attach to the exposed agents
+
(works very nicely as a concept)
+
**no data is every loaded (filter has the right name but are out of order)
+
**only PID is shown where before squiggle had the right process name
+
 
+
terminate the server and squiggle at the application and the navigator shows both terminated. Delete all the things shown in the navigator, get the correct prompts and the navigator clears
+
** select the navigator and the status line at the bottom toggles between the status of the prior agents
+
 
+
with all resources deleted, and the profiling perspective closed, memory is still not released
+
 
+
preferences select IAC and change security settings, after having used the IAC, get prompted to restart IAC, and the ACServer is stopped, but not started. AcSvc never goes away.
+
 
+
first view of execution statistics shows deltas (refresh set to 5 seconds)
+
 
+
*** view associations don't allow any role up view
+
 
+
*** no way to set buffer size in IAC - default of 24meg may be too small (need to look at Alex/igors fix)
+
 
+
** run squiggle with thread monitored, works nice but if window is partially hidden and and then a new uri set app hangs on AWT thread and app is hung
+

Latest revision as of 15:49, 8 January 2008

Initial Description of Experience

If you want to feel the pain of using the 4.4 profiler read on ...

While trying to help a user on the mailing list I was reproducing his experience and "trying" to find a way to make it easier. This is meant to be a sad and slightly entertaining story that we need to fix. It is not an example of how to do anything.


This user has a client server application with the server running in Tomcat and the client being either a browser running dojo etc. or a RCP application. This interestingly provides 3 opportunities to use our profiler, however the user had no success with any.

The basic user install was to blindly install Europa with the latest TPTP 4.4, and have a separate agent controller directory even though everything was actually running on the same box.

So the first interesting problem is getting the AC install set up correctly. He figured out to run the setup script but didn't really know what he was doing or what jvm was picked. But, it would start.

Let's start with the server. The user was not using WTP and was attempting an attach scenario. This requires him to read and understand to instructions on how to change the canned Tomcat start up script he runs. Well where are those instructions for an end user? Lots of stuff on our site, but mostly pre-TI.

Step one is to search the online help in the workbench. There are several small problems that get in the way, but the trick is to know that you need help to "launch". Boating jokes aside, this word works for us TPTP weenies, but never crossed his mind. start up, attach, configure, all take you down different paths. So he searches the web site and then Google and doesn't find the help he needs because he is missing the critical word. Interestingly once pointed at the right web page, he can not figure out what to do, and is not sure which jvm level he is even using. So bright boy me thinks to suggest just using WTP to start and stop the server because then we do the ugly part for him, but because I have had my own problems in this space try it out first. I simply take a config that I have been using everyday for over a month to develop and test an application, and hit profile on server. Ok, so I am waiting and I know it will take a bit longer, but 5 minutes go by and even I give up. I see the java process was started, but nothing is happening and the tomcat server didn't actually come up. Nothing in the console window either. I conclude the IAC must not be working and stop everything, and just pretend to attached and test the connection, which takes a short while but comes back. Ok, try PoS again and it works. It turns out that the TI agent requires the agent controller to be up and running in order to connect etc.. But wait, I started all this in the workbench so why wasn't the IAC started?

Ok, so the WTP/IAC was not a good idea, as it exposes a huge user problem. Back to setting the tomcat start up script, looking closely we find that we need to pick a profiler parameter to say what kind of data we want to profile at start up time and not at attach time. (The user had tried some basic hello world stuff, interestingly with Java 1.4 and didn't need to do this. Note that the documentation, if you can find it doesn't say if there is a default, or that you can't specify all the profiler types at once and decide later. The realization now hits that in an attach scenario the user needs to have 3 different start up scripts plus one for no profiling for each application (total 12)

5 work days and a weekend have passed so far. The user has not come back to this task to finish it. Even though his job is to do performance work, logging out some timestamps was a quick way to get started. In the meantime he also tried ARM, but didn't realize he needed some instrumentation in order to collect data.

As yet we have not tried the RCP application and I don't think we even test browser configurations anymore. (yes it used to be tested and work for both IE and FireFox with the sun and ibm jre)

Yes this can be made to work, and yes this particular user may not be typical, but he is not unique.

Documentation is hard to do well, but we need to spend some time fixing this. Our web site is out of date, and during my trip through the online help I saw <<add a link here>> mixed in the text. A fresh walk through the scenarios will help a lot.

The profile on server scenario is simply broken from a user point of view. We have users that did use earlier releases of TPTP and now walk away because it just hangs on them.

It seems we can do some intelligent defaulting and make the start up script trivial to write like XrunpiAgent was, and thus enable an easier attach scenario.

A few hints and comments

I totally agree that documentation and web updates are important and need some updates.

Note that there is some cryptic documentation readme.txt on configuring run scripts in the directory that contains the TI agent (e.g., org.eclipse.tptp.platform.jvmti.runtime_4.4.1.v200709261752\agent_files\win_ia32) directory in the 4.4.0.3 release. There is a bugzilla filed against making standalone/script creation less painful. I have put a few of the scripts I use at TPTP-standalone-script-TPTP4.4.0.3.

I don't really use PoS so I can't really speak to this problem. I believe the claim that it is painful though...

There is a very good reason that you need to pre-specify the mode with which you will attach. It comes back to how JVMTI works versus how JVMPI worked. In JVMPI, you would take a performance hit when connecting with any agent because the VM had no way of knowing what events/functions would be used by the agent. Some JVMs (e.g., BEA) added some fancy command line parameters to disable some of the JVMPI commands for JVMPI users who wanted to assert at VM startup time that they would not use certain parts of JVMPI. JVMTI standardizes this concept of limiting peturbation. At VM startup, the JVMTI agent locks in the capabilities that it will require for the duration of the execution (yes, for you JVMTI experts out there, some but not all capabilities can also be set after the primordial stage but some of the important ones can only be set at startup. This way, the VM only needs to impact the performance subject to the capabilities that were selected. JVMTI pro: the richer interface provides more power. JVMTI con: using the richer interface efficiently has implications on launch (startup, attach, configure) that are more stringent from the earlier JVMPI interface.

I would actually suggest that one modify the startup script to read an environment variable that indicates the profiler that will be attached. In this way, only a single main startup script is required with a parameterized wrapper script that sets the environment variable then calls the underlying script.

suggestion

So how about a simple defaulting example that uses defaults that are equal to this

"java -agentlib:JPIBootLoader=JPIAgent:server=enabled;CGProf "

by doing this

"java -agentlib:JPIBootLoader=JPIAgent"

and in our material not just do HelloWorld, but show how to use with Tomcat and RCP?

I think the PoS problem simply needs to be fixed in 441 and asap.

-- CLE writes

  • A tomcat or RCP example is a good idea. Anyone with experience w/ tomcat/RCP want to volunteer to make some scripts?
  • Has anyone experimented with using environment variable instead of command line to set up profiling from command line? I've never used it...
  • Anyone know if this works with all current Java5 vms?
    • If it works, it could avoid needing to change scripts...

Second try

I moved this content to the squiggly scenario here.

Back to the top