SlideShare une entreprise Scribd logo
1  sur  50
Esempio di Architettura Distribuita
      basata su PHP, CouchDB e Mobile
                               PHP Goes Mobile, Milano 13-04-2012




Stefano Maraspin   @maraspin
Stefano Maraspin
    Managing Partner di MV Associati

    Membro Fondatore del PUG Friuli
    PHP 5 ZCE




        @maraspin
         s.maraspin@mvassociati.it




2
IL CONTESTO
DOVE VOGLIAMO ARRIVARE?
RAPIDITA’
RISPARMIO
FEEDBACK
FASCINO
I CLIENTI ORDINANO…
LA CUCINA RICEVE
FEEDBACK / REAZIONE IMMEDIATI
Partiamo da...




14
…E SE?
Allora...




16
Cosa scegliere?




17
Incontriamo Mr. Brewer




        http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
            http://ksat.me/a-plain-english-introduction-to-cap-theorem/

18
Scelta Fatta!




19
Cos’è CouchDB?
     •   Datastore Documentale (schemaless)
     •   Database / Documenti
     •   JSON
     •   REST




20
Incontriamo Futon




21
Replicazione Semplice




             Supporto per modalità PULL e PUSH

22
Ma Semplice Davvero!




         Aggiornati non solo i dati ma anche le viste (design docs)

23
Versioni
     •   ID / _rev
     •   Aggiornamento ottimista, senza lock
     •   MVCC
     •   Aggiornamenti atomici sui documenti
     •   Coerenza Eventuale




24
Scenario di conflitto




              CouchDB – The definitive guide – O’Reilly

25
Risoluzione del Conflitto




              CouchDB – The definitive guide – O’Reilly

26
CouchApps




27
Implicazione




28
SAREMO PRESTO DISOCCUPATI!
…o forse no




30
Classico Backend




31
Business Logic




32
Poi tutto impacchettato




33
Mandato a CouchDB




             Localmente, poi si arrangia lui…

34
E QUINDI PRESENTATO AI CLIENT
L’ELEFANTE LA SPUNTA SEMPRE!
Parecchia scelta
     •   Chill
     •   Doctrine CouchDB
     •   PHP CouchDB Extension
     •   PHPillow
     •   Sag
     •   Settee
     •   Plain CURL (don’t forget it’s HTTP)



37
UNA PALLOTTOLA D’ARGENTO?
Alto consumo di disco
           16000
                        DB Size (MB)
           14000


           12000


           10000


            8000


            6000


            4000


            2000


               0


                   NB Quanto sopra su update!



39
Che Succede?




            Questione di affidabilità, performance



40
C’è dell’altro
     •   Mantenuta traccia dei documenti eliminati
         (replicazione)
     •   Spazio su disco viene dedicato anche alle
         viste (che vengono precalcolate e quindi
         mantenute incrementalmente)
     •   Quando si esegue la compattazione, fa
         prima una copia di tutti i dati



41
COMPATTIAMO QUANDO POSSIBILE…
Raw Performance
     •   3000 evt/sec in batch mode
     •   400 evt/sec inserimento
     •   100 evt/sec update
     •   10 evt/sec update durante compattazione




43
Possiamo sempre scalare…




44
O forse no?




45
Una soluzione al problema




46
La Morale
     •   CouchDB è un’ottima soluzione per
         contesti distribuiti
     •   Non è adatto per le situazioni in cui ci
         siano frequenti aggiornamenti sui dati e
         carichi (ingenti) costanti
     •   L’API REST ci aiuta a scalare le letture
     •   Bigcouch viene in aiuto sulle scritture
     •   L’utilizzo combinato di PHP e couchapp
         sembra una strada promettente

47
DOMANDE?
Photo Credits
     •   http://www.flickr.com/photos/saechang/4402720421/
     •   http://www.flickr.com/photos/koocbor/4738285092/
     •   http://www.flickr.com/photos/whykkk/6311281715/
     •   http://www.flickr.com/photos/whykkk/6311776616/
     •   http://www.flickr.com/photos/neeta_lind/2517034517/
     •   http://www.flickr.com/photos/sebastian_bergmann/2087764869/
     •   http://www.flickr.com/photos/mr_g_travels/863720665/sizes/l/in/photostream/
     •   http://www.flickr.com/photos/dobs/4128798936/sizes/l/in/photostream/
     •   other pictures come from fotolia archives




49
Grazie per l’attenzione




Stefano Maraspin
@maraspin
s.maraspin@mvassociati.it

Contenu connexe

Similaire à Esempio di architettura distribuita basata su PHP, CouchDB e Mobile

Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terra
Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terraPresentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terra
Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terraAndrea Mauro
 
Introduzione a Drupal 7 - 14/03/2013
Introduzione a Drupal 7 - 14/03/2013Introduzione a Drupal 7 - 14/03/2013
Introduzione a Drupal 7 - 14/03/2013Alessandro del Gobbo
 
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQLMySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQLPar-Tec S.p.A.
 
Microservices webinar EMEA Aug. 2017
Microservices webinar EMEA Aug. 2017Microservices webinar EMEA Aug. 2017
Microservices webinar EMEA Aug. 2017MongoDB
 
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e Mongodb
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e MongodbRealizzazione di Microservizi con Docker, Kubernetes, Kafka e Mongodb
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e MongodbMongoDB
 
Creare un Information Radiator con Delphi
Creare un Information Radiator con DelphiCreare un Information Radiator con Delphi
Creare un Information Radiator con DelphiMarco Breveglieri
 
VMUG.IT @ ITway Campus 2014
VMUG.IT @ ITway Campus 2014VMUG.IT @ ITway Campus 2014
VMUG.IT @ ITway Campus 2014Andrea Mauro
 
Windows 10 for fun - Building an Arcade BarTop
Windows 10 for fun - Building an Arcade BarTopWindows 10 for fun - Building an Arcade BarTop
Windows 10 for fun - Building an Arcade BarTopMarco Parenzan
 
CCI2019 - SQL Server ed Azure: Disaster Recovery per tutti
CCI2019 - SQL Server ed Azure: Disaster Recovery per tuttiCCI2019 - SQL Server ed Azure: Disaster Recovery per tutti
CCI2019 - SQL Server ed Azure: Disaster Recovery per tuttiwalk2talk srl
 
Matteo Baccan - Valerio Tognozzi - Novara LinuxDay 2015
Matteo Baccan - Valerio Tognozzi - Novara LinuxDay 2015Matteo Baccan - Valerio Tognozzi - Novara LinuxDay 2015
Matteo Baccan - Valerio Tognozzi - Novara LinuxDay 2015Matteo Baccan
 
JBoss Data Grid Tech Lab
JBoss Data Grid Tech LabJBoss Data Grid Tech Lab
JBoss Data Grid Tech LabUgo Landini
 
Infinispan codemotion - Codemotion Rome 2015
Infinispan codemotion - Codemotion Rome 2015Infinispan codemotion - Codemotion Rome 2015
Infinispan codemotion - Codemotion Rome 2015Codemotion
 
VMUGIT UC 2013 - 09b VMUGIT SMB
VMUGIT UC 2013 - 09b VMUGIT SMB VMUGIT UC 2013 - 09b VMUGIT SMB
VMUGIT UC 2013 - 09b VMUGIT SMB VMUG IT
 
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on Azure
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on AzureSQL Saturday 871 - Sardegna 2019 - SQL Server DR on Azure
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on AzureMarco Obinu
 
Introduzione alla localizzazione web
Introduzione alla localizzazione webIntroduzione alla localizzazione web
Introduzione alla localizzazione webQabiria
 
Docker_vs_Rancher_chi_dominerà_i_Desktop_dei_developers.pptx
Docker_vs_Rancher_chi_dominerà_i_Desktop_dei_developers.pptxDocker_vs_Rancher_chi_dominerà_i_Desktop_dei_developers.pptx
Docker_vs_Rancher_chi_dominerà_i_Desktop_dei_developers.pptxGiuliano Latini
 

Similaire à Esempio di architettura distribuita basata su PHP, CouchDB e Mobile (20)

Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terra
Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terraPresentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terra
Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terra
 
Introduzione a Drupal 7 - 14/03/2013
Introduzione a Drupal 7 - 14/03/2013Introduzione a Drupal 7 - 14/03/2013
Introduzione a Drupal 7 - 14/03/2013
 
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQLMySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
 
Microservices webinar EMEA Aug. 2017
Microservices webinar EMEA Aug. 2017Microservices webinar EMEA Aug. 2017
Microservices webinar EMEA Aug. 2017
 
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e Mongodb
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e MongodbRealizzazione di Microservizi con Docker, Kubernetes, Kafka e Mongodb
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e Mongodb
 
Creare un Information Radiator con Delphi
Creare un Information Radiator con DelphiCreare un Information Radiator con Delphi
Creare un Information Radiator con Delphi
 
VMUG.IT @ ITway Campus 2014
VMUG.IT @ ITway Campus 2014VMUG.IT @ ITway Campus 2014
VMUG.IT @ ITway Campus 2014
 
Lezioni 2009
Lezioni 2009Lezioni 2009
Lezioni 2009
 
Windows 10 for fun - Building an Arcade BarTop
Windows 10 for fun - Building an Arcade BarTopWindows 10 for fun - Building an Arcade BarTop
Windows 10 for fun - Building an Arcade BarTop
 
CCI2019 - SQL Server ed Azure: Disaster Recovery per tutti
CCI2019 - SQL Server ed Azure: Disaster Recovery per tuttiCCI2019 - SQL Server ed Azure: Disaster Recovery per tutti
CCI2019 - SQL Server ed Azure: Disaster Recovery per tutti
 
Matteo Baccan - Valerio Tognozzi - Novara LinuxDay 2015
Matteo Baccan - Valerio Tognozzi - Novara LinuxDay 2015Matteo Baccan - Valerio Tognozzi - Novara LinuxDay 2015
Matteo Baccan - Valerio Tognozzi - Novara LinuxDay 2015
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
 
Web 2.0 sviluppare e ottimizzare oggi
Web 2.0 sviluppare e ottimizzare oggiWeb 2.0 sviluppare e ottimizzare oggi
Web 2.0 sviluppare e ottimizzare oggi
 
JBoss Data Grid Tech Lab
JBoss Data Grid Tech LabJBoss Data Grid Tech Lab
JBoss Data Grid Tech Lab
 
Infinispan codemotion - Codemotion Rome 2015
Infinispan codemotion - Codemotion Rome 2015Infinispan codemotion - Codemotion Rome 2015
Infinispan codemotion - Codemotion Rome 2015
 
VMUGIT UC 2013 - 09b VMUGIT SMB
VMUGIT UC 2013 - 09b VMUGIT SMB VMUGIT UC 2013 - 09b VMUGIT SMB
VMUGIT UC 2013 - 09b VMUGIT SMB
 
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on Azure
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on AzureSQL Saturday 871 - Sardegna 2019 - SQL Server DR on Azure
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on Azure
 
Bbox
BboxBbox
Bbox
 
Introduzione alla localizzazione web
Introduzione alla localizzazione webIntroduzione alla localizzazione web
Introduzione alla localizzazione web
 
Docker_vs_Rancher_chi_dominerà_i_Desktop_dei_developers.pptx
Docker_vs_Rancher_chi_dominerà_i_Desktop_dei_developers.pptxDocker_vs_Rancher_chi_dominerà_i_Desktop_dei_developers.pptx
Docker_vs_Rancher_chi_dominerà_i_Desktop_dei_developers.pptx
 

Plus de Steve Maraspin

Architetture a Microservizi (con Kubernetes)
Architetture a Microservizi (con Kubernetes)Architetture a Microservizi (con Kubernetes)
Architetture a Microservizi (con Kubernetes)Steve Maraspin
 
How Agile changed Software Development
How Agile changed Software DevelopmentHow Agile changed Software Development
How Agile changed Software DevelopmentSteve Maraspin
 
Principi di Interaction Design
Principi di Interaction DesignPrincipi di Interaction Design
Principi di Interaction DesignSteve Maraspin
 
Customer Journey Mapping Workshop
Customer Journey Mapping WorkshopCustomer Journey Mapping Workshop
Customer Journey Mapping WorkshopSteve Maraspin
 
A (really) Quick Introduction to Event Storming
A (really) Quick Introduction to Event StormingA (really) Quick Introduction to Event Storming
A (really) Quick Introduction to Event StormingSteve Maraspin
 
Meet a parallel, asynchronous PHP world
Meet a parallel, asynchronous PHP worldMeet a parallel, asynchronous PHP world
Meet a parallel, asynchronous PHP worldSteve Maraspin
 
Don't Make Me Think - There's no need (2014)
Don't Make Me Think - There's no need (2014)Don't Make Me Think - There's no need (2014)
Don't Make Me Think - There's no need (2014)Steve Maraspin
 
The Metaphor Fallacy (in Digital Product Development)
The Metaphor Fallacy (in Digital Product Development)The Metaphor Fallacy (in Digital Product Development)
The Metaphor Fallacy (in Digital Product Development)Steve Maraspin
 
Lean UX: Sviluppo Software Agile e Incentrato sull'Utente
Lean UX: Sviluppo Software Agile e Incentrato sull'UtenteLean UX: Sviluppo Software Agile e Incentrato sull'Utente
Lean UX: Sviluppo Software Agile e Incentrato sull'UtenteSteve Maraspin
 
La filosofia Lean nello sviluppo di prodotti digitali
La filosofia Lean nello sviluppo di prodotti digitaliLa filosofia Lean nello sviluppo di prodotti digitali
La filosofia Lean nello sviluppo di prodotti digitaliSteve Maraspin
 
Error Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, loggingError Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, loggingSteve Maraspin
 
Outcome not Output: A Story of Lean UX Adoption
Outcome not Output: A Story of Lean UX AdoptionOutcome not Output: A Story of Lean UX Adoption
Outcome not Output: A Story of Lean UX AdoptionSteve Maraspin
 
Don't Make me Think - There's no Need
Don't Make me Think - There's no NeedDon't Make me Think - There's no Need
Don't Make me Think - There's no NeedSteve Maraspin
 
ZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of itZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of itSteve Maraspin
 
Fare con Zend Framework 2 ciò che facevo con ZF1
Fare con Zend Framework 2 ciò che facevo con ZF1Fare con Zend Framework 2 ciò che facevo con ZF1
Fare con Zend Framework 2 ciò che facevo con ZF1Steve Maraspin
 
NoSQL Data Stores: Introduzione alle Basi di Dati Non Relazionali
NoSQL Data Stores: Introduzione alle Basi di Dati Non RelazionaliNoSQL Data Stores: Introduzione alle Basi di Dati Non Relazionali
NoSQL Data Stores: Introduzione alle Basi di Dati Non RelazionaliSteve Maraspin
 
NoSQL, No Worries: Vecchi Problemi, Nuove Soluzioni
NoSQL, No Worries: Vecchi Problemi, Nuove SoluzioniNoSQL, No Worries: Vecchi Problemi, Nuove Soluzioni
NoSQL, No Worries: Vecchi Problemi, Nuove SoluzioniSteve Maraspin
 
Permettere al cliente di apprezzare l'approccio agile
Permettere al cliente di apprezzare l'approccio agilePermettere al cliente di apprezzare l'approccio agile
Permettere al cliente di apprezzare l'approccio agileSteve Maraspin
 
Let customers appreciate the agile workflow
Let customers appreciate the agile workflowLet customers appreciate the agile workflow
Let customers appreciate the agile workflowSteve Maraspin
 
Striving towards better PHP code
Striving towards better PHP codeStriving towards better PHP code
Striving towards better PHP codeSteve Maraspin
 

Plus de Steve Maraspin (20)

Architetture a Microservizi (con Kubernetes)
Architetture a Microservizi (con Kubernetes)Architetture a Microservizi (con Kubernetes)
Architetture a Microservizi (con Kubernetes)
 
How Agile changed Software Development
How Agile changed Software DevelopmentHow Agile changed Software Development
How Agile changed Software Development
 
Principi di Interaction Design
Principi di Interaction DesignPrincipi di Interaction Design
Principi di Interaction Design
 
Customer Journey Mapping Workshop
Customer Journey Mapping WorkshopCustomer Journey Mapping Workshop
Customer Journey Mapping Workshop
 
A (really) Quick Introduction to Event Storming
A (really) Quick Introduction to Event StormingA (really) Quick Introduction to Event Storming
A (really) Quick Introduction to Event Storming
 
Meet a parallel, asynchronous PHP world
Meet a parallel, asynchronous PHP worldMeet a parallel, asynchronous PHP world
Meet a parallel, asynchronous PHP world
 
Don't Make Me Think - There's no need (2014)
Don't Make Me Think - There's no need (2014)Don't Make Me Think - There's no need (2014)
Don't Make Me Think - There's no need (2014)
 
The Metaphor Fallacy (in Digital Product Development)
The Metaphor Fallacy (in Digital Product Development)The Metaphor Fallacy (in Digital Product Development)
The Metaphor Fallacy (in Digital Product Development)
 
Lean UX: Sviluppo Software Agile e Incentrato sull'Utente
Lean UX: Sviluppo Software Agile e Incentrato sull'UtenteLean UX: Sviluppo Software Agile e Incentrato sull'Utente
Lean UX: Sviluppo Software Agile e Incentrato sull'Utente
 
La filosofia Lean nello sviluppo di prodotti digitali
La filosofia Lean nello sviluppo di prodotti digitaliLa filosofia Lean nello sviluppo di prodotti digitali
La filosofia Lean nello sviluppo di prodotti digitali
 
Error Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, loggingError Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, logging
 
Outcome not Output: A Story of Lean UX Adoption
Outcome not Output: A Story of Lean UX AdoptionOutcome not Output: A Story of Lean UX Adoption
Outcome not Output: A Story of Lean UX Adoption
 
Don't Make me Think - There's no Need
Don't Make me Think - There's no NeedDon't Make me Think - There's no Need
Don't Make me Think - There's no Need
 
ZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of itZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of it
 
Fare con Zend Framework 2 ciò che facevo con ZF1
Fare con Zend Framework 2 ciò che facevo con ZF1Fare con Zend Framework 2 ciò che facevo con ZF1
Fare con Zend Framework 2 ciò che facevo con ZF1
 
NoSQL Data Stores: Introduzione alle Basi di Dati Non Relazionali
NoSQL Data Stores: Introduzione alle Basi di Dati Non RelazionaliNoSQL Data Stores: Introduzione alle Basi di Dati Non Relazionali
NoSQL Data Stores: Introduzione alle Basi di Dati Non Relazionali
 
NoSQL, No Worries: Vecchi Problemi, Nuove Soluzioni
NoSQL, No Worries: Vecchi Problemi, Nuove SoluzioniNoSQL, No Worries: Vecchi Problemi, Nuove Soluzioni
NoSQL, No Worries: Vecchi Problemi, Nuove Soluzioni
 
Permettere al cliente di apprezzare l'approccio agile
Permettere al cliente di apprezzare l'approccio agilePermettere al cliente di apprezzare l'approccio agile
Permettere al cliente di apprezzare l'approccio agile
 
Let customers appreciate the agile workflow
Let customers appreciate the agile workflowLet customers appreciate the agile workflow
Let customers appreciate the agile workflow
 
Striving towards better PHP code
Striving towards better PHP codeStriving towards better PHP code
Striving towards better PHP code
 

Esempio di architettura distribuita basata su PHP, CouchDB e Mobile