SlideShare a Scribd company logo
Technical Support Engineer, 10gen
Gianfranco Palumbo
#bigdatajaspersoft
How to leverage MongoDB for
Big Data Analysis and
Operations
@MongoDBDublin
Join us this evening at Dublin
MUG
meetup.com/DublinMUG/
Big Data
http://www.worldwidewebsize.com/
Exponential Data Growth
MongoDB solves our needs
• Ideal operational database
• Provides high performance for storage and
retrieval at large scale
• Has a robust query interface permitting intelligent
operations
• Is not a data processing engine, but provides
processing functionality
Data Processing in MongoDB
• Process in MongoDB using Map/Reduce
• Process in MongoDB using Aggregation
Framework
• Process outside MongoDB using Hadoop and
other external tools
The goal
Real Time
Analytics Engine
Data
SourceData
SourceData
Source
Sample Customers
Solution goals
• Lots of data sources
• Lots of data from each source
High write volume
• Users can drill down into dataDynamic queries
• Lots of clients
• High request rate
Fast queries
• How long before an event appears
in a report?
Minimize delay
between collection &
query
System architecture
Systems Architecture
Data
Sources
Asynchronous writes
Upserts avoid
unnecessary reads
Writes buffered in
RAM and flushed to
disk in bulk
Data
Sources
Data
Sources
Data
Sources
Spread writes over
multiple shards
Simple log storage
Design Pattern
Sample data
Original
Event Data
127.0.0.1 - frank [10/Jun/2013:13:55:36 -0700] "GET
/apache_pb.gif HTTP/1.0" 200 2326
“http://www.example.com/start.html" Mozilla/5.0 (Macintosh; U; Intel
Mac OS X 10_7_4; en-US)”
As JSON doc = {
_id: ObjectId('4f442120eb03305789000000'),
host: "127.0.0.1",
time: ISODate("2013-06-10T20:55:36Z"),
path: “/apache_pb.gif",
referer: “http://www.example.com/start.html",
user_agent: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X
10_7_4; en-US)”
}
Insert to
MongoDB
db.logs.insert( doc )
Dynamic Queries
Find all logs for a
URL
db.logs.find( { ‘path’ : ‘/index.html’ } )
Find all logs for a
time range
db.logs.find( {
‘time’ : {
‘$gte’: new Date(2013, 0),
‘$lt’: new Date(2013, s1) }
} )
Find all logs for a
host over a range of
dates
db.logs.find( {
‘host’ : ‘127.0.0.1’,
‘time’ : {
‘$gte’: new Date(2013, 0),
‘$lt’: new Date(2013, 1) }
} )
Aggregation
Framework
MongoDB Aggregation
Framework
Aggregation Framework
Requests
per day by
URL
db.logs.aggregate( [
{ '$match': {
'time': {
'$gte': new Date(2013, 0),
'$lt': new Date(2013, 1) } } },
{ '$project': {
'path': 1,
'date': {
'y': { '$year': '$time' },
'm': { '$month': '$time' },
'd': { '$dayOfMonth': '$time' } } } },
{ '$group': {
'_id': {
'p': '$path',
'y': '$date.y',
'm': '$date.m',
'd': '$date.d' },
'hits': { '$sum': 1 } } },
])
Aggregation Framework
{
‘ok’: 1,
‘result’: [
{ '_id': {'p':’/index.html’,'y': 2013,'m': 1,'d': 1 },
'hits’: 124 },
{ '_id': {'p':’/index.html’,'y': 2013,'m': 1,'d': 2 },
'hits’: 245 },
{ '_id': {'p':’/index.html’,'y': 2013,'m': 1,'d': 3 },
'hits’: 322 },
{ '_id': {'p':’/index.html’,'y': 2013,'m': 1,'d': 4 },
'hits’: 175 },
{ '_id': {'p':’/index.html’,'y': 2013,'m': 1,'d': 5 },
'hits’: 94 }
]
}
Aggregation Framework
Benefits
• Real-time
• Simple yet powerful interface
• Declared in JSON, executes in C++
• Runs inside MongoDB on local data

• Adds load to your DB
• Limited how much data it can return
Roll-ups with map-
reduce
Design Pattern
MongoDB Map/Reduce
Map Reduce – Map Phase
Generate hourly
rollups from log
data
var map = function() {
var key = {
p: this.path,
d: new Date(
this.ts.getFullYear(),
this.ts.getMonth(),
this.ts.getDate(),
this.ts.getHours(),
0, 0, 0) };
emit( key, { hits: 1 } );
}
Map Reduce – Reduce Phase
Generate hourly
rollups from log
data
var reduce = function(key, values) {
var r = { hits: 0 };
values.forEach(function(v) {
r.hits += v.hits;
});
return r;
}
)
MongoDB Map/Reduce
• Real-time
• Output directly to document or collection
• Runs inside MongoDB on local data
• V8 engine
• Adds load to your DB
• In JavaScript
Integrations
REPORTING
Charting
APACHE HADOOP
Log
Aggregation
with MongoDB
as sink
More complex
aggregations or
integration with tools like
Mahout
MongoDB
MongoDB with Hadoop
MongoDB with Hadoop
MongoDB with Hadoop
MongoDB and Hadoop
• Away from data store
• Can leverage existing data processing infrastructure
• Can horizontally scale your data processing
• Offline batch processing
• Requires synchronization between store &
processor
• Infrastructure is much more complex
The Future of Big Data and
MongoDB
What is Big?
Big today is normal
tomorrow
http://www.worldwidewebsize.com/
Big is only getting bigger
IBM - http://www-01.ibm.com/software/data/bigdata/
90% of the data in the
world today has been
created in the last two
years
MongoDB enables
you to scale to the
redefinition of BIG
MongoDB is evolving
to enable you to process
the new BIG
Gianfranco Palumbo – slides tweeted from @MongoDBDublin
MongoDB is committed to
working with the best data
processing tools
• Map Reduce
• Aggregation Framework
• Hadoop adapter
– docs.mongodb.org/ecosystem/tutorial/getting-started-with-hadoop/
• Storm
– github.com/christkv/mongo-storm
• Disco
– github.com/mongodb/mongo-disco
• Spark (coming soon)
Technical Support Engineer, 10gen
Gianfranco Palumbo
#bigdatajaspersoft
Thank you
@MongoDBDublin

More Related Content

PDF
Social Data and Log Analysis Using MongoDB
PPTX
Back to Basics Webinar 1: Introduction to NoSQL
PDF
MongoDB for Analytics
PPTX
Doing Joins in MongoDB: Best Practices for Using $lookup
PPTX
MongoDB + Spring
PPTX
Back to Basics Webinar 2: Your First MongoDB Application
PPTX
Python and MongoDB as a Market Data Platform by James Blackburn
PPTX
MongoDB 101
Social Data and Log Analysis Using MongoDB
Back to Basics Webinar 1: Introduction to NoSQL
MongoDB for Analytics
Doing Joins in MongoDB: Best Practices for Using $lookup
MongoDB + Spring
Back to Basics Webinar 2: Your First MongoDB Application
Python and MongoDB as a Market Data Platform by James Blackburn
MongoDB 101

What's hot (20)

PPTX
Introduction to MongoDB and Hadoop
PPTX
Back to Basics Webinar 1: Introduction to NoSQL
PPTX
Conexión de MongoDB con Hadoop - Luis Alberto Giménez - CAPSiDE #DevOSSAzureDays
PPTX
High Performance Applications with MongoDB
PDF
Barcelona MUG MongoDB + Hadoop Presentation
PDF
Using MongoDB + Hadoop Together
PPTX
Beyond the Basics 2: Aggregation Framework
PDF
Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...
PPT
Introduction to MongoDB
PPTX
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
PDF
MongoDB and Python
PPTX
Using MongoDB As a Tick Database
PPTX
Introduction to MongoDB
PDF
Python and MongoDB
PPTX
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
PPTX
Introduction to MongoDB
PPTX
Basics of MongoDB
PPTX
MongoDB and Hadoop: Driving Business Insights
PPTX
How Thermo Fisher Is Reducing Mass Spectrometry Experiment Times from Days to...
PPT
Mongo Web Apps: OSCON 2011
Introduction to MongoDB and Hadoop
Back to Basics Webinar 1: Introduction to NoSQL
Conexión de MongoDB con Hadoop - Luis Alberto Giménez - CAPSiDE #DevOSSAzureDays
High Performance Applications with MongoDB
Barcelona MUG MongoDB + Hadoop Presentation
Using MongoDB + Hadoop Together
Beyond the Basics 2: Aggregation Framework
Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...
Introduction to MongoDB
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
MongoDB and Python
Using MongoDB As a Tick Database
Introduction to MongoDB
Python and MongoDB
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
Introduction to MongoDB
Basics of MongoDB
MongoDB and Hadoop: Driving Business Insights
How Thermo Fisher Is Reducing Mass Spectrometry Experiment Times from Days to...
Mongo Web Apps: OSCON 2011
Ad

Viewers also liked (20)

PPTX
An Introduction to Big Data, NoSQL and MongoDB
PPTX
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
PDF
MongoDB at the energy frontier
PPTX
MongoDB Days UK: Using MongoDB and Python for Data Analysis Pipelines
PPTX
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
ODP
MongoDB & Machine Learning
PPTX
MongoDB for Time Series Data Part 2: Analyzing Time Series Data Using the Agg...
PPTX
Plus de flexibilité et de scalabilité chez Bouygues Télécom grâce à MongoDB
PPT
NoSQL Analytics: JSON Data Analysis and Acceleration in MongoDB World
PDF
Analytic Data Report with MongoDB
PDF
Практическое применение MongoDB Aggregation Framework
PDF
Webinar: Data Processing and Aggregation Options
PPTX
MongoDB Aggregation MongoSF May 2011
PPTX
Introduction to MongoDB and Workshop
PDF
Analytics with MongoDB Aggregation Framework and Hadoop Connector
PDF
Collaborative Line of Business Applications on IBM Bluemix
PDF
MongoDB et Elasticsearch, meilleurs ennemis ?
ODP
MongoDB - Ekino PHP
PDF
Apache Spark and MongoDB - Turning Analytics into Real-Time Action
PPTX
Splunk's Hunk: A Powerful Way to Visualize Your Data Stored in MongoDB
An Introduction to Big Data, NoSQL and MongoDB
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB at the energy frontier
MongoDB Days UK: Using MongoDB and Python for Data Analysis Pipelines
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
MongoDB & Machine Learning
MongoDB for Time Series Data Part 2: Analyzing Time Series Data Using the Agg...
Plus de flexibilité et de scalabilité chez Bouygues Télécom grâce à MongoDB
NoSQL Analytics: JSON Data Analysis and Acceleration in MongoDB World
Analytic Data Report with MongoDB
Практическое применение MongoDB Aggregation Framework
Webinar: Data Processing and Aggregation Options
MongoDB Aggregation MongoSF May 2011
Introduction to MongoDB and Workshop
Analytics with MongoDB Aggregation Framework and Hadoop Connector
Collaborative Line of Business Applications on IBM Bluemix
MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB - Ekino PHP
Apache Spark and MongoDB - Turning Analytics into Real-Time Action
Splunk's Hunk: A Powerful Way to Visualize Your Data Stored in MongoDB
Ad

Similar to How to leverage MongoDB for Big Data Analysis and Operations with MongoDB's Aggregation Framework and Map Reduce (20)

PPT
Schema Design by Chad Tindel, Solution Architect, 10gen
PDF
Webinar: Managing Real Time Risk Analytics with MongoDB
PDF
2016 feb-23 pyugre-py_mongo
PDF
Using MongoDB and Python
PPTX
Dev Jumpstart: Build Your First App with MongoDB
PDF
MongoDB_Spark
PPTX
MongoDB_ppt.pptx
PDF
MongoDB FabLab León
PPTX
How to learn MongoDB for beginner's
PDF
MongoDB.pdf
PPTX
MongoDB Evenings Minneapolis: MongoDB is Cool But When Should I Use It?
PDF
Data as Documents: Overview and intro to MongoDB
PDF
MongoDB Meetup
KEY
PPTX
Webinar: Applikationsentwicklung mit MongoDB : Teil 5: Reporting & Aggregation
PPTX
Dev Jumpstart: Build Your First App with MongoDB
PPTX
1403 app dev series - session 5 - analytics
DOCX
What are the major components of MongoDB and the major tools used in it.docx
PPTX
introtomongodb
PPTX
Webinar: When to Use MongoDB
Schema Design by Chad Tindel, Solution Architect, 10gen
Webinar: Managing Real Time Risk Analytics with MongoDB
2016 feb-23 pyugre-py_mongo
Using MongoDB and Python
Dev Jumpstart: Build Your First App with MongoDB
MongoDB_Spark
MongoDB_ppt.pptx
MongoDB FabLab León
How to learn MongoDB for beginner's
MongoDB.pdf
MongoDB Evenings Minneapolis: MongoDB is Cool But When Should I Use It?
Data as Documents: Overview and intro to MongoDB
MongoDB Meetup
Webinar: Applikationsentwicklung mit MongoDB : Teil 5: Reporting & Aggregation
Dev Jumpstart: Build Your First App with MongoDB
1403 app dev series - session 5 - analytics
What are the major components of MongoDB and the major tools used in it.docx
introtomongodb
Webinar: When to Use MongoDB

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Approach and Philosophy of On baking technology
PPT
Teaching material agriculture food technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Modernizing your data center with Dell and AMD
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Big Data Technologies - Introduction.pptx
Encapsulation_ Review paper, used for researhc scholars
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
“AI and Expert System Decision Support & Business Intelligence Systems”
Approach and Philosophy of On baking technology
Teaching material agriculture food technology
Understanding_Digital_Forensics_Presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Network Security Unit 5.pdf for BCA BBA.
Digital-Transformation-Roadmap-for-Companies.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Advanced methodologies resolving dimensionality complications for autism neur...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Machine learning based COVID-19 study performance prediction
Modernizing your data center with Dell and AMD
MYSQL Presentation for SQL database connectivity
Review of recent advances in non-invasive hemoglobin estimation
Big Data Technologies - Introduction.pptx

How to leverage MongoDB for Big Data Analysis and Operations with MongoDB's Aggregation Framework and Map Reduce

Editor's Notes

  • #2: i'm going to talk about How to leveragei hope you end with learning about mongodb
  • #4: Start by saying "I want to start asking a question what is it?”
  • #5: Google, Amazon, and Facebook built custom tools to handle massive amounts of data.MongoDB led an opensource movement to provide a viable alternative to proprietary solutions to handle big dataIt’s just Data! Don’t panic
  • #7: We will be demonstrating how to do each of these today and discuss why and when you would use each.
  • #8: Chart, Trends, Insights
  • #9: Traackr social mediaIntuit small business, personal finance and tax software
  • #10: Not only data size but also the rate the data comes inFor example twitterWhat is the tolerable delay? How complex is the processing of the data?
  • #17: I often think of Map reduce as the Marmite of MongoDB - people either love it or hate it.For that very reason we've produced the aggregation framework in 2.2 and its only getting better in 2.4!
  • #18: $project, $match, $unwind, $group - $limit, $skip, $sortNojavascript code$outMore operators coming soon
  • #22: The original aggregation utility in mongodb.Simplified view -> from mongodbc++ to the js runtime1) You create a map function2) MAP returns results mongoDB then groups and sorts the results3) Then passes the values to reduce4) Finialise is optionalBack to the c++ runtime
  • #23: Summarise by hour and save that in a collection.
  • #24: Map and reduce need to return the same object. Because it can the reduce can be run again.
  • #25: V8 in 2.4 & muiltithreaded
  • #28: JobsHigher latency
  • #36: The mongodbhadoop adapter allows you to stream data into hadoop and outSo you can scale data processing across many machines for batch processing.
  • #37: Another common usecase we see is warehousing of data - again the connector allows you to utilise existing libraries via hadoop
  • #38: The third most common usecase is an ETL - extract transform load - function.Then putting the aggregated data into mongodb for further analysis.
  • #42: Google, Amazon, and Facebook built custom tools to handle massive amounts of data.MongoDB led an opensource movement to provide a viable alternative to proprietary solutions to handle big data
  • #43: Horizontally scale out and providing sharding tools out the box
  • #44: Horizontally scale out and providing sharding tools out the box
  • #45: Our next challenge is helping you make sense of your data
  • #46: Map / Reduce - allows complex programable aggregationsAggregation Framework - easy and simple access to aggregationHadoop - the start of our integration with external toolsStorm Distributed and fault-tolerant realtime computation system. - used by Twitter, Groupon, etcmore flexible, incremental processingDisco is an open-source implementation of the Map-Reduce framework for distributed computing. - developed by Nokia Research Center
  • #47: Meetupeducation.10gen.com