Lab Exercise 2 (Sessions 2, 3, and 4) The Joy of Programming on the Web.

Slides:



Advertisements
Similar presentations
Remote Procedure Call (RPC)
Advertisements

Implementing A Simple Storage Case Consider a simple case for distributed storage – I want to back up files from machine A on machine B Avoids many tricky.
Lab Exercise 2 (Sessions 2, 3, and 4) The Joy of Programming on the Web.
Distributed Object & Remote Invocation Vidya Satyanarayanan.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Distributed Systems Fall 2010 Replication Fall 20105DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Interactions Between Delayed Acks and Nagle’s Algorithm in HTTP and HTTPS: Problems and Solutions Arthur Goldberg Robert Buff New York University March.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
Dynamic Web Pages. Web Programming  All our web pages so far have been static pages. 1. We create a web page 2. We upload it to the web server 3. People.
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Internet Networking Spring 2002 Tutorial 13 Web Caching Protocols ICP, CARP.
Implementing Application Protocols. Overview An application protocol facilitates communication between applications. For example, an client uses.
.NET Mobile Application Development Remote Procedure Call.
Client, Server, HTTP, IP Address, Domain Name. Client-Server Model Client Bob Yahoo Server yahoo.com/finance.html A text file named finance.html.
Fundamentals of Python: From First Programs Through Data Structures
Service Broker Lesson 11. Skills Matrix Service Broker Service Broker, provides a solution to common problems with message delivery and consistency that.
Basics Dayton Metro Library Place photo here August 10, 2015.
Asynchronous Web Services Approach Enrique de Andrés Saiz.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Programming Network Servers Topic 6, Chapters 21, 22 Network Programming Kansas State University at Salina.
Web Security Programming I Building Security in from the Start Except where otherwise noted all portions of this work are Copyright (c) 2007 Google and.
Application Protocols: ELECTRONIC MAIL (SMTP, POP) CSNB534 Semester 2, 2007/2008 Asma Shakil.
2: Application Layer1 CS 4244: Internet Software Development Dr. Eli Tilevich.
Rensselaer Polytechnic Institute Shivkumar Kalvanaraman, Biplab Sikdar 1 The Web: the http protocol http: hypertext transfer protocol Web’s application.
Extending Vista The PowerLinks WebServices SDK John Hallett Senior Product Manager WebCT, Inc
Web Services (SOAP, WSDL, UDDI) SNU OOPSLA Lab. October 2005.
Operating Systems Recitation 9, May 19-20, Iterative server Handle one connection request at a time. Connection requests stored in queue associated.
Lab 2 Group Communication Farnaz Moradi Based on slides by Andreas Larsson 2012.
1 Web Based Programming Section 8 James King 12 August 2003.
Farnaz Moradi Based on slides by Andreas Larsson 2013.
SPECULATIVE EXECUTION IN A DISTRIBUTED FILE SYSTEM E. B. Nightingale P. M. Chen J. Flint University of Michigan.
MC365 Application Servers, Servlets, and Java Server Pages (JSP’s): Tomcat.
Practical Session 12 Reactor Pattern. Disadvantages of Thread per Client It's wasteful – Creating a new Thread is relatively expensive. – Each thread.
1-1 HTTP request message GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0 Connection: close Accept-language:fr request.
Web Technologies Interactive Responsiveness Function Hypertext Web E-Publishing Simple Response Web Fill-in Forms Object Web « Full-Blown » Client/Server.
Google App Engine MemCache ae-09-session
1 Andrea Sciabà CERN Critical Services and Monitoring - CMS Andrea Sciabà WLCG Service Reliability Workshop 26 – 30 November, 2007.
CSCI 444 / CIS 644 Event Driven Programming. Outline I.What is an event driven system? II.What is event driven programming? III.Course Overview.
Replication (1). Topics r Why Replication? r System Model r Consistency Models r One approach to consistency management and dealing with failures.
Remote Procedure Call and Serialization BY: AARON MCKAY.
Building Dependable Distributed Systems, Copyright Wenbing Zhao
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
#16 Application Measurement Presentation by Bobin John.
Overview on Web Caching COSC 513 Class Presentation Instructor: Prof. M. Anvari Student name: Wei Wei ID:
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
WELCOME COACHES to the PARK VALLEY UNITED FUTBOL CLUB.
JavaScript Invented 1995 Steve, Tony & Sharon. A Scripting Language (A scripting language is a lightweight programming language that supports the writing.
1 Computer Science 1021 Programming in Java Geoff Draper University of Utah.
The Echo Server Problem. Contents  Basic Networking Concepts  The Echo Server Problem.
SE-1021 Software Engineering II
Cloud Computing Web Services.
WWW and HTTP King Fahd University of Petroleum & Minerals
“Request /Reply Communication”
Computing with C# and the .NET Framework
Chapter 6: Transport Layer (Part I)
Web Caching? Web Caching:.
Fault Tolerance - Transactions
WEB API.
Distributed Systems - Comp 655
Fault Tolerance - Transactions
AJAX Robin Burke ECT 360.
Fault Tolerance - Transactions
Introduction to Servlets
Lab Exercise 2 (Lab Sessions 2, 3, and 4)
Chinese wall model in the internet Environment
Fault Tolerance - Transactions
Fault Tolerance - Transactions
Presentation transcript:

Lab Exercise 2 (Sessions 2, 3, and 4) The Joy of Programming on the Web

Objective SlotReserved By 1Free 2Dean 3... SlotReserved By 1Free 2Dean 3... HotelBand Write a client that reserves the earliest matching slots for the band and the hotel You will compete for slots with your fellow students Each provides a reservation service on the Web

Reservation Service Provides you with a simple service: Check availability Reserve a slot Cancel a reservation Check your bookings However, we are going to make your life interesting Appreciate the “fun” in building distributed applications

Couple 1 Availability request identifier: 1 username: couple_1 password: couple_1_password

Couple 2 Availability request identifier: 1 username: couple_2 password: couple_2_password

Couple 3 Availability request identifier: 1 username: couple_3 password: couple_3_password

Couple 3 Availability msg id: msg_id_100

Couple 2 Service Unavailable

Couple 1 Availability msg id: msg_id_104

Messages can be delivered in any order Service may be unavailable when messages arrive It is your responsibility to generate unique message IDs

Couple 3 Get Message message_id: msg_id_100 username: couple_3 password: couple_3_password

Couple 1 Get Message message_id: msg_id_104 username: couple_1 password: couple_1_password

Couple 1 Message: msg_id_104 Slots: 1, 3, 5,...

Couple 3 Get Message Message not available Or Service unavailable

Couple 3 Retries Get Message: msg_id_100 Slots: 1, 3, 5,...

Requests may not be ready when you retrieve your messages Server introduces arbitrary delays when processing messages

Couple 3 Reserve Slot_id: Reserve msg_id: msg_id_203 request_id = 2

Couple 1 Reserve Slot_id: Reserve msg_id: msg_id_403 request_id = 2

Requests with the same will get the same message identifier Easy to achieve at most once semantic

Couple 3 Get Message msg_id: msg_id_203 Reserve Reserved slot 3

Couple 1 Get Message msg_id: msg_id_403 Reserve Reservation failed

Data is ALWAYS potentially out-of-date Couple 1 thought slot 3 was available but....

More Fun and Games User sends “reserve slot 3”, “cancel slot 3” and “reserve slot 1” One possible outcome Slot 3 is reserved; Reservation for slot 3 is cancelled; Slot 1 is reserved Another possibility Cancel of slot 3 fails; Slot 3 is reserved; Reservation for slot 1 fails as you have exceeded the max number of reservations

Messages from the same client can be processed in any order To enforce sequential execution Send a request, get the result of the request before sending the next But this is inefficient especially if the network and server are slow

Request to Service Reserve Cancel Availability List of slots “free” when the message was processed Bookings List of slots reserved by you when the message was processed

Response from a Request Either Message identifier Use it to fetch the result from the request Service unavailable

Get Response Possible responses depends on the request Reserve OK or failed and reason Cancel OK or failed and reason Bookings and Availability List of slots

Summary Service randomly reject incoming messages Requests are then delayed for an arbitrary amount of time before it is processed Messages are processed in any order Availability information is potentially out of date

Implementation You are going to use HTTP and XML messages Write your client in the language of your choice Java, C#, C++,... Set HTTP Header 'Content-Type' => "application/xml” 'Accept' => 'application/xml'

For Java users We provide quite a lot of code – see $COMP28112/ex2/java-client Read README.txt Look for code in package uk.ac.manchester.cs.comp28112.lab2 Grep for TODO in code given!

XML to Reserve a Slot 1 dean deanpwd 1

Response Http response code: Http response code: 503 Service unavailable

HTTP Get sg/31?username=dean&password=deanp wd sg/31?username=dean&password=deanp wd Use of HTTP response codes 200 success retrieval of message 404 Message is not available 503 Service unavailable 401 Unauthorized

Reserve Responses Body … Use HTTP codes - see documentation … Provides additional information

Browser Interface sername=dean&password=deanpwd sername=dean&password=deanpwd

Avoid Denial of Service! If your program loops making requests (without pausing) it becomes a denial of service attack – don’t do it Everyone suffers You will lose marks! At least 1 second waiting time between requests!

Session I Write a client to make a reservation, cancel a reservation, check for availability, check your reservations Deal with the possible “failures” that can occur

Session 1 assessment If programming in Java: 5 marks for showing that it works on time Other languages: more slack!

You need to reserve the matching slots for both the hotel and the band Hotel - Band - Maximum number of reservations you are allowed to hold Hotel and Band – 2 (no deadline/assessment) Session II Reserve Hotel & Band

We will block some slots and then release them during the lab sessions Session III Reserve the Earliest Possible Time Slot

Enjoy Experience the difficulties (and the fun) in building distributed applications There is no perfect solution Possible improvements (no marks) Make your client fault-tolerant (survive crashes) Use of threads