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.
int bindport = Integer.parseInt(args[0]);
InetAdress bootaddr = InetAddress.getByName(args[1]);
int bootport = Integer.parseInt(args[2]);

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 then your command line arguments should be like
$java [-options] class 9001 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");


//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


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

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.

Sunday, August 23, 2009

The best programing language to start with

There are several leading programing languages(C, C++, C#, .Net, Visual Basic, Java, Ruby, HP, Perl, Python and more) that various programmers from various institutions are interested of writing programs. The choice of a programing language depends upon the requirement. But as a beginner to programing there are some important factors to be considered.

I started with java. It went good but now I believe that it would be better If I could start with C. I would not say that java as the first programing language is totally a bad choice. Its not a bad choice actually. In fact many people recommend it. But I think object orientation is not good design methodology for beginers because java is too far from machine. In other words Java is very high level language. Unless somebody know C or assembler it is difficult to understand what the java interpreter doing.

So I believe that C is the language to start with. Although no one can really suggest you a programing language, starting with C lead to lay a strong foundation to become a better programmer. The choice can be convinced. C has both high-level and low-level features and function-oriented approach. It is simple(somewhat tricky though) to learn and forms the base from which you can jump to any other language. Also C is high speed and versatility language. Not only those, the fact that many of the languages that have been developed during the following decades derive syntax of C. And C is not going to be a dead language as it is still being used widely and the demand for C is also at a higher position around the world. This is not just only my openion. Google for it and try to find the facts behind this in more details.

Thursday, July 30, 2009

P2P Instance Messaging - Dalesa-Sallapa was born at LSF

At LSF I could able to develop a zeroconf Instance Messagin(IM) platform (we named it with the sinhala term "Sallapa" which gives the meaning of "chat"). This attempt was initiated as a requirement by ICTA who funded us. ICTA wanted to give the chatting facility to the peers which runs Dalesa. Therefore since Dalesa is a Peer-To-Peer(P2P) overlay this IM platform also should have been configured according P2P manner. Hence the Sallapa was needed to implement as a zeroconf IM which works in P2P manner. So Sallapa assures the concept of decentralization which we believe and work on at LSF.

Sallapa has designed and developed as a pidgin plugging. One could ask the question why Sallapa was born as a pidgin plugging. We basically did not want to implement all the GUI things that is needed to a IM client. Other reasons are those pidgin is open source and it provides a complete and clear API and docs to its plugging architecture.

Ok now I want to talk about how Sallapa works. Once you install Sallapa It appears as a new IM communication protocol like Yahoo IM, Google Talk in pidgin. Then you can create new pidgin login account to Sallapa. Now if you are running Dalesa on you computer you are getting signed-in to you newly created Sallapa account and list all the other peers in your network who running Dalesa and logged into their Sallapa.

Does Sallapa run on top of Dalesa?
No, not like that actually. Architecturally Sallapa does not run on Dalesa. Dalesa is a P2P overlay which is to run on and hide the IP layer. Sallapa is also running on IP layer. So if someone got to think as Sallapa is running on Dalesa then that is meaningless. But Sallapa and Dalesa has integrated by IPC module which is used to check the status of Dalesa from Sallapa. That is the only link that Dalesa and Sallapa are in.

How Sallapa works Technically?
Sallapa uses MDNS to publish its presence in the network. In linux like environments Sallapa uses Avahi to do this. But in win32 like environments it uses separate MDNS implementation developed for win32.
Once Sallapa published the presence of a peer in the network others peers are callbacked by MDNS-SD(MDNS-Service Discovery) running in them and updated their buddy list accordingly. Now at the moment Sallapa uses Bonjour as the communication protocol to exchange messages.

Wednesday, May 27, 2009

web caching on P2P overlay + mesh networking

Mesh networking has recently become popular in deploying wireless networks.
Similarly with the growth of internet browsing, implementation of a P2P overlay for web caching has identified as a major requirement to reduce the latency of the web content delivery and the network bandwidth. So emerging these two concepts together facilitates to overcome underline issues and deliver advantages to all the stake holders in the phenomena.

Currently we are at LSF developing a set of software components to address the issues mentioned above. The idea is a p2p overlay to cache the web contents. Basically the system consists of two main components(layers) that are the P2P multicasting layer and the caching proxy. These two layers have integrated in a way so that each node in the p2p overlay cache the possible web content it brows. Later when some other node requests for a particular url, which has already been visited from a node in the group previously, is then served from the cache instead of going to the actual location of the resource. This obviously cut off the latency and the bandwidth. We basically have developed this to run on top of a mesh network which contains less number of peer nodes(not hundreds of) runing on both UNIX and Win distributions.

Tuesday, April 28, 2009