main projec

33

Transcript of main projec

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 1/33

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 2/33

Under the Guidance of Mr. MV.Rajesh

Scheduling algorithms for file distribution

in p2p networks

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 3/33

Objective:

The main objective of our project is to simulate andimplement the algorithms for peer to peer networks.

Scheduling algorithms for file

distribution in peer-to-peer networks

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 4/33

Existing system:

Traditional methods for e-sharing, such as the client/server approach (e.g.

FTP, WWW), suffer from scalability bottleneck.

And also the performance of client/server approach deteriorates rapidly as

the number of simultaneous clients increases.

In existing system, peer to peer networks are available, but scheduling

algorithms are not available .

Eg: bit torrent.

Disadvantages:

1.Scalability: cannot be used by several users at a time.2.If no of clients increases, then the effective bandwidth with which the

client downloads the file decreases.

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 5/33

Proposed system:In our proposed system we simulate two algorithms to distribute the file

among the clients.We distribute the file pieces to each and every node and we assign the

priority based on the performance of the algorithms.P2P¿le sharing solves the problem by allowing peers to act as servers.

Advantages:

In our proposed system , scalability bottleneck problem is avoided.

Bandwidth problem is also avoided.

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 6/33

We are implementing the optimal scheduling

algorithm for data distribution among peers in P2P

network.

The algorithms we are comparing are :

Rarest Piece First (RPF)

Most Demanding Node First (MDNF)

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 7/33

SYSTEM REQUIREMENTS:

Hardware requirements:

processor : Intel Pentium Processor (P-IV).

Speed : 1.8GHz

Hard disk : 128MB free space on our hard disk.

Physical memory : 128MB

Software requirements:

Programming language : Java 1.6Operating system : Windows 98

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 8/33

Functional requirements:

Inputs:N×M matrix is given as input.

The type of algorithm to be performed is chosen.

Peer number to be given for file distribution.

Processing:

Mainly two algorithms such as, Rarest first piece, Most-demandingnode first algorithm are compared by using various mathematical

formulas.

Outputs:

The total number of cycles taken for file to be downloaded to the

given peer and the total number of cycles taken to perform filedistribution to all peers.

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 9/33

Example :consider the following example

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 10/33

Par ameter s:

peerNum = Number assigned to the peer

N = Total no. of peers in the network

M = Total no. of file pieces

Pk = Possession matrix at kth cycle

Sk = Schedule matrix at kth cycle

Tk = Transmission matrix at kth cycle

UC = Upload capacity matrix of all the peers

DC = Download capacity matrix of all the peers

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 11/33

Possession Matr ix:

Contains information about which peer has which piece of file at

that stage.

Schedule Matr ix:

Contains information about which file pieces will be received by

peer from which peer.

Tr ansmission Matr ix:Contains information about which file pieces were received by

the

peer in this cycle.

Pij = 1 if ith peer has jth file pieceelse 0

Sij= n if ith peer gets jth file piecefrom nth peer

else 0

Tij= 1 if Sij != 0else 0

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 12/33

Rarest Piece First (RPF) Algorithm:

In RPF, those file pieces that most peers do not have (rarest) are

distributed first.

Definition 1: The rarity cj of Piece j is the number of peers

who have Piece j. That is,

1.RPF aims at increasing the availability of different file

pieces in the network.

2.RPF also tries to distribute all pieces from the original source

to different peers across the network as quickly as possible, sothat the distribution can continue even if the original source

leaves.

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 13/33

RPF r uns as f ollows:

Initially we are having the matrix as follows:

After the file pieces are sent to the nodes. The matrix was

transformed as Follows:

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 14/33

Most Demanding Node First (MDNF)

y This algorithm concentrates on the peerselection strategy.

y It identifies the peers with most missing pieces

and tries to fulfill its demands first.y In this algorithm ,we consider the peer with the

highest demand and when ever a peer withhighest demand is satisfied ,the available copy 

of those pieces is increased by one.

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 15/33

The number of cycles needed depends on two factors:

1.how many pieces a peer needs and

2.how rare a file piece is.

Definition 2: The demand di of Node i is the number of 

un-received pieces for Node i. That is

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 16/33

The matrix that was obtained based on the demands was as

follows:

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 17/33

Most Demanding Node First

(MDNF)

y Demand d i of node i is the no. of un-received pieces fornode i, i.e.

y W hen choosing recipients, prefer sending to the node

with largestd 

i

§!

!M 

1j 

ij i  P 1d 

MDNF ± Node-Oriented: ( ={ , , , , }, q={ ,3, ,3,3})

¹¹¹¹

º

¸

©©©©

ª

¨

!

11000010

10100101

11010010

00001001

00000101

P0

¹¹¹¹

º

¸

©©©©

ª

¨

!

11100010

11100111

11010010

00111101

00011101

P1

6

6

4

4

5

«

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 18/33

Maximum flow algorithm

y In this maximum flow algorithm we used to find the no. of 

transmissions in each cycle.

y Weights are added to the nodes to achieve better matching.

y

This algorithm takes into consideration the rarity of the filepieces and also the demands of the peers and assigns weights to

the node.

y A bipartite graph is formed with all the peers in two sets.

y Once the flow graph has been constructed, the maximum

possible flow is calculated.

y Then we obtain schedule matrix.

y We finally calculate the performance.

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 19/33

Use case diagr am

select the peer 

select the input

select algorithmsoperator 

obtain the output

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 20/33

Use case diagr am f or  r ar est piece fir st

piece disribution

rarest piece selection

performance calculation

peer 

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 21/33

Use case diagr am f or most demanding node algor ithm

piece disribution

demand node selection

performance calculation

peer 

rarest piece selection

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 22/33

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 23/33

Sequence diagram:

client server  

Request for registration

Response

Enters the peer number 

Browse the input file

Chooses the algorithm

Gives the performance

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 24/33

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 25/33

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 26/33

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 27/33

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 28/33

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 29/33

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 30/33

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 31/33

Conclusion:y W e analyzed and understood three algorithms, but

due to time factor we implemented only two

algorithms.y Among the two algorithms, MDNF gives the best

performance. According to the theoretical analysismdnf and max flow algorithms gives the bestperformance.

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 32/33

THANK Y OU

8/7/2019 main projec

http://slidepdf.com/reader/full/main-projec 33/33

QUERIES?