Not Really a Blog

March 9, 2006

Chord

Filed under: Internet, Programming, Sussex University — Tags: , — jesus @ 18:01

As part of another assignment for the Distributed System course at the University of Sussex we have been doing some research on Chord, a distributed hash lookup primitive, and, in the end, implement part of what is called a chord ring in java.

The idea behind Chord is a research paper in which a distributed protocol for adding nodes to the system, insert data into it, retreive it and drop from the system is described. The way in which nodes lookups and inserts are done is O(log n), so it’s quite efficient. Chord could be look as a layer over which p2p-like applications could be built. One example of this is CFS, the Cooperative File System, a distributed read-only file system.

What we had to do is, basically, implement a simple Ring protocol and a Chord protocol:

  • Ring protocol: Each node in the system has a pointer to the next one in the ring, so, for instance, if any node wants to do a lookup on some data, it would ask the next one in the ring. If such node does not have it, it would forward that question to the next node in the ring and so forth. This would be O(n)
  • Chord Protocol: In this version of the protocol, each node not only has a pointer to the next node in the ring, but it also has a pointer to a number of other nodes, not necessarily in a row, so when any node wants to do a lookup, depending on a hash function and the list of pointers to other nodes, it would forward the question to a closer node, where the information is more likely to be stored. This is the way we get a O(log n) algorithm. In fact, there is more than this going on, so I recommend you to have a look at the chord paper again if you are interested.

So, all we had to do is implement both protocols in java and run it in a
simulator, as implementing a working solution was too much for an university assignment due in two weeks.

What happens is that using the simulator and programming the whole thing is harder than it sounds, as the simulator itself is lacking some good documentation and have some bugs. In any case, doing it has been fun and interesting as well, as it has let me understand how a distributed system, such as a p2p system, works. So, I recommend anyone interested to have a look at how the protocol works (ie, by reading the Chord paper ;) )

The idea behind Chord is a research paper in which a distributed protocol for adding nodes to the system, insert data into it, retreive it and drop from the system is described. The way in which nodes lookups and inserts are done is O(log n), so it’s quite efficient. Chord could be look as a layer over which p2p-like applications could be built. One example of this is CFS, the Cooperative File System, a distributed read-only file system.

What we had to do is, basically, implement a simple Ring protocol and a Chord protocol:

  • Ring protocol: Each node in the system has a pointer to the next one in the ring, so, for instance, if any node wants to do a lookup on some data, it would ask the next one in the ring. If such node does not have it, it would forward that question to the next node in the ring and so forth. This would be O(n)
  • Chord Protocol: In this version of the protocol, each node not only has a pointer to the next node in the ring, but it also has a pointer to a number of other nodes, not necessarily in a row, so when any node wants to do a lookup, depending on a hash function and the list of pointers to other nodes, it would forward the question to a closer node, where the information is more likely to be stored. This is the way we get a O(log n) algorithm. In fact, there is more than this going on, so I recommend you to have a look at the chord paper again if you are interested.

So, all we had to do is implement both protocols in java and run it in a
simulator, as implementing a working solution was too much for an university assignment due in two weeks.

What happens is that using the simulator and programming the whole thing is harder than it sounds, as the simulator itself is lacking some good documentation and have some bugs. In any case, doing it has been fun and interesting as well, as it has let me understand how a distributed system, such as a p2p system, works. So, I recommend anyone interested to have a look at how the protocol works (ie, by reading the Chord paper ;) )

 

February 5, 2006

FON, google and Skype

Filed under: Internet, Sussex University — Tags: , , — jesus @ 23:34

So, they did it

Fon has just announced it would get 21.5 million dollars from Google, Skype, and Sequoia Capital. Something I already talked about a couple of days ago.

Amazing. Just waiting for comments right now!.

January 29, 2006

About FON

Filed under: Internet, Random, Sussex University — Tags: , — jesus @ 21:00

As part of my studies in my e-business
course at the University of Sussex, I have been asked to write a report of a company that is somehow involved with e-business (e-commerce, use of technology to become more profitable or efficient, etc.).

So, I have decided that I am going to do some research on FON, a company created by Martin Varsavsky who is famous for founding Jazztel and Ya.com, one of the biggest phone companies and ISP in Spain.

FON idea is to profit from creating a network of wireless users around the world, called the p2p of wifi.

My task is, first of all, writing a background briefing report about the company, and afterwards an investment recomendation based on my research and study of the subject.

I chose this company because I have a friend who is working there and because I think it is interesting to see if FON’s business model is profitable or not. By the way, I have no access to internal sources as Teo (hi Teo!!) is quite secretive about it (I think because of NDAs).
Anyway, I’ll post more about it in the near future, I guess. Stay tuned.

January 28, 2006

On Distributed Computing using RMI

Filed under: Programming, Sussex University — Tags: , — jesus @ 17:40

Ok, so I have this assignment in one of my courses at the University of Sussex, Distributed Systems. The thing is that we need to implement a distributed event notification system, in which clients subscribe themselves to the server to which some event generators sends their events.

All of this, using RMI (Remote Method Invocation) in Java.

The assignment is an introduction to distributed objects in java by implementing this little system. In it, each Event Generator, sends events to the server, made of an identification string and a message (in fact, it could be any kind of object).

On the other hand, the server get subscriptions of clients. These send the server a regular expression and a timeout, each of which would be used to choose among the different events received and to set a maximu time in which the subscription is valid. When doing so, the server sets up a callback function to the clients so, when a matching event is received, the server has a way to send the clients the object (event). I think it can be better understood by looking at the graph above.

So far, it’s been quite interesting to learn this kind of distributed framework, although java is not my kind of language. I want to do some more researh on how to do this kind of things with other languages like ruby o r python. Seems to me interesting.

Here is a little bit of the code used, just for curiosity:

public static void main(String[] args) {
	if (System.getSecurityManager() == null) {
	System.setSecurityManager(new RMISecurityManager());
	}
	try {
		EventNotificationServer server = new EventNotificationServerImpl();
		String hostName = InetAddress.getLocalHost().getHostName();
		Naming.rebind("//" + hostName + "/"
				+ EventNotificationServer.rmiName, server);
		System.out.println("EventNotificationServerImpl bound to "
				+ hostName);

	} catch (Exception e) {
		System.err.println("EventNotificationServerImpl exception: "
				+ e.getMessage());
		e.printStackTrace();
	}

}

The assignment is an introduction to distributed objects in java by implementing this little system. In it, each Event Generator, sends events to the server, made of an identification string and a message (in fact, it could be any kind of object).

On the other hand, the server get subscriptions of clients. These send the server a regular expression and a timeout, each of which would be used to choose among the different events received and to set a maximum time in which the subscription is valid. When doing so, the server sets up a callback function to the clients so, when a matching event is received, the server has a way to send the clients the object (event). I think it can be better understood by looking at the graph above.

So far, it’s been quite interesting to learn this kind of distributed framework, although java is not my kind of language. I want to do some more researh on how to do this kind of things with other languages like ruby o r python. Seems to me interesting.

Here is a little bit of the code used, just for curiosity:

public static void main(String[] args) {
    if (System.getSecurityManager() == null) {
    System.setSecurityManager(new RMISecurityManager());
    }
    try {
        EventNotificationServer server = new EventNotificationServerImpl();
        String hostName = InetAddress.getLocalHost().getHostName();
        Naming.rebind("//" + hostName + "/"
                + EventNotificationServer.rmiName, server);
        System.out.println("EventNotificationServerImpl bound to "
                + hostName);

    } catch (Exception e) {
        System.err.println("EventNotificationServerImpl exception: "
                + e.getMessage());
        e.printStackTrace();
    }
}

Customized Shocking Blue Green Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 2,886 other followers