SlideShare une entreprise Scribd logo
1  sur  78
Télécharger pour lire hors ligne
Mathieu ANCELIN 
Alexandre DELEGUE
Mathieu ANCELIN 
• Développeur @SERLI 
• Scala, Java, web & OSS 
• ReactiveCouchbase, Weld-OSGi, Weld, etc ... 
• Poitou-Charentes JUG 
• Membre de l’expert group CDI 1.1 (JSR-346) 
• Membre de l’expert group OSGi Enterprise 
• @TrevorReznik
Alexandre DELEGUE 
• Développeur @ SERLI 
• Java 
• Scala 
• Web 
• spring, play, … 
• @chanksleroux
SERLI 
• Société de conseil et d’ingénierie du SI 
• 75 personnes 
• 80% de business Java 
• Contribution à des projets OSS 
• 10% de la force de travail sur l’OSS 
• Membre de l’EG JSR-346 
• Membre de l’OSGi Alliance 
• www.serli.com @SerliFr
Les technologies présentées sont inspirées de 
technologies réelles! 
Les applications qui en découlent sont fictives! 
Toute ressemblance avec des applications existantes n’est 
que fortuite!
ALEX
www.amazing.com
Mobile infrastructure
Mobile infrastructure 
Raspberry pi 
x 7 
Routeur wifi 
Switch
Demo
Résister à la charge
Résister aux pannes
Absorber une hausse de trafic
Approche classique
Monolithique 
bouquetin 
faisan 
hornbill 
???
Latence
Bloquant
Charge
Scalabilité
Reactive Manifesto
Reactive Manifesto
Reactive manifesto 
• react to event : the event-driven nature enables the following 
qualities 
• react to load : focus on scalability by avoiding contention on 
shared resources 
• react to failure : build resilient systems with the ability to 
recover at all levels 
• react to user : honor response time guarantees regardless of 
load
Scalable / React to load
Overview 
Frontend 
Cart 
Identity 
Backend
Datas
Mini / Micro Services 
• Une application par domaine fonctionnel 
• store-frontend : présentation du contenu 
• store-identity : authentification / gestion de compte 
• store-cart : panier 
• store-backend : administration du site
Stateless 
• Chaque application est stateless 
• aucune donnée n’est stockée dans l’application (pas de cache, pas de 
fichier …) 
• Chaque application peut être clonée 
Session
Frontend 
}- 100 % html 
- Indexation par les 
moteurs de recherche 
- stateless 
- une url == un contenu
Limiter la charge
Cache 
Frontend 
Cache 
Browser 
CDN 
nginx/http 
varnish
Optimisations 
Base de données ? 
Cache 
+ 
recherche full text
Modèle de données 
{ 
id: "04abe480-2521-11e4-acde-f7b0d99b8321", 
label: "Product number 1", 
description: "A description …", 
image: "image.jpeg", 
price: 1.5, 
fragments: [{ 
type: "search", 
html: " <div >...</div>" 
},{ 
type: "cart", 
html: " <tr >...</tr>" 
} 
] 
} 
}} 
Données 
indexées 
pour la 
recherche 
HTML 
pré-généré
Recherche 
GET /products?q=some%20text Frontend Search 
some text 
- Concat fragments 
- Include into main 
template
Créer / mettre à jour 
UpdateProduct ProductUpdated Frontend EventSource 
Backend 
ProductUpdated
Resilient / react to failure
Infrastructure 
Frontend 
Identity Identity 
Backend 
Cart 
Frontend 
Cart 
Backend 
Identity
Infrastructure 
Frontend 
Identity Identity 
Backend 
Cart 
Frontend 
Cart 
Backend 
Identity
Infrastructure 
Frontend 
Identity Identity 
Backend 
Cart 
Frontend 
Cart 
Backend 
Identity
Infrastructure 
Frontend 
Identity Identity 
Backend 
Cart 
Frontend 
Cart 
Backend 
Identity
Demo 
! 
Let It Crash !!!
Event-driven / react to event
Akka 
• Akka 
• Modèle acteur 
• Un acteur = Une entité statefull 
• Communication entre acteurs par messages (même à distance) 
• Un acteur peut créer/détruire des enfants 
• Un acteur peut surveiller d’autres acteurs 
• Plus de problèmes de concurrence, asynchrone par nature 
• Résistant aux pannes 
• Java or Scala
Akka 
Actor 
Actor 
Fils Actor 
Fils messages Actor 
Actor 
Actor 
Fils 
Fils 
Fils 
Actor 
Fils 
Server 1 
Server 2 
messages
Akka messages 
import akka.actor.{Props, ActorSystem, ActorLogging, Actor} 
case class Greeting(who: String) 
class GreetingActor extends Actor with ActorLogging { 
def receive = { 
case Greeting(who) ⇒ log.info("Hello " + who) 
} 
} 
val system = ActorSystem("MySystem") 
val greeter = system.actorOf(Props[GreetingActor], name = "greeter") 
greeter ! Greeting("Charlie Parker")
Play 2 
• Framework web 
• java or scala 
• Support pour les websocket et le server sent event 
• Asynchrone 
• pré-requis pour une application orientée événements
Play async 
case class ListProductsQuery() 
class ProductView extends Actor { 
override def receive: Receive = { 
case ListProductsQuery() => models.Product.list() pipeTo sender() 
} 
} 
! 
class ProductsController extends Controller { 
private def listProducts(): Future[List[models.Product]] = { 
(Actors.productView() ? ListProductsQuery()).mapTo[List[models.Product]] 
} 
def index() = Action.async { 
listProducts().map(products => Ok(views.html.index(products))) 
} 
}
Messages 
Frontend 
Cart 
Identity 
Backend 
CheckAuth 
UpdateProduct 
OrderCart 
ProductUpdated 
AddProductToCart 
ProductAddedToCart 
WebSocket 
Messages Akka 
Server sent event
Cluster 
• Utilisation de Akka-cluster 
• Librairie permettant de former un cluster de systèmes d’acteurs 
• simple service d’adhésion 
• tolérant aux pannes 
• décentralisé (P2P, gossip) 
• pas de SPOF 
• pas de SPOB 
• détection des pannes
Cluster services 
• Librairie de découverte de services distribués 
• Exposition descripteurs de services (URL, protocole, version, nom) 
• Repose sur les memberships du cluster Akka 
• Clients de services 
• HTTP, Akka, Thrift, Memcached … 
• Petits plus 
• Monitoring 
• Load balancing (pas très intelligent) 
• Retry with exponential back off
Cluster services 
Client 
spécifique 
Client 
Générique Monitoring 
Load balancer 
+ 
retry 
Service 
instance 1 
Service 
instance 1 
Service 
instance 1
Cluster services 
Client 
spécifique 
Client 
Générique Monitoring 
Load balancer 
+ 
retry 
Service 
instance 1 
Service 
instance 1 
Service 
instance 1
Cluster services 
Client 
spécifique 
Client 
Générique Monitoring 
Load balancer 
+ 
retry 
Service 
instance 1 
Service 
instance 1 
Service 
instance 1
CQRS & EventSourcing 
• Command Query Responsibility Segregation 
• Command : Enregistrement 
• Query : Lecture 
• 2 modèles distincts 
• Séparation des services 
• Event sourcing 
• Stockage des événements
Persistence 
command event event event 
Event source Journal 
processor 
View 1 
View 2 
View 3
Exemple 
AddProductToCart 
ProductAddedToCart ProductAddedToCart ProductAddedToCart 
Journal 
WebSocket 
Actor 
Products 
Views 
Products 
Processor
Responsive
Frontend réactif
Demo 
! 
Realtime web!
Et les perfs dans tout ca ?
Les chiffres 
367 998 456 756
Les chiffres 
367 998 456 756 €
200 clients
400 clients
Metrics everywhere !!!
Les problèmes 
rencontrés
Nginx / mongo …
Cassandra
Bench web socket
Configuration akka-cluster
Conclusion
scala
This is the end ...

Contenu connexe

Tendances

[DevTestday] Continuous Delivery d'une Infra Dev/Test Azure - Olivier Delmotte
[DevTestday] Continuous Delivery d'une Infra Dev/Test Azure - Olivier Delmotte[DevTestday] Continuous Delivery d'une Infra Dev/Test Azure - Olivier Delmotte
[DevTestday] Continuous Delivery d'une Infra Dev/Test Azure - Olivier DelmotteCellenza
 
Bonnes pratiques anti-DDOS
Bonnes pratiques anti-DDOSBonnes pratiques anti-DDOS
Bonnes pratiques anti-DDOSJulien SIMON
 
Vincent biret azure functions et flow (montreal)
Vincent biret azure functions et flow (montreal)Vincent biret azure functions et flow (montreal)
Vincent biret azure functions et flow (montreal)Vincent Biret
 
JSS2014 – Industrialisation de l’audit MSSQL
JSS2014 – Industrialisation de l’audit MSSQLJSS2014 – Industrialisation de l’audit MSSQL
JSS2014 – Industrialisation de l’audit MSSQLGUSS
 
Introduction à Play Framework 2
Introduction à Play Framework 2Introduction à Play Framework 2
Introduction à Play Framework 2Samy Dindane
 
NodeJS et SocketIO en mode scalable dans le Cloud - GAB 2015
NodeJS et SocketIO en mode scalable dans le Cloud - GAB 2015NodeJS et SocketIO en mode scalable dans le Cloud - GAB 2015
NodeJS et SocketIO en mode scalable dans le Cloud - GAB 2015Stéphane ESCANDELL
 
[DevTestday] Azure devtestlab - Mikael Krief
[DevTestday] Azure devtestlab - Mikael Krief[DevTestday] Azure devtestlab - Mikael Krief
[DevTestday] Azure devtestlab - Mikael KriefCellenza
 
Azure Stream analytics / Event Hub
Azure Stream analytics / Event HubAzure Stream analytics / Event Hub
Azure Stream analytics / Event HubMichel HUBERT
 
Restful, really ? MixIt 2014
Restful, really ? MixIt 2014Restful, really ? MixIt 2014
Restful, really ? MixIt 2014Xavier Carpentier
 
[Webinaire avec Océane Consulting] Utiliser Vaadin pour intégrer Nuxeo et Lif...
[Webinaire avec Océane Consulting] Utiliser Vaadin pour intégrer Nuxeo et Lif...[Webinaire avec Océane Consulting] Utiliser Vaadin pour intégrer Nuxeo et Lif...
[Webinaire avec Océane Consulting] Utiliser Vaadin pour intégrer Nuxeo et Lif...Nuxeo
 
[Dev/Testday] Dev testazure infra-arm - Manon Pernin
[Dev/Testday] Dev testazure infra-arm - Manon Pernin[Dev/Testday] Dev testazure infra-arm - Manon Pernin
[Dev/Testday] Dev testazure infra-arm - Manon PerninCellenza
 
Instances multiples : les pièges à éviter (Liferay User Group France)
Instances multiples : les pièges à éviter (Liferay User Group France)Instances multiples : les pièges à éviter (Liferay User Group France)
Instances multiples : les pièges à éviter (Liferay User Group France)Sébastien Le Marchand
 
Azugfr 2703 - service fabric
Azugfr   2703 - service fabricAzugfr   2703 - service fabric
Azugfr 2703 - service fabricWilfried Woivre
 
Chiffrez vos données avec AWS KMS et avec AWS CloudHSM
Chiffrez vos données avec AWS KMS et avec AWS CloudHSMChiffrez vos données avec AWS KMS et avec AWS CloudHSM
Chiffrez vos données avec AWS KMS et avec AWS CloudHSMJulien SIMON
 
Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016) Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016) Fabrice Sznajderman
 
Caching reboot: javax.cache & Ehcache 3
Caching reboot: javax.cache & Ehcache 3Caching reboot: javax.cache & Ehcache 3
Caching reboot: javax.cache & Ehcache 3Louis Jacomet
 

Tendances (20)

[DevTestday] Continuous Delivery d'une Infra Dev/Test Azure - Olivier Delmotte
[DevTestday] Continuous Delivery d'une Infra Dev/Test Azure - Olivier Delmotte[DevTestday] Continuous Delivery d'une Infra Dev/Test Azure - Olivier Delmotte
[DevTestday] Continuous Delivery d'une Infra Dev/Test Azure - Olivier Delmotte
 
Bonnes pratiques anti-DDOS
Bonnes pratiques anti-DDOSBonnes pratiques anti-DDOS
Bonnes pratiques anti-DDOS
 
Vincent biret azure functions et flow (montreal)
Vincent biret azure functions et flow (montreal)Vincent biret azure functions et flow (montreal)
Vincent biret azure functions et flow (montreal)
 
Python + ansible = ♥
Python + ansible = ♥Python + ansible = ♥
Python + ansible = ♥
 
SQL in the Azure World
SQL in the Azure WorldSQL in the Azure World
SQL in the Azure World
 
JSS2014 – Industrialisation de l’audit MSSQL
JSS2014 – Industrialisation de l’audit MSSQLJSS2014 – Industrialisation de l’audit MSSQL
JSS2014 – Industrialisation de l’audit MSSQL
 
Introduction à Play Framework 2
Introduction à Play Framework 2Introduction à Play Framework 2
Introduction à Play Framework 2
 
NodeJS et SocketIO en mode scalable dans le Cloud - GAB 2015
NodeJS et SocketIO en mode scalable dans le Cloud - GAB 2015NodeJS et SocketIO en mode scalable dans le Cloud - GAB 2015
NodeJS et SocketIO en mode scalable dans le Cloud - GAB 2015
 
[DevTestday] Azure devtestlab - Mikael Krief
[DevTestday] Azure devtestlab - Mikael Krief[DevTestday] Azure devtestlab - Mikael Krief
[DevTestday] Azure devtestlab - Mikael Krief
 
Azure Stream analytics / Event Hub
Azure Stream analytics / Event HubAzure Stream analytics / Event Hub
Azure Stream analytics / Event Hub
 
Restful, really ? MixIt 2014
Restful, really ? MixIt 2014Restful, really ? MixIt 2014
Restful, really ? MixIt 2014
 
[Webinaire avec Océane Consulting] Utiliser Vaadin pour intégrer Nuxeo et Lif...
[Webinaire avec Océane Consulting] Utiliser Vaadin pour intégrer Nuxeo et Lif...[Webinaire avec Océane Consulting] Utiliser Vaadin pour intégrer Nuxeo et Lif...
[Webinaire avec Océane Consulting] Utiliser Vaadin pour intégrer Nuxeo et Lif...
 
YaJUG - Spring 3.0
YaJUG - Spring 3.0YaJUG - Spring 3.0
YaJUG - Spring 3.0
 
[Dev/Testday] Dev testazure infra-arm - Manon Pernin
[Dev/Testday] Dev testazure infra-arm - Manon Pernin[Dev/Testday] Dev testazure infra-arm - Manon Pernin
[Dev/Testday] Dev testazure infra-arm - Manon Pernin
 
Hashicorp Vault
Hashicorp VaultHashicorp Vault
Hashicorp Vault
 
Instances multiples : les pièges à éviter (Liferay User Group France)
Instances multiples : les pièges à éviter (Liferay User Group France)Instances multiples : les pièges à éviter (Liferay User Group France)
Instances multiples : les pièges à éviter (Liferay User Group France)
 
Azugfr 2703 - service fabric
Azugfr   2703 - service fabricAzugfr   2703 - service fabric
Azugfr 2703 - service fabric
 
Chiffrez vos données avec AWS KMS et avec AWS CloudHSM
Chiffrez vos données avec AWS KMS et avec AWS CloudHSMChiffrez vos données avec AWS KMS et avec AWS CloudHSM
Chiffrez vos données avec AWS KMS et avec AWS CloudHSM
 
Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016) Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016)
 
Caching reboot: javax.cache & Ehcache 3
Caching reboot: javax.cache & Ehcache 3Caching reboot: javax.cache & Ehcache 3
Caching reboot: javax.cache & Ehcache 3
 

En vedette

Sophia conf 2013 - Le monde du Raspberry
Sophia conf 2013 - Le monde du RaspberrySophia conf 2013 - Le monde du Raspberry
Sophia conf 2013 - Le monde du RaspberryNicolas Hennion
 
raspberry pi
 raspberry pi raspberry pi
raspberry piTECOS
 
Maisons Intelligentes ( Projet bibliographique )
Maisons Intelligentes ( Projet bibliographique ) Maisons Intelligentes ( Projet bibliographique )
Maisons Intelligentes ( Projet bibliographique ) Hamza Ibrahmi
 
4.0 test d’un port gpio
4.0 test d’un port gpio4.0 test d’un port gpio
4.0 test d’un port gpioOsi Pallière
 
Hacker son appareil photo avec des outils libres
Hacker son appareil photo avec des outils libresHacker son appareil photo avec des outils libres
Hacker son appareil photo avec des outils libresRobert Viseur
 
Reactive programming at scale
Reactive programming at scale Reactive programming at scale
Reactive programming at scale John McClean
 
Présentation Raspberry Pi (cocoaheads remix)
Présentation Raspberry Pi (cocoaheads remix)Présentation Raspberry Pi (cocoaheads remix)
Présentation Raspberry Pi (cocoaheads remix)Arnaud Boudou
 
presentation projet domotique
presentation projet domotiquepresentation projet domotique
presentation projet domotiquets4riadhoc
 
Supercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-reactSupercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-reactJohn McClean
 
Maison domotique à Québec – Maison intelligente
Maison domotique à Québec – Maison intelligenteMaison domotique à Québec – Maison intelligente
Maison domotique à Québec – Maison intelligenteMartin Trudel
 
Eclipse Kura Shoot a-pi
Eclipse Kura Shoot a-piEclipse Kura Shoot a-pi
Eclipse Kura Shoot a-piEclipse Kura
 
Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaKasun Indrasiri
 
Agenda du roppa et de ses plateformes de decembre à fin fevrier version Fran...
Agenda du roppa  et de ses plateformes de decembre à fin fevrier version Fran...Agenda du roppa  et de ses plateformes de decembre à fin fevrier version Fran...
Agenda du roppa et de ses plateformes de decembre à fin fevrier version Fran...Fatimata Kone
 
The Dangersof Plastic Bags.Pps
The Dangersof Plastic Bags.PpsThe Dangersof Plastic Bags.Pps
The Dangersof Plastic Bags.Ppsguest48cad3
 
Internet básico: Convertirse en Periodista Digital
Internet básico: Convertirse en Periodista DigitalInternet básico: Convertirse en Periodista Digital
Internet básico: Convertirse en Periodista Digitalonlinesimple
 

En vedette (20)

Sophia conf 2013 - Le monde du Raspberry
Sophia conf 2013 - Le monde du RaspberrySophia conf 2013 - Le monde du Raspberry
Sophia conf 2013 - Le monde du Raspberry
 
raspberry pi
 raspberry pi raspberry pi
raspberry pi
 
Maisons Intelligentes ( Projet bibliographique )
Maisons Intelligentes ( Projet bibliographique ) Maisons Intelligentes ( Projet bibliographique )
Maisons Intelligentes ( Projet bibliographique )
 
Raspberry
RaspberryRaspberry
Raspberry
 
4.0 test d’un port gpio
4.0 test d’un port gpio4.0 test d’un port gpio
4.0 test d’un port gpio
 
Hacker son appareil photo avec des outils libres
Hacker son appareil photo avec des outils libresHacker son appareil photo avec des outils libres
Hacker son appareil photo avec des outils libres
 
Reactive programming at scale
Reactive programming at scale Reactive programming at scale
Reactive programming at scale
 
Athos grenoble
Athos grenobleAthos grenoble
Athos grenoble
 
Présentation Raspberry Pi (cocoaheads remix)
Présentation Raspberry Pi (cocoaheads remix)Présentation Raspberry Pi (cocoaheads remix)
Présentation Raspberry Pi (cocoaheads remix)
 
presentation projet domotique
presentation projet domotiquepresentation projet domotique
presentation projet domotique
 
Supercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-reactSupercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-react
 
Maison domotique à Québec – Maison intelligente
Maison domotique à Québec – Maison intelligenteMaison domotique à Québec – Maison intelligente
Maison domotique à Québec – Maison intelligente
 
Eclipse Kura Shoot a-pi
Eclipse Kura Shoot a-piEclipse Kura Shoot a-pi
Eclipse Kura Shoot a-pi
 
Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-Java
 
Agenda du roppa et de ses plateformes de decembre à fin fevrier version Fran...
Agenda du roppa  et de ses plateformes de decembre à fin fevrier version Fran...Agenda du roppa  et de ses plateformes de decembre à fin fevrier version Fran...
Agenda du roppa et de ses plateformes de decembre à fin fevrier version Fran...
 
The Dangersof Plastic Bags.Pps
The Dangersof Plastic Bags.PpsThe Dangersof Plastic Bags.Pps
The Dangersof Plastic Bags.Pps
 
Experiencias actividades complementarias Barcelona
Experiencias actividades complementarias BarcelonaExperiencias actividades complementarias Barcelona
Experiencias actividades complementarias Barcelona
 
Electricidad
ElectricidadElectricidad
Electricidad
 
Internet básico: Convertirse en Periodista Digital
Internet básico: Convertirse en Periodista DigitalInternet básico: Convertirse en Periodista Digital
Internet básico: Convertirse en Periodista Digital
 
Alcohol Rosario
Alcohol RosarioAlcohol Rosario
Alcohol Rosario
 

Similaire à I don't always write reactive application but when I do, it run on raspberry pi

Architectures microservices
Architectures microservicesArchitectures microservices
Architectures microservicesRiadh MNASRI
 
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 20167 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016Sébastien Le Marchand
 
J1 T1 5 - Stream Analytics - Cédric Charlier
J1 T1 5 - Stream Analytics - Cédric CharlierJ1 T1 5 - Stream Analytics - Cédric Charlier
J1 T1 5 - Stream Analytics - Cédric CharlierMS Cloud Summit
 
Azure Camp 9 Décembre - slides session développeurs webmedia
Azure Camp 9 Décembre - slides session développeurs webmediaAzure Camp 9 Décembre - slides session développeurs webmedia
Azure Camp 9 Décembre - slides session développeurs webmediaMicrosoft
 
Architecture d’une app qui fait 5 millions de visites par mois
Architecture d’une app qui fait 5 millions de visites par moisArchitecture d’une app qui fait 5 millions de visites par mois
Architecture d’une app qui fait 5 millions de visites par moisJulien Carnelos
 
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...Jean-Laurent de Morlhon
 
Besoin de rien Envie de Search - Presentation Lucene Solr ElasticSearch
Besoin de rien Envie de Search - Presentation Lucene Solr ElasticSearchBesoin de rien Envie de Search - Presentation Lucene Solr ElasticSearch
Besoin de rien Envie de Search - Presentation Lucene Solr ElasticSearchfrancelabs
 
La mobilité dans Drupal
La mobilité dans DrupalLa mobilité dans Drupal
La mobilité dans DrupalAdyax
 
USI 2009 - Du RIA pour SI
USI 2009 - Du RIA pour SIUSI 2009 - Du RIA pour SI
USI 2009 - Du RIA pour SIDjamel Zouaoui
 
[GAB2016] Azure DocumentDB - Jean-Luc Boucho
[GAB2016] Azure DocumentDB - Jean-Luc Boucho[GAB2016] Azure DocumentDB - Jean-Luc Boucho
[GAB2016] Azure DocumentDB - Jean-Luc BouchoCellenza
 
Jean-Luc Boucho - Azure DocumentDB - Global Azure Bootcamp 2016 Paris
Jean-Luc Boucho - Azure DocumentDB - Global Azure Bootcamp 2016 Paris Jean-Luc Boucho - Azure DocumentDB - Global Azure Bootcamp 2016 Paris
Jean-Luc Boucho - Azure DocumentDB - Global Azure Bootcamp 2016 Paris AZUG FR
 
AWS Paris Summit 2014 - T3 - Architecturer avec AWS pour des millions d'util...
AWS Paris Summit 2014 - T3 -  Architecturer avec AWS pour des millions d'util...AWS Paris Summit 2014 - T3 -  Architecturer avec AWS pour des millions d'util...
AWS Paris Summit 2014 - T3 - Architecturer avec AWS pour des millions d'util...Amazon Web Services
 
Du JavaScript dans mon projet
Du JavaScript dans mon projetDu JavaScript dans mon projet
Du JavaScript dans mon projetjollivetc
 
4D Summit Europe 2016 - Conférence d'A&C Consulting : "Stocker des données su...
4D Summit Europe 2016 - Conférence d'A&C Consulting : "Stocker des données su...4D Summit Europe 2016 - Conférence d'A&C Consulting : "Stocker des données su...
4D Summit Europe 2016 - Conférence d'A&C Consulting : "Stocker des données su...Nathalie Richomme
 
Aspectize meetup
Aspectize meetupAspectize meetup
Aspectize meetupAspectize
 

Similaire à I don't always write reactive application but when I do, it run on raspberry pi (20)

Architectures microservices
Architectures microservicesArchitectures microservices
Architectures microservices
 
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 20167 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
 
J1 T1 5 - Stream Analytics - Cédric Charlier
J1 T1 5 - Stream Analytics - Cédric CharlierJ1 T1 5 - Stream Analytics - Cédric Charlier
J1 T1 5 - Stream Analytics - Cédric Charlier
 
Azure Camp 9 Décembre - slides session développeurs webmedia
Azure Camp 9 Décembre - slides session développeurs webmediaAzure Camp 9 Décembre - slides session développeurs webmedia
Azure Camp 9 Décembre - slides session développeurs webmedia
 
Architecture d’une app qui fait 5 millions de visites par mois
Architecture d’une app qui fait 5 millions de visites par moisArchitecture d’une app qui fait 5 millions de visites par mois
Architecture d’une app qui fait 5 millions de visites par mois
 
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
 
Workshop - Lightning Web Components
Workshop - Lightning Web ComponentsWorkshop - Lightning Web Components
Workshop - Lightning Web Components
 
Workshop Lightning Web Components
Workshop Lightning Web ComponentsWorkshop Lightning Web Components
Workshop Lightning Web Components
 
Besoin de rien Envie de Search - Presentation Lucene Solr ElasticSearch
Besoin de rien Envie de Search - Presentation Lucene Solr ElasticSearchBesoin de rien Envie de Search - Presentation Lucene Solr ElasticSearch
Besoin de rien Envie de Search - Presentation Lucene Solr ElasticSearch
 
La mobilité dans Drupal
La mobilité dans DrupalLa mobilité dans Drupal
La mobilité dans Drupal
 
Nouveaux apis
Nouveaux apisNouveaux apis
Nouveaux apis
 
USI 2009 - Du RIA pour SI
USI 2009 - Du RIA pour SIUSI 2009 - Du RIA pour SI
USI 2009 - Du RIA pour SI
 
[GAB2016] Azure DocumentDB - Jean-Luc Boucho
[GAB2016] Azure DocumentDB - Jean-Luc Boucho[GAB2016] Azure DocumentDB - Jean-Luc Boucho
[GAB2016] Azure DocumentDB - Jean-Luc Boucho
 
Jean-Luc Boucho - Azure DocumentDB - Global Azure Bootcamp 2016 Paris
Jean-Luc Boucho - Azure DocumentDB - Global Azure Bootcamp 2016 Paris Jean-Luc Boucho - Azure DocumentDB - Global Azure Bootcamp 2016 Paris
Jean-Luc Boucho - Azure DocumentDB - Global Azure Bootcamp 2016 Paris
 
AWS Paris Summit 2014 - T3 - Architecturer avec AWS pour des millions d'util...
AWS Paris Summit 2014 - T3 -  Architecturer avec AWS pour des millions d'util...AWS Paris Summit 2014 - T3 -  Architecturer avec AWS pour des millions d'util...
AWS Paris Summit 2014 - T3 - Architecturer avec AWS pour des millions d'util...
 
Du JavaScript dans mon projet
Du JavaScript dans mon projetDu JavaScript dans mon projet
Du JavaScript dans mon projet
 
Esiea - 5A - Archi 1/3
Esiea - 5A - Archi 1/3Esiea - 5A - Archi 1/3
Esiea - 5A - Archi 1/3
 
4D Summit Europe 2016 - Conférence d'A&C Consulting : "Stocker des données su...
4D Summit Europe 2016 - Conférence d'A&C Consulting : "Stocker des données su...4D Summit Europe 2016 - Conférence d'A&C Consulting : "Stocker des données su...
4D Summit Europe 2016 - Conférence d'A&C Consulting : "Stocker des données su...
 
Aspectize meetup
Aspectize meetupAspectize meetup
Aspectize meetup
 
Usine Logicielle 2013
Usine Logicielle 2013Usine Logicielle 2013
Usine Logicielle 2013
 

I don't always write reactive application but when I do, it run on raspberry pi

  • 2. Mathieu ANCELIN • Développeur @SERLI • Scala, Java, web & OSS • ReactiveCouchbase, Weld-OSGi, Weld, etc ... • Poitou-Charentes JUG • Membre de l’expert group CDI 1.1 (JSR-346) • Membre de l’expert group OSGi Enterprise • @TrevorReznik
  • 3. Alexandre DELEGUE • Développeur @ SERLI • Java • Scala • Web • spring, play, … • @chanksleroux
  • 4. SERLI • Société de conseil et d’ingénierie du SI • 75 personnes • 80% de business Java • Contribution à des projets OSS • 10% de la force de travail sur l’OSS • Membre de l’EG JSR-346 • Membre de l’OSGi Alliance • www.serli.com @SerliFr
  • 5. Les technologies présentées sont inspirées de technologies réelles! Les applications qui en découlent sont fictives! Toute ressemblance avec des applications existantes n’est que fortuite!
  • 7.
  • 10. Mobile infrastructure Raspberry pi x 7 Routeur wifi Switch
  • 11. Demo
  • 12. Résister à la charge
  • 14. Absorber une hausse de trafic
  • 23. Reactive manifesto • react to event : the event-driven nature enables the following qualities • react to load : focus on scalability by avoiding contention on shared resources • react to failure : build resilient systems with the ability to recover at all levels • react to user : honor response time guarantees regardless of load
  • 24. Scalable / React to load
  • 25.
  • 26. Overview Frontend Cart Identity Backend
  • 27. Datas
  • 28. Mini / Micro Services • Une application par domaine fonctionnel • store-frontend : présentation du contenu • store-identity : authentification / gestion de compte • store-cart : panier • store-backend : administration du site
  • 29. Stateless • Chaque application est stateless • aucune donnée n’est stockée dans l’application (pas de cache, pas de fichier …) • Chaque application peut être clonée Session
  • 30. Frontend }- 100 % html - Indexation par les moteurs de recherche - stateless - une url == un contenu
  • 32. Cache Frontend Cache Browser CDN nginx/http varnish
  • 33. Optimisations Base de données ? Cache + recherche full text
  • 34. Modèle de données { id: "04abe480-2521-11e4-acde-f7b0d99b8321", label: "Product number 1", description: "A description …", image: "image.jpeg", price: 1.5, fragments: [{ type: "search", html: " <div >...</div>" },{ type: "cart", html: " <tr >...</tr>" } ] } }} Données indexées pour la recherche HTML pré-généré
  • 35. Recherche GET /products?q=some%20text Frontend Search some text - Concat fragments - Include into main template
  • 36. Créer / mettre à jour UpdateProduct ProductUpdated Frontend EventSource Backend ProductUpdated
  • 37. Resilient / react to failure
  • 38.
  • 39.
  • 40. Infrastructure Frontend Identity Identity Backend Cart Frontend Cart Backend Identity
  • 41. Infrastructure Frontend Identity Identity Backend Cart Frontend Cart Backend Identity
  • 42. Infrastructure Frontend Identity Identity Backend Cart Frontend Cart Backend Identity
  • 43. Infrastructure Frontend Identity Identity Backend Cart Frontend Cart Backend Identity
  • 44. Demo ! Let It Crash !!!
  • 46.
  • 47. Akka • Akka • Modèle acteur • Un acteur = Une entité statefull • Communication entre acteurs par messages (même à distance) • Un acteur peut créer/détruire des enfants • Un acteur peut surveiller d’autres acteurs • Plus de problèmes de concurrence, asynchrone par nature • Résistant aux pannes • Java or Scala
  • 48. Akka Actor Actor Fils Actor Fils messages Actor Actor Actor Fils Fils Fils Actor Fils Server 1 Server 2 messages
  • 49. Akka messages import akka.actor.{Props, ActorSystem, ActorLogging, Actor} case class Greeting(who: String) class GreetingActor extends Actor with ActorLogging { def receive = { case Greeting(who) ⇒ log.info("Hello " + who) } } val system = ActorSystem("MySystem") val greeter = system.actorOf(Props[GreetingActor], name = "greeter") greeter ! Greeting("Charlie Parker")
  • 50. Play 2 • Framework web • java or scala • Support pour les websocket et le server sent event • Asynchrone • pré-requis pour une application orientée événements
  • 51. Play async case class ListProductsQuery() class ProductView extends Actor { override def receive: Receive = { case ListProductsQuery() => models.Product.list() pipeTo sender() } } ! class ProductsController extends Controller { private def listProducts(): Future[List[models.Product]] = { (Actors.productView() ? ListProductsQuery()).mapTo[List[models.Product]] } def index() = Action.async { listProducts().map(products => Ok(views.html.index(products))) } }
  • 52. Messages Frontend Cart Identity Backend CheckAuth UpdateProduct OrderCart ProductUpdated AddProductToCart ProductAddedToCart WebSocket Messages Akka Server sent event
  • 53. Cluster • Utilisation de Akka-cluster • Librairie permettant de former un cluster de systèmes d’acteurs • simple service d’adhésion • tolérant aux pannes • décentralisé (P2P, gossip) • pas de SPOF • pas de SPOB • détection des pannes
  • 54. Cluster services • Librairie de découverte de services distribués • Exposition descripteurs de services (URL, protocole, version, nom) • Repose sur les memberships du cluster Akka • Clients de services • HTTP, Akka, Thrift, Memcached … • Petits plus • Monitoring • Load balancing (pas très intelligent) • Retry with exponential back off
  • 55. Cluster services Client spécifique Client Générique Monitoring Load balancer + retry Service instance 1 Service instance 1 Service instance 1
  • 56. Cluster services Client spécifique Client Générique Monitoring Load balancer + retry Service instance 1 Service instance 1 Service instance 1
  • 57. Cluster services Client spécifique Client Générique Monitoring Load balancer + retry Service instance 1 Service instance 1 Service instance 1
  • 58. CQRS & EventSourcing • Command Query Responsibility Segregation • Command : Enregistrement • Query : Lecture • 2 modèles distincts • Séparation des services • Event sourcing • Stockage des événements
  • 59. Persistence command event event event Event source Journal processor View 1 View 2 View 3
  • 60. Exemple AddProductToCart ProductAddedToCart ProductAddedToCart ProductAddedToCart Journal WebSocket Actor Products Views Products Processor
  • 62.
  • 65. Et les perfs dans tout ca ?
  • 66. Les chiffres 367 998 456 756
  • 67. Les chiffres 367 998 456 756 €
  • 77. scala
  • 78. This is the end ...