Nessun titolo diapositiva

annuncio pubblicitario
L'evoluzione delle Applicazioni Distribuite
Dai Fosfori Verdi alle Internet API
Tito Flagella
Laboratorio Applicazioni Internet - Università di Pisa
Tito Flagella - [email protected]
Slide
Title dei Green Screen...
Ai tempi
• thin client su 3270 a fosfori verde
• server TP-Monitor su Mainframe
Tito Flagella - [email protected]
2
Slide
Title
Definizione
del TP Monitor
• Un Sistema Operativo per Transaction Processing
– Transaction Management
– Resource Management: comunicazione, memoria,
spazio disco
– Process Management: attivazione di processi (o
thread), distribuzione del carico, monitoraggio,
recovery,...
Tito Flagella - [email protected]
3
Slide
Title
La Rivoluzione
Client-Server
• La diffusione dei PC offre:
 nuova potenza di calcolo da sfruttare;
 soluzioni economiche per realizzare GUI userfriendly (Ambienti come Visual Basic, ...)
• Si diffondono i DB Relazionali (RDBMS)
Tito Flagella - [email protected]
4
Slide
Title
Architettura
a due livelli (two-tier)
• il Fat Client include:
– Presentation Logic
– Business Logic
– Data Manipulation Logic (connessioni a DB e
query SQL)
• il Server in generale si limita a gestire
l'accesso ai dati (Resource Manager,
solitamente RDBMS)
Tito Flagella - [email protected]
5
Slide
Title dell'Architettura a due livelli
Vantaggi
Sfrutta il parallelismo nel più semplice dei modi,
distribuendo i client su macchine diverse
Tito Flagella - [email protected]
6
Slide
Title dell'Architettura a due livelli
Svantaggi
– Fat Client include la business logic
• richiede upgrade del client ad ogni upgrade del
server
– dimensioni eccessive
• incompatibili con il download a run-time (Applet
Java)
– poco scalabile
• migliaia di applicazioni client accedono a l'unico
server RDBMS
Tito Flagella - [email protected]
7
Slide
Titlela via degli RDBMS Vendor
TP-lite:
– stored procedure e triggers riportano parte della
logica applicativa nel server
– Vantaggi: viene limitato il traffico dei dati sulla rete
(sequenze di query SQL pilotate direttamente sul
server)
– Svantaggi: resta sovraccaricato un unico server
Tito Flagella - [email protected]
8
Slide
Title
TP-heavy:
la via dei TP Vendor
• Unix-based TP monitor:
– BEA Systems TUXEDO
– Digital's ACMSxp
– IBM's Encina
– NCR's Top End
– UniKix Technologies'UniKix
• Controindicazioni dei TP Monitor
– Costi e Difficoltà d’uso
Tito Flagella - [email protected]
9
Slide
Title di Open Systems e OO
L'impatto
http://en.wikipedia.org/wiki/Open_system_(computing)
Open systems are computer systems that provide some
combination of interoperability, portability, and open software standards.
Object Oriented Distribution: uso di oggetti remoti in
maniera trasparente Tito Flagella - [email protected]
10
Slide
Title
L'Architettura
CORBA
Si diffonde l'architettura CORBA (Common Object
Request Broker Architecture) di OMG (Object
Management Group)
a vendor-independent architecture and infrastructure that computer
applications use to work together over networks. Using the standard
protocol IIOP, a CORBA-based program from any vendor, on almost
any computer, operating system, programming language, and network,
can interoperate with a CORBA-based program from the same or
another vendor, on almost any other computer, operating system,
programming language, and network.
La versione 1.0 fù rilasciata nel 1991.
Tito Flagella - [email protected]
11
Slide
Title
L'Architettura
CORBA
Tito Flagella - [email protected]
12
Slide
Title Wide Web
Il World
• Tim Berners-Lee pubblicò la prima proposta
del WWW nel 1989
• Il primo web browser di larga diffusione fù
Mosaic, realizzato nel 1993 da Marc
Andreessen
• Nel 1993, l'NCSA propone anche il
protocollo CGI, un semplice meccanismo
per servire pagine dinamiche da parte di un
Web Server
Tito Flagella - [email protected]
13
L'impatto
Slide
Titledel WWW sulle Applicazioni Distribuite
• Il browser diventa il thin client universale
• Applicazioni aggiornabili solo sul server
(supporto di utenza “spontanea”)
• Il server Web c’è e quindi si candida ad
occupare il secondo livello
Tito Flagella - [email protected]
14
Slide
Title
Prima
Generazione Applicazioni Web
• Architettura a tre livelli (browser, Application Server,
DB)
• Client: Browser di prima generazione (no Java, no
Scripting)
• Application Server: Web server con estensioni CGI (Perl,
shell, ...)
• HTTP come protocollo di comunicazione tra client e
server
• La presentazione viene realizzata ridisegnando
completamente la pagina del browser ad ogni
interazione con l’utente
Tito Flagella - [email protected]
15
Slide
Prima
TitleGenerazione Applicazioni Web
Prima Generazione Applicazioni Web
Tito Flagella - [email protected]
16
Slide
Title Generazione Web
Seconda
• Architettura a più livelli (three-tier o multi-tier)
– Thin Client (Browser delle ultime generazioni + uso di Java +
Dynamic HTML)
– un certo numero di Application Server Distribuiti (Business
Logic + Data Access Logic)
– HTTP come protocollo tra browser e web-server
– la presentazione può essere realizzata senza ridisegnare
tutta la pagina del browser, grazie alla comunicazione Applet
- Application Server basata su HTTP o in qualche caso su
IIOP
– IIOP (CORBA) come protocollo di comunicazione tra gli
Application Server e con i sistemi legacy.
Tito Flagella - [email protected]
17
Terza
Generazione Web
Slide
Title
• Nasce l’esigenza di far comunicare le applicazioni su
Internet, con un minimo coordinamento tra i nodi
• CORBA si dimostra inadatto a questo fine
• Comincia il processo di standardizzazione della nuova
tecnologia dei Web Services, basati su http e XML.
• Attorno ad http e XML si cerca di standardizzare tutta
una serie di servizi analoghi a quelli già disponibili per
altri ambienti distribuiti, come CORBA.
Tito Flagella - [email protected]
18
Slide Title
Tito Flagella - [email protected]
19
Slide
Title
La programmazione
su Internet
•
http://en.wikipedia.org/wiki/Web_service
–
●
The W3C defines a Web service as: a software system designed to support
interoperable machine-to-machine interaction over a network. It has an interface
described in a machine-processable format (specifically WSDL). Other systems
interact with the Web service in a manner prescribed by its description using SOAP
messages, typically conveyed using HTTP with an XML serialization in conjunction
with other Web-related standards.
http://en.wikipedia.org/wiki/Representational_state_transfer
Representational state transfer (REST) is an architectural style consisting of a
coordinated set of constraints applied to components, connectors, and data elements,
within a distributed hypermedia system. REST ignores the details of component
implementation and protocol syntax in order to focus on the roles of components, the
constraints upon their interaction with other components, and their interpretation of
significant data elements.
•
http://en.wikipedia.org/wiki/Web_API
A server-side web API is a programmatic interface to a defined request-response message
system, typically expressed in JSON or XML, which is exposed via the web—most
commonly by means of an HTTP-based web server.
Tito Flagella - [email protected]
20
Slide
Title
REST
http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
Tito Flagella - [email protected]
22
Slide
WebTitle
API
Tito Flagella - [email protected]
23
Slide
Che Title
tecnologia scegliere...
L'unico punto fermo resta http come protocollo di
base
●
Per il resto non esiste una tecnologia migliore di altre,
si tratta di scelte progettuali
Un paio di esempi:
●
Google parte con Web Service API ma le dismette nel
2009:
●
http://googlecode.blogspot.it/2009/08/well-earned-retirement-for-soap-search.html
●
La legge Italiana impone dal 2008 l'uso di SOAP per
tutte le comunicazioni applicative tra e con la
Pubblica Amministrazione:
http://www.agid.gov.it/agenda-digitale/infrastrutture-architetture/servizi-interoperabilita-evoluta
Tito Flagella - [email protected]
24
Slide
Title
Google
Search API
http://googlecode.blogspot.it/2009/08/well-earned-retirement-for-soap-search.html
Tito Flagella - [email protected]
25
Slide
ComeTitle
evolvono le infrastrutture?
Ok per le Interfacce, ma per le infrastrutture?
●
Avevamo lasciato i DBMS come collo di bottiglia
dell'architettura Client Server
●
L'architettura a 3 livelli permette di scaricare il DB da
qualunque logica applicativa, ma resta un collo di
bottiglia nell'accesso ai dati
●
E sappiamo che i DBMS scalano molto male in orizzontale
●
Le nuove applicazioni Internet hanno requisiti
prestazionali incommessurabilmente maggiori delle
applicazioni tradizionali
●
Serve un rinnovamento tecnologico anche sugli aspetti
legati alla persistenza dei dati
●
Tito Flagella - [email protected]
26
Slide
Titledi Partizionamento dei Dati
Tecniche
Sharding is the equivalent of "horizontal partitioning". When you shard
a database, you create replica's of the schema, and then divide what
data is stored in each shard based on a shard key. For example, I might
shard my customer database using CustomerId as a shard key - I'd
store ranges 0-10000 in one shard and 10001-20000 in a different
shard. When choosing a shard key, the DBA will typically look at dataaccess patterns and space issues to ensure that they are distributing
load and space across shards evenly.
●
"Vertical partitioning" is the act of splitting up the data stored in one
entity into multiple entities - again for space and performance reasons.
For example, a customer might only have one billing address, yet I
might choose to put the billing address information into a separate
table with a CustomerId reference so that I have the flexibility to move
that information into a separate database, or different security context,
etc.
●
Tito Flagella - [email protected]
27
L'esempio
Slide
Title della crescita di YouTube
The Early Years
- Use MySQL to store meta data like users, tags, and descriptions.
- Served data off a monolithic RAID 10 Volume with 10 disks.
- Living off credit cards so they leased hardware. When they needed more hardware to handle load it took a few
days to order and get delivered.
- They went through a common evolution: single server, went to a single master with multiple read slaves, then
partitioned the database, and then settled on a sharding approach.
- Suffered from replica lag. The master is multi-threaded and runs on a large machine so it can handle a lot of
work. Slaves are single threaded and usually run on lesser machines and replication is asynchronous, so the
slaves can lag significantly behind the master.
- Updates cause cache misses which goes to disk where slow I/O causes slow replication.
- Using a replicating architecture you need to spend a lot of money for incremental bits of write performance.
- One of their solutions was prioritize traffic by splitting the data into two clusters: a video watch pool and a
general cluster. The idea is that people want to watch video so that function should get the most resources. The
social networking features of YouTube are less important so they can be routed to a less capable cluster.
The later years:
- Went to database partitioning.
- Split into shards with users assigned to different shards.
- Spreads writes and reads.
- Much better cache locality which means less IO.
- Resulted in a 30% hardware reduction.
- Reduced replica lag to 0.
- Can now scale database almost arbitrarily.
Fonte: http://highscalability.com/youtube-architecture
Tito Flagella - [email protected]
28
Slide
Title il codice dai Dati
Portare
I dati scalano meglio, ma restano su server
diversi dalle applicazioni
●
I dati del web aumentano e Google non può
più indicizzare il mondo usando tecniche
così primitive
●
Google annuncia il Google File System
nell'ottobre del 2003 ed il paradigma
MapReduce nel dicembre del 2004:
●
http://research.google.com/archive/gfs.htmlhttp://research.google.com/
archive/gfs.html
http://research.google.com/archive/mapreduce.html
Tito Flagella - [email protected]
29
Slide
Title
Hadoop
Tito Flagella - [email protected]
30
NOSQL
Slide
Title Database
http://en.wikipedia.org/wiki/NoSQL
A NoSQL (often interpreted as Not only SQL) database provides a
mechanism for storage and retrieval of data that is modeled in means other
than the tabular relations used in relational databases. Motivations for this
approach include simplicity of design, horizontal scaling, and finer control
over availability. The data structures used by NoSQL databases (e.g. keyvalue, graph, or document) differ from those used in relational databases,
making some operations faster in NoSQL and others faster in relational
databases. The particular suitability of a given NoSQL database depends on
the problem it must solve. Many NoSQL stores compromise consistency in
favor of availability and partition tolerance.
http://en.wikipedia.org/wiki/NewSQL
NewSQL is a class of modern relational database management systems that
seek to provide the same scalable performance of NoSQL systems for online
transaction processing (OLTP) read-write workloads while still maintaining
the ACID guarantees of a traditional database system.
Tito Flagella - [email protected]
33
Slide
Title
L'architettura
logica di un nodo applicativo
Tito Flagella - [email protected]
34
Slide
Title
L'architettura
fisica di un nodo
Tito Flagella - [email protected]
35
Slide Title
L'architettura
software di un nodo
Tito Flagella - [email protected]
36
SlideCase
TitleStudy 1 (da: Release It!)
Tito Flagella - [email protected]
37
Slide
Title
Case
Study 1 (da: Release It!)
Tito Flagella - [email protected]
39
Slide
CaseTitle
Study 1 (da: Release It!)
Case Study 1 (da: Release It!)
Tito Flagella - [email protected]
40
Slide
TitleStudy 1 (da: Release It!)
Case
public List lookupByCity( ... ) throws SQLException, RemoteException {
Connection conn = null;
Statement stmt = null;
try {
Conn = connectionPool.getConnection();
Stmt = conn.createStatement();
// ... business logic, return results ...
}
finally {
if (stmt != null ) stmt.close();
if (conn != null ) conn.close();
}
}
}
Tito Flagella - [email protected]
41
Slide
TitleStudy 1 (da: Release It!)
Case
public List lookupByCity( ... ) throws SQLException, RemoteException {
Connection conn = null;
Statement stmt = null;
try {
Conn = connectionPool.getConnection();
Stmt = conn.createStatement();
// ... business logic, return results ...
}
finally {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) { /*ignored*/ }
if (conn != null ) conn.close();
}
}
Tito Flagella - [email protected]
42
Scarica