Title: Gnutella [The routing protocol for sharing data among peers]
1GnutellaThe routing protocol for sharing data
among peers
- By -
- Pallav Paliwal 11185
- Vikas Chauhan 11044
2Motivation
- According to ivkovic reserch paper on P2P
applications. - It is said that P2P file sharing holds great
potential for the future. In addition, P2P
networking could change the structure of the
Internet from the web-centric to the purely
distributed data model by allowing users that are
accessing data from a particular web site to
retrieve the cached copy - of the data from a geographically closest
point to their location.
3Motivation
- Working on this had definitely helped us in
enhancing and given us the opportunity to learn
the new concept . - Gnutella is very hot topic in current RD world,
as many giants like Intel and Microsoft are
working together on it.
4Data Sharing Scenario-
Traditional Approach
- Client Server Architecture
- Data is shared between two computers by
Installing the special server - where client make
the request and the server processes the
requests. - Goal High availability for Reads and Writes.
-
- Challenges
- Malfunctioning of server-Shut downs
- cost involved in installing the
specialized servers
5Data sharing scenario-P2P
- Peer to Peer Architecture
- Peer to peer networks allows computers to
communicate directly with each other and to
share data among them. - Cost effective
- No need for specialized server
- Flexible-
6Data sharing scenario P2P
- Nodes have awareness of other nodes.
- Peers create a virtual network .
- Each node can both act as client and server.
- Clients can leave or join the network any time
without interrupting the overall functionality of
the network. - Over all performance of system increases as more
nodes are added to network.
7Peer to Peer Architecture
- No central Administration
- Direct Communications
- Distributed resources with different owners
-gtsites are autonomous. - In General each peer has less resources then
the server in the traditional Client-Server
Model.
8Types of P2P Architecture
- When it comes to P2P - 2 types
-
- - Centralized P2P Model
- - Decentralized P2P Model
9Centralized P2P Model
- Used by well known applications like Nepster .
- - Nepster as a service allows the users to
list the MP3 encoded music files they want to
share. - - Other users can download them through
Nepster.
10Centralized P2P Model
- Required
- - Network infrastructure of servers.
- - Data storage.
- - corresponding bandwidth for allowing the large
no. of user connections.
11Centralized Server P2P
Join
Central Index
Get
Answer
File
Query
12Centralized P2P Model
Search Response
With user2 information
File download
Server
User 2
User 1
Search Query
- uses central server Directs traffic among
users. - Maintains directories of data shared by the
users.
13Centralized P2P Model
- Server allows query of their databases.
- Allows user to connect the other user who
- is actually sharing the file.
- Typically the connection is made by using the
HTTP request response mechanism. - Actual transfer of data is done by users not by
the server.
14Advantages of centralized P2P
- The existence of a central index that allows
users to search and find the desired files
efficiently. - The mandatory registration of all users of the
system. - Query reaches all users currently connected to
the network.
15Key Disadvantages- centralized P2P
- The single entry point
- possibility of the entire network becoming
incapacitated if main entry point is disabled
(e.g., Napsters failure). - The invalid data in the database resulting from
the - periodical, not real time, refreshes of the data
in the database.
16Solution Decentralized P2P
- Multiple points of entry in the distributed
model. - No fear of failure of the system.
- Lack of registration in the decentralized
network. - Decreasing the breadth of data being queried.
17What is Gnutella
- Gnutella is a decentralized P2P file-sharing
model. - Gnutella is simply is a routing protocol-
- To share files on the Gnutella Network among
peers in a Decentralized network environment.
18Servent A
Search Query
Search response With servent Fs info
File Download
Servent B
Search response having Fs info
Search query
Search query
Search query
Servent F
Servent E
Servent D
Servent c
19Gnutella Working
- User starts with a networked computer that runs
one of the Gnutella clients. - (Node A for example).
- This node will work both as a server and a
client. - Generally referred to as a (Gnutella) servant
(both a Server and a client).
20What is Gnutella
- Connect to another Gnutella-enabled networked
computer- - Node B for example.
- A will announce existence to B.
- Node B will in turn announce to all its
neighboring nodes. (nodes C, D, E, and F for
example) - A is alive , pattern will continue recursively.
21Gnutella Working
- Once the node A has announced its existence to
the rest of the network - user at this node can now query the
- contents of the data shared across the
network. - This announcement broadcasting ends -
22Gnutella Working
- when the Time- To-Live (TTL) packet information
expires. - At each level the TTL counter will be decreased
by one from some initial value until it reaches
zero .its broadcasting will stop. - TTL is generally initialized by users.
- To prevent users from setting this initial TTL
value too high, the majority of the Gnutella
servents will refuse packets with excessively
high TTL value.
23Gnutella- TTL (A closer look)
- TTL Time to live, as in TCP/IP.
- Signifies how much time the broadcasting of
- a message will occur.
- Value should neither very low nor very high.
- Servents should carefully scrutinize the TTL
field of received descriptors and lower them as
necessary. - Abuse of the TTL field will lead to an
unnecessary amount of network traffic and poor
network performance.
24Gnutella TTL (A closer look)
- Low TTL means minimizing the usage of the network
resources. - High TTL value means maximizing the QoS provided
to the users of the network. - The optimal TTL value would then (among others)
depend on the network topology and traffic
characteristics for a particular location and a
particular time of the day.
25Gnutella Protocol Specifications
- All Gnutella communication happens on top of the
TCP/IP protocol. - Once a TCP/IP connection is established between
two servents . - Servents send Gnutella connection string
GNUTELLA CONNECT/ltprotocol version
stringgt\n\n. - The servent respond with respond with a GNUTELLA
OK\n\n message.
26Gnutella Protocol Specifications
- Any other response to the original connection
string -taken as a communication-rejection by the
initiator servent. - After a connection is established- Two servents
- communicate by exchanging Gnutella protocol
descriptors. - Gnutella protocol also defines the rules for how
these descriptors are exchanged between nodes.
27Gnutella Descriptors
- Ping
- Used to actively discover hosts on the
network. - Servent receiving a Ping descriptor is
expected to respond with one or more Pong
descriptors. - Pong
- The response to a Ping. Includes the
address of a connected Gnutella servent. - Information regarding the among of data it
is making available to the network. - Query
- The primary mechanism for searching the
distributed network. - A servent receiving a Query descriptor will
respond with a QueryHit if a match is found
against its local data set.
28Gnutella Descriptors
- Query hit
- The response to a Query, descriptor provides
- Recipient with enough information to acquire
the data matching the corresponding Query - Push
- A mechanism that allows a fire walled servent
to contribute file-based data to the network.
29Gnutella-Design
- The design consists of design of classes in the
JAVA Environment. - Why Java?
- -Good support for the Distributed Environment.
- -Socket programming is easy using java then in
Unix. - -Object oriented Structure
- -Reuse
- -The concepts of Java Beans etc make the code
more portable.
30Gnutella-Design
- There will be 4 main Classes
- 1.Node
- For adding the node to Gnutella Network
- 2.MonitorExample
- For Monitoring the network like making
connection exchanging the headers ping ,pong etc. - 3.FileServerExample
- This is like the network share directory.
- 4.SearchExample
- For actually running the queries and queryhit if
some match is found over the network.
31public class Node private GNUTellaConnection
conn / Constructs the example given a
started network connection / public
Node(GNUTellaConnection networkConnection)
this.conn networkConnection /
Main entrypoint for the example /
public static void main(String args)
System.out.println("lt--- Node running ---gt")
if ( args.length ! 1 )
System.out.println("Usage Node inputport")
System.exit(1)
32try ConnectionData connectionData
new ConnectionData() connectionData.setInco
mingPort(Integer.decode(args0).intValue())
connectionData.setOutgoingConnectionCount(0)
connectionData.setIncommingConnectionCount(2)
GNUTellaConnection c new
GNUTellaConnection(connectionData)
c.start() catch (Exception e)
e.printStackTrace()
33 class for showing how to monitor search queries
on the GNUTella network . The application
expects two command ine parameters, the host
name, and the port the servant is listening on
public class MonitorExample private
GNUTellaConnection conn / Constructs
the example given a started network connection
/ public MonitorExample(GNUTellaConnection
networkConnection) this.conn
networkConnection / Main
entrypoint for the example /
34public static void main(String args)
System.out.println("lt--- MonitorExample running
---gt\n") if (args.length ! 2)
System.out.println("Usage MonitorExample host
port") System.exit(1) try
System.out.println("Connecting to
Gnutella Network...")
//------------------------------------------------
------------- // Start a network connection
and listen for succesful connection
//------------------------------------------------
------------- GNUTellaConnection c new
GNUTellaConnection(args0,
Integer.decode(args1).intValue())
c.getSearchMonitorSession(new
TestReceiver()) c.start()
System.out.println("connected")
35class for showing how to execute search queries
on the GNUTella network . The application
expects two command line parameters, the host
name, and the port the servant is listening on
public class SearchExample private
GNUTellaConnection conn /
Constructs the example given a started network
connection / public SearchExample(GNUTe
llaConnection networkConnection)
this.conn networkConnection
36try System.out.println("Connecting to
Gnutella Network...")
//------------------------------------------------
------------- // Start a network
connection, wait, then execute searches //
A proper application would check if Node
connections // exist prior to searching
//----------------------------------------------
--------------- GNUTellaConnection c new
GNUTellaConnection(args0,
Integer.decode(args1).intValue())
c.start()
37System.out.println("Sending search requests")
SearchSession search1 c.createSearchSession("
vikas.txt",
100,
0,
new
TestReceiver()) SearchSession search2
c.createSearchSession("atul",
100,
0,
new TestReceiver()) SearchSession search3
c.createSearchSession("pali",
100,
0,
new TestReceiver())
catch
(Exception e) e.printStackTrace()
38Gnutella-Design
- The basic functionality of the Gnutella works on
the top of TCP/IP and the BootStrapping. - The boot strapping is the process in which we
refer to GWebCache for the list of known hosts
which are connected to Gnutella Network at that
point of time. - These web caches are maintained over the Gnutella
Supporting Societies like www.Gnutella.org - Here we have to first fetch the list of known
Gnutella servants then connect to network at a
point like the address of known Gnutella Host. - Then node class is run for declaring the
existence of the node over the network.
39Gnutella-Design
- Node class will take the port on which the node
is listening the default port for Gnutella is
6346 or 6347. - once the existence is declared the class
MonitorExample is run with the ip address and
port as the command line input. - This is the class where all the basics of
connection making etc are done through the
package proj.vikas.gnutella.
40Gnutella-process model
41Gnutella-Design
- The various classes are used from this package
which represents the inheritance in the object
oriented model - These are like connection class,connection
data,ping,pong all the classes are made for
modularity and ease for change in future.
42Gnutella Design-DFD
Node
Existing Gnutella Network
IP/Port
Web Cache
Host
Remote Host IP/Port
Ping
Add to list
User1
User2
Host Alive
Pong
43Gnutella Design-DFD
True/false
File Server
Search
Query Hit
Keywords
Hash Table
User2
Download
User1
Connection data
IP/Port user2
44Gnutella-Future
- We have designed the Gnutella Servant but
peculiarity is that the functionality of the
servant will depend over the various factors like
Firewall, Proxies, GWebCache avilability moreover
more emphasis on the social acceptance. - More research is can to be done on the field of
security ,authentication and the trust.
45References Used
- A. Ghosh, M. Fry, J. Crowcroft An architecture
for application layer routing, Active Networks. - Reserch paper on Peer-to-Peer Data Sharing Among
LabVIEW Nodes. - By Sadia Malik.
- WWW.aduni.org/courses.
- http//www.rixsoft.com/Knowbuddy/gnutellafaq.html.
46references used
- Unix Network Programming
- Networking API Sockets and XTI.
- By W.Richard Stevens.
- volume 1,Second Edition.
47 Ongoing research Proposals
- Security in Peer to Peer Networks.
- Protocol Enhancement Ideas.
- -Authentication and trust.
- -Using UDP instead of TCP/IP.
- Gnutella Protocol Enhancements and security
issues in the decentralized networks.
48Thank you