Tuesday, November 30, 2010

How to setup JProfiler for Carbon products..

JProfiler is a popular profiling tool which helps developers monitor a huge number of parameters that are related to the execution of a particular program, such as memory usage, CPU usage, etc thereby providing the ability of identifying memory leaks, threading issues, etc.

The focus of this article is to provide you with an understanding of how to set up the environment for a WSO2 Carbon server to run a profile on it and observe the aforementioned parameters associated with its execution.

Here, I'm using WSO2 Data Service Server to demonstrate the above task on a Ubuntu 64-bit installed machine.

First, go to the bin folder of the distribution of WSO2 Data Service Server (or the intended Carbon Server) and open the server script which is used to run the server. i.e. wso2server.sh

Then, add the following line marked with red (which is automatically generated when you first install JProfiler on your machine) under the heading Execute The Requested Command, to the appropriate position as depicted below. 

NOTE: You need to replace "/home/djpro/Installations/" with the location in which the JProfiler is installed in your machine.


Configuring JProfiler locally, to create a new profile..

Step 1: Run the JProfiler application and click on the "Start Center" icon which is in the top left corner of the menu bar. Then the following window will pop up which will guide through the process of creating a new profiling session.


Step 2: Select "New Session" tab and then on the "New Session" button under the sub topic called "Main Configuration".

Step 3: Then, select the "Remote" radio button and enter the IP address(in this instance, it is 127.0.0.1) and the port(default is 8849) of the remote machine which runs JProfiler application. Then press "OK". Don't forget to enter an appropriate name for the session inside the "Session Name" text box.


Step 4: If you could successfully configure the JProfiler session up to this point, you will see the "Session Startup" window asking you to further edit start up attributes of the session.


Step 5: As the final step, run the desired Carbon server which has already been configured to be monitored and click on the "OK" button of the "Session Startup" window.



Now you should be able to successfully run the profiler session for your carbon product. :)

Saturday, November 27, 2010

Building WSO2 Carbon..

What is WSO2 Carbon?
Carbon is a modular platform built upon OSGi techonogy which is the base for each of the products of WSO2.

In this post, I'd like to discuss the methodology that requires to build wso2 carbon on your Ubuntu installed machine and a couple of tips to make the building and troubleshooting processes easy.

Intended platform :
Ubuntu

Check whether you've got the stuff :
Before you start the proceedings, you need to have some SVN client installed in your machine. I prefer subversion which you can download either by visiting their official site or using the following command on your console.


During this process it is intended to use Apache Maven as the build tool and you can download the latest distribution from the Maven site.

NOTE: Make sure you properly set up the environment for Maven before moving forward with the rest of the phases of this process.

Checking out the source code :
After you successfully installed subversion client you can checkout the source code of WSO2 carbon to the desired location of your machine using the following command.


Everything is ready??? Double check.. :)
If you have successfully checked out the source code from the wso2 repositary, you should be able to observe the following directory structure corresponds to the location to which you have checked out the source code in your machine.


Be careful.. :
When you go on with the task, you need to be mindful of the sequence which is required to follow while building WSO2 Carbon.

dependencies -> orbit -> core -> componenets -> features -> products

It is a must that you follow the aforementioned build sequence to ensure Carbon is built properly at the end of this process.

Let's build it :
Go to the desired directory from the console and use the following command to build the contents inside that particular directory.


Additionally, you can use the following set of commands to make the process much simpler depending upon the requirements

(i) To build Carbon in Offline mode:


(ii) To avoid building tests:


(iii) To carry out the build for only one product:


(iv)To make the process faster by introducing more threads to work on it:

NOTE: This is efficient when you do the build in Offline mode

At the end of the aforementioned process, you should be able to successfully build carbon.

If you encounter some error,
Step 1: Try taking a "svn update" from the repository and building it again.

Step 2: If that does not seem to work, drop a mail to carbon-dev@wso2.com to get support from the devs.