How to profile a headless Java application, running remotely? - java

I have a headless Java application, running on a remote server as a daemon-style process.
I want to extract Java level profiling information from the process, of the sort displayed by JVisualVM. For example, it should show method invocation times and so on.
What is the best way of doing this? My understanding is that JVisualVM does not profile when connecting remotely.
Ideally, the profiling information would be stored in a file for later inspection, in a manner similar to Java heap generation (with jmap) and later analysis (with a heap inspector).

You can use NetBeans profiler remote profiling capability.
Remote Profiling
Profile an application that is running on a different system than your NetBeans IDE. The profiler's remote pack can be installed on a remote system, allowing you to profile an application that is started on that system.
In fact, VisualVM is based on it.
Beside various monitoring features, the tool contains a built-in profiler based on the NetBeans profiler. While the profiler UI in VisualVM looks simple (especially when compared to the NetBeans profiler), the profiling capabilities are almost as powerful as in NetBeans.
Here is a detailed blog post about Profiling a Java remote server using Netbeans.

According to the link you will have to set up jstatd and jmx:
http://javadevsoup.blogspot.de/2012/02/remote-java-profiling-using-visual-vm.html

I just found another product that I think does this: http://chrononsystems.com/products/chronon-recording-server

Related

Can JProfiler be run without the GUI?

Is it possible to run JProfiler to profile an application without having to launch the GUI, select the application, etc?
I'd like to be able to run a set of executions of my application and save the profiling results in an automated way.
Thanks
You can use the offline profiling capability from JProfiler:
JProfiler's offline profiling capability allows you to run profiling sessions from the command line without the need for starting JProfiler's GUI front end. Offline profiling makes sense if you want to
perform profiling runs from a scripted environment (e.g. an ant build file)
save snapshots on a regular basis for QA work
profile server components on remote machines via slow network connections
Reference: JProfiler Docs

16 Thread / 16 core code profiling with Java / Eclipse TPTP on Linux system

I have developed a nice multi-Threaded genetic algorithm in Java that runs on a 16-core system running CentOS with 128GB of RAM.
I want to use a code profiler to see if I can figure out which portion of the code is getting bogged down when I increase the number of mutations in my simulation beyond a certain point. Memory doesn't seem to be the issue.
So I installed VNC and Eclipse 3.6SR2 on the server and installed the TPTP plugin.
PROBLEM: The biggest issue is that it doesn't look like eclipse is using more than one core when I am doing the TPTP "execution time analysis" (I checked using 'top'). Normally when the program is run from the command line it uses as many cores as there are threads in the program.
Is there a way to fix this in the eclipse configuration?
Disclaimer: My company develops JProfiler
A profiler that uses JVMTI should not change the multi-core thread distribution with respect to a regular execution. TPTP may not be the best option for you.
There are several powerful Java profilers in the market. The most well-known free option is VisualVM and a commmercial alternative with much more powerful analytic capabilities in the area of multi-threading and monitor contention analysis is JProfiler - there's a fully functional free trial.
Get a real profiler like YourKit and add the agent to your application at startup.
Then you can open an SSH tunnel with the port where the agent is running and you can remotely profile your application. It has a quite good documentation and a healthy community in their forums. And in my opinion YourKit is great for multithreaded applications, I use it a lot.
No need for VNC and installing Eclipse on a production server.

Profiling java application running as service(locally/remotely)

I'm looking for a tool which can profile the java application running as a windows service ( remotely/locally either way) .
I've come across VisualVM as one option. Are there any other products available other than VisualVm.I'm more interested in reputated product. Can Jprofiler do this for me?
VisualVM , Does it give class wise list of profiling ?
See this article, if you want to use Java VisualVM. It describes how java application running as a Windows service can be monitored and/or profiled using VisualVM.
JVisualVM is you best shot. It's free, comes with the JVM and gives you a pretty decent range of functionality. Not sure what you mean by "class wise list of profiling." But it will show you where the majority of your execution time is spent.
You can execute jvsiualvm by going to $JAVA_HOME/bin and typing jvisualvm. Then select the the vm you wish to profile.
You can use BTrace to instrument your application and to measure the parts of the application that you are interested in. BTrace logs its output to files, which you can later or in real-time transfer to a monitoring application, such as EurekaJ (which I've written myself).
Both tools are Open Sourced and free to use. BTrace uses the "GNU Public License v.2 w/Classpath Exception" license, while EurekaJ uses the GPLv3 license.
InfoQ Writeup on the two tool including VisualVM and a few commandline tools: http://www.infoq.com/articles/java-profiling-with-open-source
Link How can I monitor my Java application running as Windows Service with Visual VM? says that on recent Windows versions only JMX mode can be used, but not local.

Profiling a jar file remotely?

Is there any profiler available in the java environment which can be used on a remote machine?
I have a .jar file (plain java code,nothing fancy) running on a remote machine and I want to profile that file. However,I can't install the profiler on the remote machine since I do not have the necessary permissions. Is there any way I can profile the application from my local machine?
Aall Java profilers I know have that ability, since the Java debugging interface (JVMTI) is inherently network-capable.
VisualVM has basic (but often sufficient) profiling features and comes with the JDK.

How to find cpu,io,memory utilization of a loading page in web application

I've written a Java file, using Jsp,servlets, that I would like to perform run-time tests on. I've never done this before and was just curious on how to go about it.
What I'm interested in knowing, besides the actual timings, is how to find cpu,memory and io utilization when running the application.Your thoughts are appreciated.
Typically you wouldn't measure these from within the application, but by running another tool on the same host.
If you just want to see the impact on the host operating system, you can use a program like top (on *nix boxes), or good old Task Manager on Windows, to see the CPU/memory/IO utilisation of your Java process (typically the servlet container such as Tomcat).
If you want more detailed information on the actual Java process itself, you can connect JConsole or jvisualvm to get VM information (including memory and CPU) for the process itself. (With Java 6 you should be able to do this from the local machine without passing any parameters to the Java process at startup; for Java 5, or remote connections, you'll need to pass command-line arguments to the Java process to allow (remote) JMX connections.)
Finally, if you want really in-depth details of the resource usage, down to the performance of various methods (which it sounds like you're after), you'll need to use a profiler. There are several of these for Java - with YourKit and JProfiler being the biggest commercial ones (in my unqualified opinion). I believe that the NetBeans IDE also has a decent profiler built-in. The process for connecting these to your application would vary depending on the app itself, but these will all typically allow you to "drill down" into the CPU time to see which classes/methods took the most cycles to execute, and likewise to drill down into memory use to see which classes are taking up the most memory.
The standard way to monitor running Java applications these days is sing JMX through the JConcole
If your a using a commercial application server like Weblogic or WebSphere these have custom and powerful management consoles that provide the monitoring information you are looking for. The technology at the heart of these consoles is still JMX so these can also be monitored and managed using the standard JConsole. This article shows how to do this for Weblogic.
I guess you need this info in the client side (browser). So it's not Java based question.
If so, here is my answer:
I prefer using FireBug and ySlow extensions. They give performance information, memory information and much more.
I combine it with using regular task-manager to view more information about the browser.
BR

Categories

Resources