Profiling Ofbiz with YourKit
YourKit is a Java and .net profiler similar to jProfiler. Both are commercial profilers and I used the trial version which did a pretty good job for evaluation reasons.
There are two alternatives to connect the profiler to an OFBiz instance. The first and easiest way is the integration with Eclipse (YourKit Eclipse integration). You can create a new profiler startup configuration which loads the profiler parallel to our OFBiz instance and links them together. With this configuration it is possible to investigate the memory or CPU resource consumption on system startup in order to identify problems.
The second alternative provides you the opportunity to connect to a remote instance (i.e. an OFBiz instance on a Linux machine). For a remote connection a second YourKit copy has to be installed on the system which should be profiled (I didn’t need any root privileges). To tell OFBiz it has to publish some information for the profiler, the startup parameters must be extended:
The agentpath specifies the path to Profiler installation, it points to the system specified profiler library (in my case: linux-x86-32). Notice: The profiler library architecture depends on the JVM rather than the OS, when a 32-Bit JVM is used on a 64-Bit Linux the 32-Bit profiler library is needed. The "dir" describes the directory in which memory dumps can be stored and the session name makes identification in the GUI easier. The others are standard parameters, which were taken from the documentary.
After running OFBiz with the new parameters, YourKit can be loaded on the local computer. On the home screen, the profiler provides the option: "connect to remote application", which opens a prompt where you can enter the server IP plus the connection port (default 10001).
This article was first published in german on ofbiz.biz (http://www.ofbiz.biz/allgemein/ofbiz-profiling-yourkit/) .