SlideShare a Scribd company logo
1 of 21
Mongo for the Mission-Critical Enterprise



                                                   Thom Nichols
                                     Principal Software Engineer
                                           Advanced Technology
                                                     @thom_nic




© EnerNOC Inc.
What am I talking about?
Integrating Mongo into a mission-critical system
• EnerNOC provides a 24/ 7 system to help ensure electric grid stability
• How do we introduce Mongo to help meet scalability needs?
• How do we do so in a way that ensures stability?




                                                                           2
Background
We provide stability to the electric grid.


How we do it:
1. Instability on the grid (peaking load, transmission line failure)
2. Grid operator sends a “demand response” signal to us
3. We send a signal to our customers (large electric consumers)
4. Customers reduce their energy usage
5. ???       We monitor customer telemetry in near-realtime
6. Profit!




                                                                       3
Background
• We’ve experienced tremendous growth
• Software (esp. database) struggles to keep up
     • Hundreds of tables


• Hibernate  Inefficient queries
     • Our solution? Make everything a stored proc


• Better, except…
     • A few tables take up 99% of our storage
     • It’s still slow
     • Looking at $$millions in hardware cost to scale




                                                         4
What’s worse than a database that won’t scale?




             Two databases that won’t scale.




                                                 5
Planning for Mongo
We listened
• Replication from day 1
• Sharding shortly after




                           6
Planning for Mongo
• Bucketing
• Pre-allocated stubbed out documents
• Hashed IDs for data locality


   pid = 1234 # natural key

   hash_pid = pid.to_s.rjust(15,'0').reverse!.to_i

   _id = {
     :p => hash_pid,
     :s => Date.new
   }




                                                     7
The Software Architect’s Haiku
Avoid vendor lock-in


Mongo might solve scaling problems


But increase dependencies




                                     8
What did we do?
Create a Data Management Service


• Common HTTP interface for data in, data out
• Hides ID hashing & bucketing
• Interface for on-the-fly aggregation
• Caching behind the service
• Native client libraries – Java, Ruby, R




                                                9
The Basic Idea




    Woo! Problem solved!



                           10
So What?




           11
Ok, it’s not quite that simple…




                                  12
What’s the point? Centralized Auth




                                     13
14
API Documentation




                    15
Java API Method Example




                          16
What about the other services?
Independently scalable based on usage




                                        17
Aggregation – Long running service operations




                                                18
Scaling the Architecture




                           19
Scaling the Architecture




                           20
Questions?




Thom Nichols
   @thom_nic




                      21

More Related Content

Similar to Mongo for the Mission Critical Enterprise

Rakuten Ichiba_Rakuten Technology Conference 2016
Rakuten Ichiba_Rakuten Technology Conference 2016Rakuten Ichiba_Rakuten Technology Conference 2016
Rakuten Ichiba_Rakuten Technology Conference 2016Rakuten Group, Inc.
 
Webinar: How Banks Manage Reference Data with MongoDB
 Webinar: How Banks Manage Reference Data with MongoDB Webinar: How Banks Manage Reference Data with MongoDB
Webinar: How Banks Manage Reference Data with MongoDBMongoDB
 
Use Case: Apollo Group at Oracle Open World
Use Case: Apollo Group at Oracle Open WorldUse Case: Apollo Group at Oracle Open World
Use Case: Apollo Group at Oracle Open WorldMongoDB
 
A Morning with MongoDB - Helsinki
A Morning with MongoDB - HelsinkiA Morning with MongoDB - Helsinki
A Morning with MongoDB - HelsinkiMongoDB
 
Introducing MongoDB into your Organization
Introducing MongoDB into your OrganizationIntroducing MongoDB into your Organization
Introducing MongoDB into your OrganizationMongoDB
 
Suning OpenStack Cloud and Heat
Suning OpenStack Cloud and HeatSuning OpenStack Cloud and Heat
Suning OpenStack Cloud and HeatQiming Teng
 
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDBMongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDBMongoDB
 
2012 RightScale Conference NYC - Jeff Gelb, Director of Technology Strategy, ...
2012 RightScale Conference NYC - Jeff Gelb, Director of Technology Strategy, ...2012 RightScale Conference NYC - Jeff Gelb, Director of Technology Strategy, ...
2012 RightScale Conference NYC - Jeff Gelb, Director of Technology Strategy, ...RightScale
 
Zero to ten million daily users in four weeks: sustainable speed is king
Zero to ten million daily users in four weeks: sustainable speed is kingZero to ten million daily users in four weeks: sustainable speed is king
Zero to ten million daily users in four weeks: sustainable speed is kingplumbee
 
Architecture to Scale. DONN ROCHETTE at Big Data Spain 2012
Architecture to Scale. DONN ROCHETTE at Big Data Spain 2012Architecture to Scale. DONN ROCHETTE at Big Data Spain 2012
Architecture to Scale. DONN ROCHETTE at Big Data Spain 2012Big Data Spain
 
WSO2Con US 2013 - Connected Business - making it happen
WSO2Con US 2013 - Connected Business - making it happenWSO2Con US 2013 - Connected Business - making it happen
WSO2Con US 2013 - Connected Business - making it happenWSO2
 
Morningwithmongodbisrael 121217184113-phpapp02
Morningwithmongodbisrael 121217184113-phpapp02Morningwithmongodbisrael 121217184113-phpapp02
Morningwithmongodbisrael 121217184113-phpapp02Andrei Colta
 
Dutchcontainerdays
DutchcontainerdaysDutchcontainerdays
Dutchcontainerdays4bakker
 
"How to create usless software... and distribute it" (Alto university lecture...
"How to create usless software... and distribute it" (Alto university lecture..."How to create usless software... and distribute it" (Alto university lecture...
"How to create usless software... and distribute it" (Alto university lecture...Marcin Kokott
 
The DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetupThe DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetupNorm Leitman
 
Welcome and Introduction to A Morning with MongoDB Petah Tikvah
Welcome and Introduction to A Morning with MongoDB Petah TikvahWelcome and Introduction to A Morning with MongoDB Petah Tikvah
Welcome and Introduction to A Morning with MongoDB Petah TikvahMongoDB
 
Modern Post-Exploitation Strategies - 44CON 2012
Modern Post-Exploitation Strategies - 44CON 2012Modern Post-Exploitation Strategies - 44CON 2012
Modern Post-Exploitation Strategies - 44CON 201244CON
 
Emerging technologies
Emerging technologiesEmerging technologies
Emerging technologiesSteve Feldman
 

Similar to Mongo for the Mission Critical Enterprise (20)

Rakuten Ichiba_Rakuten Technology Conference 2016
Rakuten Ichiba_Rakuten Technology Conference 2016Rakuten Ichiba_Rakuten Technology Conference 2016
Rakuten Ichiba_Rakuten Technology Conference 2016
 
Webinar: How Banks Manage Reference Data with MongoDB
 Webinar: How Banks Manage Reference Data with MongoDB Webinar: How Banks Manage Reference Data with MongoDB
Webinar: How Banks Manage Reference Data with MongoDB
 
Use Case: Apollo Group at Oracle Open World
Use Case: Apollo Group at Oracle Open WorldUse Case: Apollo Group at Oracle Open World
Use Case: Apollo Group at Oracle Open World
 
A Morning with MongoDB - Helsinki
A Morning with MongoDB - HelsinkiA Morning with MongoDB - Helsinki
A Morning with MongoDB - Helsinki
 
Introducing MongoDB into your Organization
Introducing MongoDB into your OrganizationIntroducing MongoDB into your Organization
Introducing MongoDB into your Organization
 
DevOps Days Ohio
DevOps Days OhioDevOps Days Ohio
DevOps Days Ohio
 
Suning OpenStack Cloud and Heat
Suning OpenStack Cloud and HeatSuning OpenStack Cloud and Heat
Suning OpenStack Cloud and Heat
 
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDBMongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
 
2012 RightScale Conference NYC - Jeff Gelb, Director of Technology Strategy, ...
2012 RightScale Conference NYC - Jeff Gelb, Director of Technology Strategy, ...2012 RightScale Conference NYC - Jeff Gelb, Director of Technology Strategy, ...
2012 RightScale Conference NYC - Jeff Gelb, Director of Technology Strategy, ...
 
Zero to ten million daily users in four weeks: sustainable speed is king
Zero to ten million daily users in four weeks: sustainable speed is kingZero to ten million daily users in four weeks: sustainable speed is king
Zero to ten million daily users in four weeks: sustainable speed is king
 
Architecture to Scale. DONN ROCHETTE at Big Data Spain 2012
Architecture to Scale. DONN ROCHETTE at Big Data Spain 2012Architecture to Scale. DONN ROCHETTE at Big Data Spain 2012
Architecture to Scale. DONN ROCHETTE at Big Data Spain 2012
 
WSO2Con US 2013 - Connected Business - making it happen
WSO2Con US 2013 - Connected Business - making it happenWSO2Con US 2013 - Connected Business - making it happen
WSO2Con US 2013 - Connected Business - making it happen
 
Morningwithmongodbisrael 121217184113-phpapp02
Morningwithmongodbisrael 121217184113-phpapp02Morningwithmongodbisrael 121217184113-phpapp02
Morningwithmongodbisrael 121217184113-phpapp02
 
Dutchcontainerdays
DutchcontainerdaysDutchcontainerdays
Dutchcontainerdays
 
"How to create usless software... and distribute it" (Alto university lecture...
"How to create usless software... and distribute it" (Alto university lecture..."How to create usless software... and distribute it" (Alto university lecture...
"How to create usless software... and distribute it" (Alto university lecture...
 
The DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetupThe DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetup
 
Welcome and Introduction to A Morning with MongoDB Petah Tikvah
Welcome and Introduction to A Morning with MongoDB Petah TikvahWelcome and Introduction to A Morning with MongoDB Petah Tikvah
Welcome and Introduction to A Morning with MongoDB Petah Tikvah
 
Curated Computing
Curated Computing Curated Computing
Curated Computing
 
Modern Post-Exploitation Strategies - 44CON 2012
Modern Post-Exploitation Strategies - 44CON 2012Modern Post-Exploitation Strategies - 44CON 2012
Modern Post-Exploitation Strategies - 44CON 2012
 
Emerging technologies
Emerging technologiesEmerging technologies
Emerging technologies
 

More from MongoDB

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump StartMongoDB
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB
 

More from MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Mongo for the Mission Critical Enterprise

  • 1. Mongo for the Mission-Critical Enterprise Thom Nichols Principal Software Engineer Advanced Technology @thom_nic © EnerNOC Inc.
  • 2. What am I talking about? Integrating Mongo into a mission-critical system • EnerNOC provides a 24/ 7 system to help ensure electric grid stability • How do we introduce Mongo to help meet scalability needs? • How do we do so in a way that ensures stability? 2
  • 3. Background We provide stability to the electric grid. How we do it: 1. Instability on the grid (peaking load, transmission line failure) 2. Grid operator sends a “demand response” signal to us 3. We send a signal to our customers (large electric consumers) 4. Customers reduce their energy usage 5. ??? We monitor customer telemetry in near-realtime 6. Profit! 3
  • 4. Background • We’ve experienced tremendous growth • Software (esp. database) struggles to keep up • Hundreds of tables • Hibernate  Inefficient queries • Our solution? Make everything a stored proc • Better, except… • A few tables take up 99% of our storage • It’s still slow • Looking at $$millions in hardware cost to scale 4
  • 5. What’s worse than a database that won’t scale? Two databases that won’t scale. 5
  • 6. Planning for Mongo We listened • Replication from day 1 • Sharding shortly after 6
  • 7. Planning for Mongo • Bucketing • Pre-allocated stubbed out documents • Hashed IDs for data locality pid = 1234 # natural key hash_pid = pid.to_s.rjust(15,'0').reverse!.to_i _id = { :p => hash_pid, :s => Date.new } 7
  • 8. The Software Architect’s Haiku Avoid vendor lock-in Mongo might solve scaling problems But increase dependencies 8
  • 9. What did we do? Create a Data Management Service • Common HTTP interface for data in, data out • Hides ID hashing & bucketing • Interface for on-the-fly aggregation • Caching behind the service • Native client libraries – Java, Ruby, R 9
  • 10. The Basic Idea Woo! Problem solved! 10
  • 11. So What? 11
  • 12. Ok, it’s not quite that simple… 12
  • 13. What’s the point? Centralized Auth 13
  • 14. 14
  • 16. Java API Method Example 16
  • 17. What about the other services? Independently scalable based on usage 17
  • 18. Aggregation – Long running service operations 18
  • 21. Questions? Thom Nichols @thom_nic 21

Editor's Notes

  1. What I’m not talking about – High availabilityQuestion:Who uses Mongo in production today?Who has more than one front-end or app server hitting their mongo instance?
  2. So clearly our current architecture is not sclable
  3. So we can’t just add a second database and expect that to solve our problems. Even if Mongo can solve our problems, we need to put some thought into this to make sure we do it right.
  4. Basically we followed known best-practices. Sharding is something you have to plan for so your ID is right.
  5. Our buckets have a predictable size from the beginning, so it’s easy to stub them outPrevents fragmentationThe ID hashing ensures balanced shards
  6. So even when we know Mongo is right and it will scale, adding it as the backend to every app is messy.Now all apps have logic for when to ask RDBMS and when to ask Mongo. Increased coupling == bad!
  7. So we made a common front-end API and built that separate from the services for the underlying data sources.
  8. Here’s why – we wanted a common layer for authentication and auditing.
  9. Why is that important? Because when there are multiple apps hitting the services, we want a single point of entry.Auditing and SLA trackingAnd API versioning!