TEST PRESTAZIONALI ED OTTIMIZZAZIONE DI UN CLUSTER DI CALCOLO OPENMOSIX
PRESTATIONAL TESTS AND OPTIMIZATION ON A OPENMOSIX CLUSTER
CLICK HERE FOR ENGLISH VERSION
SCOPO DI QUESTO DOCUMENTO
Lo scopo di questo scritto e' la tracciatura dei differenti livelli prestazionali forniti da un cluster di 4 PC, in funzione della topologia di rete con la quale verranno interconnesse le macchine.
A CHI SI RIVOLGE QUESTO DOCUMENTO
Mi rivolgo principalmente a persone che hanno già esperienza con i cluster openMosix (da ora in poi indicato con oM) e che vogliono trarre il massimo vantaggio in termini prestazionali dal proprio cluster.IL PERCHE' DI QUESTO DOCUMENTO
In tutta la documentazione che ho letto inerente oM, ho notato che l'incremento prestazionale dato dall'aggiunta di nodi ad un cluster e' MENO che proporzionale. Da un documento letto, (si veda la documentazione reperibile nel sito di openmosix) risulta che 24 nodi (identici) non danno come risultato un cluster che 'va' come se fosse un nodo 24 volte piu' veloce, ma SOLO 15 volte piu' veloce... E' come se la potenza di 9 nodi si fosse 'persa per strada'. Un altro documento, parlava di un cluster di 20 desktop Pentium1 a 100Mhz che davano una potenza equivalente di un Pentium1 a 1700Mhz. Ora, nel secondo caso la potenza persa e' giustificabile dal fatto che l'algoritmo di oM richiede tempo per calcolare i carichi dei nodi e decidere di conseguenza la migrazione dei processi; inoltre, altro tempo viene impiegato per la necessità fisica di migrare il processo da un nodo all'altro. Ma nel primo caso si ha una CONSISTENTE perdita di potenza complessiva: questo porta a pensare che sia il TIPO di applicativo e la relativa necessità di traffico di rete a fare la differenza.| | Il grafico non e' in scala | p| o| t| ************ e| ***************** n| ********** z| ****** a| *** | **** d| **** i| *** | *** c| ** a| *** l| ** c| ** o| ** l| * o| * | * |* |_____________________________________________________________________________ 1 2 3 ........................... Numero nodi ............................. N
DOVE E COME MIGLIORARE IL CLUSTER
Così come le prestazioni totali di un pc sono date da piu' elementi (ram, disco, CPU, scheda video, etc) e la modifica di uno o piu' elementi può aumentare le capacità totali del sistema, così anche un cluster può essere migliorato agendo sugli elementi che lo costituiscono.I NODI DEL CLUSTER
L'hardware disponibile e' il seguente:
4 nodi desktop IBM 300GL
CPU: P2 300Mhz
RAM: 64M a 66Mhz
NIC: 10/100 3com 3c905*
Sono stati scelti PC tutti uguali in quanto risulta piu' facile eseguire dei
test su hardware omogeneo: questo permetterà di dire che:
"un cluster di TOT PC con CPU a ZMhz connessi in topologia
Y
equivale ad un unico PC di Whz quando svolge il compito
T".
PREREQUISITI
Questo documento e' la prosecuzione ideale di quello precedente, dove si spiega
come realizzare un cluster con (fino a) 8 nodi. Questo cluster si presuppone
già configurato ed attivo, composto da 4 nodi e si dà per scontato quanto
segue:
- che i 4 nodi abbiano questa configurazione:
NODO NOME INDIRIZZO IP FUNZIONE A server 192.168.1.1 server B nodo2 192.168.1.2 nodo slave C nodo3 192.168.1.3 nodo slave D nodo4 192.168.1.4 nodo slave- che tutti i nodi abbiano lo STESSO kernel e la stessa configurazione di cluster (con il MFS=yes)
COME VERRANNO CABLATI I NODI DEL CLUSTER
Verranno provate varie topologie di rete, onde determinare il rapporto prezzo/prestazioni di ognuna di esse anche in funzione dell'applicativo testato.
+----+-----+-----------+--------------+----+---------+------+
| | | | bladeenc | | | |
|N° |N° pc|tipo di | tempo tempo |num.| tipo di |schede|
|caso|usati|connessione| mm.ss in % |cavi| cavo |totali|
+----+-----+-----------+--------------+----+---------+------+
| 1 | 1 | - | mm.ss 100.00| 0 | - | 0 |
| 2 | 4 |hub 10 | mm.ss xxx.xx| 4 | diretto | 4 |
| 3 | 4 |switch 100 | mm.ss xxx.xx| 4 | diretto | 4 |
| 4 | 4 |P2P | mm.ss xxx.xx| 3 | incroc. | 6 |
+----+-----+-----------+--------------+----+---------+------+
CASO 2 CASO 3 CASO 4
+---------------+ +---------------+ +---------------+
| | | | | server |
| hub | | switch | | e e e |
| 10Mbit/s | | 100Mbit/s | | t t t |
| | | | | h h h |
| | | | | 0 1 2 |
+---------------+ +---------------+ +---------------+
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
.-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-.
|s| |n| |n| |n| |s| |n| |n| |n| |n| |n| |n|
|e| |o| |o| |o| |e| |o| |o| |o| |o| |o| |o|
|r| |d| |d| |d| |r| |d| |d| |d| |d| |d| |d|
|v| |o| |o| |o| |v| |o| |o| |o| |o| |o| |o|
|e| |2| |3| |4| |e| |2| |3| |4| |2| |3| |4|
|r| :_: :_: :_: |r| :_: :_: :_: :_: :_: :_:
:_: :_:
SVANTAGGI DEL CASO 4
- Detto N il numero dei nodi del cluster, servono 2*(N-1) NIC, N-1 sul server e poi una per ogni nodo. Quindi il numero delle NIC cresce in modo quasi doppio rispetto al numero dei nodi.VANTAGGI DEL CASO 4
- La connessione punto-punto ottimizza la velocita' di comunicazione tra il
server e i nodi, per cui si dovrebbe accellerare la trasmissione dati via
rete: se si e di quanto, e' da vedere; ecco perche' sto scrivendo questo
documento :-).
PREPARIAMO IL SERVER
Nella nostra (spasmodica) ricerca di colli di bottiglia da ottimizzare, ci
scontriamo col server, o meglio, con l'hard disk del server. Infatti, quest'
ultimo dovra' reggere tutto il carico di I/O del files.
Come vedremo in seguito, questo carico sara' pesante, per cui non avrebbe senso
ottimizzare la velocita' di rete se poi non abbiamo abbastanza dati da farci
transitare.
L'hard disk originale (hda) non e' quello che si dice un fulmine: dal test
effettuato con hdparm -t /dev/hda otteniamo un valore di 12.36MB/sec.
aggiungiamo
percio' un hard disk piu moderno, e lo montiamo come hdc.
Il risultato di hdparm -t /dev/hdc e' un piu' confortante 28.83MB/sec.
Potremmo aumentare la velocita' di I/O facendo in modo di avere i file sorgenti
su hdc e i file destinazione sul disco hda, in modo da sfruttare al meglio
la banda dei due controller EIDE. Certo, sarebbe stato meglio avere dei dischi
SCSI, ma, come detto, stiamo lavorando in economia con materiale di riciclo per
cui bisogna accontentarsi :-|
|
OTTIMIZZIAMO L'HARD DISK Prima di cominciare ad eseguire le prove, occorre considerare che l'hard disk del nodo master, tranne che nel CASO 1, sara' sottoposto ad un pesante traffico di I/O in quanto verranno letti in parallelo i file sorgenti e verranno altresi' scritti i file convertiti. Occorre perciò assicurarci che l'hard disk non diventi un "collo di bottiglia" che rallenti il cluster. Il comando 'hdparm' permetterà di migliorare le prestazioni dell'hard disk (man hdparm per i dettagli). Comunque, il minimo indispensabile lo indico subito; se l'hard disk sul quale operiamo e' hdc, il comando # hdparm -c 1 -d 1 /dev/hdcattiverà l'I/O a 32bit e l'utilizzo del DMA. |
SOFTWARE DI TEST UTILIZZATO
Il software utilizzato e' bladeenc, un programma a riga di comando per la conversione tra vari formati audio. Verra' usato per convertire molti file (tramite script) da WAV a MP3 e 'stressare' le connessioni tra i nodi. Il programma l'ho scaricato dal sito http://bladeenc.mp3.no. Poiche' uso DEBIAN, ho utilizzato il relativo pacchetto .deb gia' compilato per Pentium 1 o CPU superiore.|
CONFIGURAZIONE PER HUB E SWITCH Questi file sono validi per i casi 1, 2, e 3. Per il caso 4, verrà specificato in dettaglio come sono stati configurati i vari file. /etc/openmosix.map (valido per tutti i nodi) 1 192.168.1.1 1
2 192.168.1.2 1
3 192.168.1.3 1
4 192.168.1.4 1
/etc/default/openmosix (valido per tutti i nodi)
# This node is a Mosix node.
OPENMOSIX_NODE=yes
# Processes are allowed to migrate to other nodes.
MIGRATE=yes
# Allow guest processes to arrive.
BLOCK=no
# use of MFS (Mosix File System)
MFS=yes
#EOF#
/etc/hosts (server)
192.168.1.1 server
127.0.0.1 localhost
/etc/hosts (nodo 2)
192.168.1.2 nodo2
127.0.0.1 localhost
/etc/hosts (nodo 3)
192.168.1.3 nodo3
127.0.0.1 localhost
/etc/hosts (nodo 4)
192.168.1.4 nodo4
127.0.0.1 localhost
|
|
SCRIPT DI TEST Per ottimizzare le prestazioni, verranno usati due script diversi, uno per il caso iniziale (il solo nodo master) e uno script che verrà usato in tutti gli altri casi. SCRIPT PER IL SOLO MASTER Disabilitate il clustering con: /etc/init.d/openmosix stop in modo da isolare il master dagli altri nodi. Ora occupiamoci dello script. Questo script serve per vedere quanto tempo impiega un singolo nodo per completare la conversione di tutti i file. In questo modo, avremo disponibile un dato con cui confrontare tutti i risultati che seguiranno. Il contenuto dello script di conversione (che si chiama converti.sh) e' il seguente:
#!/bin/sh
date +%s > /mfs/0/mnt/hdc1/audio.txt
./bladeenc -quit -quiet audio01.wav -256 -copy -crc
./bladeenc -quit -quiet audio02.wav -256 -copy -crc
.........................................
./bladeenc -quit -quiet audio23.wav -256 -copy -crc
./bladeenc -quit -quiet audio24.wav -256 -copy -crc
date +%s >> /mfs/0/mnt/hdc1/audio.txt
In questo caso, poiche' il pc master sta lavorando da solo, le 24 istanze di bladeenc sono state lanciate una dopo l'altra, per mitigare l'intervento dell' algoritmo di linux che gestisce il multitasking intervenga a gestire (e rallentare) l'esecuzione dei vari processi: in questo modo lo script viene visto come un solo processo e gestito piu' velocemente. Lo script (tramite i due comandi 'date') genera il file /mfs/0/home/mnt/hdc1/date.txt il quale contiene due numeri, la cui differenza darà la durata, in secondi, dello script. SCRIPT PER IL CLUSTER il contenuto dello script di conversione (che si chiama converti-om.sh) e' il seguente:
#!/bin/sh
./converti01.sh &
./converti02.sh &
...............
./converti23.sh &
./converti24.sh &
In questo modo, lo script 'converti-om.sh' lancia in background (grazie al parametro '&') i 24 script che, venendo considerati 'atomici', possono migrare tra i vari nodi del cluster. Devono essere creati 24 script chiamati 'convertiXX.sh' dove XX varia da 01 a 24. Il contenuto dei singoli script deve essere il seguente: date +%s > audioXX.txt ; bladeenc -quit -quiet audioXX.wav -256 -copy -crc ; date +%s >> audioXX.txtanche qui XX deve andare da '01' a '24'. Gli script sono composti da tre comandi distinti: il primo comando 'date' scrive all'interno del file di report audioXX.txt il tempo in secondi di quando lo script e' partito; il comando 'bladeenc' converte il file audioXX.wav in audioXX.mp3 ed infine l'ultimo comando 'date' scrive, in secondi, il momento in cui lo script termina. I due comandi 'date' servono solo per registrare il momento di inizio e di fine della conversione: dalla differenza dei due numeri riportati all'interno del file audioXX.txt si avrà la durata in secondi del processo di conversione. confrontando le 24 durate, quella piu' grande indicherà il tempo impiegato complessivamente dal cluster per portare a termine tutte e 24 le conversioni. |
INIZIAMO I TEST
Tutti i test vanno lanciati dal nodo master.
CASO 1: test sul nodo master senza connessioni ad altri PC
(dettaglio)
Lanciate il comando ./converti.sh, (aspettate la conclusione) editate il file
audio.txt, calcolate la differenza e scrivetela in tabella.
CASI 2, e 3: HUB E SWITCH
L'implementazione dei casi 2 e 3 e' banale in quanto si tratta di collegare
tutti i pc, scegliendo di volta in volta il mezzo di connessione hub e switch,
eseguire i test e riportarne in tabella i risultati.
Ovviamente qui oM DEVE essere attivato, per smistare i processi tra i vari nodi.
|
CASO 4: TOPOLOGIA P2P
P2P A QUATTRO NODI
+-----------------------+
| |
| server |
| |
| e e e |
| t t t |
| h h h |
| 0 1 2 |
+-----------------------+
| | |
| | |
| | |
| | |
.- -. .- -. .- -.
| | | | | |
| N | | N | | N |
| o | | o | | o |
| d | | d | | d |
| o | | o | | o |
| 2 | | 3 | | 4 |
:___: :___: :___:
Nodo.punto_rete <-> Nodo.punto_rete
Server.eth0 <-> nodo2.eth0
Server.eth1 <-> nodo3.eth0
Server.eth2 <-> nodo4.eth0
Ora occorre attivare tutte le NIC del server, istruendole in modo da
instradare il traffico di rete in modo "intelligente" verso gli altri nodi.Contrariamente a quanto si potrebbe immaginare, NON e' necessario dedicare un indirizzo di rete ad ogni NIC del nodo, ma e' possibile (grazie al kernel 2.4.x o superiore) condividere lo stesso indirizzo IP su tutte le NIC del nodo. Indico di seguito in contenuto dei file /etc/network/interface presenti sui 4 nodi.
Esaminiamo con attenzione la configurazione (per esempio) del punto_rete eth0 del server: auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
up route add -host 192.168.1.2 dev eth0
Le prime sei righe sono facilmente comprensibili, mentre l'ultima e'
l'istruzione "magica": infatti traducendola in italiano significa:
"tutte e solo le comunicazioni che dall'IP corrente (192.168.1.1)
e che sono diretti all'IP 192.168.1.2 devono essere instradate sulla NIC fisica
chiamata eth0". In questo modo non avvengono collisioni
superflue in quando si tratta di una connessione peer-to-peer cioe', in italiano
, punto-a-punto: in breve P2P.
|
ANALISI DEI RISULTATI
i file di partenza sono lunghi 89782940 byte e generano file lunghi 16287870 byte.
+----+-----+-----------+--------------+----+---------+------+
| | | | bladeenc | | | |
|N° |N° pc|tipo di | tempo tempo |num.| tipo di |schede|
|caso|usati|connessione| mm.ss in % |cavi| cavo |totali|
+----+-----+-----------+--------------+----+---------+------+
| 1 | 1 | - |107.39 100.00| 0 | - | 0 |
| 2 | 4 |hub 10 | 41.12 38.27| 4 | diretto | 4 |
| 3 | 4 |switch 100 | 39.28 36.66| 4 | diretto | 4 |
| 4 | 4 |P2P | 37.40 34.98| 3 | incroc. | 6 |
+----+-----+-----------+--------------+----+---------+------+
TIPO LENTO VELOCE DIFF DIFF% hub10MB/s 41m12s 39m01s 2m11s 5.3% switch 39m28s 38m58s 0m31s 1.3% P2P 37m40s 36m44s 0m56s 2.5%
num tipo CASO 20% 40% 60% 80% 100%
pc conn. 10% | 30% | 50% | 70% | 90% |
v v v v v v v v v v
1 - 1 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 100.00%
2 hub10 2 OOOOOOOOOOOOOOOOOOO. | | | | | | 38.27%
3 sw100 3 OOOOOOOOOOOOOOOOOOo| | | | | | | 36.66%
4 P2P 4 OOOOOOOOOOOOOOOOOo | | | | | | | 34.98%
--------------------------------------------------
Tempo in percentuale rispetto al singolo pc.
TEST VELOCITA' DI COMUNICAZIONE TRA I NODI
Verifichiamo quale e' la velocita' di comunicazione tra due nodi, nei casi 2, 3 e 4: per farlo, copieremo un file di 320M dal server al nodo due, calcolando i tempi e modificando caso per caso la connessione. Creiamo un file di 32M:CONNESSIONE TEMPO (s) PERCENTUALE MB/s hub 10Mbs 337.4 100.0% 0.95 switch 10/100Mbs 453.3 134.3% 0.70 P2P 71.5 21.2% 4.47
date +%s > audioXX.txt ; bladeenc -quit -quiet audioXX.wav -256 -mono ; date +%s >> audioXX.txtCosi' la conversione sara' mono e non piu' stereo, dimezzando i tempi di conversione.
TIPO LENTO VELOCE DIFF DIFF%
hub10MB/s 28m29s 21m10s 7m18s 25.7%
switch 25m56s 12m04s 13m52s 53.5%
P2P 19m42s 17m38s 2m04s 10.5%
tipo CASO 20% 40% 60% 80% 100%
conn. 10% | 30% | 50% | 70% | 90% |
v v v v v v v v v v
- 1 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 100.00% 53m53s
hub10 2 OOOOOOOOOOOOOOOOOOOOOOOOOOo | | | | | 52.86% 28m29s
sw100 3 OOOOOOOOOOOOOOOOOOOOOOOO| | | | | | 48.13% 25m56s
P2P 4 OOOOOOOOOOOOOOOOOOo| | | | | | | 36.56% 19m42s
--------------------------------------------------
Tempo in percentuale rispetto al singolo pc.
Notate come nel caso P2P il tempo in percentuale (36.56%) sia molto vicino
al massimo teorico (33.33%) con uno scarto di solo il 3.23%
numero Topologia Potenza equiv. Max. potenza differenza PC (Y) (W) teorica 1 - 300Mhz - 3 hub 567Mhz 900Mhz -36.94% 3 switch 623Mhz 900Mhz -30.74% 3 P2P 820Mhz 900Mhz - 8.88%Aggregando tre CPU da 300Mhz, ci si potrebbe aspettare, al massimo, di avere un potenza complessiva pari ad una CPU virtuale a 900Mhz: in questo caso, abbiamo come risultato 820Mhz, cioe' una discrepanza di poco meno di 9 punti percentuali rispetto al massimo teorico. Abbiamo visto che c'e' un evidente e convenienete incremento prestazionale, dato unicamente dalla topologia: il cluster "scala" bene, il che giustifica e ricompensa ampiamente gi svantaggi del P2P.
tipo CASO 20% 40% 60% 80% 100%
conn. 10% | 30% | 50% | 70% | 90% |
v v v v v v v v v v
hub10 2 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 100.00% 28m29s
sw100 3 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo | 91.04% 25m56s
P2P 4 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo| | | | 69.16% 19m42s
--------------------------------------------------
Tempo in percentuale rispetto alla topologia hub10Mb/s
Analiziamo il comportamento della topologia di rete, ponendo uguale al 100% la velocita' del piu' lento (hub10Mb/s)
Arrotondando i valori, vediamo che il P2P guadagna il 20% rispetto allo switch ed il 30% rispetto all'hub.
Poiche' in una situazione reale sarebbe piu' prevedibile l'utilizzo di uno switch al posto di un semplice hub, possiamo avere questo confronto
tipo CASO 20% 40% 60% 80% 100%
conn. 10% | 30% | 50% | 70% | 90% |
v v v v v v v v v v
sw100 3 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 100.00% 25m56s
P2P 4 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | | | 75.96% 19m42s
--------------------------------------------------
Tempo in percentuale rispetto alla topologia switch 10/100Mb/s
In questo caso, il guadagno e' del 24%
ULTERIORI SVILUPPI: PREVISIONI PRESTAZIONI
E' interessante notare che basandosi su questa tabellanumero Topologia Potenza equiv. Max. potenza differenza PC (Y) (W) teorica 1 - 300Mhz - 3 hub 567Mhz 900Mhz -36.94% 3 switch 623Mhz 900Mhz -30.74% 3 P2P 820Mhz 900Mhz - 8.88%si puo' precalcolare la potenza teorica totale generabile dall'aggiunta di altri nodi: 3 nodi->820Mhz, 4 nodi->1095Mhz. Poiche' il P2P ha eliminato il collo di bottiglia dato dalla la velocita' di rete, la potenza risultante da 4 nodi deve essere intesa come "non meno di" 1095Mhz. Mi sarebbe piaciuto avere abbastanza computer per eseguire dei test e comporre la "curva prestazionale" data da Numero_pc/Potenza_equivalente.... forse, lo faro' in futuro :-)
ULTERIORI SVILUPPI: CUSTER P2P PIU' GRANDI DI 9 NODI
Poiche' il server deve "vedere" ogni nodo su una diversa NIC, abbiamo precedentente detto che il numero massimo di quest'ultime equivaleva al numero massimo di nodi del cluster, ma questo non e' del tutto esatto.
Infatti, esistono in commercio NIC che consentono DUE punti rete: in pratica, hanno raddoppiato i chipset di gestione rete su un'unico circuito stampato. Non ho ancora avuto la possibilita' di usarle, ma se funzionassero come le normali NIC, questo consentirebbe di arrivare a cluster da 16 nodi (7 slot PCI * 2 NIC + 1 NIC integrata + il server).
Alternativamente, esiste anche un'altra possibilita': si potrebbero configurare due sotto-cluster in P2P collegati da NIC da 1Gb/s oppure da due o tre NIC con velocita' di rete aggregata tramite channel bonding. Come al solito, la carenza di hardware omogeneo (leggi: pc uguali) mi impedesce di eseguire i relativi test: forse, in futuro riusciro' a produrre dei test adeguati.
CONCLUSIONI
Abbiamo dimostrato che un cluster,|
NICE TO HAVE Mi sarebbe piaciuto avere dell'hardware piu' numeroso e/o piu' prestante: 10 o 12 P3 a 1Ghz di clock con 256Mram (adesso, febbraio 2004, tale hardware e' cosiderabile di livello medio/basso) per fare delle prove piu' accurate... Magari, potete farle voi: oppure, se mi procurate i PC, lo faro' io :-) |
|
CREDITS Questo documento nasce da una mia idea personale. Ringrazio: - un socio openlabs (del quale al momento non ricordo il nome) per l'introduzione dell'istruzione up route add -host 192.168.1.X dev ethY , Ma sopratutto, ringrazio me stesso per la caparbieta' dimostrata nel perseguire l'obbiettivo di realizzare questo documento, (troppo a lungo posticipato per la mancanza di hardware a disposizione), anche perche' mi sono fatto un mazzo cosi': bravo Roby! |
|
NOTIZIE SULL'AUTORE Sono contattabile all'indirizzo di posta elettronica: roberto.premoli(chiocciola)tiscali.it oppure r00(chiocciola)excite.it |
PRESTATIONAL TESTS ON A OPENMOSIX CLUSTER
SCOPE OF THIS PAPER
Scope of this paper is to take track of different level of prestations of a cluster of 4 nodes , in function of network topology.
DESTINATARY OF THIS PAPER
This paper is for people already able to turn on a openMosix (from hereinafter oM) cluster and that needs to get maximum level of prestations from their own cluster.WHY THIS PAPER
I read several papers about openMosix: I saw that the improvement of prestations doesn't grow in linear mode in function of added nodes. In a document, I saw that (look at openMosix documentation website) cluster of 24 identical nodes the total power was only fifteen times the power of a single node: it seems as the power of nine nodes gone 'lost in the wind'. In another document 20 Pentium1 at 100Mhz, gave a cluster as a virtual Pentium1 at 1700Mhz. Well, in first case, it is not admissible to loose a so CONSISTENT power quantity: this situation make me to think that is the TYPE of application and the necessity of traffic network that make the difference.| | The graphic in not in scale | p| o| w| ************ e| ***************** r| ********** | ****** o| *** f| **** | **** c| *** a| *** l| ** c| *** u| ** l| ** a| ** t| * i| * o| * n|* |_____________________________________________________________________________ 1 2 3 ........................... Number of nodes ......................... N
WHERE AND HOW OPTIMIZE THE CLUSTER
So as the average prestations of a pc came from a variety of different elements (ram, hard disk, CPU, graphic card, etc) and modify a single element can improve the global performances of the PC, in the same way a cluster can be optimized working on the single cluster's elements.THE NODES OF CLUSTER
I will work with this hardware:
4 desktop IBM 300GL
CPU: Pentium 2 at 300Mhz
RAM: 64M at 66Mhz
NIC: 10/100 3com 3c905*
I choose identical PCs because it is easier to test hardware of the same nature: this
will allow to say that:
"a cluster of TOT PC with CPU at ZMhz connected with topology
Y equivalent to a single 'virtual' PC running at Whz when he does the job T".
PRECONDITIONS
This howto is the ideal procecution of a my previous howto where I explained how
to build up a cluster with (till) 8 nodes. This cluster is intended as 'up and
running' with 4 nodes and with the follow:
- the 4 nodes have this configuration:
NODE NAME IP ADDRESS FUNCTION A server 192.168.1.1 server B nodo2 192.168.1.2 slave node C nodo3 192.168.1.3 slave node D nodo4 192.168.1.4 slave node- all the nodes have the SAME kernel and the same cluster configuration (with MFS=yes)
HOW THE NODES WILL BE CONNECTED
Some different network topologies will be tested, to calculate the cost/benefit ratio, as a function of the used software application.
+----+-----+-----------+--------------+----+---------+------+
| | | | bladeenc | | | |
|N° |N° pc|connection | time time |num.| wire |total |
|case|used | type | mm.ss in % |wire| type | NIC |
+----+-----+-----------+--------------+----+---------+------+
| 1 | 1 | - | mm.ss 100.00| 0 | - | 0 |
| 2 | 4 |hub 10 | mm.ss xxx.xx| 4 | direct | 4 |
| 3 | 4 |switch 100 | mm.ss xxx.xx| 4 | direct | 4 |
| 4 | 4 |P2P | mm.ss xxx.xx| 3 | crossed | 6 |
+----+-----+-----------+--------------+----+---------+------+
CASE 2 CASE 3 CASE 4
+---------------+ +---------------+ +---------------+
| | | | | server |
| hub | | switch | | e e e |
| 10Mbit/s | | 100Mbit/s | | t t t |
| | | | | h h h |
| | | | | 0 1 2 |
+---------------+ +---------------+ +---------------+
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
.-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-.
|s| |n| |n| |n| |s| |n| |n| |n| |n| |n| |n|
|e| |o| |o| |o| |e| |o| |o| |o| |o| |o| |o|
|r| |d| |d| |d| |r| |d| |d| |d| |d| |d| |d|
|v| |o| |o| |o| |v| |o| |o| |o| |o| |o| |o|
|e| |2| |3| |4| |e| |2| |3| |4| |2| |3| |4|
|r| :_: :_: :_: |r| :_: :_: :_: :_: :_: :_:
:_: :_:
CASE 4: DISADVANTAGES
- Called N the numbers of nodes, 2*(N-1) NIC, N-1 on server and one NIC for each node are needed. So, the needed NIC's number grows in linear mode with node number.CASE 4: ADVANTAGES
- P2P connection optimizes communication velocity between server and nodes: this would improve
the communication on the network: if YES and HOW MUCH is unknown: this is because I am writing this
howto :-).
SETTING UP THE SERVER
In my (spasmodic) search of bottleneck to optimize, I find on my street the
server, or, in other words, with the hard disk of the server. In fact, the hard
disk of the server must support all the I/O load.
As we will see below, this load will be heavy: it will be nonsense to
optimize the network load without optimizing the I/O load on hard disk: I must
avoid the hard disk being a bottleneck for the cluster.
The original hard disk (hda) is not so fast: testing it with hdparm -t /dev/hda
I get 12.36MB/sec. I added a newer hard disk and install it as hdc.
Testing hdc with hdparm -t /dev/hdc I get a better 28.83MB/sec.
We could make the I/O faster putting input files on hdc and forcing output files
onto hda: this allow to use both EIDE controller bandwidth. Of course, it would be
better to have SCSI hard disks, but, as I said, I am working in economy, using
hardware from trash: so, we can't ask more than what we have :-|
|
HARD DISK OPTIMIZATION before to start, we have to remember that, with exception of CASE 1, the hard disk of the server will have a heavy I/O load, because ALL the input files will be ready at the same time and ALL the output file will be write at the same time. So, we must avoid that the server's hard disk will be a bottleneck. To do so, the command 'hdparm' can tune the hard disk (man hdparm for details). All in all, the minimum command (for hdc) is: # hdparm -c 1 -d 1 /dev/hdcthese option will activate I/O at 32bit and DMA usage. |
SOFTWARE USED IN THIS HOWTO
I will use bladeenc, a command line software that allow audio format conversion. I will use bladeenc to convert (with some scripts) several files from WAV to MP3 and to stress the connection between nodes. I downloaded bladeenc from http://bladeenc.mp3.no. I use DEBIAN, so, I used the related .deb package, prepared for Pentium 1 or above.|
CONFIGURATION FOR HUB OR SWITCH These configurations are valid for CASE 1, 2, and 3. For CASE 4, I will write in detail how to configure. /etc/openmosix.map (valid for all nodes) 1 192.168.1.1 1
2 192.168.1.2 1
3 192.168.1.3 1
4 192.168.1.4 1
/etc/default/openmosix (valid for all nodes)
# This node is a Mosix node.
OPENMOSIX_NODE=yes
# Processes are allowed to migrate to other nodes.
MIGRATE=yes
# Allow guest processes to arrive.
BLOCK=no
# use of MFS (Mosix File System)
MFS=yes
#EOF#
/etc/hosts (server)
192.168.1.1 server
127.0.0.1 localhost
/etc/hosts (nodo 2)
192.168.1.2 nodo2
127.0.0.1 localhost
/etc/hosts (nodo 3)
192.168.1.3 nodo3
127.0.0.1 localhost
/etc/hosts (nodo 4)
192.168.1.4 nodo4
127.0.0.1 localhost
|
|
SCRIPTS FOR TEST To optimize the prestations, 2 different scripts will be used: one for CASE 1 (only one PC) and one for CASEs 2, 3 and 4. SCRIPT FOR SERVER ALONE hang up the clusterin with: /etc/init.d/openmosix stop in this way, the server will not move to other nodes his jobs. Now lets write the script. This script will tell us how much time is needed by only one node to complete the conversion of all files: so, we will have a milestone to confrontate all the other test results. The script's name is converti.sh and it is the the follow: sequence:
#!/bin/sh
date +%s > /mfs/0/mnt/hdc1/audio.txt
./bladeenc -quit -quiet audio01.wav -256 -copy -crc
./bladeenc -quit -quiet audio02.wav -256 -copy -crc
.........................................
./bladeenc -quit -quiet audio23.wav -256 -copy -crc
./bladeenc -quit -quiet audio24.wav -256 -copy -crc
date +%s >> /mfs/0/mnt/hdc1/audio.txt
The server works alone, so the conversions are processed one by one to limit the time consumed by Linux's scheduler. In this way the whole scripts is seen as a one process and runs faster. The script, (thanks to the dommands 'date') create a file named /mfs/0/home/mnt/hdc1/date.txt with 2 number: second minus first will tell, in seconds the duration of the script. SCRIPT FOR CLUSTER the script for cluster is named converti-om.sh an inner there are these list of commands:
#!/bin/sh
./converti01.sh &
./converti02.sh &
...............
./converti23.sh &
./converti24.sh &
In this way, the script 'converti-om.sh' sends in background (thanking '&' parameter) other 24 script can migrate one other node, because they are considered 'atomic' by oM. You must create 24 scripts called 'convertiXX.sh' where XX starts from 01 till 24. The content of the single script is the follow: date +%s > audioXX.txt ; bladeenc -quit -quiet audioXX.wav -256 -copy -crc ; date +%s >> audioXX.txtalso here XX must go from '01' to '24'. Scripts consists of 3 different commands: first command 'date' writes inside the report file called audioXX.txt the time-of-start (in seconds) of the script; command 'bladeenc' is the core of the script and converts the audioXX.wav into audioXX.mp3; the last command 'date' writes inside the report file called audioXX.txt the time-of-end (in seconds) of the script. Both command 'date' are needed to know when the script starts and finishes: so it easy to calculate the duration, in seconds, of the single scripts. Comparing the 24 durations, the slower will tell us the duration of the entire conversion jobs. |
STARTING WITH TESTS
All the tests must be done onto server (master node).
CASE 1: test on master node with no connection to other nodes
(detail)
Run command ./converti.sh, (wait for end) edit audio.txt file, calculate time
and archive it on the table.
CASE 2 and 3: HUB AND SWITCH
CASES 2 and 3 are easy because u have co connect the nodes with hub, run the converti-om.sh
script, compare the 24 results, achieve in the table the slower.
The same job must be done with switch connection.
Of course, in CASES 2 and 3 openMosix MUST be active.
|
CASE 4: P2P TOPOLOGY
P2P WITH 4 NODES
+-----------------------+
| |
| server |
| |
| e e e |
| t t t |
| h h h |
| 0 1 2 |
+-----------------------+
| | |
| | |
| | |
| | |
.- -. .- -. .- -.
| | | | | |
| N | | N | | N |
| o | | o | | o |
| d | | d | | d |
| o | | o | | o |
| 2 | | 3 | | 4 |
:___: :___: :___:
Node.NIC <-> Node.NIC
Server.eth0 <-> nodo2.eth0
Server.eth1 <-> nodo3.eth0
Server.eth2 <-> nodo4.eth0
Now we must turn on all the NICs of the server, tuning them to integradate
the network traffic in "intelligent" way to the other nodes.Contrary to what we could think, it in not necessary to dedicate a IP address to each NIC, but is possible (tanking to kernel 2.4.x and above) to use the SAME ip address for all the NICs of the node. Here follow the content of /etc/network/interface files of each node.
Look with attention the configuration (i.e.) if NIC eth0 of the server: auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
up route add -host 192.168.1.2 dev eth0
First six rows are clear, the last row is the "magic" instruction: in fact it menas:
"all and the only communication between the current IP (192.168.1.1)
that are to IP 192.168.1.2 must be sent to NIC called eth0". In this way,
there are no collisions because there are only peer-to-peer connections: shortly P2P.
|
RESULTS ANALYSIS
The WAV files are 89782940 byte each, the generate MP3 files are 16287870 byte each.
+----+-----+-----------+--------------+----+---------+------+
| | | | bladeenc | | | |
|case|N# pc|connection | time time |num.| cable | N# of|
| N# |used | type | mm.ss in % |wire| tipe | NIC |
+----+-----+-----------+--------------+----+---------+------+
| 1 | 1 | - |107.39 100.00| 0 | - | 0 |
| 2 | 4 |hub 10 | 41.12 38.27| 4 | direct | 4 |
| 3 | 4 |switch 100 | 39.28 36.66| 4 | direct | 4 |
| 4 | 4 |P2P | 37.40 34.98| 3 | crossed | 6 |
+----+-----+-----------+--------------+----+---------+------+
TYPE SLOW FAST DIFF DIFF% hub10MB/s 41m12s 39m01s 2m11s 5.3% switch 39m28s 38m58s 0m31s 1.3% P2P 37m40s 36m44s 0m56s 2.5%
num type CASE 20% 40% 60% 80% 100%
pc conn. 10% | 30% | 50% | 70% | 90% |
v v v v v v v v v v
1 - 1 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 100.00%
2 hub10 2 OOOOOOOOOOOOOOOOOOO. | | | | | | 38.27%
3 sw100 3 OOOOOOOOOOOOOOOOOOo| | | | | | | 36.66%
4 P2P 4 OOOOOOOOOOOOOOOOOo | | | | | | | 34.98%
--------------------------------------------------
% time in function of the single PC.
VELOCITY TEST BETWEEN NODES
Let us see what are the communication velocity between the nodes, for CASEs 2, 3 and 4: to do it, I will copy a file of 320M from server to nodo02 calculating the time needed for each type of connection. Make a test file of 32M:CONNECTION TIME(sec) PERCENTAGE MB/s hub 10Mbs 337.4 100.0% 0.95 switch 10/100Mbs 453.3 134.3% 0.70 P2P 71.5 21.2% 4.47
date +%s > audioXX.txt ; bladeenc -quit -quiet audioXX.wav -256 -mono ; date +%s >> audioXX.txtSo, the conversion will be mono and not more stereo, using half CPU time.
TYPE SLOWER FASTER DIFF DIFF%
hub10MB/s 28m29s 21m10s 7m18s 25.7%
switch 25m56s 12m04s 13m52s 53.5%
P2P 19m42s 17m38s 2m04s 10.5%
conn. CASE 20% 40% 60% 80% 100%
type 10% | 30% | 50% | 70% | 90% |
v v v v v v v v v v
- 1 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 100.00% 53m53s
hub10 2 OOOOOOOOOOOOOOOOOOOOOOOOOOo | | | | | 52.86% 28m29s
sw100 3 OOOOOOOOOOOOOOOOOOOOOOOO| | | | | | 48.13% 25m56s
P2P 4 OOOOOOOOOOOOOOOOOOo| | | | | | | 36.56% 19m42s
--------------------------------------------------
Percentage of time in function of a single PC.
As u can see in CASE P2P the time is 36.56%, near the theoretical maximum of 33.33%
(33.33% is theoretical because it is never reachable)
PC Topology Equivalent power Max. theoretic difference num (Y) (W) power 1 - 300Mhz - - 3 hub 567Mhz 900Mhz -36.94% 3 switch 623Mhz 900Mhz -30.74% 3 P2P 820Mhz 900Mhz - 8.88%Putting together 3 CPU at 300Mhz, we could hope to get, at maximum a equivalent power of a virtual CPU running at 900Mhz in this case, we have the results of 820, less than 9% under the theoretical maximum. We can see that there is eqvident and convenient increment of prestations that came only from different topology: the cluster "grows" well, and this justify and compensate the disadvantages of P2P topology.
conn. CASE 20% 40% 60% 80% 100%
type 10% | 30% | 50% | 70% | 90% |
v v v v v v v v v v
hub10 2 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 100.00% 28m29s
sw100 3 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo | 91.04% 25m56s
P2P 4 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo| | | | 69.16% 19m42s
--------------------------------------------------
Percentage of time in function of hub10Mb/s topology
Let analyze the topology setting hub topology as 100%.
Shortly, the P2P gains il 20% on switch and 30% on hub.
Because in a real situation it is more easy to use switch, we can do this relation:
conn. CASE 20% 40% 60% 80% 100%
type 10% | 30% | 50% | 70% | 90% |
v v v v v v v v v v
sw100 3 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 100.00% 25m56s
P2P 4 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | | | 75.96% 19m42s
--------------------------------------------------
Percentage of time in function of switch10/100Mb/s topology
In this case, P2P gains 24% on switch.
FURTER DEVELOPMENTS: PRESTATION FORECAST
It is interesting to see that using this table:PC Topology Equivalent power Max. theoretic difference num (Y) (W) power 1 - 300Mhz - - 3 hub 567Mhz 900Mhz -36.94% 3 switch 623Mhz 900Mhz -30.74% 3 P2P 820Mhz 900Mhz - 8.88%it is possible to forecast the maximum power that came from adding furter nodes: 3 nodes->820Mhz, 4 nodes->1095Mhz. Because P2P eliminates the bandwidth bottleneck, the power of 4 nodes must be read as "not less than" 1095Mhz. I would had pleasure to had enough PCs to test and write "prestational curve" for pc_num vs Equivalent _power.... Perhaps, I will do next time :-)
FURTER DEVELOPMENTS: P2P CUSTER BIGGER THAN 9 NODES
Because the server must "see" all the other nodes on a different NIC, I previously said that the NIC's number is equivalent to numbers of nodes, but this is not totally correct.
In fact, exists NICs with 2 network points: shortly, they doubled the chipset on the same PCI board. I did not used them thill now, but if they function it will be possible to have 16-nodes cluster (7 slot PCI * 2 NIC + 1 NIC on board + server node).
Alternatively, there is another possibility: to create 2 different P2P cluster linked with a NIC running at 1Gb/s or 2-3 NIC configured with channel bonding. As usual I have not enough hardware to do this: perhaps, in future.
CONCLUSIONS
I shown that a cluster,|
NICE TO HAVE It would be good to have more PCs and/or more powerful PCs: 10 o 12 Pentium III at 1Ghz with 256Mram (now, feb-2004, that hardware can be considered as low/medium level) to do more exhaustive tests... Well, you can do those tests: or, if you provide me that PCs, I will do for you :-) |
|
CREDITS This howto came from a my own idea. Thanks to: - an openlabs member (I do not remember name) for up route add -host 192.168.1.X dev ethY , But, overall, I thank myself for obstinacy shown to do this work (delayed for too much time due to absence of hardware) and because I worked hard to do this: well done, Roby! (NOTE FOR NON-ITALIAN SPEAKERS: "I worked hard" does not give the right idea of difficulties I found: it is a rude/foyer and not correct translation of italian sentence "mi sono fatto un mazzo cosi'", but it is just a slang term, an I do not know the English version of it: anyway, in italian it sounds good :-)) |
|
DATA ABOUT ME Here my mail adresses: roberto.premoli(at)tiscali.it or r00(at)excite.it |