25
1 P2P File-Sharing Solution CS654 – Software Architecture course project Guide: T V Prabhakar Members: S Pavan Kumar – Y1306 D V Janardhan Rao – Y4111053

1 P2P File-Sharing Solution CS654 – Software Architecture course project Guide: T V Prabhakar Members: S Pavan Kumar – Y1306 D V Janardhan Rao – Y4111053

Embed Size (px)

Citation preview

1

P2P File-Sharing Solution

CS654 – Software Architecture course project

Guide: T V Prabhakar

Members:S Pavan Kumar – Y1306D V Janardhan Rao – Y4111053

2

Contents

Functional RequirementsNon Functional RequirementsBrief description of the solutionHow we arrived at the solution

3

Functional Requirements

User should be able to Share files Search for files based on keywords Download files

Online Relay Chat

4

Non-Functional Requirements

Fast resource discoveryAvailability – If a resource is shared by some user, then a search query for that resource should always succeedScalability of the solutionSolution should be fault tolerantImplicit Security in terms of the extent of damage in case of compromise

5

Module ViewP2P File

Sharing s/w

Peer NetworkAdapter

Web AdapterUIController

SearchEngine

Online RelayChat Engine

DecentralizedStructured

File Mapper

CentralizedStructured

NetworkModules

MetadataHandler

Download andUpload Manager

6

Allocation View

Web browser

Java Servlets

AndJSP’s

Controller

Web Adapter

Peer networkAdapter

Hard disk

Meta data files

P2P network

P2P network

Centralized Index server ( Application server )XML

database

7

Web browser

Web

ADAPTER

Application Server

Searchengine

Filemapper

Metadatahandler

Hard disk of the machine

NETWORK

MODULE

Peer network Adapter

Stub

Uploadmanager

Downloadmanager

Chatengine

Controller

CreateJSP

Uploadservlet

Create andupload

Createservlet

Meta data files

8

Web browser

Web

ADAPTER

Application Server

Searchengine

Filemapper

Metadatahandler

Hard disk of the machine

NETWORK

MODULE

Peer network Adapter

Stub

Uploadmanager

Downloadmanager

Chatengine

Controller

View JSP

Display JSP

View servlet

LocalBrowsing

Meta data files

9

Web browser

Web

ADAPTER

Application Server

Searchengine

Filemapper

Metadatahandler

Hard disk of the machine

NETWORK

MODULE

Peer network Adapter

Stub

Uploadmanager

Downloadmanager

Chatengine

Controller

Search andDownload

Search.jsp

Download.jsp

Searchservlet

DisplayResults.jsp

Meta data files

10

Web browser

Web

ADAPTER

Application Server

Searchengine

Filemapper

Metadatahandler

Hard disk of the machine

NETWORK

MODULE

Peer network Adapter

Stub

Uploadmanager

Downloadmanager

Chatengine

Controller

ChatRelay

post.jsp

Recvmsgservlet

Sendmsgservlet

Display.jsp

Meta data files

11

Web browser

Web

ADAPTER

Application Server

Searchengine

Filemapper

Metadatahandler

Hard disk of the machine

NETWORK

MODULE

Peer network Adapter

Stub

Uploadmanager

Downloadmanager

Chatengine

Controller

Meta data files

12

Switching between the network modules

P2P Network

P2P Network

XML database

Centralized Index server

StructuredCentralized

network module

StructuredDe-

centralizednetworkmodule

Networking Module

Routing table info

1Echo req

2Echo req

Echo reply 3

Echo reply 4

Switching ofNetwork module

13

Architecting the solution

Architectural decision at the top level and the tradeoffs – structured or unstructured network

14

Unstructured Networks

Ad-hoc topologyQueries are flooded for bounded number of hopsNo guarantees on queriesProbs:

Fast Resource discovery Availability

Query: “xyz”

xyz

xyz

User Interface

MetadataHandler andFile Handler

Peer NetworkAdapter

P2P Network

P2P Network

Harddisk

MetadataFiles

15

Structured networks (centralized)Centralized index serversO(1) hops for resource discoveryGuarantees on queries – availabilityProbs: Scalability, Fault tolerance and implicit security

Query

Response

User Interface

File Handler

Peer NetworkAdapter

P2P Network

P2P Network

Harddisk

Centralized Index server ( Application server )

XML database

16

Distributed Hash Tables (DHTs)Hash table interface: put(key,item), get(key)O(log n) hops – some what problematic; not so fastGuarantees on search queries, fault tolerant, scalable

Structured Networks (decentralized)

K I

K I

K I

K I

K I

K I

K I

K I

K I

put(K1,I1)

(K1,I1)

get (K1)

I1

17

Tradeoff

Structured

(decentralized)

Structured

(centralized)

Fast Resource discovery and availability

So why not use a combination of both

Fault Tolerance, Scalability and Implicit security

18

Switching between the network modules (Polling)

P2P Network

P2P Network

XML database

Centralized Index server

StructuredCentralized

network module

StructuredDe-

centralizednetworkmodule

Networking Module

Routing table info

1Echo req

2Echo req

Echo reply 3

Echo reply 4

Switching ofNetwork module

19

Architectural Decisions

Why are we switching between various network modules and not using a single centralized index server or a totally decentralized structured network? – fast resource discovery, scalability, load balancing, fault tolerance and securityWhy are we not using multiple central index servers? – consistency and cost

20

Storage of metadata

At central index server use XML Database – heavy loads, faster processing (indexing becomes important because of huge number of metadata files), dynamism (index files are updated every now and then)For local meta data files use flat file system – very few files, light loads, number of updates are small

21

Decisions

Technology – use JSP’s and Servlets for UI (easy build, modify and run)Web Server – Open source and freeDecouple functionality from networking to ensure smooth fault detection and recovery

22

Architecture

Web browser

Java Servlets

AndJSP’s

Controller

Web Adapter

Peer networkAdapter

Hard disk

Meta data files

P2P network

P2P network

Centralized Index server ( Application server )XML

database

23

Quality attributes and tactics

Modifiability Use an intermediary – Use of a web

adapter removes tight coupling between the modules

24

Quality attributes and tactics …

Availability Fault detection

Ping/echo Recovery

Active redundancy Switching between the network modules

Security

25

Questions?