Monday, September 9, 2013

VisualVM For Java Developers

Introduction

VisualVM is a very powerful and convenient tool for visualizing local and remote java applications. These days, I use it for visualizing camel routes, memory usage, and many other things.

Start VisualVM

VisualVM comes with JDK 7 under %JAVA_HOME%\bin\jvisualvm
When you start this application, you may encounter the error page below. This seems no-harm error. The work-around to avoid this problem is show on the troubleshooting page:
https://visualvm.java.net/troubleshooting.html. I fixed this problem by changing the directory hsperfdata_GLIU to hsperfdata_gliu. The hsperfdata_gliu directory is at %TMP% for windows. 

Install Plugins

After you start the VisualVM, you will see the local currently running application. That is fine if you just want to browse the local applications with minimum information, such as jvm startup options, threading etc. However, as java developer, you probably want to have more plugins. VisualVM plugins center comes with 16 plugins at this time or writing. I selected and installed all of them. 


Connect To Remote Applications

To connection applications running on remote servers are very useful feature of VisualVM. It comes with 2 mechanisms, namingly JMX and stated. To me jmx is the choice, as my currently project is about enterprise integration using Talend ESB which is basically running on top of Apache ServiceMix.

The following is the procedure to connection Apache Karaf application:

Right click on remote note
Now, the remote server is connected. 
Connect Apache Karaf - right client on the newly added node - select JMX option.
on the URL I entered the following:
service:jmx:rmi://acldlu02tld.corp.vha.com:44444/jndi/rmi://acldlu02tld.corp.vha.com:1099/karaf-trun

You can achieve this by using jconsole, but jconsole will not remember all your connections like visualvm. 






Saturday, May 11, 2013

New MacBook Pro Experience

OK, this is my third MacBook. The last one I bought was January 2011. That one is still in good shape. I have upgraded the memory from 4GB to 8GB. Still, I have installed a lot of software on that Mac including Paralles, and other open source softwares, ActiveMQ, ServiceMix, Tomcat, MySQL, etc. All those applications put stress on the Mac. So I decided to buy a new one with 16GB memory and 2.7GHZ CPU. BestBuy has a promotion saving 150$, a good deal. But still, it cost almost 2,900$. Not small amount, but I think it worths it. Here are few photos I took when I open the box. It is really beautifully designed. At the moment, I am trying to migrate my music to the new computer, but the Migration Assistent seems taking very long time to recognized my previous MacBook Pro.