SlideShare a Scribd company logo
Designing MongoDB solutions for
the Internet of Things and Big Data
INNOVATION COMPANY
Roberto Contiero
r.contiero@zero12.it
@contieroroberto
“Learn quickly and Think Well!”
Stefano Dindo
s.dindo@zero12.it
@stefanodindo
“We are an Innovation Company. We design
and develop cutting edge software to drive
our customers’ digital transformation,
through Agile Methodologies and continuous
delivery”
WE HELP OUR CUSTOMERS TO
DESIGN
IDEA
CREATE
PRODUCTS
EXTRACT VALUE
FROM DATA
We get powerful ideas
to market fast
We design and develop
innovative and better
software solutions
We collect and analyze
data to help your
decisions
Discover Experiment Delivery
MVP
Continuous Design 

&
Integration
OUR APPROACH
MVP
MVP
MVP
?
?
? ?
? ?
?
End UsersIdeaCustomer & zero12
collaboration meeting 

( CanvUX )
Customer feedback
Today
we are dealing with
“Internet Of Things”
“Internet of Things is a neologism
referring to the extension of the
Internet to the world of objects
and concrete places.”
2020 IoT Market Share
4
Billion
Connected People
$4
Trillion
Business 

Opportunity
25+
Billion
Integrated systems
connected to the Web
50
Trillion
50GBs of data
Fonte: IDC
Broker
MQTT
Authentication
API
Business Logic
API
Predictive

Engine
API
Application
Frontend
MongoDB
IoT Architecture:
Users
Things
Predictive Algorithm
Data Operation
User Interaction
Authentication
MongoDB
for GIANT Ideas
What is MongoDB?
MongoDB Solution for Internet of Things and Big Data
General Purpose Document Database Open Source
MongoDB
General Info
SQL - like MongoDB World
Database Database
Table Collection
Row Document
Column Field
What’s a document?
{

	 "name": "John",

	 "surname": "Doe",

	 "email": "jdoe@gmail.com",

	 "cell": 3281432896,

	 "sport": ["swimming", "football"]

}
{
_id: ‘ObjectId(“4b2b9…”)’,
first_name: ‘Paul’,
surname: ‘Miller’,
city: ‘London’,
location: [45.123,47.232],
cars: [
{ model: ‘Bentley’,
year: 1973,
value: 100000, … },
{ model: ‘Rolls Royce’,
year: 1965,
value: 330000, … }
]
}
Comparison Relational vs Document
Document
{
_id: ‘ObjectId(“4b2b9…”)’,
first_name: ‘Paul’,
surname: ‘Miller’,
city: ‘London’,
location: [45.123,47.232],
cars: [
{ model: ‘Bentley’,
year: 1973,
value: 100000, … },
{ model: ‘Rolls Royce’,
year: 1965,
value: 330000, … }
]
}
Example Data Type
Null
Boolean
Number
String
Date
Array
Embedded documents
{ x: null }
{ x: true }
{ x: 3.14 } { x: 3 }
{ x: “zero12” }
{ x: new Date() }
{ x: [“a”,”b”, “c”] }
{ x: {y: “a” } }
Aggregation
op1 op2 opn……
{
"name": "John",
"surname": "Doe",
"email": "jdoe@gmail.com"
}
Pipeline stages Documents
MongoDB Solution for Internet of Things and Big Data
Main Operator
• $project
• $match
• $limit
• $skip
• $sort
• $unwind
• $group
Join ?
Yes, use
$lookup
operator
MongoDB
3.2
MongoDB Compass 3 Storage Engine
• WiredTiger
• NMAPv1.1
• In-Memory ( beta )
Data Encryption
Business Intelligence 

Connectors
$lookup operator
Document Validation
MongoDB
Architectures
Node 1
Secondary
Node 2
Secondary
Node 3
Primary
Heartbeat
Replica Replica
ReplicaSet Configuration
Sharding Configuration
MongoDB Solution for Internet of Things and Big Data
How to Use MongoDB in IoT Area
Time Series
Definition
Set of values of a variable detected at different timestamps.
Time
t0 t1 t2 t3
f ( t0 )
f ( t1 )
f ( t2 )
f ( t3 )
Time Series Data is Everywhere
1. Financial markets pricing
2. Sensors (temperature, pressure, proximity)
3. Industrial Fleets (Location, velocity, operational)
4. Social Networks (status update)
5. System (server logs, application logs)
6. Mobile devices (calls, texts)
Time Series Data at a Higher Level
1. Widely applicable data model

2. Various schema and modeling options

3. Application requirements drive schema
design
Time Series - Schema Design
How to Use MongoDB in IoT Area
Designing for writing and reading
1. One document per event
2. One document per minute (average)
3. One document per minute (second)
4. One document per hour
One document per event
{
server: "server1",

load: 92,

ts: ISODate("2014-10-16T22:07:38.000-0500")
}
1. Relational-centric approach
2. Insert-driven workload
3. Aggregations computed at application-level
One document per minute (average)
{
server: "server1",

load_num: 92,

load_sum: 4500,

ts: ISODate("2014-10-16T22:07:00.000-0500")
}
1. Pre-aggregation to compute average per minute more easily
2. Update-driven workload
3. Minute-level resolution
One document per minute ( second )
{
server: "server1",

load: { 0: 15, 1: 20, ..., 58: 45, 59: 40 }

ts: ISODate("2014-10-16T22:07:00.000-0500")
}
1. Store per second data at minute level
2. Update-driven workload
3. Pre-allocate structure to avoid document moves
One document per hour ( by second )
{

server: "server1",

load: { 0: 15, 1: 20, ..., 3598: 45, 3599: 40 } 

ts: ISODate("2014-10-16T22:00:00.000-0500")
}
1. Store per second data at hourly level
2. Update driven workload
3. Pre-allocate structure to avoid document moves
4. Updating the last second requires 3599 steps
One document per hour ( by second )
{
server: "server1", 

load: {
0: {0: 15, ..., 59: 45}, ....

59: {0: 25, ..., 59: 75}
}
ts: ISODate("2014-10-16T22:00:00.000-0500")
}
1. Store per second data at hourly level with nesting
2. Update-driven workload
3. Pre-allocate structure to avoid document moves
4. Updating the last second requires 59+59 steps
Writing operation analysis
1. Example: data generated every second
2. Capturing data per minute requires:

- One document per event: 60 writes

- One document per minute: 1 write, 59 updates
3. Transition from “insert-driven” to “update-driven”
- Individual writes are smaller

- Performance and concurrency benefits
1. Example: data generated every second
2. Reading data for a single hours requires:

- One document per event: 3600 reads 

- One document per minute: 60 reads
3. Read performance is greatly improved:

- Fewer disk seeks

- Optimization with tuned block sizes and read ahead
Read operation analysis
Live Demo
http://www.zero12.it/lab-festivalict/
E’ possibile scaricare semplici esercizi realizzati per il Lab da:

More Related Content

PPTX
IOT Paris Seminar 2015 - intro by Yann Aubry
PDF
MongoDB and the Internet of Things
PPTX
MongoDB and the Internet of Things
PDF
MongoDB and the Internet of Things
PPTX
Xanadu Big Data Platform Technology BMT@ Rackspace Cloud
PDF
Introduction to Big Data Analytics: Batch, Real-Time, and the Best of Both Wo...
PDF
Google's Infrastructure and Specific IoT Services
PPTX
How the Italian Market is Embracing Alternatives to Relational Databases
IOT Paris Seminar 2015 - intro by Yann Aubry
MongoDB and the Internet of Things
MongoDB and the Internet of Things
MongoDB and the Internet of Things
Xanadu Big Data Platform Technology BMT@ Rackspace Cloud
Introduction to Big Data Analytics: Batch, Real-Time, and the Best of Both Wo...
Google's Infrastructure and Specific IoT Services
How the Italian Market is Embracing Alternatives to Relational Databases

What's hot (20)

PPTX
Big data
PDF
Webinar: Building a Blockchain Database with MongoDB
PDF
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
PDF
Digital Transformation, OSS, 모두를 위한 AI - 마이크로소프트의 관점
PPTX
Why we need internet of things on Node.js
PDF
Time Series Analytics for Big Fast Data
PDF
Big Data Expo 2015 - Gigaspaces Making Sense of it all
PPTX
IoT and Robotic Process Automation in Future Logistics - Asia Logistics Forum...
PDF
Big Data LDN 2017: BI Converges with AI - GPUs for Fast Data
PDF
INTEROPERABILITY & IOT: GETTING EVERYTHING CONNECTED
PDF
On Developing and Operating of Data Elasticity Management Process
PDF
Big Data Visualization
PPTX
Intel_IoT_Munich
PDF
Self Service Analytics at Twitch
PDF
Governing Elastic IoT Cloud Systems under Uncertainties
PPTX
Apache edgent
PPT
Counting Unique Users in Real-Time: Here's a Challenge for You!
PDF
DPA - a gate between IoT networks and the Internet: Nedžib Bukalo
PDF
Big Query Basics
PDF
Connecta Event: Big Query och dataanalys med Google Cloud Platform
Big data
Webinar: Building a Blockchain Database with MongoDB
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
Digital Transformation, OSS, 모두를 위한 AI - 마이크로소프트의 관점
Why we need internet of things on Node.js
Time Series Analytics for Big Fast Data
Big Data Expo 2015 - Gigaspaces Making Sense of it all
IoT and Robotic Process Automation in Future Logistics - Asia Logistics Forum...
Big Data LDN 2017: BI Converges with AI - GPUs for Fast Data
INTEROPERABILITY & IOT: GETTING EVERYTHING CONNECTED
On Developing and Operating of Data Elasticity Management Process
Big Data Visualization
Intel_IoT_Munich
Self Service Analytics at Twitch
Governing Elastic IoT Cloud Systems under Uncertainties
Apache edgent
Counting Unique Users in Real-Time: Here's a Challenge for You!
DPA - a gate between IoT networks and the Internet: Nedžib Bukalo
Big Query Basics
Connecta Event: Big Query och dataanalys med Google Cloud Platform
Ad

Viewers also liked (20)

PPTX
Internet of Things and Big Data: Vision and Concrete Use Cases
PDF
MongoDB IoT City Tour STUTTGART: Industry 4.0 and the Internet of Things: Inm...
PDF
IOT Paris Seminar 2015 - Storage Challenges in IOT
PDF
IOT Paris Seminar 2015 - Enabling Transformation to the IOT
PDF
Internet of Things Cologne 2015: Rethinking Global Real-Time Data Integration...
PDF
IOT Paris Seminar 2015 - Connected Objects makers, How to deal with Data?
PDF
Internet of Things Cologne 2015: The Contribution of New Data Storage and Ana...
PPT
MongoDB IoT City Tour STUTTGART: Analysing the Internet of Things. By, Pentaho
PPTX
MongoDB and the Internet of Things
PPTX
IOT Paris Seminar 2015 - MAXXING Presentation
PPTX
MongoDB IoT City Tour STUTTGART: Managing the Database Complexity, by Arthur ...
PPTX
IoT – The Machine Guys Meet the Internet Guys
PDF
„Enterprise Event Bus“ Unified Log (Event) Processing Architecture
PPTX
MongoDB IoT CITY Tour STUTTGART: The IoT Market Landscape, Machina Research
PPTX
Migrating from RDBMS to MongoDB
PDF
MongoDB World 2016: The Best IoT Analytics with MongoDB
PPTX
IOT Seminar Paris 2015 - AXA France Presentation
PDF
MongoDB Case Study in Healthcare
PDF
Real Time Analytics with Apache Cassandra - Cassandra Day Berlin
PPTX
Introduction to MongoDB
Internet of Things and Big Data: Vision and Concrete Use Cases
MongoDB IoT City Tour STUTTGART: Industry 4.0 and the Internet of Things: Inm...
IOT Paris Seminar 2015 - Storage Challenges in IOT
IOT Paris Seminar 2015 - Enabling Transformation to the IOT
Internet of Things Cologne 2015: Rethinking Global Real-Time Data Integration...
IOT Paris Seminar 2015 - Connected Objects makers, How to deal with Data?
Internet of Things Cologne 2015: The Contribution of New Data Storage and Ana...
MongoDB IoT City Tour STUTTGART: Analysing the Internet of Things. By, Pentaho
MongoDB and the Internet of Things
IOT Paris Seminar 2015 - MAXXING Presentation
MongoDB IoT City Tour STUTTGART: Managing the Database Complexity, by Arthur ...
IoT – The Machine Guys Meet the Internet Guys
„Enterprise Event Bus“ Unified Log (Event) Processing Architecture
MongoDB IoT CITY Tour STUTTGART: The IoT Market Landscape, Machina Research
Migrating from RDBMS to MongoDB
MongoDB World 2016: The Best IoT Analytics with MongoDB
IOT Seminar Paris 2015 - AXA France Presentation
MongoDB Case Study in Healthcare
Real Time Analytics with Apache Cassandra - Cassandra Day Berlin
Introduction to MongoDB
Ad

Similar to MongoDB Solution for Internet of Things and Big Data (20)

PPTX
Codemotion Milano 2014 - MongoDB and the Internet of Things
PPTX
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
PPT
MongoDB Tick Data Presentation
PPTX
Tutorial: Building Your First App with MongoDB Stitch
PPTX
ClickHouse Paris Meetup. ClickHouse Analytical DBMS, Introduction. By Alexand...
PPTX
MongoDB for Time Series Data
PDF
Reactive Stream Processing Using DDS and Rx
PPTX
How to leverage what's new in MongoDB 3.6
PPTX
Building Your First App with MongoDB Stitch
PDF
Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHo...
PDF
Application Monitoring using Open Source: VictoriaMetrics - ClickHouse
PDF
MongoDB.local Paris Keynote
PPTX
MongoDB Days Silicon Valley: Jumpstart: The Right and Wrong Use Cases for Mon...
PDF
Metaverse and Digital Twins on Enterprise-Public.pdf
PPTX
Azure Stream Analytics : Analyse Data in Motion
PDF
Timeseries - data visualization in Grafana
PDF
Capacity Planning for Linux Systems
PPTX
MongoDB IoT City Tour LONDON: Managing the Database Complexity, by Arthur Vie...
PPTX
MongoDB for Developers
PDF
[WSO2Con EU 2018] Patterns for Building Streaming Apps
Codemotion Milano 2014 - MongoDB and the Internet of Things
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB Tick Data Presentation
Tutorial: Building Your First App with MongoDB Stitch
ClickHouse Paris Meetup. ClickHouse Analytical DBMS, Introduction. By Alexand...
MongoDB for Time Series Data
Reactive Stream Processing Using DDS and Rx
How to leverage what's new in MongoDB 3.6
Building Your First App with MongoDB Stitch
Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHo...
Application Monitoring using Open Source: VictoriaMetrics - ClickHouse
MongoDB.local Paris Keynote
MongoDB Days Silicon Valley: Jumpstart: The Right and Wrong Use Cases for Mon...
Metaverse and Digital Twins on Enterprise-Public.pdf
Azure Stream Analytics : Analyse Data in Motion
Timeseries - data visualization in Grafana
Capacity Planning for Linux Systems
MongoDB IoT City Tour LONDON: Managing the Database Complexity, by Arthur Vie...
MongoDB for Developers
[WSO2Con EU 2018] Patterns for Building Streaming Apps

More from Stefano Dindo (20)

PDF
Big Data: Come usare le Machine Learning per migliorare il business
PDF
Business Agility - Come competere nell'Era Digitale
PDF
Business Agility - come competere nell'Era Digitale
PDF
Come creare infrastrutture Cloud Sicure
PDF
Proximity marketing
PDF
Cloud App: Vantaggi per il Business
PDF
Proximity Marketing - che cos'è, come funziona e come realizzarlo tecnologica...
PDF
Deploy MongoDB su Infrastruttura Amazon Web Services
PDF
Cultura Digitale e Data Design
PDF
Internet of Things e manutenzione a distanza: 
disponibilità di nuove tecnolo...
PDF
Business attraverso i Big Data
PDF
Introduzione all'Agile Coaching
PDF
Aperitivo Innovativo: Mobile Strategy & Development
PDF
Google Glass e le tecnologie indossabili: alcuni esempi in ambito aziendale
PDF
Overview di MongoDB
PDF
MongoDB User Group Padova - Overviews iniziale su MongoDB
PDF
Keep Calm & dai uno sguardo al futuro con nuove strategie di relazione con gl...
PDF
Logstash: Progetto open per l'analisi dei log in tempo reale di architetture ...
PDF
Mobile & Cloud: quali servizi sono disponibili e come sfruttarli al meglio
PDF
Better Software 2012 - Dall'Idea all'App
Big Data: Come usare le Machine Learning per migliorare il business
Business Agility - Come competere nell'Era Digitale
Business Agility - come competere nell'Era Digitale
Come creare infrastrutture Cloud Sicure
Proximity marketing
Cloud App: Vantaggi per il Business
Proximity Marketing - che cos'è, come funziona e come realizzarlo tecnologica...
Deploy MongoDB su Infrastruttura Amazon Web Services
Cultura Digitale e Data Design
Internet of Things e manutenzione a distanza: 
disponibilità di nuove tecnolo...
Business attraverso i Big Data
Introduzione all'Agile Coaching
Aperitivo Innovativo: Mobile Strategy & Development
Google Glass e le tecnologie indossabili: alcuni esempi in ambito aziendale
Overview di MongoDB
MongoDB User Group Padova - Overviews iniziale su MongoDB
Keep Calm & dai uno sguardo al futuro con nuove strategie di relazione con gl...
Logstash: Progetto open per l'analisi dei log in tempo reale di architetture ...
Mobile & Cloud: quali servizi sono disponibili e come sfruttarli al meglio
Better Software 2012 - Dall'Idea all'App

Recently uploaded (20)

PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PPTX
Business Acumen Training GuidePresentation.pptx
PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
STUDY DESIGN details- Lt Col Maksud (21).pptx
PDF
Fluorescence-microscope_Botany_detailed content
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPTX
Database Infoormation System (DBIS).pptx
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
Reliability_Chapter_ presentation 1221.5784
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
Introduction-to-Cloud-ComputingFinal.pptx
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
Business Ppt On Nestle.pptx huunnnhhgfvu
Data_Analytics_and_PowerBI_Presentation.pptx
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Business Acumen Training GuidePresentation.pptx
IB Computer Science - Internal Assessment.pptx
STUDY DESIGN details- Lt Col Maksud (21).pptx
Fluorescence-microscope_Botany_detailed content
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
Galatica Smart Energy Infrastructure Startup Pitch Deck
Database Infoormation System (DBIS).pptx
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg

MongoDB Solution for Internet of Things and Big Data

  • 1. Designing MongoDB solutions for the Internet of Things and Big Data
  • 2. INNOVATION COMPANY Roberto Contiero r.contiero@zero12.it @contieroroberto “Learn quickly and Think Well!” Stefano Dindo s.dindo@zero12.it @stefanodindo
  • 3. “We are an Innovation Company. We design and develop cutting edge software to drive our customers’ digital transformation, through Agile Methodologies and continuous delivery”
  • 4. WE HELP OUR CUSTOMERS TO DESIGN IDEA CREATE PRODUCTS EXTRACT VALUE FROM DATA We get powerful ideas to market fast We design and develop innovative and better software solutions We collect and analyze data to help your decisions
  • 5. Discover Experiment Delivery MVP Continuous Design 
 & Integration OUR APPROACH MVP MVP MVP ? ? ? ? ? ? ? End UsersIdeaCustomer & zero12 collaboration meeting 
 ( CanvUX ) Customer feedback
  • 6. Today we are dealing with “Internet Of Things”
  • 7. “Internet of Things is a neologism referring to the extension of the Internet to the world of objects and concrete places.”
  • 8. 2020 IoT Market Share 4 Billion Connected People $4 Trillion Business 
 Opportunity 25+ Billion Integrated systems connected to the Web 50 Trillion 50GBs of data Fonte: IDC
  • 13. General Purpose Document Database Open Source MongoDB
  • 14. General Info SQL - like MongoDB World Database Database Table Collection Row Document Column Field
  • 15. What’s a document? { "name": "John", "surname": "Doe", "email": "jdoe@gmail.com", "cell": 3281432896, "sport": ["swimming", "football"] }
  • 16. { _id: ‘ObjectId(“4b2b9…”)’, first_name: ‘Paul’, surname: ‘Miller’, city: ‘London’, location: [45.123,47.232], cars: [ { model: ‘Bentley’, year: 1973, value: 100000, … }, { model: ‘Rolls Royce’, year: 1965, value: 330000, … } ] } Comparison Relational vs Document
  • 17. Document { _id: ‘ObjectId(“4b2b9…”)’, first_name: ‘Paul’, surname: ‘Miller’, city: ‘London’, location: [45.123,47.232], cars: [ { model: ‘Bentley’, year: 1973, value: 100000, … }, { model: ‘Rolls Royce’, year: 1965, value: 330000, … } ] } Example Data Type Null Boolean Number String Date Array Embedded documents { x: null } { x: true } { x: 3.14 } { x: 3 } { x: “zero12” } { x: new Date() } { x: [“a”,”b”, “c”] } { x: {y: “a” } }
  • 18. Aggregation op1 op2 opn…… { "name": "John", "surname": "Doe", "email": "jdoe@gmail.com" } Pipeline stages Documents
  • 20. Main Operator • $project • $match • $limit • $skip • $sort • $unwind • $group
  • 23. MongoDB 3.2 MongoDB Compass 3 Storage Engine • WiredTiger • NMAPv1.1 • In-Memory ( beta ) Data Encryption Business Intelligence 
 Connectors $lookup operator Document Validation
  • 25. Node 1 Secondary Node 2 Secondary Node 3 Primary Heartbeat Replica Replica ReplicaSet Configuration
  • 28. How to Use MongoDB in IoT Area Time Series
  • 29. Definition Set of values of a variable detected at different timestamps. Time t0 t1 t2 t3 f ( t0 ) f ( t1 ) f ( t2 ) f ( t3 )
  • 30. Time Series Data is Everywhere 1. Financial markets pricing 2. Sensors (temperature, pressure, proximity) 3. Industrial Fleets (Location, velocity, operational) 4. Social Networks (status update) 5. System (server logs, application logs) 6. Mobile devices (calls, texts)
  • 31. Time Series Data at a Higher Level 1. Widely applicable data model
 2. Various schema and modeling options
 3. Application requirements drive schema design
  • 32. Time Series - Schema Design How to Use MongoDB in IoT Area
  • 33. Designing for writing and reading 1. One document per event 2. One document per minute (average) 3. One document per minute (second) 4. One document per hour
  • 34. One document per event { server: "server1",
 load: 92,
 ts: ISODate("2014-10-16T22:07:38.000-0500") } 1. Relational-centric approach 2. Insert-driven workload 3. Aggregations computed at application-level
  • 35. One document per minute (average) { server: "server1",
 load_num: 92,
 load_sum: 4500,
 ts: ISODate("2014-10-16T22:07:00.000-0500") } 1. Pre-aggregation to compute average per minute more easily 2. Update-driven workload 3. Minute-level resolution
  • 36. One document per minute ( second ) { server: "server1",
 load: { 0: 15, 1: 20, ..., 58: 45, 59: 40 }
 ts: ISODate("2014-10-16T22:07:00.000-0500") } 1. Store per second data at minute level 2. Update-driven workload 3. Pre-allocate structure to avoid document moves
  • 37. One document per hour ( by second ) {
 server: "server1",
 load: { 0: 15, 1: 20, ..., 3598: 45, 3599: 40 } 
 ts: ISODate("2014-10-16T22:00:00.000-0500") } 1. Store per second data at hourly level 2. Update driven workload 3. Pre-allocate structure to avoid document moves 4. Updating the last second requires 3599 steps
  • 38. One document per hour ( by second ) { server: "server1", 
 load: { 0: {0: 15, ..., 59: 45}, ....
 59: {0: 25, ..., 59: 75} } ts: ISODate("2014-10-16T22:00:00.000-0500") } 1. Store per second data at hourly level with nesting 2. Update-driven workload 3. Pre-allocate structure to avoid document moves 4. Updating the last second requires 59+59 steps
  • 39. Writing operation analysis 1. Example: data generated every second 2. Capturing data per minute requires:
 - One document per event: 60 writes
 - One document per minute: 1 write, 59 updates 3. Transition from “insert-driven” to “update-driven” - Individual writes are smaller
 - Performance and concurrency benefits
  • 40. 1. Example: data generated every second 2. Reading data for a single hours requires:
 - One document per event: 3600 reads 
 - One document per minute: 60 reads 3. Read performance is greatly improved:
 - Fewer disk seeks
 - Optimization with tuned block sizes and read ahead Read operation analysis
  • 41. Live Demo http://www.zero12.it/lab-festivalict/ E’ possibile scaricare semplici esercizi realizzati per il Lab da: