1 / 28

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

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 and JSP are related. How to run your own Servlets and JSP in Netbeans Part 2 Peer to Peer Systems.

nguyet
Download Presentation

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

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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, BBC’s 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 HTTP file HTML&JS HTML&JS JS interpreter HTML + J.S. file Display

  7. Servlets • Sometimes you don’t want to run code on the client. • The webpage doesn’t 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

  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 > New Project… > Java Web > 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 > New File… > Web > 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 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” I H G F E “x” D “x” C “x”? B A,E E A “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 it’s “neighbours”. This is forwarded to all of there neighbours, up to a fixed hops. A

  21. Original Gnutella The search request includes A’s IP address. Any peer with the requested file contacts A directly. Peer “A” may then request the file. A

  22. BitTorrent: Setting Up Tracker 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. Web Server A T A T

  23. BitTorrent: Sharing Tracker 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. Web Server A ,B T B T A A

  24. BitTorrent: Sharing Tracker 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”. Web Server A, B ,C T B T A A C T A,B D T B,C

  25. Case Study: BBC’s 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: BBC’s iPlayer The idea is: • If I’m 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: BBC’s iPlayer In fact: • iPlayer users like to stream TV, not download. • The P2P system can’t 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 it’s problems

  28. Next Time: • AJAX and other new web systems.

More Related