Wednesday, December 9, 2009

128-bit node id space in p2p systems

DHT based p2p systems are designed based on 128 bit(sometimes more bits) length unique hash value as the node id. There are several ways this can be done and this should be done. It depends on the way that the system need to be performed in message routing. For an example one may need to route messages anonymously to all the nodes in the ring(DHT based nodes are normally organized to a ring of nodes). But another may need to rout a message to some particular node. So there are several scenarios to be considered when deciding which way to use in order generate node ids. Most popular ways of generating node ids are using the peer's IP or its public key. Some system uses randomly generated 128 bit hash as the node id.

However in my research work I wanted to generate a nodeId based on not neither the IP nor the Public key of the node but using some unique key/number given or that can be used to identified the node. For an example the mobile number of a mobile device(phone, PDA, iPhone, etc) which represents a peer in a p2p network. Since I am using Freepastry API this capability is not provided directly. But extending its NodeIdFactory class this can be done easily. Its quite simple. :)

Friday, November 20, 2009

Finally my freepastry nodes are working

In past few weeks I have been working with Freepastry in order to implement a p2p substrate. Freepastry is the java implementation of pastry algorithm based on DHT. But I was very unhappy in this case that the Pastry nodes implemented in different machines were not communicating. More technically bootstrap node is not identified by the lately come nodes and hence the nodes are not organizing into a ring. But while running on same JVM it works well. Btw finally I could able to make it worked. i.e nodes are now joining to pastry ring and communicating residing even in different machines also.
Initially It was not working because of that I had forget to implement one code line that perform the call to register() method of endpoint reference object.

Not only that. There are some other points also that I found and which was not mentioned in freepastry tutorial.
1) For the Bootstrap node bootAdress(InetAdrress) should be the real Ip( or the domain name also could be worked but I didn't check ) of the machine and the boot port and bind port should be equal.
e.g
int bindport = Integer.parseInt(args[0]);
InetAdress bootaddr = InetAddress.getByName(args[1]);
int bootport = Integer.parseInt(args[2]);
..............
............
node.boot(bootaddress);

Note that here if you start new node as the bootstrap(parent) node then you should pass local IP or domain name of local maching as as the bootaddr and same port number for both bindport and bootport.
So if the ip of the local machin is 192.168.1.100 then your command line arguments should be like
$java [-options] class 9001 192.168.1.100 9001

2) In FreePastry Application class (in this example MyApp) where we normally initiate the reference for Endpoint, dont forget to call register() method.


import rice.p2p.commonapi.Application;
import rice.p2p.commonapi.Endpoint;
import rice.p2p.commonapi.Id;
import rice.p2p.commonapi.Message;
import rice.p2p.commonapi.Node;
import rice.p2p.commonapi.NodeHandle;
import rice.p2p.commonapi.RouteMessage;


public class MyApp implements Application {

protected Endpoint endpoint;

public MyyApp(Node node) {

this.endpoint = node.buildEndpoint(this, "myinstance");

this.endpoint.register();
}

//some codes go here
................
..................
}

Therefore the Warning is...
If somebody wish to implement freepastry and forget to call this register() method your other pastry nodes who are waiting to receive messages from the first node wont receive pastry messages.

Monday, November 16, 2009

Changing default java setting on ubuntu

By default ubuntu comes with default GCJ flavor of Java which sometimes gives trouble when working in console to compile and run java programs. I recently faced to this problem. So here I thought to write how to change the default java setting on ubuntu.

Nothing much. we only need to change two things in advance that is java and javac command.

To choose Java
Just installing new Java flavours does not change the default Java pointed to by /usr/bin/java. You must explicitly set this:

$ sudo update-java-alternatives -l to see the current configuration and possibilities.

$sudo update-java-alternatives -s XXXX to set the XXX java version as default. For Sun Java 6 this would be sudo update-java-alternatives -s java-6-sun

Run java -version to ensure that the correct version is being called.

Alternative way

$sudo update-alternatives --config java

Although the above changes are done the system may still refer to old 'javac' setting.

To choose javac

To check which javac is fired when type javac -version use

$which javac

/usr/bin/javac

To check this javac is a real program or a symlink
$
ls -al /usr/bin/javac
lrwxrwxrwx 1 root root 23 2009-07-29 19:42 /usr/bin/javac -> /etc/alternatives/javac

It is a symlink. follow the same command again.
$ls -al
/etc/alternatives/javac

lrwxrwxrwx 1 root root 42 2009-11-16 14:59 /etc/alternatives/javac -> /usr/lib/jvm/java-gcj/bin/javac

So probably the /etc/alternatives/javac link will point to the not desired javac. Change it (as root) using:

$ln -sf /etc/alternatives/javac

Friday, October 23, 2009

Fine example to explain a Mutex and Threads

For what purpose we can use rubber chicken. Different people would use for different purpose.
I found this example while 'google'ing.

[When I am having a big heated discussion at work, I use a rubber chicken which I keep in my desk for just such occassions. The person holding the chicken is the only person who is allowed to talk. If you don't hold the chicken you cannot speak. You can only indicate that you want the chicken and wait until you get it before you speak. Once you have finished speaking, you can hand the chicken back to the moderator who will hand it to the next person to speak. This ensures that people do not speak over each other, and also have their own space to talk.

Replace Chicken with Mutex and person with thread and you basically have the concept of a mutex.]


Wednesday, October 14, 2009

Advanced Collaboration Grids

Grid computing technologies enable wide-spread sharing and coordinated use of network resources. Among the number of types of grids collaboration grid takes a significant attention from the researchers and communities. But so far collaboration has not been used in a consistence fashion by different communities. Hence identifying the issues related to grid collaboration and finding some open standard approaches to overcome these obstacles is much needed. These approaches can be different from each. But what important is that these approaches should follow open standards that can be agreed and used by every interested parties. Taking this matter into account I thought to open this tread to address the above matters.

Collaboration become regular and important in the grid paradigm. But so far collaboration has not been used in a consistence fashion by different communities for many reasons. Hence Identifying the related issues with the collaboration has become one of major concern among research communities for last couple of year. The challenge is to finding an open standard that can be agreed by every communities.

A grid is basically built on services. In other words a grid is a better example for Service Oriented Architecture(SOA). These services are at each separate layers in the grid architecture according to their functionality. Approaching to the concept of collaboration in the current grid services hierarchy collaboration can also be identified to a set of services. Therefore implementing a service based middleware to handle the the concurrent events coming from grid participants is quite natural. The same kind of implementation has been done by Indiana university but again its a shared event model using common message broker. They have proved the concept instantiating that model that enable working concurrently on a single OpenOffice files by many peers from any corner of the world. But the problem I see in this is the solution is application specific and so no common interface provided that can be used commonly. Therefore I believe that extending this concept to model a Service Based middleware instead of it's shared event based model that would be a more flexible in general.

Thursday, October 8, 2009

Dcache/Delasa Nominates for the e-Swabhimani award !

It is a great pleasure for me write it here that the project we have been working on at the LSF has been shortlisted for the national award of e-Swabhimani Awards 2009 under e-science and technology category. Even whether we would receive the award or not Dcache/Delase will remains as the first distributed web cache implemented so for. This was a team effort. I thankful all the members worked to take the project this far, specially Dr.sanjiva-adviser, wathsala-lead, nishshanka-se and shehani-pm.

Summing up the last 9 moths spent on this it was a great experience specially in implementing a research idea. It has a lot of varieties in terms of many common working experiences we meet in the commercial software development environment. As every elements in the world, these two environments also have good and bad. But I would rather satisfy by working in a environment like LSF, doing research. It catered me the freedom most importantly, let myself to be enjoyed of the work done, no QA team to reports bug :), also it keeps me on the study track.

Finally we believe that Dcache will be smart enough and beautiful to win the award. So that we would future treat to take her to a another level.

Friday, September 18, 2009

FOSS-ed 2009 -Trinco

I had a great time being as a FOSS advocator at FOSS-ed conference which was another FOSS event held in Trinco in last week. we were a 8 man team who came from various institutes and companies as FOSS advocators.
This was not the first time that i had been to Trinco. I had my first visit to Trico in 2004 when Tsunami came. The purpose of that journey was to provide water with IDPs.
Now when I look at these two visits, the objective of both visits was to help people. This time I spent a great couple of days at Trinco. I could able to be relaxed myself and felt the freedom of the life itself.


The people who had come to the event and the organizers of the event welcomed us at a great deal. This was a good example to how it is easy to live for northern and southern people in Sri Lanka in peace. Mindset is the most important factor for being good or bad. What I felt was the war is just a creation of group of people(what ever they are defined to be like). Even though I come up with lot of unorganized ideas about the conflict had I am not going to write those in here as its now over. This is ABOUT FOSS. Completely different from a war. :)



The two days conference and training session held at Northern governor office at Trinco. All the people who had participated for the event were public workers and they had several levels in IT knowledge but each had good enough knowledge at their levels rather I expected. So it was easy for us give to introduce FOSS and things and gave some practical session with the FOSS applications. Even the term FOSS was totally a new experience for them I hope we could able to convice them a lot about the context in it.