Part.1. Execution Environment for Distributed Computing

1,369 views
1,236 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,369
On SlideShare
0
From Embeds
0
Number of Embeds
56
Actions
Shares
0
Downloads
41
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Part.1. Execution Environment for Distributed Computing

  1. 1. EEDC 34330Execution Part 1.Environments for DistributedDistributedComputing ComputingMaster in Computer Architecture,Networks and Systems - CANS Basics
  2. 2. Background A good background – Distributed Systems • an introductory course on principles for Distributed Systems. • http://www.ac.upc.edu/distributed-systems – Scalable Distributed Systems • an advanced course on Scalable Distributed Systems. – Learn the fundamental concepts, operation and design guidelines, patterns and methods for developing software systems with good scalability and predictability, and the evaluation of scalable and Internet- scale systems. • http://www.ac.upc.edu/en/scalable-distributed-systems-sds Excellent teachers in the area: – Leandro Navarro: http://personals.ac.upc.edu/leandro/ – Jordi Guitart: http://personals.ac.upc.edu/jguitart/ 2
  3. 3. ContentPart 1. Distributed Computing Basics (review concepts) 1.1. Distributed Systems Overview (review) 1.2. Distributed Computing Communication (review) 1.3. XML basics(review) 1.4. Web Services basics (review) 1.5. REST versus POST (Homework 2) 1.6. Service Level parameters (review) 1.7. Distributed Systems become complex systems 3
  4. 4. EEDC 34330Execution 1.1Environments for DistributedDistributedComputing SystemsMaster in Computer Architecture,Networks and Systems - CANS Overview
  5. 5. EEDC 34330Execution 1.1Environments for DistributedDistributedComputing SystemsMaster in Computer Architecture,Networks and Systems - CANS Overview deprecated? :-)
  6. 6. The Rise of Distributed Systems Computer hardware prices falling, power increasing – If cars the same, Rolls Royce would cost 1 dollar and get 1 billion miles per litre Network connectivity increasing – Everyone is connected with fat pipes It is easy to connect hardware together First definition: a distributed system is a collection of independent computers that appears to its users as a single coherent system. 6
  7. 7. Distributed Systems Wikipedia: “Distributed computing is a method of computer processing in which different parts of a program run simultaneously on two or more computers that are communicating with each other over a network”. – Is a type of parallel computing • “Parallel” usually describes a set of processes running in the same machine – Some particular communication mechanisms are required for distributed computing: • RPC, sockets, soap, rest, http, mapreduce, OpenMP, MP, pregel, CompSs,…………… 7
  8. 8. Distributed Systems Different targets: – Scientific // Numerical distributed computing • Parallelism to reduce computation time • Examples: MPI, CompSs – Commercial distributed computing • Increase availability, functionalities, service level guarantees, • Examples: Distributed computing models, Application servers (N- tier)… 8
  9. 9. Transparency in a Distributed System Different forms of transparency in a Distributed SystemTransparency Description Hide differences in data representation and how aAccess resource is accessedLocation Hide where a resource is locatedMigration Hide that a resource may move to another location Hide that a resource may be moved to anotherRelocation location while in use Hide that a resource may be shared by severalReplication competitive users Hide that a resource may be shared by severalConcurrency competitive usersFailure Hide the failure and recovery of a resource Hide whether a (software) resource is in memory orPersistence on disk 9
  10. 10. Software Concepts (old concepts?)System Description Main Goal Tightly-coupled operating system for multi- Hide and manageDOS processors and homogeneous hardware resources multicomputers Loosely-coupled operating system for Offer local servicesNOS heterogeneous multicomputers (LAN and to remote clients WAN) Additional layer top of NOS implementing Provide distributionMiddleware general-purpose services transparency DOS (Distributed Operating Systems) NOS (Network Operating Systems) Middleware - preliminary vision 10
  11. 11. Distributed Operating Systems (old view?) But no longer have shared memory – Provide message passing – Can try to provide distributed shared memory • But tough to get acceptable performance 11
  12. 12. Network Operating System (old view?)OSes can be different (Windows or Linux) 12
  13. 13. Network Operating System (old view?)Typical services: rlogin, rcp– Quite primitive way to share filesCan have one computer provide files transparentlyfor others: e.g. NFS 13
  14. 14. Middleware: the solution? A distributed system organized as “middleware”. – the middleware layer extends over multiple machines. Users can interact with the system in a consistent way, regardless of where the interaction takes place. – Middleware may be “part” of application in practice. 14
  15. 15. Middleware Positioning middleware – Network OS not transparent. – Distributed OS not independent of computers. Middleware can help Much middleware built in-house to help use networked operating systems – distributed transactions, – better communication, – RPC, – … Unfortunately, many different standards 15
  16. 16. Distributed System? Evolution of Computing Systems Distributed Systems Client Centralized Systems Server Systems 16
  17. 17. Definitions for Distributed System? A distributed system is a collection of independent computers that appears to its users as a single coherent system – Heterogeneous computers – vendors/OS should be able to interoperate – Communication should be hidden – Should be easy to expand and scale – Should be permanently available (even though parts of it are not) Machine A Machine B Machine C Distributed Applications Middleware Services OS, e.g. OS, e.g. OS, e.g. Windows XP Mac OS Linux Network 17
  18. 18. Taxonomy for Distributed Systems Taxonomy is based on following factors: 1. Resource Discovery 2. Resource Availability 3. Resource Communication1. Resource Discovery: Mechanism for discovering resources on a distributed system?2. Resource Availability: Scalability – do resources scale with network? 18
  19. 19. Taxonomy for Distributed Systems3. Resource Communication: Two basic types: – Brokered Communication (centralized): • communication is passed through a central server - resources do not have direct references to each other. – Point to point (decentralized -peer to peer): • a direct connection between the sender and the receiver. 19
  20. 20. Taxonomy for Distributed Systems Centralized vs descentralized True Peer to Peer Central Server Many to one relationship between users and the central Equal Peers, communication is supposed server and therefore this can be to be even i.e. each provider is also a considered centralized server of information and each node has communication an equal number of connections 20
  21. 21. Taxonomy for Distributed SystemsCentralized example: A web server- Clients (i.e. users) use their webbrowser to navigate web pages on Webone or more web sites. Server- Web site is static to particulardomain• Discovery: Centralized, DNS• Availability: available or not• Communication: centralized tothe particular web server 21
  22. 22. Taxonomy for Distributed Systems Summary: Client-Server vs Peer-to-Peer Client-Server Computing Peer-to-Peer Computing Server • Client initiates • Any participant can communications initiate communication • Client issues request • Any device can to a server generate a request • Server replies or • Any device may performs some service provide a response 22
  23. 23. Taxonomy for Distributed Systems OverviewCentralized systems - Hybrid – combinations Decentralizedtypically, client/server of the 2 extremes e.g. systems - Peer tobased systems brokered architecture Peer (P2P)Centralized Hybrid Decentralized 23
  24. 24. Middleware Systems offers the Execution Environment – are comprised of abstractions and services to facilitate the design, development, integration and deployment of distributed applications in heterogeneous networking environments. – Middleware components are of crucial importance for new systems and architectures because of their impact on the quality of the service offered by the application. 24
  25. 25. Middleware Definition? RFC2768: (IETF) – Def 1: those services found above the transport (I.e. over TCP/IP) layer set of services but below the application environment (i.e., below application-level APIs) – Def 2: a reusable, expandable set of services and functions that are commonly needed by many applications to function well in a networked environment. 25
  26. 26. Middleware Definition? RFC2768: (IETF) – Def 1: those services found above the transport (I.e. over TCP/IP) layer set of services but below the application environment (i.e., below application-level APIs) – Def 2: a reusable, expandable set of services and functions that are commonly needed by many applications to function well in a networked environment. EEDC approximation: – Software “glue” between two apps/layers/…. 26
  27. 27. Middleware Definition? Middleware refers to the software which is common to multiple applications and builds on the network transport services to enable ready development of new applications and network services. Middleware typically includes a set of components such as resources and services that can be utilized by applications either individually or in various subsets. – Examples of services: Security, Directory and naming, end-to-end quality of service, etc. 27
  28. 28. Middleware Definition? Middleware? Application Middleware JVM MIDDLEWARE OS Hardware OMG’s CORBA ? – defines a middleware standard. Java 2 enterprise edition (J2EE) ? – is a middleware specification. Hadoop? – is a middleware framework of the MapReduce programming model. 28
  29. 29. Middleware Definition? Conclusion: – Middleware is a somewhat overloaded term For this course: – Generally speaking, middleware provides software services for application programs INCLUDING the basic operating system and networking services above the resources. Application Programs Software services Operating System and Networking Services Resources 29
  30. 30. Middleware Definition? Goal is to simplify development effort and increase application functionality and robustness – Allow code to run across different platforms – Provide higher level abstractions of services Example of “traditional” functions – Messaging – Distributed object management – Directory services – Location services – User-defined and composite data types – Remote procedure calls (RPC) – Alternate communication abstractions – … 30
  31. 31. Middleware: Layered architecture Solving such a problem is not an easy task. Middlewares as many other software have a layered architecture. Applications Domain-specific middleware services Middleware Common middleware services Distribution middleware Host infrastructure middleware Operating system Hardware devices[1] Richard E. Schantz , Douglas C. Schmidt, Research Advances in Middleware for Distributed Systems, Proceedings of the IFIP 17th World Computer Congress -TC6 Stream on Communication Systems: The State of the Art, p.1-36, August 25-30, 2002. Thank you to F. Zyulkyarov and R. Ferrer 31
  32. 32. Benefits of middleware Increasing focus on integration rather on programming. – Middlewares allow for connecting separate pieces of software despite their location. Increased viability of open systems architectures and open-source availability – Openly defined middlewares motivate the creation of additional technologies on top of them. At last, they enable a new software market of distributed solutions. 32
  33. 33. Some challenges for middleware today Middlewares have not completely solved the «distributed heterogeneous computing» problem. Standartizing domain-specific middleware services – Domain-specific middleware is tightly tailored to the domain and the components cannot be reused in building simillar domain-specific applications. – Challenges for Openness • Openness facilitates • interoperability, portability, extensibility, adaptivity 33
  34. 34. Some challenges for middleware today Challenges for Scalability – The system will remain effective when there is a significant increase in number of resources, number of users, etc. Providing end-to-end Quality of Service (QoS) over the whole system. – And special attention require quality service as “TREC” in this course Resource allocation and management for embeded distributed applications. 34
  35. 35. Some challenges for middleware today But also issues like – Better failure tolerance – Better integration – Better adaptivity to highly dynamic environments – Lack of good system engineering and tools “middleware-aware” – … – … – … – … – … 35
  36. 36. Summary: Middleware systems offers an Execution Environment are comprised of – abstractions and services – to facilitate the design, development, integration and deployment of distributed applications – in heterogeneous computing systems. 36
  37. 37. Divide and Conquer paradigm!: Layers Breaking up the complexity of systems by designing them through layers and services – Layer: a group of related functional components – Service: functionality provided to the next layer. Layer N … Layer 2 (services offered to above layer) Layer 1 37
  38. 38. Middleware: can be a layered architecture Divide and Conquer paradigm! – Middlewares as many other software have a layered architecture. Applications Domain-specific middleware services Common middleware services Middleware Distribution middleware Host infrastructure middleware Operating system Hardware devices Thank you to F. Zyulkyarov and R. Ferrer from BSC 38
  39. 39. Middleware: can be a layered architecture Encapsulates the running OS services – Concurrency and low level process and Applications task management. Domain-specific middleware services Middleware Common middleware services – Communication. Distribution middleware Host infrastructure middleware Operating system e.g. high level distributed Hardware devices programming models. – Allows for applications to be developed Applications as if they were not distributed, by means Domain-specific middleware services Middleware Common middleware services of some sort of remote invocation. Distribution middleware Host infrastructure middleware Operating system Hardware devices[1] Richard E. Schantz , Douglas C. Schmidt, Research Advances in Middleware for Distributed Systems, Proceedings of the IFIP 17thWorld Computer Congress - TC6 Stream on Communication Systems: The State of the Art, p.1-36, August 25-30, 2002. 39
  40. 40. Middleware: can be a layered architecture Provide a rich set of services that Applications turn out to be common across all Domain-specific middleware services Middleware Common middleware services distributed applications, namely Distribution middleware Host infrastructure middleware – Transaction support Operating system Hardware devices – Security services – Database connection – ... Applications Tailored to the requirements of Domain-specific middleware services Middleware particular domains Common middleware services Distribution middleware – Telecommunications Host infrastructure middleware Operating system – E-commerce Hardware devices – Aerospace – ... 40
  41. 41. Middleware: can be a layered architecture Along the course we will see different examples for each layer Applications Domain-specific middleware services Common middleware services Middleware Distribution middleware Host infrastructure middleware Operating system Hardware devices 41
  42. 42. The world of …Example:Real Time middleware, Embeddedmiddleware, … In RT systems, it doesn’t matter how fast you can perform an action, the important thing is that you must finish it before a deadline. However, we can relax deadline-constraints a little...: – Hard Real-Time: • Operations must be concluded before a deadline. E.g.: air-bag, ABS, defence systems, etc. – Soft Real-Time: • Operations must be concluded most of the time before a deadline. E.g.: Telepizza gives your money back if they can’t deliver your pizza before 30 minutes. Applying RT methodologies they can upper-bound maximum losses. Thank you to Ismael Gómez Miguelez 42
  43. 43. The world of … Embedded Systems: “They are special-purpose computer systems designed to perform one or a few dedicated functions.” http://en.wikipedia.org/wiki/Embedd ed_systemPrimary Characteristics: – Optimization: In contrast with general-purpose computers, they can be highly optimized in performing one task. • Underlying OS overhead must be minimum. • Limited resources (CPU, memory, etc.) – Reliability: They are expected to run continuously for years without errors. • We must avoid dynamic memory, system can’t be just “rebooted”. E.g. space systems, pacemaker, etc. • System shut down may incur in large money losses or even death. E.g. telephone switches, funds transfer, elevator controls, etc. Thank you to Ismael Gómez Miguelez 43
  44. 44. The world of …… and Distributed Real-Time Embedded (DRE) Systems They are Real-Time Embedded systems executed in multiprocessor environments (sometimes heterogeneous) Main challenges: – Real-Time Scheduling in distributed heterogeneous processors is a NP-hard problem. – Predictable latencies and jitter on all system services and procedures – QoS – Optimality and reliability Reference: Middleware for real-time and embedded systems Communications of the ACM . Volume 45 , Issue 6 (June 2002) Pages: 43 - 48 Year of Publication: 2002 ISSN:0001-0782 http://delivery.acm.org/10.1145/510000/508472/p43- schmidt.pdf?key1=508472&key2=4239626321&coll=GUIDE&dl=GUIDE&CFID=25423637&CFTOKEN=92900699 Thank you to Ismael Gómez Miguelez 44
  45. 45. Focus of this course: Middleware Considering a layered architecture to ease the explanation … Web Services … Aplication Server Applications … Web server Or Programming Models frameworks … Middleware Java Virtual Machine Operating System Virtualization layer Hardware … 45
  46. 46. EEDC 34330Execution 1.2Environments forDistributed DistributedComputing ComputingMaster in Computer Architecture,Networks and Systems - CANS Communication
  47. 47. Distributed Computing Communication? Origins? Remote procedure call (RPC) The idea of RPC goes back at least as far as 1976, when it was described in RFC 707. It is a technology that allows a computer program to cause a subroutine or procedure to RPC execute in another address space (commonly on another computer on a shared network) without the programmer explicitly coding the details for this remote interaction. (from wikipedia) 47 47
  48. 48. Current “RPC”? Some basic forms • Sockets • http • Web Services (WS) • (CORBA is not considered in this course) • ... Sockets supports http, and http suports WS !!!! 48 48
  49. 49. Distributed Systems Communication Basic concepts of Distributed Computing Communication: Sockets, Http, WS Review concepts: – Principles of app layer protocols – Web and HTTP – DNS – Socket programming with TCP – Socket programming with UDP – Building a Web server Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 49
  50. 50. Distributed Systems comm. across network Distributed Systems communicating across network using sockets process sends/receives messages to/from its socket host or host or server server controlled by app developer process process socket socket TCP with TCP with buffers, Internet buffers, variables variables controlled by OS Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 50
  51. 51. Addressing processes: For a process to receive messages, it must have an identifier – Every host has a unique 32-bit IP address Identifier includes both the IP address and port numbers associated with the process on the host. – Example port numbers: • HTTP server: 80 • Mail server: 25 • … Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 51
  52. 52. What transport service does an app need?Data loss some apps (e.g., audio) can tolerate some loss other apps (e.g., file transfer, telnet) require 100% reliable data transferTiming some apps (e.g., Internet telephony, interactive games) require low delay to be “effective”Bandwidth some apps (e.g., multimedia) require minimum amount of bandwidth to be “effective” other apps (“elastic apps”) make use of whatever bandwidth they get 52
  53. 53. Web and HTTPFirst some jargon Web page consists of objects Object can be HTML file, JPEG image, Java applet, audio file,… Web page consists of base HTML-file which includes several referenced objects Each object is addressable by a URL Example URL: www.someschool.edu/someDept/pic.gif host name path name 53
  54. 54. HTTP overviewHTTP: hypertext transfer protocol Web’s application layer protocol client/server model – client: browser that requests, receives, “displays” Web objects – server: Web server sends objects in response to requests HTTP 1.0: RFC 1945 HTTP 1.1: RFC 2068 PC running browser Server running Web server Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 54
  55. 55. HTTP overview (continued)Uses TCP: HTTP is “stateless” client initiates TCP server maintains no connection (creates socket) information about to server, port 80 past client requests server accepts TCP connection from client HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) TCP connection closed Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 55
  56. 56. HTTP connectionsNonpersistent HTTP Persistent HTTP At most one object is Multiple objects can be sent over a TCP sent over single TCP connection. connection between HTTP/1.0 uses client and server. nonpersistent HTTP HTTP/1.1 uses persistent connections in default mode Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 56
  57. 57. Non persistent HTTP (contains text, Suppose user enters URL references to 10www.someSchool.edu/someDepartment/home.index jpeg images) 1a. HTTP client initiates TCP connection to HTTP server (process) at 1b. HTTP server at host www.someSchool.edu waiting www.someSchool.edu on port for TCP connection at port 80. 80 “accepts” connection, notifying client 2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message 3. HTTP server receives request indicates that client wants message, forms response object message containing requested someDepartment/home.index object, and sends message into its sockettime Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 57
  58. 58. Non persistent HTTP (cont.) 4. HTTP server closes TCP connection. 5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objectstime 6. Steps 1-5 repeated for each of 10 jpeg objects Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 58
  59. 59. HTTP request message HTTP request message: – ASCII (human-readable format) request line (GET, POST, GET /somedir/page.html HTTP/1.1HEAD commands) Host: www.someschool.edu User-agent: Mozilla/4.0 header Connection: close lines Accept-language:fr Carriage return, (extra carriage return, line feed) line feed indicates end of message Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 59
  60. 60. HTTP request message: general format Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 60
  61. 61. HTTP response message status line (protocol status code HTTP/1.1 200 OK status phrase) Connection close Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) header Last-Modified: Mon, 22 Jun 1998 …... lines Content-Length: 6821 Content-Type: text/html data, e.g., data data data data data ... requested HTML file Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 61
  62. 62. HTTP response status codesIn first line in server->client response message.A few sample codes:200 OK – request succeeded, requested object later in this message301 Moved Permanently – requested object moved, new location specified later in this message (Location:)400 Bad Request – request message not understood by server404 Not Found – requested document not found on this server505 HTTP Version Not Supported 62
  63. 63. Trying out HTTP (client side) for yourself1. Telnet to your favorite Web server: Opens TCP connection to port 80 telnet www.eurecom.fr 80 (default HTTP server port) at www.eurecom.fr. Anything typed in sent to port 80 at www.eurecom.fr2. Type in a GET HTTP request: GET /~ross/index.html HTTP/1.0 By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to HTTP server3. Look at response message sent by HTTP server! Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 63
  64. 64. DNS: Domain Name SystemInternet hosts, routers: – IP address (32 bit) - used for addressing datagrams – “name”, e.g., www.ac.upc.edu - used by humansmap between IP addresses and name ? 64
  65. 65. DNS: Domain Name SystemDomain Name System: distributed database implemented in hierarchy of many name servers application-layer protocol host, routers, name servers to communicate to resolve names (address/name translation) – note: core Internet function, implemented as application-layer protocol – complexity at network’s “edge” 65
  66. 66. DNS name serversWhy not centralize DNS? single point of failure traffic volume distant centralized database maintenancedoesn’t scale! Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 66
  67. 67. DNS: Root name servers contacted by local name server that can not resolve name root name server: – contacts authoritative name server if name mapping not known – gets mapping – returns mapping to local name server a NSI Herndon, VA c PSInet Herndon, VA k RIPE London d U Maryland College Park, MD i NORDUnet Stockholm g DISA Vienna, VA h ARL Aberdeen, MD j NSI (TBD) Herndon, VA m WIDE Tokyoe NASA Mt View, CAf Internet Software C. Palo Alto,CA root name servers b USC-ISI Marina del Rey, CA worldwide l ICANN Marina del Rey, CA Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 67
  68. 68. Simple DNS example root namehost surf.eurecom.fr server wants IP address of gaia.cs.umass.edu 2 4 5 31. contacts its local DNS server, dns.eurecom.fr2. dns.eurecom.fr contacts root name server, if necessary local name server authorititive name server dns.eurecom.fr dns.umass.edu3. root name server contacts authoritative name server, 1 6 dns.umass.edu, if necessary requesting host gaia.cs.umass.edu surf.eurecom.fr Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 68
  69. 69. Socket programmingGoal: learn how to build client/server application that communicate using socketsSocket API socket introduced in BSD4.1 UNIX, a host-local, 1981 application-created, explicitly created, used, OS-controlled interface released by apps (a “door”) into which client/server paradigm application process can two types of transport both send and service via socket API: receive messages – unreliable datagram to/from another application process – reliable, byte stream- oriented Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 69
  70. 70. Socket-programming using TCP Socket: a door between application process and end-end-transport protocol (UCP or TCP) TCP service: reliable transfer of bytes from one process to another controlled bycontrolled by process application application process developer developer socket socketcontrolled by TCP with TCP with controlled by buffers, operating operating buffers, internet variables system system variables host or host or server server Slides partially extracted from: Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley. 70
  71. 71. Socket programming with TCPClient must contact server When contacted by client, server process must first server TCP creates new be running socket for server process to server must have created communicate with client socket (door) that – allows server to talk with welcomes client’s contact multiple clientsClient contacts server by: – source port numbers used to distinguish clients (more creating client-local TCP in Chap 3) socket specifying IP address, port application viewpoint number of server process TCP provides reliable, in-order When client creates transfer of bytes (“pipe”) socket: client TCP between client and server establishes connection to server TCP 71
  72. 72. Sockets with TCP SERVIDOR CLIENT socket() socket() bind() connect() listen() accept() read() write() write() read() 72
  73. 73. 3. Sockets with UDP HOST 1 HOST 2 socket() socket() bind() bind() recvfrom() sendto() sendto() recvfrom() 73
  74. 74. Socket programming with TCP keyboard monitorExample client-server app:1) client reads line from inFromUser standard input (inFromUser input stream stream) , sends to server via Client socket (outToServer Process process stream)2) server reads line from socket3) server converts line to inFromServer uppercase, sends back to outToServer output input client stream stream4) client reads, prints modified line from socket client TCP clientSocket (inFromServer stream) socket TCP socket to network from network 74
  75. 75. Client/server socket interaction: TCP Server (running on hostid) Client create socket, port=x, for incoming request: welcomeSocket = ServerSocket() TCP create socket, wait for incoming connection request connection setup connect to hostid, port=x connectionSocket = clientSocket = welcomeSocket.accept() Socket() send request using read request from clientSocket connectionSocket write reply to connectionSocket read reply from clientSocket close connectionSocket close clientSocket 75
  76. 76. Example: Java client (TCP) import java.io.*; import java.net.*; class TCPClient { public static void main(String argv[]) throws Exception { String sentence; String modifiedSentence; Create input stream BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); Create client socket, Socket clientSocket = new Socket("hostname", 6789); connect to server Create DataOutputStream outToServer = output stream new DataOutputStream(clientSocket.getOutputStream());attached to socket 76
  77. 77. Example: Java client (TCP), cont. Create BufferedReader inFromServer = input stream new BufferedReader(newattached to socket InputStreamReader(clientSocket.getInputStream())); sentence = inFromUser.readLine(); Send line to server outToServer.writeBytes(sentence + n); Read line modifiedSentence = inFromServer.readLine(); from server System.out.println("FROM SERVER: " + modifiedSentence); clientSocket.close(); } } 77
  78. 78. Example: Java server (TCP) import java.io.*; import java.net.*; class TCPServer { public static void main(String argv[]) throws Exception { String clientSentence; Create String capitalizedSentence; welcoming socket ServerSocket welcomeSocket = new ServerSocket(6789); at port 6789 while(true) {Wait, on welcoming socket for contact Socket connectionSocket = welcomeSocket.accept(); by client BufferedReader inFromClient = Create input new BufferedReader(new stream, attached InputStreamReader(connectionSocket.getInputStream())); to socket 78
  79. 79. Example: Java server (TCP), contCreate output stream, attached DataOutputStream outToClient = to socket new DataOutputStream(connectionSocket.getOutputStream()); Read in line from socket clientSentence = inFromClient.readLine(); capitalizedSentence = clientSentence.toUpperCase() + n;Write out line to socket outToClient.writeBytes(capitalizedSentence); } } } End of while loop, loop back and wait for another client connection 79
  80. 80. Socket programming with UDPUDP: no “connection” between client and server no handshaking sender explicitly attaches IP address and port of destination to each packet application viewpoint server must extract IP UDP provides unreliable transfer address, port of sender from of groups of bytes (“datagrams”) received packet between client and serverUDP: transmitted data may be received out of order, or lost 80
  81. 81. Client/server socket interaction: UDP Server (running on hostid) Client create socket, create socket, port=x, for clientSocket = incoming request: DatagramSocket() serverSocket = DatagramSocket() Create, address (hostid, port=x, send datagram request using clientSocket read request from serverSocket write reply to serverSocket specifying client read reply from host address, clientSocket port number close clientSocket 81
  82. 82. Example: Java client (UDP) keyboard monitor inFromUser input stream Client Process process Input: receives packet (TCP Output: sends received “byte packet (TCP sent stream”) receivePacket sendPacket “byte stream”) UDP UDP packet packet client UDP clientSocket socket UDP socket to network from network 82
  83. 83. Example: Java client (UDP) import java.io.*; import java.net.*; class UDPClient { public static void main(String args[]) throws Exception { Create input stream BufferedReader inFromUser = Create new BufferedReader(new InputStreamReader(System.in)); client socket DatagramSocket clientSocket = new DatagramSocket(); Translate hostname to IP InetAddress IPAddress = InetAddress.getByName("hostname");address using DNS byte[] sendData = new byte[1024]; byte[] receiveData = new byte[1024]; String sentence = inFromUser.readLine(); sendData = sentence.getBytes(); 83
  84. 84. Example: Java client (UDP), cont. Create datagramwith data-to-send, length, IP addr, DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, 9876); port Send datagram clientSocket.send(sendPacket); to server DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); Read datagram from server clientSocket.receive(receivePacket); String modifiedSentence = new String(receivePacket.getData()); System.out.println("FROM SERVER:" + modifiedSentence); clientSocket.close(); } } 84
  85. 85. Example: Java server (UDP) import java.io.*; import java.net.*; class UDPServer { public static void main(String args[]) throws Exception Create { datagram socket at port 9876 DatagramSocket serverSocket = new DatagramSocket(9876); byte[] receiveData = new byte[1024]; byte[] sendData = new byte[1024]; while(true) { Create space forreceived datagram DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); Receive serverSocket.receive(receivePacket); datagra m 85
  86. 86. Example: Java server (UDP), cont String sentence = new String(receivePacket.getData()); Get IP addr port #, of InetAddress IPAddress = receivePacket.getAddress(); sender int port = receivePacket.getPort(); String capitalizedSentence = sentence.toUpperCase(); sendData = capitalizedSentence.getBytes();Create datagramto send to client DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port); Write out datagram serverSocket.send(sendPacket); to socket } } } End of while loop, loop back and wait for another datagram 86
  87. 87. Building a simple Web server handles one HTTP after creating server, request you can request file accepts the request using a browser (e.g. IE explorer) parses header see text for details obtains requested file from server’s file system creates HTTP response message: – header lines + file sends response to client 87
  88. 88. EEDC 34330ExecutionEnvironments forDistributed 1.3ComputingMaster in Computer Architecture,Networks and Systems - CANS XML basics
  89. 89. What is XML? XML is not a language, it is actually a set of syntax rules for creating semantically rich markup languages in a particular domain. – In other words you apply XML to create new languages! Any language created via the rules of XML, like MathML, is called an application of XML. A markup language’s primary concern is how to add semantic information about the raw content in a document. So, a key principle of XML is that the markup is separate from content. Source: Mark Baker UPC PhD Course 2007 89
  90. 90. Well formed and Valid The XML specification defines two levels of conformance for XML documents: well formed and valid. Well-formed documents are mandatory, while validity is optional. A well-formed document compiles with all the WC3 syntax rules of XML – like naming, nesting, and attribute quoting: – This guarantees that an XML parser can parse the document without error. A valid XML document references and satisfies a schema: – A schema is a separate document whose purpose is to define the legal elements, attributes, and structure of an XML document. Source: Mark Baker UPC PhD Course 2007 90
  91. 91. XML Example XML is a language used to represent structured documents or data electronically: • Note that order is important, but whitespace is not. Here is an example:<Article > <Headline>Direct Marketer Offended by Term Junk Mail </Headline> <authors> <author> Joe Garden</author> <author> Tim Harrod</author> </authors> <abstract>Dan Spengler, CEO of the direct-mail-marketing firm Mailbox of Savings, took umbrage Monday at the use of the term "junk mail." </abstract> <body type="url" > http://www.theonion.com/archive/3-11-01.html </body></Article> Source: Mark Baker UPC PhD Course 2007 91
  92. 92. XML by example<?xml version "1.0" ?><CML> <MOL TITLE="Water" > <ATOMS> <ARRAY BUITLIN="ELSYM" > H O H</ARRAY> </ATOMS> <BONDS> <ARRAY BUILTIN="ATID1" >1 2</ARRAY> <ARRAY BUILTIN="ATID2" >2 3</ARRAY> <ARRAY BUILTIN="ORDER" >1 1</ARRAY> </BONDS> </MOL></CML> Source: Mark Baker UPC PhD Course 2007 92
  93. 93. XML examples<?xml version="1.0" ?><rooms> <room name="Red"> <capacity>10</capacity> <equipmentList> <equipment>Projector</equipment> </equipmentList> </room> <room name="Green"> <capacity>5</capacity> <equipmentList /> <features> <feature>No Roof</feature> </features> </room></rooms> Source: Mark Baker UPC PhD Course 2007 93
  94. 94. Application Architectures XML HTML repository XML processing applications PDF Postscript VoiceXml WML Source: Mark Baker UPC PhD Course 2007 94
  95. 95. What are XML Technologies? Xpath – for identifying subsets of a document, used in XSL , Xquery and other XML-based languages. DTDs and XML Schema – for describing a dialect of XML. Xquery – language for querying XML documents. SOAP – for making remote procedure calls over XML: – SOAP is extremely important! Source: Mark Baker UPC PhD Course 2007 95
  96. 96. History of XML eXtensible Markup Language (XML): – Started by W3C in 1996,standardized in 1998. – Inherits many features from SGML: • Simpler, • Smaller specification, • Stricter. – Adopted and influenced by many outside of document community. Source: Mark Baker UPC PhD Course 2007 96
  97. 97. Parts of an XML documentDeclaration <?xml version "1.0" ?> Tags <CML> <MOL TITLE="Water" >Begin Tags <ATOMS>End Tags <ARRAY BUILTIN="ELSYM" > H O H</ARRAY> </ATOMS> <BONDS>Attributes <ARRAY BUILTIN="ATID1" >1 2</ARRAY> <ARRAY BUILTIN="ATID2" >2 3</ARRAY> <ARRAY BUILTIN="ORDER" >1 1</ARRAY> </BONDS> </MOL> </CML> Attribute Values Source: Mark Baker UPC PhD Course 2007 97
  98. 98. XML and Trees CML Tags give the structure of aRoot element document. They divide the document up MOL into Elements, starting at the top most element, the root element. The stuff inside an element is its content – content can ATOMS BONDS include other elements along with ‘character data’ (CDATA). ARRAY ARRAY ARRAY ARRAY CDATA sections HOH 12 23 11 Source: Mark Baker UPC PhD Course 2007 98
  99. 99. XML Examples<?xml version="1.0" ?><rooms> <room name="Red"> <capacity>10</capacity> <equipmentList> <equipment>Projector</equipment> </equipmentList> </room> <room name="Green"> <capacity>5</capacity> <equipmentList /> <features> <feature>No Roof</feature> </features> </room></rooms> Source: Mark Baker UPC PhD Course 2007 99
  100. 100. Rules for Well-Formed XML XML requires a document to obey the following rules: – There must be one element that contains all others. – All tags must be balanced. <BOOK>...</BOOK> <BOOK /> – Tags must be nested properly: <BOOK> <LINE> this is OK </LINE> </BOOK> <LINE> <BOOK> this is </LINE> definitely NOT </BOOK> OK – Text is case-sensitive so: <P> this is not ok, even though we do it all the time in HTML!</p> Source: Mark Baker UPC PhD Course 2007 100
  101. 101. More Rules for Well-Formed XML The attributes in a tag must be in quotes: – < ITEM CATEGORY=“Home and Garden” Name=“hoe-matic t500”> Comments are allowed: – <!– They are done just as in HTML… --> Must begin with: – <?xml version=‘1.0’ ?> Special characters must be escaped: the most common are : – < " > & • <formula> x &lt; y+2x </formula> • <cd title="&quot; music"> An XML document that obeys these rules is Well- Formed. Source: Mark Baker UPC PhD Course 2007 101
  102. 102. DTD – Document Type Definition A DTD is a schema for Xml data Xml protocols and languages can be standardized with DTD files A DTD says what elements and attributes are required or optional – Defines the formal structure of the language From Mark Baker UPC PhD Course 2007 102
  103. 103. DTD – An Example<?xml version=1.0?><!ELEMENT Basket (Cherry+, (Apple | Orange)*) > <!ELEMENT Cherry EMPTY> <!ATTLIST Cherry flavor CDATA #REQUIRED> <!ELEMENT Apple EMPTY> <!ATTLIST Apple color CDATA #REQUIRED> <!ELEMENT Orange EMPTY> <!ATTLIST Orange location ‘Florida’>-------------------------------------------------------------------------------- <Basket> <Basket> <Cherry flavor=‘good’/> <Apple/> <Apple color=‘red’/> <Cherry flavor=‘good’/> <Apple color=‘green’/> <Orange/> </Basket> </Basket> From Mark Baker UPC PhD Course 2007 103
  104. 104. DTD - !ELEMENT<!ELEMENT Basket (Cherry+, (Apple | Orange)*) > Name Children !ELEMENT declares an element name, and what children elements it should have Wildcards: – * Zero or more – + One or more From Mark Baker UPC PhD Course 2007 104
  105. 105. DTD - !ATTLIST <!ATTLIST Cherry flavor CDATA #REQUIRED> Element Attribute Type Flag <!ATTLIST Orange location CDATA #REQUIRED color ‘orange’> !ATTLIST defines a list of attributes for an element Attributes can be of different types, can be required or not required, and they can have default values. From Mark Baker UPC PhD Course 2007 105
  106. 106. DTD –Well-Formed and Valid <?xml version=1.0?> <!ELEMENT Basket (Cherry+)> <!ELEMENT Cherry EMPTY> <!ATTLIST Cherry flavor CDATA #REQUIRED> -------------------------------------------------------------------------------- Not Well-Formed Well-Formed but Invalid <basket> <Job> <Cherry flavor=good> <Location>Home</Location> </Basket> </Job> Well-Formed and Valid <Basket> <Cherry flavor=‘good’/> </Basket> From Mark Baker UPC PhD Course 2007 106
  107. 107. What is XML Schema? XML Schema is a definition language that allows you to constrain conforming XML documents to a specific vocabulary and hierarchical structure. The things you want to define in your language are element types, attribute types, and the composition of both into composite types (called complex types). XML Schema is analogous to a database schema, which defines the column names and data types in database tables. XML Schema became a W3C Recommendation (synonymous with standard) on May 5, 2001. From Mark Baker UPC PhD Course 2007 107
  108. 108. What Is XML Schema? Both the schema document and the instance document use XML syntax (tags, elements, and attributes). This was one of the primary motivating factors to replace DTDs, which did not use XML syntax. Having a single syntax for both definition and instance documents enables a single parser to be used for both. Referring back to our database analogy, the database schema defines the columns, and the table rows are instances of each definition. From Mark Baker UPC PhD Course 2007 108
  109. 109. Advantages of XML Schemas XML Schemas are more advanced than DTDs: – Enhanced datatypes, – Can roll your own datatypes, – Written in the same syntax as instance documents, – Object-oriented-ish, – Can express sets, – Can specify element content as being unique (keys on content) and uniqueness within a region, – Can define multiple elements with the same name but different content, – Can define elements with no content, – Can define substitutable elements. From Mark Baker UPC PhD Course 2007 109
  110. 110. What Do Schemas Look Like? An XML Schema uses XML syntax to declare a set of simple and complex type declarations: – A type is a named template that can hold one or more values: • Simple types hold one value, • Complex types are composed of multiple simple types. So, a type has two key characteristics: a name and a legal set of values. A simple type is an element declaration that includes its name and value constraints. Here is an example of an element called author that can contain any number of text characters: – <xsd:element name=”author” type=”xsd:string” /> The preceding element declaration enables an instance document to have an element like this: – <author> Mark Baker </author> From Mark Baker UPC PhD Course 2007 110
  111. 111. What Do Schemas Look Like? Notice that the type attributed in the element declaration declares the type to be xsd:string: – A string is a sequence of characters. There are many built-in data types defined in the XML Schema specification. If a built-in data type does not constrain the values the way the document designer wants, XML Schema allows the definition of custom data types. From Mark Baker UPC PhD Course 2007 111
  112. 112. XML Schemas are ExtensibleXML Schemas are extensible, just like XML,because they are written in XML.With an extensible schema definition you can:– Reuse your schema in other schemas,– Create your own data types derived from standard types,– Reference multiple schemas from the same document. From Mark Baker UPC PhD Course 2007 112
  113. 113. episodes.xsd <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="action" type="xs:string"/> <xs:element name="dialog"> <xs:element> used to declare elements <xs:complexType> <xs:simpleContent>keywords <xs:extension base="xs:string">must use <xs:attribute name="speaker" type="xs:string“ use="required"/>Schema </xs:extension> type of an element Thename </xs:simpleContent> is given by its contentspace </xs:complexType> or by the type attribute </xs:element> Elements and Attributes with textual <xs:element name="episode"> data become type xs:string <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element ref="dialog"/> <xs:element ref="action"/> </xs:choice> </xs:complexType> </xs:element> </xs:schema> From Mark Baker UPC PhD Course 2007 113
  114. 114. Predefined Simple TypesBoth Elements and Attributes have Types.You can specify a predefined simple type or makeyour own.XML Schema has a lot of built-in data types.Here are the most common types: – xs:string – xs:decimal – xs:integer – xs:boolean – xs:date – xs:time From Mark Baker UPC PhD Course 2007 114
  115. 115. Using Specific Simple Types Using type “integer” for the zip, ensures that no alpha-numeric characters are put in it (what about non-US countries!?): <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="Address"> <xsd:complexType> <xsd:sequence> <xsd:element name="Street" type="xsd:string"/> <xsd:element name="Apartment" type="xsd:string"/> <xsd:element name="Zip" type="xsd:integer"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> From Mark Baker UPC PhD Course 2007 115
  116. 116. Default and Fixed ValuesSimple elements can have a default value OR a fixed valuedeclared.A default value is automatically assigned to the element whenno other value is specified.In the following example the default value is 42:<xs:element name=“LifeAndUniverse" type="xs:integer" default=“42"/>A fixed value is also automatically assigned to the element;however, the XML file cannot specify another value.In the following example the fixed value is 42:<xs:element name=“LifeAndUniverse" type="xs:integer" fixed=“42"/> From Mark Baker UPC PhD Course 2007 116
  117. 117. Attributes<xs:element name="dialog"> The attribute declaration is part of the type of <xs:complexType> the element. <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="speaker" type="xs:string" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType></xs:element>… From Mark Baker UPC PhD Course 2007 117
  118. 118. Attributes<xsd:element name="cartoon"> Attribute list is part <xsd:complexType> of the type of the element. <xsd:sequence> <xsd:element ref="character" minOccurs="0" Default is given by the “use” maxOccurs="unbounded"/> attribute. </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required"/> <xsd:attribute name="genre" type="xsd:string" use="required"/> <xsd:attribute name="syndicated" use="required"> <xsd:simpleType> <xsd:restriction base="xsd:NMTOKEN"> <xsd:enumeration value="yes"/> <xsd:enumeration value="no"/> </xsd:restriction> </xsd:simpleType> If an attribute type is </xsd:attribute> more complicated than a basic type, then we spell </xsd:complexType> out the type in a type</xsd:element> declaration. From Mark Baker UPC PhD Course 2007 118
  119. 119. EEDC 34330Execution 1.4Environments for WebDistributedComputing servicesMaster in Computer Architecture,Networks and Systems - CANS basics
  120. 120. Web Services? Web Services are encapsulated, loosely coupled contracted functions offered via standard protocols where: – Encapsulated – implementation of the function is never seen from the outside – Loosely coupled – changing the implementation of one function does not require change of the invoking function – Contracted – there are publicly available descriptions of the function’s behavior, how to bind to the function, and its input and output parameters 120
  121. 121. Web Services Components XML – Extensible UDDI Markup LanguageWeb Services WSDL SOAP – Simple SOAP Object Access Protocol XML WSDL – Web HTTP FTP SMTP Services Definition Language XML normally carried UDDI – Universal using HTTP Discovery Description Integration 121
  122. 122. Introduction to Web Services Microsoft coined the term “Web services” in June 2000, when the company introduced Web services as a key component of its .Net initiative, – A new vision for embracing the Internet in the development, engineering and use of software. As others began to investigate Web services, it became clear that the technology could revolutionise distributed computing. Now, nearly every major vendor is marketing Web services tools and applications and Web services are radically changing IT architectures and partner relationships. Source: Mark Baker UPC PhD Course 2007 122
  123. 123. Introduction to Web Services Web services encompass a set of related standards that can allow any two computers to communicate and exchange data via a network, such as the Internet. The primary standard used in Web services is the Extensible Markup Language (XML) developed by the World Wide Web Consortium (W3C). Developers use XML tags to describe individual pieces of data, forming XML documents, which are text-based and can be processed on any platform. Source: Mark Baker UPC PhD Course 2007 123
  124. 124. Introduction to Web Services XML’s portability and its rapid adoption throughout the industry made it the obvious choice for enabling cross-platform data communication in Web services. XML provides the foundation for many core Web services standards: 1. SOAP, 2. WSDL, 3. UDDI, Almost every type of business can benefit from Web services such as: – Expediting software development, – Integrating applications and databases, – Automating transactions with suppliers, partners, and clients. Source: Mark Baker UPC PhD Course 2007 124
  125. 125. Introduction to Web Services SOAP (was originally called the Simple Object Access Protocol) is an XML vocabulary that lets programs on separate computers to interact across a network (via RPC). WSDL (Web Services Description Language) is another XML vocabulary that lets developers describe Web services and their capabilities in a standardized format. UDDI (Universal Description, Discovery and Integration) is a framework that defines XML-based registries where businesses can publish information about themselves and the services they offer. Source: Mark Baker UPC PhD Course 2007 125
  126. 126. Web Services 1. Client queries registry to 2 WSDL locate service. UDDI Docume 2. Registry refers client to WSDLRegistry nt document. 3. Client accesses WSDL document. 3 1 4. WSDL provides data to interact 4 with Web service. 5. Client sends SOAP-message 5 request. Client 6. Web service returns SOAP- Web message response. 6 Service Source: Mark Baker UPC PhD Course 2007 126
  127. 127. XML Messaging: SOAP SOAP 1.1 defined: – An XML envelope for XML messaging: • Headers + body. – An HTTP binding for SOAP messaging: • SOAP is “transport independent”. – A convention for doing RPC, – An XML serialization format for structured data. SOAP Attachments adds: – How to carry and reference data attachments using in a MIME envelope and a SOAP envelope. 127
  128. 128. What is SOAP? SOAP is a lightweight protocol for exchange of information in a decentralized, distributed environment using XML. 128
  129. 129. SOAP over HTTP The SOAP envelope as The HTTP header the HTTP payloadPOST /StockQuoteProj/servlet/rpcrouter HTTP/1.0Host: localhost:9081Content-Type: text/xml; charset=utf-8Content-Length: 469SOAPAction: ""<?xml version=1.0 encoding=UTF-8?><SOAP-ENV:Envelope xmlns:SOAPENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <ns1:getQuote xmlns:ns1=“http://tempuri.org/StockQuoteService”> <symbol xsi:type="xsd:string">IBM</symbol> </ns1:getQuote> </SOAP-ENV:Body></SOAP-ENV:Envelope> 129
  130. 130. SOAP Endpoint Reference85.34.235.95 80 /servlet/rpcrouter/getMessagePOST /servlet/rpcrouter HTTP/1.1Host: www.messages.comContent-Type: text/xml; charset="utf-8"Content-Length: nnnnSOAPAction: ""<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" <SOAP-ENV:Body> <ns1:getMessage xmlns:ns1="urn:NextMessage" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <UserID xsi:type="xsd:string">JDoe</UserID> <Password xsi:type="xsd:string">0JDOE0</Password> </ns1:getMessage> </SOAP-ENV:Body></SOAP-ENV:Envelope> 130
  131. 131. Web Services Description Language WSDL provides functional description of network services: – IDL description, – Protocol and deployment details, – Platform independent description,. – Extensible language. A short history: – WSDL v1.0, 9/2000, – WSDL v1.1 submitted to W3C 3/2001, – A de facto industry standard. 131
  132. 132. WSDL Structure portType: Service – Abstract definition of a service (set of operations) Port Port Multiple bindings per (e.g. http://host/svc) portType: Binding Binding (e.g. SOAP) – How to access it – SOAP, JMS, direct call portType Ports – Where to access it operation(s) inMesage outMessage Abstract interface 132
  133. 133. Using WSDL As extended IDL: WSDL allows tools to generate compatible client and server stubs: – Tool support for top-down, bottom-up and “meet in the middle” development. Allows industries to define standardised service interfaces. Allows advertisement of service descriptions, enables dynamic discovery and binding of compatible services: – Used in conjunction with UDDI registry Provides a normalised description of heterogeneous applications. 133
  134. 134. Summary: Core technologies used for WS XML SOAP – Simple Object Access Protocol – a framework for exchanging XML-based information in a network – the currently most hyped XML/Web service technology WSDL – Web Service Description Language – an XML-based language for describing network services – WSDL descriptions of capabilities and locations of services – like an interface description language for Web services – communication using SOAP or direct HTTP UDDI – Universal Description, Discovery, and Integration – provides a registry mechanism for clients and servers to find each other – uses SOAP for communication 134
  135. 135. EEDC 34330 1.4ExecutionEnvironments for RESTDistributed VersusComputingMaster in Computer Architecture,Networks and Systems - CANS SOAP (Homework)
  136. 136. REST OR SOAP? I am seeing a lot of new web services are implemented using a REST style architecture these days rather than a SOAP one. Imagine that you are Roy Fielding http://www.ics.uci.edu/~fielding/ 136
  137. 137. REST OR SOAP? Why Use "REST" Architecture for Web Services? 5You can use 2 minutes 137
  138. 138. Elevator Pitch An elevator pitch summary used to quickly and simply define a product, service, or organization and its value proposition. The name "elevator pitch“ reflects the idea that it should be possible to deliver the summary in the time span of an elevator ride, or approximately thirty seconds to two minutes. 138
  139. 139. Investors Your classmates are very important investors capture the attention of a potential investor! 139
  140. 140. INDIVIDUAL HOMEWORK 2Procedure for delivering1. Find the information2. Choose your argumentation3. Build the presentation – 3 minutes, ONLY! – FREE template, FREE number of slides4. Upload the presentation on to slideshare (or similar)5. Link your presentation to EEDC students website – Find the correct post and include a comment with the link the presentation6. Check that everything is ok before the deadline 140
  141. 141. Procedure for presenting homework1. Prepare the presentation and bring it to the class with your «pendrive» or similar – Optionally you could use the uploaded presentation2. three students will have the opportunity for take the elevator – The students will be chosen at random3. After the presentation investors will choose the must convincing presentation 141
  142. 142. 2n homework: SOAP vs REST Delivery deadline: – Monday 05/03/2012 at 11:00am Presentation: – Monday 05/03/2012 at 12:00am ( class room) 142
  143. 143. EEDC 34330Execution 1.6Environments for ServiceDistributedComputing LevelMaster in Computer Architecture,Networks and Systems - CANS Parameters
  144. 144. Some BASIC BASIC concepts Performance measurements – Load: • Clients “using” an application at a particular time • Client life-cycle is (web example): – Page request • 1 HTML page -> X requests for static/dynamic content – “Think time” while the page is read • The aggregate load for a large number of clients results in spikes – Type of load: • Active clients: – Issuing requests • Concurrent clients: – Active clients + clients connected but not issuing requests at the moment – Peak load: Maximum number of concurrent clients observed 144
  145. 145. Some BASIC BASIC concepts Throughput: – Number of “services”/jobs performed in a period of time – Can be measured in different units, depending of the level of abstraction • Responses / second • Sessions completed / second • ... • Jobs/second • … – Units are know as… • Hits/sec • Transaction rate • Page rate • … 145
  146. 146. Some BASIC BASIC concepts Performance measurement: Throughput curve Load 146
  147. 147. Some BASIC BASIC concepts Response time: – Time required to process a request – Covers the period of time in between the time the request is issued and the time when the response is received by the client – Commonly, in ms units 147
  148. 148. Some BASIC BASIC concepts 148
  149. 149. Example: The cost of Security SSL encryption protocol phases: • Connection establishment, with the associated key generation if necessary • Reusing of previously generated encryption keys Connection establishment can be accelerated: • Key generation (full handshake) • Key reusing (resumed handshake) Cost: • Full handshake: 200ms • Resumed handshake: 20ms (Pentium Xeon a 1,4Ghz) 149
  150. 150. Example: The cost of Security Performance impact can be easily calculated • 5 full handshakes/sec and CPU if the cost is 200ms!! 150
  151. 151. Example: The cost of Security Workarounds: • Dedicated hardware (SSL-offload, asymetric multiprocessors) • Admission control • resumed-handshakes first! • Set-up the server to increase the throughput in terms of sessions/sec • Big impact in the system performance! • Caution: what if we decrease the server TCP timeout? 151

×