Architectural Models CSE 513: Distributed Systems (System...
Transcript of Architectural Models CSE 513: Distributed Systems (System...
1
CSE 513: Distributed Systems(System Models)
Guohong Cao
Department of Computer & Engineering
310 Pond Lab
2
Architectural Models
• An architectural model simplifies and abstracts the functions of the individual components of a distributed system and then it considers– The placement of the components across a network of
computers
– The interrelationships between the components
• Process classification– Server process: a process that accepts requests from
other processes
– client process, peer process.
3
Software and hardware service layers• A distributed service can be provided by one or more
server processes, interacting with each other and with client processes to maintain a consistent view of the service’s resources, e.g., network time protocol
Guohong Cao ([email protected])
Middleware• Mask heterogeneity and provide a convenient
programming model– Implement communication and resource sharing to
support distributed applications. For example, naming, security, transactions, persistent storage, event notification.
– Provide building blocks for construction of software components
– Early packages: RPC, Isis– Recently, Object Management Group’s Common
Object Request Broker Architecture (CORBA), Java remote object invocation (RMI), Microsoft’s distributed common object model (DCOM).
5
Client-server model
• Servers can be clients, and clients can be servers.
6
Services provided by multiple servers
• Improve performance
• Increase reliability by replication
7
Proxy servers and cache
• Proxy servers are used to increase availability and performance of the service by reducing the load on the network and web-server
Guohong Cao ([email protected])
Peer processes
• All processes play similar roles. – Distributed whiteboard
9
Mobile code• An applets is responsible to communicate with the
server, also referred to as push model, in which the server instead of the clients initiates interaction.
10
Mobile Agents• A mobile agent is a running program that travels from one
computer to another carrying out a task to someone’s behalf, such as collecting information, eventually returning with the results. – Security
11
Network Computers and Thin Clients
• Network computers– The maintenance of the OS and application software for
desktop computer requires considerable efforts.– Network computer downloads its OS and application
software from the file server. • Low cost
• Thin clients– Supports a GUI while executing applications on a
remote computer– Low cost– Drawbacks: CAD and image processing may incur
network latencies.
Guohong Cao ([email protected])
Mobile devices and spontaneous networking
• Easy connection to a local network
• Easy integration with local services, how to discovery services.
13
Failure Models
• Fail stop: a process crashes and remains halted.
• Send-omission: a process completes a send, but the message is not in the outgoing buffer
• Receive-omission: a msg is put into a process’s incoming buffer, but that process does not receiveit.
• Omission (channel): a message is lost
• Arbitrary (Byzantine): Anything can happen.
14
CSE 513: Distributed Systems(Communication Network)
Guohong Cao
Department of Computer & Engineering
310 Pond Lab
15
OSI v TCP/IP
Guohong Cao ([email protected])
17
IPv4 Header
18
1.0.0.0 to 127.255.255.255A
32 BitsClass
HostNetwork0
128.0.0.0 to 191.255.255.255B HostNetwork10
192.0.0.0 to 223.255.255.255C HostNetwork110
224.0.0.0 to 239.255.255.255D Multicast address1110
240.0.0.0 to 247.255.255.255E Reserved for future use11110
This host0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Broadcast on the local network1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
A host on this network0 0 ….. 0 0 Host
Broadcast on a distant networkNetwork 1 1 1 1 ….. 1 1 1
Loopback test127 (Anything)
19
Domain Name Service (DNS)
• Map between IP addresses and machine names.
• Each organization has several name servers.
• DNS Hierarchy
com, edu, gov, mil, net, org, country code
for example: www.cse.psu.edu(130.203.30.5)
mail.cse.psu.edu (130.203.3.50)
Guohong Cao ([email protected])
User Datagram Protocol (UDP)
• Connectionless service for application level procedures– Unreliable
– Delivery and duplication control not guaranteed
• Reduced overhead– Used in real-time applications
– Network management
21
Transmission Control Protocol (TCP)
• Reliable ordered delivery– Implements congestion avoidance and control– Reliability achieved by means of retransmissions if necessary
• End-to-end semantics– Acknowledgements sent to TCP sender confirm delivery of data
received by TCP receiver– Ack for data sent only after data has reached receiver
• Cumulative acknowledgements– An acknowledgement acks all contiguously received data
• TCP assigns byte sequence numbers– For simplicity, people may use packet sequence numbers
22
TCP Header
23
Establishing a connection
Guohong Cao ([email protected])
socket()
bind()
listen()socket()
bind()
sendto()
read()write()
process request
blocks until dataReceived from client
data (request)
data (reply)
Client
Server
Connectionless protocol
socket()
bind()
listen()
accept()
socket()
connect()
write()
read()
read()
write()
process request
blocks until connectionfrom client connection establishment
data (request)
data (reply)
Client
Server
Connection-oriented protocol
26
Jini Technology
• Jini technology allows plug-and-participate
• The arrow indicate the different levels of communication that are required. – After the camera locates the printer service, to print
the picture it downloads and runs the java code supplied by the printing service.
– The code uses the underlying network transport, and perhaps RMI to implement the printing service
27
Jini Technology
Application
Java
OS
Network
Jini
Service
Java
OS
Network
Jini
networkprotocol
Java RMI
service protocol
Foreign service
bridge protocol
Camera PrinterPrinte picture
Guohong Cao ([email protected])
Jini system
• Enabling users to share services and resources over a network
• Providing users easy access to resource anywhere on the network while allowing the network location of the user to change
• Simplifying the task of building, maintaining, and altering a network of devices, software, and users.
29
Jini System
• Based on discovery/join protocol, lookup service, and Remote Method Invocation (RMI).
Application
Java
OS
Network
Jini
Service
Java
OS
Network
Jini
networkprotocol
Java RMI
service protocol
Foreign service
bridge protocol
30
Discovery
31
Join
Guohong Cao ([email protected])
Lookup
33
Service Invocation
34
Leasing and distributed system
• In non-distributed systems, resources are granted until explicitly freed or given up.
• Distributed system is complex, due to the failure of communication link or node.– Distributed system tend to be long lived. Shared by
many clients in an uncoordinated fashion, difficult to maintain.
– As the system lives longer, the unwanted information can grow out of bound.
– Resorting to manual cleanup.
35
Characteristics of leasing• A lease is a time period during which the grantor
(lookup service) ensures that the holder will have access to some resources.
• The lease can be cancelled by the holder.• The holder can request to renew the lease.
Negotiate with the granter• A lease can expire. • Time: widely distributed system
– Use duration instead of absolute time. Not cumulative in the way errors in absolute time. Consider the communication delay
Guohong Cao ([email protected])
Discovery and Join
• A distributed Jini system is called adjinn.
• A discovering entityis one or more objects that are in the process of obtaining reference to Jini lookup service
• A joining entityis one or more objects that is in the process of obtaining service from or exporting them to a djinn.
37
Discovery and Join
• The protocol is based IP networks
• The multicast request protocol is employed by entities that wish to discover nearby lookup services
• The multicast announcement protocol is provided to allow lookup service to advertise their existence
• A unicast discovery protocol makes it possible for an entity to communicate with a specific lookup service.
38
The multicast request protocol
39
Multicast request participants
Guohong Cao ([email protected])
Steps of the Discovery entity
1. It establishes a multicast request client, which can send packets to well-known multicast network endpoints
2. Establishes a TCP server socket that listens for incoming connection
3. Sends multicast request at periodic intervals (5s)
4. For each response, it adds the service ID to a list
5. Continues multicasting request for some time, then stop.
6. Finish if have received enough reference, otherwise, start using the multicast announcement protocol
41
Multicast request server
• Binds a datagram socket to a well-known multicast endpoint
• When a multicast request is received, use attached ID set to decide whether to respond.– No respond if own ID is in the list or it is not in the
requested group.
• If the entity must respond, Using unicast discovery protocol to connect to the other party’s multicast response server
42
Multicast Announcement
• The entity that runs the lookup service– constructs a object, send the multicast
– establish a server
– multicast announcement at intervals (120s). Long-live process.
• The entity that listen to the announcement– binds a datagram sokect to well-known multicast
endpoint, and listen
– For each announcement received, determine if it is in its own ID list.
43
Unicast discovery by a lookup service
• If a lookup service is responding to a multicast request, it makes TCP connection to that address and port
Guohong Cao ([email protected])
Unicast discovery by an entity
• If an entity wishes to obtain a reference to a given djinn, it makes TCP connection to that address and port specified by the lookup locator
45
Persistent State
• A service must maintain certain items of states. – Service ID
– A set of attributes that describe the service’s lookup service entry
– A set of specific lookup services to register with.
– A set of groups in with the service wishes to participate.
46
Join Protocol
• When a service initially starts up, it should pause a random amount of time (up to 15s).
• Initial discovery and registration– Perform unicast discovery of each lookup service and register
with them. In case of failure, retry or not retry
• Lease renewal and handling of communication problem– retry, or wait a subsequent multicast announcement
• Make changes and updates
47
Jini device bay could provide power, a network connection, and a processor running a JVM. Devices could be plugged into the bay and announce themselves to the bay.
48