Tuesday 2 June 2009

About Chanchal Kumar

Chanchal Kumar

Currently:

Chanchal Kumar is currently working for Ericsson Telecommunicatie B.V., Netherlands as a Senior Software Engineer on the Next-Generation Intelligent Network Platform. He has more than a decade of experience in the area of Valued Added Services - Intelligent Networks.

Background:

Chanchal Kumar has worked with Tata Consultancy Services in their Telecom Competence Center. With TCS, he worked for clients like Nynex(now Verizon), New York & Lucent Technologies (now Alcatel-Lucent), Hilversum, The Netherlands.

Education:

Chanchal Kumar's University Education

Birla Institute of Technology, Ranchi, India
B.E., Electronics & Communication,
1992 — 1996

Chanchal Kumar's Secondary Education

Bal Bharati Public School, New Delhi, India
1988 — 1992

Chanchal Kumar's Primary Education

Neo Convent School, New Delhi India
1978 - 1988

Wednesday 27 May 2009

Profiling with YourKit in Eclipse | Chanchal Kumar

Chanchal Kumar writes:

Here is a quick primer for profiling in Eclipse using YourKit:

1) Lets take an (over)simplified piece of (buggy) code as an example to see how:

2) Now lets write a small unit test to catch our bug:


3) Now lets download YourKit and integrate it with your eclipse as follows:

4) Follow the prompts and your eclipse will show the nice YourKit icon as:

5) Lets first run our test not pushing our JVM too much:


6) Lets push our JVM a little now:

Aha, an OutOfMemoryError, time to profile.....

7) Lets see how to Profile as a JUnit Test:

8) YourKit window pops up like this and in our simple scenario, we find our bottleneck ;-)


9) Cool, isn't it!?!

Happy YourKitting!!

Tuesday 26 May 2009

How to setup a Glassfish / Sailfin Cluster for Design Environment | Chanchal Kumar

Chanchal Kumar writes:

It can be embarrassing to give your supposedly distributable code to the test team to let them throw it in a cluster only to see it explode. For such moments, its pretty handy that you, at least, run a smoke test to prove that your code is indeed cluster-safe.

And the best part is that it doesn't even take 5 minutes to do so for Glassfish / Sailfin to setup a simple cluster configuration on your local machine. Here's how (the commands are self-explanatory, if you need details chip in a line and I shall get back):

$> ant -f setup-gt; ant -f setup-gt; ant -f setup-gt; ant -f setup-gt; ant -f setup-gt; ant -f setup-cluster.xml
$> asadmin start-domain
$> asadmin create-cluster myCluster
$> asadmin create-node-agent myNodeAgent
$> asadmin create-instance --nodeagent myNodeAgent --cluster myCluster firstInstance
$> asadmin create-instance --nodeagent myNodeAgent --cluster myCluster secondInstance
$> asadmin start-node-agent myNodeAgent
$> asadmin deploy --target myCluster myClusterSafeApp.ear

For a quick primer before trying out some real life clustering beyond your development environment, please read this nice guide.

Happy Clustering!!

Friday 15 May 2009

Profiling Java - Part 2 | Chanchal Kumar

Chanchal Kumar writes:

Continuing on the earlier disussion about java profilers, here is a nice list you should spend some time to evaluate. All these solutions have their pros and cons and you should try them out to see which one suits your requirements the best; remember there is no single panacea for your profiling needs and experience is your best friend in this area.

List of java profilers (in no particular order):

* Yourkit
* JPobe
* JRat
* JProifler
* YAJP
* JMeter
* JXInsight


and last but not the least:

* VisualVM


Ofcourse if you really want to create your own medicine and have the required competence and patience (and no manager breathing deadlines down your neck), you could try making your own custom profiler, you need to know JVM Tool Interface for that; see this nice JVMTI User Guide.

Happy Profiling!!

Thursday 14 May 2009

Profiling Java - Part 1 | Chanchal Kumar

Chanchal Kumar writes:

If you have been missing out on a good Java profiling tool with a GUI, you should give the trial version of JProfiler a shot:

http://www.ej-technologies.com/products/jprofiler/overview.html

JProfiler lets you get a close look at your VM, and the visuals are intuitive and self-revelatory.

Unfortunately, JProfiler comes for a price but if you are satisfied, I believe its worth every penny you spend.

If you really are bent upon using an open-source tool, you will be happy to know that Sun Microsystems has released
VisualVM as part of its 6u7 release. If you have been an avid user of jinfo, jmap, jstack, jstat, jconsole; you would now see all of these clubbed together in a single tool. Also the Profiling GUI is quite sleek and, if not as good as JProfiler, does the job.

Tuesday 12 May 2009

How to Debug Glassfish with Eclipse | Chanchal Kumar

Chanchal Kumar writes:

Debugging Glassfish with Eclipse is a straightforward two step process (I admit that Eclipse has its own very difficult moments when even the straightforward isn't so straight anymore), nevertheless these two steps should take you forward:

1) Starting your glassfish in the debug mode is the first step. Here is a screenshot explaining what to do first:



In the image above, you see that in the Glassfish Admin Console, you need to tick the Enabled flag for Debug under JVM General Settings. Also notice that (by default) the debug options have a port sest to 9009. You need to inform Eclipse that this is the port it should use to connect to Glassfish.

2) In the next step, we open the debug dialog in eclipse (Run -> Open Debug Dialog), and configure our project to use the Glassfish in the Debug mode. Here is another screenshot explaining what to do:





Notice that you need to create a `New` when you right-click `Remote Java Application`, the project you selected in Eclipse is by default filled in or if you want you could change to the project you want to use. Enter the IP address of the host running Glassfish/Sailfin and the port number we configured in the first step i.e. 9009

That was all that is needed, you are set to rock the JVM now. I mentioned there are only two steps, the third one is perhaps too intuitive to be called a step; I shall mention it anyway that for debugging you need to turn on the debugging perspective as shown in this image: