Thursday, January 21, 2010

Profiling Java Applications

Well, last few days have given me some serious reasons for profiling Java applications. To be precise, the problem was with one of the Java application which was becoming slower overtime. I tried to figure out the real problem both by manually scanning the code and debugging as well but the problem was hidden and all my efforts were getting wasted. Then, someone came and advised me on using a profiler to find the actual problem in the code.

Really, till then I had just heard about profiling but had never tried myself. This was the first time I gave it a try and it really worked. I used NetBeans profiler in order to find the problem with the code and I must say, it worked wonders for me.

Profiler enables a Java developer to make the application JVM friendly. Java profilers connect to a running Java application's JVM and capture memory information. In older Java versions they used Java Virtual Machine Profiler Interface (JVMPI). In latest versions however, the JVM Tool Interface (JVMTI) for Java is used to get the profiling information. If you don't profile your large enterprise Java applications prior to releasing them to production, they can fail with OutOfMemoryErrors or render poor performance over time.

JVMPI


JVMPI was an experimental feature in the Java 2 SDK. Sun intended tools vendors to use it to develop profilers that would work in conjunction with Sun's JVM. Similar to the Java AWT listener API, JVMPI was based on the event model.

Profiling tools that utilized JVMPI had to implement the function call interface and register for various events in order to get various VM memory stats. When a registered event occurred, the application's VM captured a memory snapshot by querying the object hierarchy. This was very time consuming and it interfered with the running application. Also, when the profiling tool registered all the exposed events, it slowed down the VM considerably. As a result, many vendors stayed away from developing profiling tools with this interface.

JVMTI


As JVMPI had some shortcomings and was not offering finer-grain control of the running JVM, Sun introduced JVMTI with JDK 5.0 as an experimental interface model to profile the JVM. It provides ways to both inspect the state and control the execution of applications running in the JVM. JVMTI supports the full breadth of tools that need access to JVM state, including but not limited to profiling, debugging, monitoring, thread analysis, and coverage analysis tools. The JVMTI model supports both sampling and instrumentation of the JVM.

JVMTI is a two-way (query and control) interface. A client of JVMTI can be notified of interesting occurrences through events. Using JVMTI, profilers can query and control the application through many functions. The native in-process interface allows maximal control with minimal intrusion from the tool.

So what are you waiting for, if you are facing any kind of memory related issues in your Java application, NetBeans profiler is there to help you out.

Friday, September 18, 2009

Free alternative to FlexBuilder in 10 easy steps!

After downloading Flex SDK and documentation last week, I came to know about Adobe FlexBuilder, a commercial tool available from Adobe website to develop flex applications. I was really disappointed when i was not able to find even a single free alternative to FlexBuilder. FlexBuilder is basically based upon eclipse and as soon as I came to know about it, I start wondering if something similar is available for NetBeans as well. And here it is. After some googling around, I found a plugin for NetBeans which would allow me to develop Flex Applications for free. Its pretty easy to install and configure. The only downside being that it won’t give you code auto-complete feature. But anyways, as a beginner its good for me to write my own code instead of making bad habit of code to auto-complete. Below is a quick walkthrough of how I was able to install flex plugin into my NetBeans IDE in just 10 easy steps.

1. To download the FlexBean plugin, click here.

2. Once downloaded, please start NetBeans IDE and click Tools >> Plugins

3. Now in “Plugins” dialog box select “Downloaded” Tab and click “Add Plugins…” button.

4. From “Add Plugins…” dialog please browse to the directory where you downloaded the flex bean plugin file and select it. Finally, click “Open” button to add the plugin to plugin list.



5. Now click “Install” button with FlexBean selected and you will be presented with a FlexBean installation wizard.

6. Click Next, accept the agreement, and finally click install to install the plugin in NetBeans.

7. Click finish and then close all the dialogs to return to NetBeans workbench.



8. To configure FlexBean plugin properly, it needs to know the location where the Flex SDK has been extracted. Click Tools >> Flex Platform.

9. From “Flex Platforms” dialog select "Add Platform…” Button and select the folder where you have extracted Flex SDK and click Next.

10. Finally, write a name of the platform in the next dialog and click Finish.

This is all you need to do in order to make the NetBeans IDE ready for Flex editing.

Next, I will be creating our first flex application and get our hands wet with some real water. Stay tuned!

Wednesday, September 9, 2009

My Latest Interest…

Well… no excuses on why I am blogging after a long break. I would just say… I was really busy with all the work I have been doing during this break of mine. Lots of things in life have changed. I am not the same “Java Enthusiast”. I am much more grown up now, in the sense that I see Java just as any other technology which could help me achieve the requirements. I, no more belong to a group of people who follow a particular technology as their religion but believe in new inventions and innovations. Just like Windows has its alternatives in form of Linux and Mac OS… Java too has its alternatives. Then why should I stick to Java… why shouldn’t I try something new, something more productive, something more flashy. First of all, I must tell you… I am just talking about the client side Java for now. The last day, someone told me about Adobe Flex and its power. Therefore, I decided to give it a try. My latest interest is Adobe Flex and I am trying to get my hands wet with it.

Will keep you updated on it.

Saturday, December 15, 2007

Thats me on NetBeans Community Docs Spotlight

A day before, James Branam, the man responsible for documentation for NetBeans web applications and release notes and is also the NetBeans Community Docs Manager, published NetBeans Community Docs spotlight on his official blog at http://blogs.sun.com/branajam/. Any guesses on who was picked up as a spotlight for NetBeans Community Docs by James this time. It was me! Check it out at http://blogs.sun.com/branajam/entry/nb_community_docs_spotlight_arpit

Well, I have another good news. He is sending all the Community Docs contributors a NetBeans T-Shirt and I am really excited.

With all these good stuffs, I have now planned to write one more tutorial for Community Docs section which will be posted soon.

Thanks James!

Thursday, December 6, 2007

Tutorial on Beginning Enterprise Application Development with NetBeans 6.0

You might be aware that NetBeans 6.0 has been released a day before. For all the NetBeans fans its a great news. This time around NetBeans team has done a lot of improvement in all spheres and have tried their level best in making it the "Only IDE you would ever require for any sort of Java Development".

If anyone of you is interested, I have just published a tutorial which may be an excellent starting point for any Java Developer who want to start Enterprise Application Development (J2EE 5) using NetBeans 6.0 IDE, on NetBeans CommunityDocs Wiki. The tutorial has been done entirely on Ubuntu but is applicable to all the operating systems.

Click Here
to go through this tutorial and do not forget to post in your comments!