Part 1: Overview of Web Systems Part 2: Peer-to-Peer Systems - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

Part 1: Overview of Web Systems Part 2: Peer-to-Peer Systems

Description:

Part 1: Overview of Web Systems Part 2: Peer-to-Peer Systems Internet Computing Workshop Tom Chothia Introduction Part 1: Summary how Web pages, JavaScript, Servlets ... – PowerPoint PPT presentation

Number of Views:119
Avg rating:3.0/5.0
Slides: 29
Provided by: TOM55
Category:

less

Transcript and Presenter's Notes

Title: Part 1: Overview of Web Systems Part 2: Peer-to-Peer Systems


1
Part 1 Overview of Web SystemsPart 2
Peer-to-Peer Systems
  • Internet Computing Workshop
  • Tom Chothia

2
Introduction
  • Part 1
  • Summary how Web pages, JavaScript, Servlets and
    JSP are related.
  • How to run your own Servlets and JSP in Netbeans
  • Part 2
  • Peer to Peer Systems.
  • Very high level overview of the design of
    Napster, Gnutella and Bittorrent.
  • P2P case studies, BBCs iPlayer.

3
4 Key Web Technologies
  • Web Pages
  • HTML file passed via HTTP.
  • JavaScript
  • Code in HTML file, runs on client
  • Servlets
  • Server code that generates HTML file.
  • JavaServer Pages
  • Java code in HTML that runs on the server.

4
Web Pages
HTTP GET
Client
Server
HTTP file
HTML
HTML
Display
HTML file
5
JavaScript
  • HTML is very basic.
  • JavaScript is a simple scripting language.
  • You can put into HTML web pages.
  • It runs on the client.

6
JavaScript
HTTP GET
Client
Server
HTMLJS
HTTP file
HTMLJS
JS interpreter
HTML J.S. file
Display
7
Servlets
  • Sometimes you dont want to run code on the
    client.
  • The webpage doesnt have to be a file.
  • A servlet is Java code that runs on the server to
    handle a request from the client.
  • Servlet a little be of a server.

8
HTTPServlets
  • The javax.servlet.http.HttpServlet class lets you
    build a servlet to handle web page request.
  • When someone requests the page the doGet method
    is called.
  • The doGet method must write HTML output.

9
Servlets
HTTP GET
Client
Server
HTTP file
HTML
HTML
Java code Servlet doGet
Display
10
JavaServer Pages (JSP)
  • When writing servlets you can end up writing lots
    of HTML.
  • JSP lets you put the Java in a HTML file.
  • Great for pages with a lot of HTML and a little
    Java.

11
JSP
Server
HTTP GET
Client
HTML
HTTP file
HTML
Java code Servlet doGet
Display
HTML Java file
12
4 Key Web Technologies

Language Where Processed
Web Pages HTML N/A
JavaScript HTML JavaScript Client
Servlets Java Server
JavaServer Pages HTML Java Server
13
Containers
  • To run JSP or Servlets you need a JSP/Servlets
    container.
  • This is a web server that can run servlets and
    compile JSP.
  • E.g. Apache TomCat, Glassfish.
  • Good IDEs can run these for you.

14
Running JSP in Netbeans
  • Create a Web Application project
  • File gt New Project gt Java Web gt Web Application
  • This creates the JSP page index.jsp
  • Edit index.html (it can call other Java code).
  • Click Run, to start a web server and open the
    page in a browser.

15
Running Servlets in NetBeans
  • Create a web app, as before.
  • Create a servlet file File gt New File gt Web gt
    Servlet
  • Click Next, Next and enter the URL Pattern
  • The servlet is run when a client requests this
    URL.
  • Edit the Servlet file. E.g. write the doGet()
    method.
  • Click run to start up the server.
  • Enter the URL in the browser to see your page.

16
Part 2 Peer-to-Peer Systems
  • Internet Computing Workshop

17
File Sharing P2P Networks
  • Napster
  • The first big file sharing network.
  • Online between 1999-2001.
  • Central Coordinator.
  • Gnutella
  • Most popular file-sharing network in mid 2000s.
  • No central coordinator.
  • Unstructured Network.
  • BitTorrent
  • Lots of little P2P networks.
  • Single tracker coordinates each download.
  • Rewards up-loaders.

18
Napster
I
  • Peer A asks the database for x.
  • The database tells A which peer has the file.
  • A downloads the file from that peer.
  • A tells the database it has the file.
  • Other peers can then download the file from A

H
G
F
E
x
D
x
C
x?
B
A,E
A
E
x?
x?
I have x
x?
19
Napster User Figures
20
Original Gnutella
  • In newer networks peers record the IP address of
    other peers.
  • A searcher sends a request to all of its
    neighbours.
  • This is forwarded to all of there neighbours, up
    to a fixed hops.

A
21
Original Gnutella
  • The search request includes As IP address.
  • Any peer with the requested file contacts A
    directly.
  • Peer A may then request the file.

A
22
BitTorrent Setting Up
Tracker
Web Server
  • Peer A wants to share a find.
  • A must find a tracker to coordinate the
    download.
  • A makes a torrent file,
  • The name of the file.
  • The hash of the data.
  • The IP address of the tracker.
  • A must put the torrent somewhere people can
    find it. E.g., on a web server.
  • A tells the tracker is wants to share the file.

A
T
A
T
23
BitTorrent Sharing
Tracker
Web Server
  • Peer B finds the torrent file.
  • B finds the tracker IP and connects to it.
  • The tracker
  • tells B the IP of the file sharers.
  • And adds B address to the list of sharers
  • B connects to A
  • and then gets some pieces of the file.

A
,B
T
B
T
A
A
24
BitTorrent Sharing
Tracker
Web Server
  • Peer C connects in the same way.
  • A will try to hand out different copies of the
    file.
  • A may disconnect.
  • C may get the rest of the file from B.
  • D can connect and the sharing continues without
    A.

A,
B
,C
T
B
T
A
A
C
A,B
T
D
B,C
T
25
Case Study BBCs iPlayer
  • The BBC wants to provide TV programs via the Web.
  • Streaming all that data costs a lot.
  • Therefore the BBC tried out a peer-to-peer
    system for downloads.
  • They used a centrally controlled coordinator and
    digital rights management.

26
Case Study BBCs iPlayer
  • The idea is
  • If Im only downloading then I cost the BBC money
    (they pay for bandwidth).
  • If I upload as much as I download then I cost the
    BBC very little.
  • If I upload more than I download then I am
    providing a service for the BBC.
  • In theory, a company can save millions.

27
Case Study BBCs iPlayer
  • In fact
  • iPlayer users like to stream TV, not download.
  • The P2P system cant provide the exact
    information at the exact time to watch live.
  • In December 2008 the BBC changed their download
    service to direct download via HTTP.
  • Key point P2P has great potential, but it has
    its problems

28
Next Time
  • AJAX and other new web systems.
Write a Comment
User Comments (0)
About PowerShow.com