SlideShare a Scribd company logo
1 of 29
System integration through queues
● Paolo Laurenti
@paololaurenti
● Gianluca Padovani
coders51 - @gpad619
● Gabriele Santomaggio
Erlang-Solutions - @gsantomaggio
What we will see... topics
● Integration with MQTT - AMQP
● Different languages (Elixir, Java, .Net, Ruby, Python, C++, .Net)
● Different technologies in action as Docker, Phoenix, RabbitMQ and more
● Unit tests / Integration Tests and Monitoring
● High availability and Horizontal scaling
What we will see... structure
● Introduction (15 mins)
● Coding (you) (25 mis)
● Recap and introduction next problem (10 mins)
● Coding (you) (20 mis)
● Recap Q&A Monitoring/QuickCheck!! (20 min)
What we will see...
.Net
JS
Java
Python
Ruby
C++
HAProxy
RabbitMQ - Cluster Elixir
Consumer
BackendOne
Phoenix
Web-Socket
Beam
AMQP protocol, send receipts from many shops at
minutes scale.
MQTT protocol, send internal, external
temperatures and the number of people inside a
shop at seconds scale.
What we will see...
.Net
JS
Java
Python
Ruby
C++
RabbitMQ - Cluster
HAProxy
Elixir
Consumer
BackendOne
Phoenix
Web-Socket
Beam
We work here!
BackendOne
What we will see...
DeviceConsumer FinancialConsumer
Accumulator
RabbitMQ
FinancialMessage
StatisticalMessage
DeviceMessage
Financial message
The financial messages are the receipts received from different sellers.
Message struct:
sellerId - identifies the seller
date - date of the receipt
totalAmount - total amount of the receipt
other fields
Look in FinancialConsumer to see how this message is handled
Device message
The device messages are sent from MQTT producers.
Message struct :
sellerId - identifies the seller
date
type - of device
value
The message payload is binary, look in DeviceConsumer to see how the binary-
deserilization works
Statistical message
The statistical messages are sent from BackendOne and contain statistical data
extracted from Device and Financial messages.
Message struct :
Seller id
payload:
Receipt
Date
Id
Amount
Statistical message - continue
The statistical messages are calculated from Device and Financial messages.
When we receive a receipt in one minute and we receive internal temperature,
external temperature and people count in the same minute of receipt and in the next
minute.
Example:
We receive some temperatures and counters at 14:31 and 14:32. We calculate the
average of internal and external temperature of this minute, and the sum of people
counter. When we receive the receipt at 14:31 we send statistical message for 14:31.
Accumulator state
If I want create a map with key ‘k1’ as atom and value 42 I should write something like
this:
%{ k1: 42 }
or
%{ :k1 => 42 }
Accumulator state - continue
The accumulator state is a map like this:
%{
internal_avg_temperature: %{ … },
external_avg_temperature: %{ … },
people: %{ … },
receipt: %{ … },
}
Accumulator state - continue
The value of internal_avg_temperature and external_avg_temperature keys are
maps that have as key the datetime rounded at minute and another map as value.
%{
external_avg_temperature: %{
“2016-11-19 11:23:00” => %{
value: average,
total: total_of_received_temperatures,
count: numer_of_temperatures_received,
},
“2016-11-19 11:24:00” => %{
…
},
}
}
Accumulator state - continue
The value of people key is a maps that have as key the datetime rounded at minute
and the total of people counter.
%{
people: %{
“2016-11-19 11:23:00” => 12,
“2016-11-19 11:24:00” => 10,
}
}
Accumulator state - continue
The value of receipt key is a maps that have as key the datetime rounded at minute
and the list of receipt received in that minute.
%{
receipt: %{
“2016-11-19 11:23:00” => [receipt_1,receipt_2, … receipt_N],
“2016-11-19 11:24:00” => [receipt_1,receipt_2],
…
}
}
Accumulator state - continue
%{
external_avg_temperature: %{
“2016-11-19 11:21:00” => %{
value: average,
total: total_of_received_temperatures,
count: numer_of_temperatures_received,
},
},
people: %{
“2016-11-19 11:23:00” => 12,
},
receipt: %{
“2016-11-19 11:25:00” => [receipt_1,receipt_2, … receipt_N],
}
}
Get the code
git clone https://github.com/ggp/backend_one .
git checkout CLUES_master
mix deps.get
mix compile
AMQP_HOST=<rabbit-ip> AMQP_USERNAME=<rabbit-user>
AMQP_PASSWORD=<rabbit-pwd> mix test
Test failed
CODING - Test failed
Some hints:
The code probably doesn’t manage correctly some new fields
Take some time to study the code
Pay attention when accumulator crashes …
Make a simple solution that works for test (couldn’t work in general …)
Your round...
Fix the test in ~25 mins.
CODING - Test failed - recap
Did you understand the architecture of the backend_one?
How many ‘if … then … else’ did you see?
How do the process communicate?
What happen if:
The accumulator crashes? Who knows?
The accumulator is too slow?
Get the code
git clone https://github.com/ggp/backend_one .
git checkout TDD_new_aggregator
mix deps.get
mix compile
AMQP_HOST=<rabbit-ip> AMQP_USERNAME=<rabbit-user>
AMQP_PASSWORD=<rabbit-pwd> mix test
Tests failed!!!
CODING - New tests ..
We replaced accumulator process with a GenServer
We use struct to manage data
More tests are red
You can execute only a subset of tests executing
CODING - New tests ..
Some hints:
Start with AccumulatorService
Execute single file test
Pay attention on how the state is managed in GenServer
In Aggregate pay attention to how a new message can declare a slot as “complete”
Your round… again.
Fix the test … 20 mins.
CODING - New tests .. - recap
How the state is managed in GenServer?
Is it better to manage data with structs?
How do you call functions in GenServer?
How do you identify it?
Is the caller blocked during execution?
Monitoring - Tests
● Monitor distribution application
● Common tools ( Netdata, Zabbix, Ganglia, tc)
● Observer
● Beam tools - WombatOM
● QuickCheck (http://www.quviq.com/products/erlang-
quickcheck/)
Thank you
Any questions?
● Paolo Laurenti
@paololaurenti
● Gianluca Padovani
coders51 - @gpad619
● Gabriele Santomaggio
Erlang-Solutions - @gsantomaggio

More Related Content

What's hot

GPA calculator and grading program in c++
GPA calculator and grading program in c++GPA calculator and grading program in c++
GPA calculator and grading program in c++Taimur Muhammad
 
VHDL coding in Xilinx
VHDL coding in XilinxVHDL coding in Xilinx
VHDL coding in XilinxNaveen Kumar
 
ECMAScript 2017
ECMAScript 2017ECMAScript 2017
ECMAScript 2017max peng
 
OS Process Synchronization, semaphore and Monitors
OS Process Synchronization, semaphore and MonitorsOS Process Synchronization, semaphore and Monitors
OS Process Synchronization, semaphore and Monitorssgpraju
 
Legacy projects: how to win the race
Legacy projects: how to win the raceLegacy projects: how to win the race
Legacy projects: how to win the raceVictor_Cr
 
Process synchronization(deepa)
Process synchronization(deepa)Process synchronization(deepa)
Process synchronization(deepa)Nagarajan
 
Legacy projects: how to win the race
Legacy projects: how to win the raceLegacy projects: how to win the race
Legacy projects: how to win the raceVictor_Cr
 
Reactive by example - at Reversim Summit 2015
Reactive by example - at Reversim Summit 2015Reactive by example - at Reversim Summit 2015
Reactive by example - at Reversim Summit 2015Eran Harel
 
Hidden in Plain Sight: DUAL_EC_DRBG 'n stuff
Hidden in Plain Sight: DUAL_EC_DRBG 'n stuffHidden in Plain Sight: DUAL_EC_DRBG 'n stuff
Hidden in Plain Sight: DUAL_EC_DRBG 'n stuffWhiskeyNeon
 

What's hot (12)

GPA calculator and grading program in c++
GPA calculator and grading program in c++GPA calculator and grading program in c++
GPA calculator and grading program in c++
 
OS_Ch7
OS_Ch7OS_Ch7
OS_Ch7
 
VHDL coding in Xilinx
VHDL coding in XilinxVHDL coding in Xilinx
VHDL coding in Xilinx
 
ECMAScript 2017
ECMAScript 2017ECMAScript 2017
ECMAScript 2017
 
OS Process Synchronization, semaphore and Monitors
OS Process Synchronization, semaphore and MonitorsOS Process Synchronization, semaphore and Monitors
OS Process Synchronization, semaphore and Monitors
 
OSCh7
OSCh7OSCh7
OSCh7
 
Legacy projects: how to win the race
Legacy projects: how to win the raceLegacy projects: how to win the race
Legacy projects: how to win the race
 
Process synchronization(deepa)
Process synchronization(deepa)Process synchronization(deepa)
Process synchronization(deepa)
 
Legacy projects: how to win the race
Legacy projects: how to win the raceLegacy projects: how to win the race
Legacy projects: how to win the race
 
Java day 2016.pptx
Java day 2016.pptxJava day 2016.pptx
Java day 2016.pptx
 
Reactive by example - at Reversim Summit 2015
Reactive by example - at Reversim Summit 2015Reactive by example - at Reversim Summit 2015
Reactive by example - at Reversim Summit 2015
 
Hidden in Plain Sight: DUAL_EC_DRBG 'n stuff
Hidden in Plain Sight: DUAL_EC_DRBG 'n stuffHidden in Plain Sight: DUAL_EC_DRBG 'n stuff
Hidden in Plain Sight: DUAL_EC_DRBG 'n stuff
 

Viewers also liked

Accidenti! Non è command and control! ovvero Stili di leadership in un conte...
Accidenti! Non è command and control! ovvero Stili di leadership in un conte...Accidenti! Non è command and control! ovvero Stili di leadership in un conte...
Accidenti! Non è command and control! ovvero Stili di leadership in un conte...Fabio Ghislandi
 
Product Owner - Scopriamo questo sconosciuto!
Product Owner - Scopriamo questo sconosciuto!Product Owner - Scopriamo questo sconosciuto!
Product Owner - Scopriamo questo sconosciuto!Alessio Del Toro
 
How to Design Reliable and Scalable Webhooks with RabbitMQ
How to Design Reliable and Scalable Webhooks with RabbitMQHow to Design Reliable and Scalable Webhooks with RabbitMQ
How to Design Reliable and Scalable Webhooks with RabbitMQJim Liao
 
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...James Titcumb
 
Introducing Practical RabbitMQ (php[tek] 2016 - Tutorial)
Introducing Practical RabbitMQ (php[tek] 2016 - Tutorial)Introducing Practical RabbitMQ (php[tek] 2016 - Tutorial)
Introducing Practical RabbitMQ (php[tek] 2016 - Tutorial)James Titcumb
 
[Greach 2016] Down The RabbitMQ Hole
[Greach 2016] Down The RabbitMQ Hole[Greach 2016] Down The RabbitMQ Hole
[Greach 2016] Down The RabbitMQ HoleAlonso Torres
 
RabbitMQ: Message queuing that works
RabbitMQ: Message queuing that worksRabbitMQ: Message queuing that works
RabbitMQ: Message queuing that worksCodemotion
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 

Viewers also liked (10)

Accidenti! Non è command and control! ovvero Stili di leadership in un conte...
Accidenti! Non è command and control! ovvero Stili di leadership in un conte...Accidenti! Non è command and control! ovvero Stili di leadership in un conte...
Accidenti! Non è command and control! ovvero Stili di leadership in un conte...
 
TDD a piccoli passi
TDD a piccoli passiTDD a piccoli passi
TDD a piccoli passi
 
Product Owner - Scopriamo questo sconosciuto!
Product Owner - Scopriamo questo sconosciuto!Product Owner - Scopriamo questo sconosciuto!
Product Owner - Scopriamo questo sconosciuto!
 
How to Design Reliable and Scalable Webhooks with RabbitMQ
How to Design Reliable and Scalable Webhooks with RabbitMQHow to Design Reliable and Scalable Webhooks with RabbitMQ
How to Design Reliable and Scalable Webhooks with RabbitMQ
 
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
 
Introducing Practical RabbitMQ (php[tek] 2016 - Tutorial)
Introducing Practical RabbitMQ (php[tek] 2016 - Tutorial)Introducing Practical RabbitMQ (php[tek] 2016 - Tutorial)
Introducing Practical RabbitMQ (php[tek] 2016 - Tutorial)
 
[Greach 2016] Down The RabbitMQ Hole
[Greach 2016] Down The RabbitMQ Hole[Greach 2016] Down The RabbitMQ Hole
[Greach 2016] Down The RabbitMQ Hole
 
RabbitMQ: Message queuing that works
RabbitMQ: Message queuing that worksRabbitMQ: Message queuing that works
RabbitMQ: Message queuing that works
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
Microservices e RabbitMQ
Microservices e RabbitMQMicroservices e RabbitMQ
Microservices e RabbitMQ
 

Similar to System integration through queues

Algorithm analysis.pptx
Algorithm analysis.pptxAlgorithm analysis.pptx
Algorithm analysis.pptxDrBashirMSaad
 
Design & Analysis of Algorithm course .pptx
Design & Analysis of Algorithm course .pptxDesign & Analysis of Algorithm course .pptx
Design & Analysis of Algorithm course .pptxJeevaMCSEKIOT
 
Testing: ¿what, how, why?
Testing: ¿what, how, why?Testing: ¿what, how, why?
Testing: ¿what, how, why?David Rodenas
 
Computer network (8)
Computer network (8)Computer network (8)
Computer network (8)NYversity
 
Beyond the DSL-Unlocking the Power of Kafka Streams with the Processor API (A...
Beyond the DSL-Unlocking the Power of Kafka Streams with the Processor API (A...Beyond the DSL-Unlocking the Power of Kafka Streams with the Processor API (A...
Beyond the DSL-Unlocking the Power of Kafka Streams with the Processor API (A...confluent
 
Kernel Recipes 2019 - Formal modeling made easy
Kernel Recipes 2019 - Formal modeling made easyKernel Recipes 2019 - Formal modeling made easy
Kernel Recipes 2019 - Formal modeling made easyAnne Nicolas
 
How to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindHow to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindAndreas Czakaj
 
A New Chapter of Data Processing with CDK
A New Chapter of Data Processing with CDKA New Chapter of Data Processing with CDK
A New Chapter of Data Processing with CDKShu-Jeng Hsieh
 
Beyond the DSL - Unlocking the power of Kafka Streams with the Processor API
Beyond the DSL - Unlocking the power of Kafka Streams with the Processor APIBeyond the DSL - Unlocking the power of Kafka Streams with the Processor API
Beyond the DSL - Unlocking the power of Kafka Streams with the Processor APIconfluent
 
Big Data Day LA 2016/ Big Data Track - Portable Stream and Batch Processing w...
Big Data Day LA 2016/ Big Data Track - Portable Stream and Batch Processing w...Big Data Day LA 2016/ Big Data Track - Portable Stream and Batch Processing w...
Big Data Day LA 2016/ Big Data Track - Portable Stream and Batch Processing w...Data Con LA
 
What’s eating python performance
What’s eating python performanceWhat’s eating python performance
What’s eating python performancePiotr Przymus
 
Data Analytics and Simulation in Parallel with MATLAB*
Data Analytics and Simulation in Parallel with MATLAB*Data Analytics and Simulation in Parallel with MATLAB*
Data Analytics and Simulation in Parallel with MATLAB*Intel® Software
 
Introduction to Erlang Part 2
Introduction to Erlang Part 2Introduction to Erlang Part 2
Introduction to Erlang Part 2Dmitry Zinoviev
 
Peddle the Pedal to the Metal
Peddle the Pedal to the MetalPeddle the Pedal to the Metal
Peddle the Pedal to the MetalC4Media
 
complexity analysis.pdf
complexity analysis.pdfcomplexity analysis.pdf
complexity analysis.pdfpasinduneshan
 
Ake hedman why we need to unite and why vscp is a solution to a problem
Ake hedman  why we need to unite and why vscp is a solution to a problemAke hedman  why we need to unite and why vscp is a solution to a problem
Ake hedman why we need to unite and why vscp is a solution to a problemWithTheBest
 
Iot with-the-best & VSCP
Iot with-the-best & VSCPIot with-the-best & VSCP
Iot with-the-best & VSCPAke Hedman
 

Similar to System integration through queues (20)

Algorithm analysis.pptx
Algorithm analysis.pptxAlgorithm analysis.pptx
Algorithm analysis.pptx
 
Design & Analysis of Algorithm course .pptx
Design & Analysis of Algorithm course .pptxDesign & Analysis of Algorithm course .pptx
Design & Analysis of Algorithm course .pptx
 
Testing: ¿what, how, why?
Testing: ¿what, how, why?Testing: ¿what, how, why?
Testing: ¿what, how, why?
 
Nexmark with beam
Nexmark with beamNexmark with beam
Nexmark with beam
 
Computer network (8)
Computer network (8)Computer network (8)
Computer network (8)
 
Beyond the DSL-Unlocking the Power of Kafka Streams with the Processor API (A...
Beyond the DSL-Unlocking the Power of Kafka Streams with the Processor API (A...Beyond the DSL-Unlocking the Power of Kafka Streams with the Processor API (A...
Beyond the DSL-Unlocking the Power of Kafka Streams with the Processor API (A...
 
Kernel Recipes 2019 - Formal modeling made easy
Kernel Recipes 2019 - Formal modeling made easyKernel Recipes 2019 - Formal modeling made easy
Kernel Recipes 2019 - Formal modeling made easy
 
04 performance
04 performance04 performance
04 performance
 
How to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindHow to write clean & testable code without losing your mind
How to write clean & testable code without losing your mind
 
A New Chapter of Data Processing with CDK
A New Chapter of Data Processing with CDKA New Chapter of Data Processing with CDK
A New Chapter of Data Processing with CDK
 
Code Tuning
Code TuningCode Tuning
Code Tuning
 
Beyond the DSL - Unlocking the power of Kafka Streams with the Processor API
Beyond the DSL - Unlocking the power of Kafka Streams with the Processor APIBeyond the DSL - Unlocking the power of Kafka Streams with the Processor API
Beyond the DSL - Unlocking the power of Kafka Streams with the Processor API
 
Big Data Day LA 2016/ Big Data Track - Portable Stream and Batch Processing w...
Big Data Day LA 2016/ Big Data Track - Portable Stream and Batch Processing w...Big Data Day LA 2016/ Big Data Track - Portable Stream and Batch Processing w...
Big Data Day LA 2016/ Big Data Track - Portable Stream and Batch Processing w...
 
What’s eating python performance
What’s eating python performanceWhat’s eating python performance
What’s eating python performance
 
Data Analytics and Simulation in Parallel with MATLAB*
Data Analytics and Simulation in Parallel with MATLAB*Data Analytics and Simulation in Parallel with MATLAB*
Data Analytics and Simulation in Parallel with MATLAB*
 
Introduction to Erlang Part 2
Introduction to Erlang Part 2Introduction to Erlang Part 2
Introduction to Erlang Part 2
 
Peddle the Pedal to the Metal
Peddle the Pedal to the MetalPeddle the Pedal to the Metal
Peddle the Pedal to the Metal
 
complexity analysis.pdf
complexity analysis.pdfcomplexity analysis.pdf
complexity analysis.pdf
 
Ake hedman why we need to unite and why vscp is a solution to a problem
Ake hedman  why we need to unite and why vscp is a solution to a problemAke hedman  why we need to unite and why vscp is a solution to a problem
Ake hedman why we need to unite and why vscp is a solution to a problem
 
Iot with-the-best & VSCP
Iot with-the-best & VSCPIot with-the-best & VSCP
Iot with-the-best & VSCP
 

More from Gianluca Padovani

A Gentle introduction to microservices
A Gentle introduction to microservicesA Gentle introduction to microservices
A Gentle introduction to microservicesGianluca Padovani
 
Beam me up, scotty (PUG Roma)
Beam me up, scotty (PUG Roma)Beam me up, scotty (PUG Roma)
Beam me up, scotty (PUG Roma)Gianluca Padovani
 
Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Gianluca Padovani
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Gianluca Padovani
 
DDD loves Actor Model and Actor Model loves Elixir
DDD loves Actor Model and Actor Model loves ElixirDDD loves Actor Model and Actor Model loves Elixir
DDD loves Actor Model and Actor Model loves ElixirGianluca Padovani
 
From a web application to a distributed system
From a web application to a distributed systemFrom a web application to a distributed system
From a web application to a distributed systemGianluca Padovani
 
La mia prima lezione di pozioni
La mia prima lezione di pozioniLa mia prima lezione di pozioni
La mia prima lezione di pozioniGianluca Padovani
 
Keynote meetup Elixir/Erlang 17 ottobre 2015
Keynote meetup Elixir/Erlang 17 ottobre 2015Keynote meetup Elixir/Erlang 17 ottobre 2015
Keynote meetup Elixir/Erlang 17 ottobre 2015Gianluca Padovani
 
C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...Gianluca Padovani
 

More from Gianluca Padovani (16)

A Gentle introduction to microservices
A Gentle introduction to microservicesA Gentle introduction to microservices
A Gentle introduction to microservices
 
Beam me up, scotty (PUG Roma)
Beam me up, scotty (PUG Roma)Beam me up, scotty (PUG Roma)
Beam me up, scotty (PUG Roma)
 
Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
 
DDD loves Actor Model and Actor Model loves Elixir
DDD loves Actor Model and Actor Model loves ElixirDDD loves Actor Model and Actor Model loves Elixir
DDD loves Actor Model and Actor Model loves Elixir
 
Tdd is not about testing
Tdd is not about testingTdd is not about testing
Tdd is not about testing
 
From a web application to a distributed system
From a web application to a distributed systemFrom a web application to a distributed system
From a web application to a distributed system
 
Beam way of life
Beam way of lifeBeam way of life
Beam way of life
 
Cook your KV
Cook your KVCook your KV
Cook your KV
 
Beam me up, Scotty
Beam me up, ScottyBeam me up, Scotty
Beam me up, Scotty
 
Docker e git lab
Docker e git labDocker e git lab
Docker e git lab
 
La mia prima lezione di pozioni
La mia prima lezione di pozioniLa mia prima lezione di pozioni
La mia prima lezione di pozioni
 
Keynote meetup Elixir/Erlang 17 ottobre 2015
Keynote meetup Elixir/Erlang 17 ottobre 2015Keynote meetup Elixir/Erlang 17 ottobre 2015
Keynote meetup Elixir/Erlang 17 ottobre 2015
 
C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...
 
Ferrara Linux Day 2011
Ferrara Linux Day 2011Ferrara Linux Day 2011
Ferrara Linux Day 2011
 
OOP vs COP
OOP vs COPOOP vs COP
OOP vs COP
 

Recently uploaded

WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
WSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid EnvironmentsWSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid EnvironmentsWSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2
 
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and ApplicationsWSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and ApplicationsWSO2
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2
 

Recently uploaded (20)

WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid EnvironmentsWSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid Environments
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and ApplicationsWSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 

System integration through queues

  • 1. System integration through queues ● Paolo Laurenti @paololaurenti ● Gianluca Padovani coders51 - @gpad619 ● Gabriele Santomaggio Erlang-Solutions - @gsantomaggio
  • 2. What we will see... topics ● Integration with MQTT - AMQP ● Different languages (Elixir, Java, .Net, Ruby, Python, C++, .Net) ● Different technologies in action as Docker, Phoenix, RabbitMQ and more ● Unit tests / Integration Tests and Monitoring ● High availability and Horizontal scaling
  • 3. What we will see... structure ● Introduction (15 mins) ● Coding (you) (25 mis) ● Recap and introduction next problem (10 mins) ● Coding (you) (20 mis) ● Recap Q&A Monitoring/QuickCheck!! (20 min)
  • 4. What we will see... .Net JS Java Python Ruby C++ HAProxy RabbitMQ - Cluster Elixir Consumer BackendOne Phoenix Web-Socket Beam
  • 5. AMQP protocol, send receipts from many shops at minutes scale. MQTT protocol, send internal, external temperatures and the number of people inside a shop at seconds scale. What we will see... .Net JS Java Python Ruby C++ RabbitMQ - Cluster HAProxy Elixir Consumer BackendOne Phoenix Web-Socket Beam We work here!
  • 6. BackendOne What we will see... DeviceConsumer FinancialConsumer Accumulator RabbitMQ FinancialMessage StatisticalMessage DeviceMessage
  • 7. Financial message The financial messages are the receipts received from different sellers. Message struct: sellerId - identifies the seller date - date of the receipt totalAmount - total amount of the receipt other fields Look in FinancialConsumer to see how this message is handled
  • 8. Device message The device messages are sent from MQTT producers. Message struct : sellerId - identifies the seller date type - of device value The message payload is binary, look in DeviceConsumer to see how the binary- deserilization works
  • 9. Statistical message The statistical messages are sent from BackendOne and contain statistical data extracted from Device and Financial messages. Message struct : Seller id payload: Receipt Date Id Amount
  • 10. Statistical message - continue The statistical messages are calculated from Device and Financial messages. When we receive a receipt in one minute and we receive internal temperature, external temperature and people count in the same minute of receipt and in the next minute. Example: We receive some temperatures and counters at 14:31 and 14:32. We calculate the average of internal and external temperature of this minute, and the sum of people counter. When we receive the receipt at 14:31 we send statistical message for 14:31.
  • 11. Accumulator state If I want create a map with key ‘k1’ as atom and value 42 I should write something like this: %{ k1: 42 } or %{ :k1 => 42 }
  • 12. Accumulator state - continue The accumulator state is a map like this: %{ internal_avg_temperature: %{ … }, external_avg_temperature: %{ … }, people: %{ … }, receipt: %{ … }, }
  • 13. Accumulator state - continue The value of internal_avg_temperature and external_avg_temperature keys are maps that have as key the datetime rounded at minute and another map as value. %{ external_avg_temperature: %{ “2016-11-19 11:23:00” => %{ value: average, total: total_of_received_temperatures, count: numer_of_temperatures_received, }, “2016-11-19 11:24:00” => %{ … }, } }
  • 14. Accumulator state - continue The value of people key is a maps that have as key the datetime rounded at minute and the total of people counter. %{ people: %{ “2016-11-19 11:23:00” => 12, “2016-11-19 11:24:00” => 10, } }
  • 15. Accumulator state - continue The value of receipt key is a maps that have as key the datetime rounded at minute and the list of receipt received in that minute. %{ receipt: %{ “2016-11-19 11:23:00” => [receipt_1,receipt_2, … receipt_N], “2016-11-19 11:24:00” => [receipt_1,receipt_2], … } }
  • 16. Accumulator state - continue %{ external_avg_temperature: %{ “2016-11-19 11:21:00” => %{ value: average, total: total_of_received_temperatures, count: numer_of_temperatures_received, }, }, people: %{ “2016-11-19 11:23:00” => 12, }, receipt: %{ “2016-11-19 11:25:00” => [receipt_1,receipt_2, … receipt_N], } }
  • 17. Get the code git clone https://github.com/ggp/backend_one . git checkout CLUES_master mix deps.get mix compile AMQP_HOST=<rabbit-ip> AMQP_USERNAME=<rabbit-user> AMQP_PASSWORD=<rabbit-pwd> mix test
  • 19. CODING - Test failed Some hints: The code probably doesn’t manage correctly some new fields Take some time to study the code Pay attention when accumulator crashes … Make a simple solution that works for test (couldn’t work in general …)
  • 20. Your round... Fix the test in ~25 mins.
  • 21. CODING - Test failed - recap Did you understand the architecture of the backend_one? How many ‘if … then … else’ did you see? How do the process communicate? What happen if: The accumulator crashes? Who knows? The accumulator is too slow?
  • 22. Get the code git clone https://github.com/ggp/backend_one . git checkout TDD_new_aggregator mix deps.get mix compile AMQP_HOST=<rabbit-ip> AMQP_USERNAME=<rabbit-user> AMQP_PASSWORD=<rabbit-pwd> mix test
  • 24. CODING - New tests .. We replaced accumulator process with a GenServer We use struct to manage data More tests are red You can execute only a subset of tests executing
  • 25. CODING - New tests .. Some hints: Start with AccumulatorService Execute single file test Pay attention on how the state is managed in GenServer In Aggregate pay attention to how a new message can declare a slot as “complete”
  • 26. Your round… again. Fix the test … 20 mins.
  • 27. CODING - New tests .. - recap How the state is managed in GenServer? Is it better to manage data with structs? How do you call functions in GenServer? How do you identify it? Is the caller blocked during execution?
  • 28. Monitoring - Tests ● Monitor distribution application ● Common tools ( Netdata, Zabbix, Ganglia, tc) ● Observer ● Beam tools - WombatOM ● QuickCheck (http://www.quviq.com/products/erlang- quickcheck/)
  • 29. Thank you Any questions? ● Paolo Laurenti @paololaurenti ● Gianluca Padovani coders51 - @gpad619 ● Gabriele Santomaggio Erlang-Solutions - @gsantomaggio

Editor's Notes

  1. Gianluca Ws di due giorni ridotto
  2. Gianluca
  3. Gabriele
  4. Gabriele
  5. Gabriele
  6. Paolo
  7. Paolo
  8. Paolo
  9. Paolo
  10. Gabriele