Griglie ComputazionaliFile Transfer in Grids1 [email protected] INFN – CNAF Corso di...

57
Griglie Computazionali File Transfer in Grids 1 File Transfer in Grids [email protected] INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005

Transcript of Griglie ComputazionaliFile Transfer in Grids1 [email protected] INFN – CNAF Corso di...

Page 1: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 1

File Transfer in [email protected]

INFN – CNAF

Corso di Laurea specialistica in Informatica

Anno Acc. 2004/2005

Page 2: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 2

Outline• PART I: Transport Control Protocol (TCP)

• PART II: TCP: Controllo e prevenzione della congestione

• PART III: FTP

• PART IV: GridFTP

• References

Page 3: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 3

PART ITransport Control Protocol

Page 4: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 4

Caratteristiche generali• Viene creata una connessione virtuale tra mittente e destinatario

attraverso lo scambio di informazioni di controllo (fase di call set-up).

• La creazione della connessione è seguita dalla fase di trasferimento dati vera e propria. Durante la trasmissione il protocollo TCP continua a scambiare informazioni di controllo. La connessione e’ di tipo bidirezionale: una direzione viene utilizzata per scambiare i byte di informazione utile (mittente destinatario), mentre la direzione opposta viene utilizzata per lo scambio di informazione di controllo (destinatario sorgente)

• Per le applicazioni di natura interattiva in cui deve essere minimizzato il ritardo di ricezione delle unità di dato (e.g. telnet), viene forzato l’invio di pacchetti non appena è disponibile qualche byte di informazione (meccanismo di data push)

Page 5: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 5

Send e receive buffer• Si dice “buffer” un’area della memoria dell’applicazione che contiene i dati da

scambiare tra mittente e destinatario. I dati vengono mano mano copiati - in unità di memoria di dimensione configurabile da parte di una applicazione - nell’area di memoria del sistema operativo attraverso la system call write().

Per ottimizzare il rapporto tra le informazioni di controllo poste nell’intestazione e la quantità di byte di dati disponibili nell’area data, un dato messaggio vene inviato soltanto nel momento in cui la parte di dati disponibile nel buffer eccede una data soglia configurabile.

• Send buffer: area di memoria in cui TCP pone i messaggi in attesa di trasmissione; il send buffer è anche detto “send socket buffer”.

• Receive buffer: area di memoria del sistema operativo in cui TCP pone i messaggi ricevuti; il receive buffer è anche detto “receive socket buffer”

• Per ogni nuova connessione vengono allocati una nuova coppia di send e receive buffer

Page 6: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 6

Send e receive buffer (cont)

dati dati

Applicazione 1 Applicazione n

...

Connessione 1

Connessione n

SEND SOCKET

RECEIVE SOCKET

write() write()

AREE DI MEMORIA DELLE APPLICAZIONI

AREA DI MEMORIA DELLE SISTEMA OPERATIVO

Page 7: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 7

Segmento

• Viene definita segmento la parte dati di una unita’ di trasmissione del protocollo TCP .

• Viene definito messaggio l’unione del segmento e dell’intestazione TCP.

• La dimensione massima di un segmento e’ pari alla dimensione massima del pacchetto IP, esclusi i byte dell’intestazione TCP e IP. Essa viene definita Maximum Segment Size (MSS):

MSS = MTU – sizeof(TCP header) – sizeof(IP header)

Intestazione TCPdati

SEGMENTO TCP

MESSAGGIO TCP

Page 8: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 8

Intestazione TCP: formatoSource port Destination port

Sequence number

Acknowledgement number

Offset Reserved Code Window

Checksum Urgent pointer

Options Padding

Data

...0 8 16 31

Source/destination port: identificazione dell’applicazione mittente/ricevente attive rispettivamente sul nodo mittente IP_source e nodo destinatario IP_destSequence number: numero di sequenza del primo byte del campo Data nell’ambito del flusso di byte generati dalla sorgente (ne identifica la posizione)Acknowledgement number: numero di sequenza del primo byte di dati atteso. Tale numero corrisponre al numero di sequenza successivo al numero di sequenza dell’ultimo segmento correttamente ricevuto. Il numero di sequenza si riferisce al flusso generato nel senso opposto del traffico (gli ackknowledgement sono generati sempre dal ricevente di un dato stream e quindi viaggiano nel senso inverso del flusso dati).

Page 9: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 9

Intestazione TCP: formato (cont)Offset: indica la dimensione della porzione Data del segmento TCPReserved: campo non specificato, riservato ad usi futuriCode: codice che identifica la funzione del segmento (e.g. Segmento di apertura di una connession: SYN, segmento di chiusura: FIN, segmento dati, segmento che include esclusivamente informazione di acknowledgement URG: urgent pointer set, il segmento non è soggetto a buffering al lato ricevente ACK: campo ACK valido PUSH: il segmento non è soggetto a buffering al lato mittente RST: reset della connessione SYN: synchronize sequence numbers FIN: il mittente ha raggiunto la fine del byte stream generato dalla

applicazioneWindow: il mittente/ricevente comunica al ricevente/mittente la quantità di memoria disponibile per momorizzare datiOptions: le opzioni servono per scambiare specifici elementi di informazione tra mittente e destinatario, come il Maximum Segment Size (la massima dimensione del segmento che può essere accettata)Checksum: controllo d’errore applicato alla sola intestazione TCP (non alla parte data), per il calcolo del codice di controllo d’errore si assume che il campo checksum contenga una stringa di 0

Page 10: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 10

Multiplexing di connessioni• Il multiplexing di connessioni consiste nella possibilita’ di stabilire molteplici

connessioni TCP concorrenti in trasmissione o ricezione in un dato nodo.A questo scopo, vengono utilizzate le porte TCP: ogni punto terminale di una

connessione in un dato host H e’ definito da un coppia di identificatori detta socket cosi’ formata:

Socket = (TCP port, IP address(H))Dunque una connessione TCP tra due nodi H1 e H2 e’ identificata dalla coppia di

socket:

Connessione = ( TCP source port, add(H1), TCP destination port, add(H2) )Dunque in un dato istante un socket puo’ essere utilizzato da piu’ di una connessione:

es. il socket associato ad un www server o ad un ftp server.

131.154.3.41

131.154.3.1

131.154.3.10Sock2=(port2, 131.154.3.41)

Sock1=(port1, 131.154.3.1)

Sock3=(port3, 131.154.3.41)Sock4=(port4, 131.154.3.10)

Sock5=(port5, 131.154.3.10)

conn1

conn2

conn3

Conn1=(sock1, sock4)Conn2=(sock2, sock4)Conn3=(sock3, sock5)

Page 11: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 11

Positive acknowledgement

P1 P2 P3 P4 P4 P5

ACK(s1+1) ACK(s2+1) ACK(s3+1) ACK(s3+1) ACK(s3+1)

timeout t

t

Sn: numero di sequenza dell’ultimo byte dell’n-esimo messaggio; il numero di sequenzaIniziale del primo byte nel flusso di dati viene definito in fase di call set-up

Svantaggio: ritardo tra la trasmissione di un messaggio e il successivo derivante dall’attesadell’acknowledgement

s1P1

s2P2

s3P3

s4P4

s5P5

Numero di sequenza del byteMITTENTE

RICEVENTE

ACK duplicati

Page 12: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 12

Sliding window• Ottimizzazione dell’algoritmo di positive acknowledgement in cui il mittente e’

autorizzato ad inviare m pacchetti (n byte) prima di porsi in attesa della ricezione dell’acknowledgement relativo al primo messaggio inviato.

• n rappresenta la dimensione della window, ovvero la quantita’ di dati che il mittente e’ autorizzato ad inviare dopo essersi posto in attesa dell’ack del primo messaggio della window stessa

• Nel caso in cui il tempo che intercorre tra l’invio del primo messaggio e la ricezione del relativo acknowledgement sia piccolo, il mittente può inviare dati in modo continuativo senza mai sperimentare periodi di inattività che limitano le prestazioni dell’applicazione.

• Il fenomeno contrario, in cui il mittente trascorre la maggior parte del tempo attendendo la ricezione dell’ack (per esempio su connessioni ad elevato tempo di propagazione, come nelle connessioni satellitari) viene detto: stop-and-wait.

• Il ricevente deduce la presenza di un messaggio perso nel caso in cui ack(Sn) non sia ricevuto entro un intervallo prestabilito, al termine del quale si procede con la ritrasmissione. La durata ottimale di tale timeout viene determinata stimando la media e la variazione del ritardo che intercorre tra la trasmissione di un messaggio e la ricezione del corrispondente acknowledgement (Round Trip Time)

Page 13: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 13

Sliding window (cont)

P1 P2

100by

P3 P4 P5 P6

ACK(s1) ACK(s2) ACK(s3) ACK(s4) ACK(s5)

timeout t

t

Sn: numero di sequenza dell’ultimo byte dell’n-esimo messaggio; il numero di sequenzaIniziale del primo byte nel flusso di dati viene definito in fase di call set-up

Ipotesi: ogni messaggio ha lunghezza costante di 100 by, la dimensione della window e’costante e pari a 400 by.

200by 300by 400by by

ACK(s3)

500by 600by 700by

P4 P5

ACK(s3)

800by

P6 P7 P5

ACK(s6) ACK(s7)

Page 14: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 14

Terminologia

• 1: sequence number vecchi che hanno già ricevuto un acknowledgement• 2: sequence number che non hanno ancora ricevuto un acknowledgement• 3: sequence number di pacchetti che non sono stati ancora trasmessi ma che posono essere

trasmessi essendo essi all’interno della window (SEND WINDOW)• 4: sequence number futuri relativi a dati che non possono essere trasmessi, essendo essi

esterni alla window

• 1: sequence number di pacchetti di cui è già stato inviato l’ack• 2: spazio di memoria disponibile per la ricezione di nuovi dati (RECEIVE WINDOW)• 3: sequence number futuri che non sono ancora ammessi

Byte sequence number1 2 3 4

AL LATO MITTENTE:

AL LATO RICEVENTE:

Byte sequence number

windowsend windowacked not acked

1 2 3receive windowacked Seq number non ancora autorizzati

Page 15: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 15

Terminologia (cont)

• offered window: la dimensione della finestra segnalata dal ricevente. L’offered window varia nel tempo, il valore massimo equivale alla dimensione di memoria disponibile per la memorizzazione di dati.

• Usable window: min [send window, offered window]

Page 16: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 16

PART IITCP: Controllo e prevenzione della congestione

Page 17: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 17

Controllo della congestione

• Per scoprire la presenza di un punto di congestione sul cammino di collegamento di due end-node, utilizzando un metodo che NON introduca traffico di monitoraggio aggiuntivo, può essere sufficiente effettuare una stima del ritardo di propagazione di un messaggio sul cammino (mittente destinatario mittente): RTT (Round Trip Time)

• Acknowledgement: messaggio inviato dal destinatario alla sorgente per segnalare che un dato messaggio Mi e’ stato ricevuto correttamente

• Data una stima del round trip time RTT, se dopo RTT sec ack(Mi) non e’ stato ancora ricevuto si assume che Mi sia stato perso e si procede con la ritrasmissione e la fase di controllo della congestione

Page 18: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 18

Meccanismi di controllo di flusso

• Si dividono in due gruppi:– Congestion control (implementato dall’algoritmo “slow start”), serve per

fronteggiare situazioni di congestione grave, ovvero quando scade il timeout al lato mittente. E’ caratterizzato da un incremento esponenziale della usable window.

– Congestion avoidance viene adottato in assenza di congestione grave, ovvero solo in presenza di acknowledgement duplicati. Permette un incremento graduale della usable window (lineare)

Page 19: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 19

Congestion Control (Slow Start) e Congestion Avoidance: meccanismo di base

Slow Start Congestion Avoidance

Connection opening : cwnd = 1 segment

Exponential increase for cwnd until cwnd = SSTHRESH

cwnd = SSTHRESHAdditiveincrease for cwnd

Retransmission timeoutSSTHRESH:=cwnd/2cwnd:= 1 segment

Retransmission timeout SSTHRESH:=cwnd/2

•Exponential increase for cwnd :for every useful acknowledgment received, cwnd := cwnd + (1 segment size)

•Additive increase for cwnd : for every useful acknowledgment received, cwnd := cwnd + (segment size)*(segment size) / cwnd it takes a full window to increment the window size by one.

Page 20: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 20

CONGESTION CONTROL

Page 21: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 21

Slow startTCP entra nella fase slow start ogni volta che viene riscontrata la perdita di un messaggio

(cioè come conseguenza dello scadere di un timeout). TCP è nella fase di Slow start anche inizialmente, in apertura della connessione, e ogni qual volta una connessione TCP viene riattivata dopo un periodo di pausa

La fase slow start serve per limitare il numero di pacchetti in transito tra la sorgente e il destinatario in presenza di congestione oppure inizialmente, quando deve essere ancora determinata la frequenza di trasmissione dei pacchetti ottimale, per incrementare in modo graduale la frequenza di trasmissione

IMPLEMENTAZIONE: viene utilizzata una variabile chiamata “congestion window” (indicata con la sigla: cwind). Cwind è un parametro il cui valore varia durante le varie fasi di un trasferimento TCP secondo le seguenti regole:

• all’inizio e per ogni restart di una trasmissione: cwind=1 ack ricevuto: cwind=cwind+const (e.g. const=1)• Usable Window = min (cwind, RCV advertized window)

Il tempo necessario affinché cwind raggiunga una ampiezza pari a W (supponendo che W sia espresso in pacchetti) varia secondo la regola:

time = RTT * log2 W

CONGESTION CONTROL

Page 22: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 22

Slow Start (cont)• Vantaggi:

– non vengono inviati burst (=sequenze di pacchetti affiancati) che peggiorano la situazione di congestione nei colli di bottiglia della rate e nei router che iniettano traffico da una interfaccia I di input ad una di output O, dove

capacita(I) > capacita(O)

• Svantaggi:– Poiché la window viene ridotta di dimensione in presenza di congestione, in caso

di elevata percentuale di pacchetti persi (packet loss) la connessione non è mai in grado di sfruttare pienamente la banda disponibile su alcuni tratti della rete

– In caso di connessioni ad alto tempo di propagazione (RTT >>, per esempio su link satellitari, in cui il tempo di propagazione e’ la componente più significativa della latenza end-to-end), la durata della fase slow start è considerevole, con un conseguente calo delle prestazione e una latenza superiore necessaria per raggiungere uno stato di “equilibrio”

CONGESTION CONTROL

Page 23: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 23

P1

t

P2 P3

Ack(P1)Cwin=2Cwin=1

Ack(P4)Cwin=5

Ack(P5)Cwin=6

Ack(P6)Cwin=7

Ack(P7)Cwin=8

P8 P9 P10 P11 P12 P13 P14 P15

t

Ack(P2)Cwin=3

Ack(P3)Cwin=4

P4 P5 P6 P7

t

RTTPacket Time: intervallo di tempo fra 2 pacchetti consecutivi

Esempio

Ack(P8)Cwin=9

CONGESTION CONTROL

Page 24: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 24

CONGESTION AVOIDANCE

Page 25: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 25

Congestion avoidance• TCP si trova nella fase di congestion avoidance quando raggiunge una situazione di

equilibrio (cioè TCP non è soggetto a perdita di pacchetti). In questa fase TCP tenta ancora di aumentare il parametro cwind allo scopo di verificare la possibilità di aumentare la frequenza di trasmissione dei pacchetti per raggiungere la MASSIMA frequenza trasmisssiva ammessa dai link di collegamento presenti nel cammino tra la sorgente e il destinatario.

• AUMENTO DELLA FREQUENZA TRASMISSIVA: Nella fase di congestion avoidance il parametro cwind viene aumentato in modo più lento e

graduale, per esempio facendo in modo che anziché incremenatare esponenzialmente nel tempo (come nella fase di slow start), l’aumento sia lineare.

In fase slow start: ack ricevuto, cwind=cwind+const

In fase di congestion avoidance: ack ricevuto, cwind = cwind + const/cwind

1. const = 1 // se cwin espresso in numero di segmenti2. const = MSS*MSS // cwin espresso in byteovvero ad ogni scadere di 1 RTT, cwind aumenta all’incirca di 1 messaggio. Lo scopo e’ quello di

evitare la sovrastima della banda disponibile per non entrare nuovamente nella fase di slow start.

CONGESTION AVOIDANCE

Page 26: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 26

Congestion avoidance (cont)• DIMINUZIONE DELLA FREQUENZA TRASMISSIVA:

1. In presenza di ack duplicati (ack del medesimo sequence number Si) la window size viene ridotta secondo la regola moltiplicativa:

cwindi = d * cwindi-1 (d < 1, e.g. 1/2)

cwind e’ espresso in byte2. In presenza di un timeout che scade si passa alla fase di slow start:

cwind=1

In caso di congestione persistente la formula al punto 1. produce un effetto di decrescita esponenziale nel tempo del parametro (essendo applicata ad ogni messaggio iterativamente)

Anche in fase di congestion avoidance, in ogni istante:

W = min(cwind, RCV advertized win)

CONGESTION AVOIDANCE

Page 27: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 27

• Come si passa dalla fase di congestion control a quella di congestion avoidance e viceversa?Si utilizza una variabile (threshold T) tale che:

– Inizialmente T=64 KB

– Se cwind < T: TCP in fase di slow start (congestion control)

– Se cwind T: TCP in fase di congestion avoidance

• Quando si passa dalla fase di congestion avoidance a quella di congestion control?Al lato mittente ogni qual volta scade un timeout, il parametro T viene

dimezzato: T := cwind/2, e cwind=1

A questo punto comincia la fase di slow start.

CONGESTION AVOIDANCE CONGESTION CONTROL

Page 28: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 28

Slow start e congestion avoidance: esempio

Cwnd average of the last 10 samples.

Cwnd average over the life of the connection to that point

Slow start Congestion Avoidance

SSTHRESH

•Slow start : incremento rapido di cwnd•Congestion Avoidance : incremento piu’ lento della cwnd

Page 29: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 29

Infulenza del parametro threshold T sulle prestazioni

SSTHRESH = 730Kbyte

SSTHRESH = 1460Kbyte

Slow start

Congestion avoidance

Durante la fase di congestion avoidance e in assenza di perdite di paccheti, cwnd incrementa di un segmento per ogni RTT. Nel nostro caso, essendo tutti i pacchetti ricevuti correttamente, la window incrementa di 1460 byte (supponendo una MTU di 1500 by) ogni 175 ms.

Se la cwnd e’ pari a 730 kbyte, sono necessari almeno 4 minutes per ottenere una cwnd piu’ larga dek prodotto bandwidth*delay (nel nostro esempio pari a 2,65 MByte). In altri termini, sono necessari almeno 4 min per ottenere un pieno utilizzo della banda.

Page 30: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 30

PART IIIFile Transfer Protocol

Page 31: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 31

Objectives of the Protocol

• (FROM RFC 959, Oct 1985) The objectives of FTP are:

1. to promote sharing of files (computer programs and/or data),

2. to encourage indirect or implicit (via programs) use of remote computers,

3. to shield a user from variations in file storage systems among hosts (FTP, though usable directly by a user, is designed mainly for use by programs and consequently variations can be operated through FTP by programs),

4. to transfer data reliably and efficiently.

Page 32: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 32

Collective

File Transfer Protocol

Application

Fabric

Connectivity

Resource

InternetTransport

Application

Link

Inte

rnet P

roto

col

Arch

itectu

re

Grid Architecture

Internet Architecture

(Grid)FTP

Page 33: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 33

Network Enabled Services: the Protocol Stack

• All services require protocols

• Not all protocols are used to provide services (e.g. IP, TLS)

• Examples: FTP and Web servers

Web Server

IP Protocol

TCP Protocol

TLS Protocol

HTTP Protocol

FTP Server

IP Protocol

TCP Protocol

FTP Protocol

Telnet Protocol

Page 34: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 34

History

• FTP has had a long evolution over the years:– 1971 (RFC 114): the first proposed file transfer mechanisms in 1971 that

were developed for implementation on hosts at M.I.T.

– 1972 (RFC 354): The File Transfer Protocol was now defined as a protocol for file transfer between HOSTs on the ARPANET, with the primary function of FTP defined as transferring files efficiently and reliably among hosts and allowing the convenient use of remote file storage capabilities.

– 1973 (RFC 542): new “official” specification

– 1980 (RFC 765): specification of FTP for use on TCP

– ...

– 2003: GridFTP: Protocol Extensions to FTP for the Grid

– 2004: GridFTP v2 Protocol Description

Page 35: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 35

The FTP Model 1: User-to-Server

Server ProtocolInterpreter

Server DataTransfer Protocol

User ProtocolInterpreter

User DataTransfer Protocol

FTP Commands

FTP Replies

Connection

Data

File System File System

User Interface UserServer-FTP

User-FTP

A user wishes to transfer files between two hosts, of which one is a local host.

Page 36: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 36

The FTP Model 2: Server-to-Server

FTP Commands

FTP Replies

Connection

Data

Server-FTP“A”

Server-FTP“B”

User-FTPand

User-PI“C”

A user might wish to transfer files between two hosts, neither of which is a local host.

The user sets up control connections to the two servers and then arranges for a data connection between them.

Control information is passed to the user-PI but data is transferred between the server data transfer processes.

FTP Commands

FTP Replies

Page 37: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 37

Server and User-FTP

Server ProtocolInterpreter

Server DataTransfer Protocol

User ProtocolInterpreter

User DataTransfer Protocol

FTP Commands

FTP Replies

Connection

Data

File System File System

User Interface

User

Server-FTP

User-FTP

Server-FTP: a process or set of processes which perform the function of file transfer in cooperation with a user-FTP process and, possibly, another server. The functions consist of a protocol interpreter (PI) and a data transfer process (DTP)

User-FTP: A set of functions including a protocol interpreter, a data transfer process and a user interface which together perform the function of file transfer in cooperation with one or more server-FTP processes. The user interface allows a local language to be used in the command-reply dialogue with the user.

Page 38: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 38

Data Transfer Protocol

Server ProtocolInterpreter

Server DataTransfer Protocol

User ProtocolInterpreter

User DataTransfer Protocol

FTP Commands

FTP Replies

Connection

Data

File System File System

User Interface

User

Server-FTP

User-FTP

Data Transfer Protocol: establishes and manages the data connection, it can be passive (if the protocol waits for incoming connections) or active (if it requests the opening of a connection).

Data Port: The passive data transfer process "listens" on the data port for a connection from the active transfer process in order to open the data connection.

Page 39: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 39

Control and Data Connections

Server ProtocolInterpreter

Server DataTransfer Protocol

User ProtocolInterpreter

User DataTransfer Protocol

FTP Commands

FTP Replies

Connection

Data

File System File System

User Interface

User

Server-FTP

User-FTP

Control connection: The communication path between the USER-PI and SERVER-PI for the exchange of commands and replies. This connection follows the Telnet Protocol. It is based on the TCP protocol.

Data connection: A full duplex connection over which data is transferred, in a specified mode and type. The data transferred may be:- a part of a file, -an entire file or -a number of files. The path may be between a server-DTP and a user-DTP, or between two server-DTPs. It is based on the TCP protocol.

Page 40: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 40

Commands and Replies

Server ProtocolInterpreter

Server DataTransfer Protocol

User ProtocolInterpreter

User DataTransfer Protocol

FTP Commands

FTP Replies

Connection

Data

File System File System

User Interface

User

Server-FTP

User-FTP

FTP Commands: a set of commands that comprise the control information flowing from the user-FTP to the server-FTP process.

Reply: an acknowledgment (positive or negative) sent from server to user via the control connection in response to FTP commands. The general form of a reply is a completion code (including error codes) followed by a text string. The codes are for use by programs and the text is usually intended for human users.

Page 41: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 41

Set-up of an FTP Session (1/2)

Server ProtocolInterpreter

Server DataTransfer Protocol

User ProtocolInterpreter

User DataTransfer Protocol

FTP Commands

FTP Replies

Connection

Data

File System File System

User Interface

User

Server-FTP

User-FTP

1. In this model, the user-protocol interpreter initiates the control connection. The control connection follows the Telnet protocol.

2. The FTP commands specify the parameters for the data connection (data port, transfer mode, representation type, and structure) and the nature of file system operation (store, retrieve, append, delete, etc.).

Page 42: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 42

Set-up of an FTP Session (2/2)

Server ProtocolInterpreter

Server DataTransfer Protocol

User ProtocolInterpreter

User DataTransfer Protocol

FTP Commands

FTP Replies

Connection

Data

File System File System

User Interface

User

Server-FTP

User-FTP

3. The user-DTP or its designate should "listen" on the specified data port, and the server initiate the data connection and data transfer in accordance with the specified parameters.

The data port need not be in the same host that initiates the FTP commands via the control connection, but the user or the user-FTP process must ensure a "listen" on the specified data port.

4. The data connection may be used for simultaneous sending and receiving.

Page 43: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 43

Data Connection Parameters

• Files are transferred only via the data connection. The control connection is used for the transfer of commands, which describe the functions to be performed, and the replies to these commands (see the Section on FTP Replies).

• Data transfer commands include:– MODE command which specify how the bits of the data are to be

transmitted,

– STRUcture and TYPE commands: which are used to define the way in which the data are to be represented.

Page 44: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 44

Data Representation

• Data is transferred from a storage device in the sending host to a storage device in the receiving host. Often it is necessary to perform certain transformations on the data because data storage representations in the two systems are different.

• For example, data storage representations of Network Virtual Terminal ASCII (telnet protocol):– five 7-bit ASCII characters, left-justified in a 36-bit word

– four 9-bit characters in a 36-bit word.

• It is desirable to convert characters into the standard NVT-ASCII representation when transmitting text between dissimilar systems. The sending and receiving sites would have to perform the necessary transformations between the standard representation and their internal representations.

Page 45: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 45

Structures

• FILE STRUCTURE – File structure is the default to be assumed if the STRUcture command has

not been used. In file-structure there is no internal structure and the file is considered to be a continuous sequence of data bytes.

• RECORD STRUCTURE – Record structures must be accepted for "text" files (i.e., files with TYPE

ASCII or EBCDIC) by all FTP implementations. In record-structure the file is made up of sequential records.

• PAGE STRUCTURE – To transmit files that are discontinuous, FTP defines a page structure. Files

of this type are sometimes known as "random access files“. In these files there is sometimes other information associated with the file as a whole (e.g., a file descriptor), or with a section of the file (e.g., page access controls), or both. In FTP, the sections of the file are called pages. To provide for various page sizes and associated information, each page is sent with a page header.

Page 46: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 46

PARTGridFTP

Page 47: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 47

Grid Data Needs

• Transfer of large amounts of data (petabytes or terabytes) between storage systems

– Striping across multiple servers to improve performance

– Network traffic load balancing

• Access to large amounts of data (terabytes or gigabytes) by many geographically distributed applications and users for analysis, visualization, etc. Issues:

– Lack of a common protocol to access data (only multiple incompatible APIs are available)

– Authentication and authorization

– Management of consistency between different replicas of the same file

– Location of multiple file replicas

– Selection of best file replica

Page 48: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 48

Requirements• Grid Security Infrastructure (GSI) and Kerberos support

• Third-party control of data transfer (e.g. data exchange driver by schedulers)

• Parallel data transfer: multiple TCP streams between two given end-points

• Striped data transfer

• Partial file transfer

• Automatic negotiation of TCP buffer/window size

• Support for reliable/recoverable data transfer

• GridFTP extends standards with: additions to security extensions, partial file transfer, parallel/striped transfer, TCP buffer/window size tuning

Page 49: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 49

Grid Security Infrastructure and Kerberos

• Authentication, integrity and confidentiality features are critical

when transferring or accessing files.

• GridFTP supports both GSI and Kerberos autenitcation.

• User-controlled setting of various levels of data integrity and

or/confidentiality on the data channel:

– No authentication

– Self authentication (the identity of the remote data connection has to be the

same as the identity of the user which authenticated to the control

connection)

– Subject-name authentication (the identity of the remote data connection must

match the supplied subject-name)

Page 50: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 50

Third-party control of data transfer and TCP buffer tuning

• Third-party control:– in order to manage large data sets, it is necessary to provide third-party

control of transfers between storage servers.

– GridFTP provides this capability by adding GSSAPI security to the existing third-party transfer capability defined in the FTP standard

• Manual control of TCP buffer size:– In order to achieve optimize bandwidth with TCP/IP, the protocol needs

support for automatic buffer size tuning

– A specific command “SBUF” (set buffer size) is introduced

– The “Autonegotiate buffer size” (ABUF) command allows the invocation of an algorithm to determine and set the TCP buffer size (any algorithm can be chosen)

Page 51: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 51

Parallel data transfer• On wide-area links, using multiple TCP streams can improve

aggregate bandwidth over using a single TCP stream.

• This is required both between a single client and a single server, and between two servers.

• GridFTP supports this through extensions to the commands and the data channel. In particular:– It can be controlled how many parallel data connections may be established

to each destination data node: fixed level and variable level (where the number of connections varies according to the network performance)

– Starting-parallelism: the data connections are enabled by the server-ftp

– Miximum-parallelism: the number of open data connections is reduced to the specified minimum

– Maximum-parallelism: the number of open data connections is increased up to the specified maximum

S1 D1

Page 52: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 52

Striped Data Transfer• Data is partitioned across multiple servers, in order to improve aggregate

bandwidth. There are one or more TCP streams between M network end-points on the sending side and N network end-points on the receiving side.

• The end-point is called “data node”.

• Layout option issued by the source data node: – Partitioned: a partitioned data layout is one where the data is distributed evenly on the

destinatio ndata nodes. Only one contiguous section of data is stored on each data node.

– Blocked: the data is distributed in round-robin fashion over the destination data nodes

S1 D1

S2 D2

D3

M N

Data nodes

Data nodes

Page 53: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 53

Striped Data Transfer (cont)

• New commands:– SPAS: Striped Passive

• allows an array of host/port connections to be RETURNED

• Multiple end-points (multihomed hosts or multiple hpsts9participate in the transfer

– SPOR: Striped Port

• Allows an array of host/port connections to be SENT

Page 54: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 54

Partial file transfer and reliable data transfer

• Partial file transfer:– Standard FTP requires the application to:

• transfer the entire file, • Or the remainder of a file starting at a particular offset.

– GridFTP introduces new FTP commands to support transfers of regions of a file.

• Reliable data transfer:– Fault recovery methods for handling transient network failures, server

outages etc.– The FTP standard includes basic features for restarting failed transfer that

are noo widely implemented.– GridFTP to these features, for example by supporting:

• Automatic retry• Re-scheduling of a transfer fo a later time• Switching to alternate soruces by means of a replica catalog

Page 55: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 55

Integrated instrumentation (1/2)• The protocol calls for restart and performance markers to be sent

back. It is not specified how often, but it would be important to give the possibility to specify this parameter

• Restart: the command is issued by the client and it indicates the byte ranges whose transfer needs to be restarted. – Byte ranges which have been succesfully stored to disk are recorded and

notified to the client;

– Complete restart marker: a concatenation of all ranges received by the data server on the control channel. It is computed by the client by aggregating contiguous ranges.

– The client requests a restart by specifying for what byte ranges the transfer needs to be restarted.

Data server Client1. Byte ranges

2. Restart (complete restart marker)

Page 56: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 56

Integrated instrumentation (2/2)

• The performance response of a server is extende by adding the following pieces of information:– Timestamp: time at which the server computed the performance

information;

– Stripe index. The stripe index that the marker pertains to (for monitoring of striped FTP);

– Stripe bytes transferred: the number of bytes which have been received on this stripe (for striped FTP monitoring);

– Total stripe count: the total number of stripes participating in this transfer;

– Transfer start time.

Page 57: Griglie ComputazionaliFile Transfer in Grids1 Tiziana.Ferrari@cnaf.infn.it INFN – CNAF Corso di Laurea specialistica in Informatica Anno Acc. 2004/2005.

Griglie Computazionali File Transfer in Grids 57

References

• File Transfer Protocol, RFC 959.

• GridFTP: Protocol Extensions to FTP for the Grid; B.Allcock et alt.; GGF Recommendation, Apr 2003.