O que é um Sistema Distribuído? Introdução aos Sistemas Distribuídos Um sistema distribuído consiste num conjunto de máquinas que trabalham de forma coordenada e conjunta para resolver um determinado problema. A comunicação é feita por troca de mensagens. SISTEMAS INFORMÁTICOS I, ENG. BIOMÉDICA SLIDES_9 Modelo Típico: Client-Server Exemplo Client-Server Client Request Network Server Client machine Result Server machine 1
Database s File Server DBMS Server TP Monitor Groupware Server Web s Desafios Sistemas Distribuídos Web Browser + HTML & Forms Web Browser + Java HTTP Over /IP Internet Server JSP HTML Documents Transparência Heterogeneidade Flexibilidade Tratamento de falhas Desempenho Escalabilidade Segurança Desenvolvimento de aplicações distribuídas Gestão de sistemas e aplicações distribuídas Integração de diferentes aplicações 2
O que é diferente?... Comunicação: Client-Server Latência na execução de procedimentos Semântica de falha bem diferente APIs de programação distribuída Client: initiates contact with server requests a service from the server, Web: client implemented in browser; e-mail: in mail reader Falta o conhecimento do estado global Relógios não sincronizados Eventos concorrentes /não-determinismo Server: provides requested service to client e.g., Web server sends requested Web page, mail server delivers e-mail Client-Server vs Peer-to-Peer Comunicação Distribuída usando Sockets 3
Networking Endereços IP s Layer Standard apps HTTP FTP Telnet User apps Transport Layer UDP Programming Interface: Sockets Network Layer IP Link Layer Device drivers /IP Stack (http,ftp,telnet, ) Transport (, UDP,..) Network (IP,..) Link (device driver,..) Every host on the Internet is identified by a unique, four-byte Internet Protocol (IP) v4 address IPv4: 4 bytes (32bits) today IPv6: 16 bytes (128bits) the future This is written in dotted quad format like 199.1.32.90 where each byte is an unsigned integer between 0 and 255. Endereços IP Endereços IP 4
Domain Name System (DNS) Numeric addresses are mapped to (and from) names like www.yahoo.com by DNS. Each site runs domain name server software that translates names to IP addresses and vice versa. DNS is a distributed protocol/service. Endereçamento de Sockets: IP address + Port For a process to receive messages, it must have an identifier Every host has a unique 32-bit IP address Q: does the IP address of the host on which the process runs suffice for identifying the process? Answer: No, many processes can be running on same host 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 FTP: 20,21 Telnet: 23 Exemplo Protocolos de Transporte service: connection-oriented reliable transport flow control congestion control. does not provide timing or bandwidth guarantee. UDP service: unreliable data transfer low latency. does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee 5
Protocolo Como funciona o? All connections are reliable, full-duplex point-to-point. A connection is a byte stream not a message stream. Byte stream means that message boundaries don't exist. The receiving process can't tell how the data was written by the sending process. Establishment and termination - setting up the connection. Sequencing of data. End-to-end reliability (checksums, acks, timeouts). Data is buffered at the layer, since it must be delivered to the application in reliable, sequenced chunks. Protocolo UDP Clients that have one request and one response use UDP Low startup overheads Example DNS Unreliable, does not refer to the presence of undetected errors Data integrity is guaranteed, but delivery and sequence is not. Many times used in non-critical services (e.g. timeof-day service; clock syncronization) Protocolo UDP UDP packets may be lost due to congestion in a router, lost due to buffer overrun in the receiver's buffer, and even duplicated. In all cases their is no indication given to the sending process Packets just disappear! Remember that UDP is: unreliable out-of-order delivery data sent in packets, not streams 6
Métricas a Considerar Data loss some apps (e.g., audio) can tolerate some loss other apps (e.g., file transfer, telnet) require 100% reliable data transfer Timing 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 ( apps ) make use of whatever bandwidth they get Características de Aplicações Data loss file transfer no loss e-mail no loss Web documents no loss real-time audio/video loss-tolerant stored audio/video loss-tolerant interactive games loss-tolerant instant messaging no loss Bandwidth audio: 5kbps-1Mbps video:10kbps-5mbps same as above few kbps up Time Sensitive no no no yes, 100 s msec yes, few secs yes, 100 s msec yes and no Aplicações de Internet e-mail remote terminal access Web file transfer streaming multimedia Internet telephony layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] proprietary (e.g. RealNetworks) proprietary (e.g., Dialpad) Underlying transport protocol or UDP typically UDP 7