SlideShare a Scribd company logo
@MongoDB




           Webinar Building Web Applications with MongoDB and Spring will begin
                     at 11:00 AM EDT / 8:00 AM PDT / 3:00 PM UTC

            Audio should start immediately when you log into the event via Audio
               Broadcast. You will need a Voip headset and reliable internet
            connection for Audio Broadcast. If you are having issues connecting,
                   please dial 1-877-668-4493; Access code: 669 104 658.

                            There is a Q&A following the webinar.

                A recording of the webinar will be available 24 hours after the
                                     event is complete.
IT needs are evolving...
                              Agile Development

                              • Iterative
                              • Continuous




Data Volume, Type &
Use
• Trillions of records
• 100’s of millions of
  queries per second
• Real-Time Analytics
• Unstructured / semi-            New Hardware
  structured
                                  Architectures
                                  • Commodity servers
                                  • Cloud Computing
                                  • Horizontal Scaling
Is there a better way?
Terminology

RDBMS              MongoDB
Table              Collection
Row(s)             JSON Document
Index              Index
Join               Embedding & Linking
Partition          Shard
Partition Key      Shard Key
Lets build a Spring Data MongoDB App!
Welcome to Dev News
User Story 1:
As a user I should be able to create “News Articles”
What is a News Article?
{
    title: “What is new in 2.2 MongoDB”,
    date : new Date(),
    author : “Fred”
    text : “.......”
}
Example 1 - Create
Welcome to Dev News
User Story 1:
As a user I should be able to create “News Articles”
User Story 2:
As a user I should be able to find a “News Articles” by Name
Example 2 - Query
Example 3 - Repo
Welcome to Dev News
User Story 1:
As a user I should be able to create “News Articles”
User Story 2:
As a user I should be able to find a “News Articles” by Name
User Story 3:
As a user I should be able to comment on “News Articles”
What is a Comment?
{
    title: “What is new in 2.2 MongoDB”,
    date : new Date(),
    author : “Fred”
    text : “.......”
    tags : [“mongodb”, “nosql”]
    comments : [
         {author : “chris”, text: “this is great” , date : new Date()},
         {author : “tom”, text: “rock on”, date : new Date()}
    ]
Example 4 - Comments
Welcome to Dev News
User Story 1:
As a user I should be able to create “News Articles”
User Story 2:
As a user I should be able to find a “News Articles” by Name
User Story 3:
As a user I should be able to comment on “News Articles”
User Story 4:
As a user I want to know how many comments are on a “Articles”
What is a Comment?
{
    title: “What is new in 2.2 MongoDB”,
    ....
    comments : [
           {author : “chris”, text: “this is great” , date : new Date()},
           {author : “tom”, text: “rock on”, date : new Date()}
    ],
    comments_count : 2
}
Example 5 - Inc
Least durability - Don't use!
  Driver           Primary
           write


                             apply in memory
Wait for Journal Sync
Same as RDBMS
  Driver                  Primary
              write
           getLastError             apply in memory
              j:true
                                     Write to journal
More durability
  Driver                  Primary                        Secondary
              write
           getLastError             apply in memory
            w:2
                                             replicate
Replica Set
Data Protection
Multiple copies of the data
Spread across Data Centers, AZs
High Availability
Automated Failover
Automated Recovery
Replica Sets


Java   Write
App               Primary
                              Asynchronous Replication
       Read

                 Secondary



                 Secondary
Replica Sets


Java   Write
App               Primary
       Read

                 Secondary



                 Secondary
Replica Sets


Java
App               Primary


       Write
                  Primary     Automatic Election of new
                                      Primary
       Read

                 Secondary
Replica Sets


Java
App              Recovering


       Write                  New primary serves data
                  Primary
       Read

                 Secondary
Replica Sets


Java
App              Secondary


       Write
                  Primary
       Read

                 Secondary
Durability Summary
                  Memory   Journal   Secondary   Other Data Center

  RDBMS

    Default
"Fire & Forget"

   w=1

   w=1
  j=true
w="majority"
   w=n
w="myTag"

           Less                                              More
Example 6 - Write Concern
Eventual Consistency




http://www.flickr.com/photos/26095468@N04/3779692985
Understanding Eventual Consistency

  Thread #1   Primary   Secondary

 Insert         v1
Understanding Eventual Consistency

  Thread #1   Primary   Secondary

 Insert         v1




                        v1
Understanding Eventual Consistency


  Thread #1   Primary   Secondary

 Insert        v1




  Read
                        v1
Understanding Eventual Consistency


               Thread #1   Primary   Secondary

            Insert           v1




reads v1     Read
                                     v1
Understanding Eventual Consistency

               Thread #1   Primary   Secondary

            Insert           v1




reads v1     Read
                                     v1



           Update            v2
Understanding Eventual Consistency

              Thread #1   Primary   Secondary

            Insert          v1




reads v1     Read
                                    v1



           Update           v2




                                    v2
Understanding Eventual Consistency

              Thread #1   Primary   Secondary

            Insert          v1




reads v1     Read
                                    v1



           Update           v2




             Read                   v2
Understanding Eventual Consistency

             Thread #1   Primary   Secondary

            Insert         v1




reads v1     Read
                                   v1



           Update          v2




reads v2     Read                  v2
Understanding Eventual Consistency

Thread #1   Primary   Secondary   Thread #2

 Insert         v1




  Read
                      v1



Update          v2




  Read                v2
Understanding Eventual Consistency

Thread #1   Primary   Secondary   Thread #2

 Insert         v1




  Read
                      v1



Update          v2




  Read                v2
Understanding Eventual Consistency

Thread #1   Primary   Secondary   Thread #2

 Insert         v1
                                         v1 does not
                                           exist on
  Read                                   Secondary
                      v1



Update          v2




  Read                v2
Understanding Eventual Consistency

Thread #1   Primary   Secondary   Thread #2

 Insert         v1
                                         v1 does not
                                           exist on
  Read                                   Secondary
                      v1



Update          v2
                                        Reads v1 but
                                        Primary at v2

  Read                v2
                                              Read v2
Example 7 - Eventual Consistency
Questions

• MongoDB 2.2
 – Improved concurrency
 – Tag-aware sharding
 – Aggregation framework
 – TTL collections

• Free online MongoDB training
 – Develop
 – Deploy
 – Classes start Oct. 2012

More Related Content

KEY
The Spring Data MongoDB Project
PDF
What is kubernet
PDF
Replication and Replica Sets
PDF
Schema & Design
PPTX
Building Your First Java Application with MongoDB
PDF
Morning with MongoDB Paris 2012 - Accueil et Introductions
PPTX
Bringing Spatial Love to Your Java Application
PPT
Mongo @ homeshop18
The Spring Data MongoDB Project
What is kubernet
Replication and Replica Sets
Schema & Design
Building Your First Java Application with MongoDB
Morning with MongoDB Paris 2012 - Accueil et Introductions
Bringing Spatial Love to Your Java Application
Mongo @ homeshop18

Viewers also liked (11)

PDF
Webinar: Operational Best Practices
PDF
Webinar: What's New in Aggregation
PDF
A Morning with MongoDB Barcelona: Introduction
PDF
Morning with MongoDB Paris 2012 - MongoDB Cas d'utilisation au Figaro
PPTX
An Evening with MongoDB Detroit 2013
PPTX
MongoDC 2012: Taming Social Media with MongoDB
PPTX
Webinar: What's new in the .NET Driver
PDF
Morning with MongoDB Paris 2012 - MongoDB Basic Concepts
PDF
MongoDB in FS
PDF
MongoDB and Fractal Tree Indexes
PDF
Webinar: A Total Cost of Ownership Analysis for MongoDB
Webinar: Operational Best Practices
Webinar: What's New in Aggregation
A Morning with MongoDB Barcelona: Introduction
Morning with MongoDB Paris 2012 - MongoDB Cas d'utilisation au Figaro
An Evening with MongoDB Detroit 2013
MongoDC 2012: Taming Social Media with MongoDB
Webinar: What's new in the .NET Driver
Morning with MongoDB Paris 2012 - MongoDB Basic Concepts
MongoDB in FS
MongoDB and Fractal Tree Indexes
Webinar: A Total Cost of Ownership Analysis for MongoDB
Ad

Similar to Webinar: Building Web Applications with MongoDB and Spring (20)

PDF
Consistency Models in New Generation Databases
PDF
Consistency-New-Generation-Databases
PDF
Thoughts on Transaction and Consistency Models
PPTX
PPTX
Presentation
POTX
Presentation
PDF
Automated conflict resolution - enabling masterless data distribution (Rune S...
PDF
Coherence Implementation Patterns - Sig Nov 2011
PDF
NoSQL - how it works (@pavlobaron)
PDF
Challenges in Maintaining a High Performance Search Engine Written in Java
PDF
Why we cannot ignore Functional Programming
PDF
Updateable Fields in Lucene and other Codec Applications
PDF
Dzone core java concurrency -_
PPT
MongoDB Basic Concepts
PPTX
Cистема распределенного, масштабируемого и высоконадежного хранения данных дл...
PDF
Distributed computing the Google way
PDF
Design Patterns For Distributed NO-reational databases
PPT
Big Data & NoSQL - EFS'11 (Pavlo Baron)
PPTX
Mongosv 2011 - Replication
PPT
Distributed System by Pratik Tambekar
Consistency Models in New Generation Databases
Consistency-New-Generation-Databases
Thoughts on Transaction and Consistency Models
Presentation
Presentation
Automated conflict resolution - enabling masterless data distribution (Rune S...
Coherence Implementation Patterns - Sig Nov 2011
NoSQL - how it works (@pavlobaron)
Challenges in Maintaining a High Performance Search Engine Written in Java
Why we cannot ignore Functional Programming
Updateable Fields in Lucene and other Codec Applications
Dzone core java concurrency -_
MongoDB Basic Concepts
Cистема распределенного, масштабируемого и высоконадежного хранения данных дл...
Distributed computing the Google way
Design Patterns For Distributed NO-reational databases
Big Data & NoSQL - EFS'11 (Pavlo Baron)
Mongosv 2011 - Replication
Distributed System by Pratik Tambekar
Ad

More from MongoDB (20)

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

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
Cloud computing and distributed systems.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Encapsulation theory and applications.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Digital-Transformation-Roadmap-for-Companies.pptx
sap open course for s4hana steps from ECC to s4
Review of recent advances in non-invasive hemoglobin estimation
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Electronic commerce courselecture one. Pdf
Cloud computing and distributed systems.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MYSQL Presentation for SQL database connectivity
Network Security Unit 5.pdf for BCA BBA.
Encapsulation_ Review paper, used for researhc scholars
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
The Rise and Fall of 3GPP – Time for a Sabbatical?
Advanced methodologies resolving dimensionality complications for autism neur...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation theory and applications.pdf
Understanding_Digital_Forensics_Presentation.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

Webinar: Building Web Applications with MongoDB and Spring

  • 1. @MongoDB Webinar Building Web Applications with MongoDB and Spring will begin at 11:00 AM EDT / 8:00 AM PDT / 3:00 PM UTC Audio should start immediately when you log into the event via Audio Broadcast. You will need a Voip headset and reliable internet connection for Audio Broadcast. If you are having issues connecting, please dial 1-877-668-4493; Access code: 669 104 658. There is a Q&A following the webinar. A recording of the webinar will be available 24 hours after the event is complete.
  • 2. IT needs are evolving... Agile Development • Iterative • Continuous Data Volume, Type & Use • Trillions of records • 100’s of millions of queries per second • Real-Time Analytics • Unstructured / semi- New Hardware structured Architectures • Commodity servers • Cloud Computing • Horizontal Scaling
  • 3. Is there a better way?
  • 4. Terminology RDBMS MongoDB Table Collection Row(s) JSON Document Index Index Join Embedding & Linking Partition Shard Partition Key Shard Key
  • 5. Lets build a Spring Data MongoDB App!
  • 6. Welcome to Dev News User Story 1: As a user I should be able to create “News Articles”
  • 7. What is a News Article? { title: “What is new in 2.2 MongoDB”, date : new Date(), author : “Fred” text : “.......” }
  • 8. Example 1 - Create
  • 9. Welcome to Dev News User Story 1: As a user I should be able to create “News Articles” User Story 2: As a user I should be able to find a “News Articles” by Name
  • 10. Example 2 - Query
  • 11. Example 3 - Repo
  • 12. Welcome to Dev News User Story 1: As a user I should be able to create “News Articles” User Story 2: As a user I should be able to find a “News Articles” by Name User Story 3: As a user I should be able to comment on “News Articles”
  • 13. What is a Comment? { title: “What is new in 2.2 MongoDB”, date : new Date(), author : “Fred” text : “.......” tags : [“mongodb”, “nosql”] comments : [ {author : “chris”, text: “this is great” , date : new Date()}, {author : “tom”, text: “rock on”, date : new Date()} ]
  • 14. Example 4 - Comments
  • 15. Welcome to Dev News User Story 1: As a user I should be able to create “News Articles” User Story 2: As a user I should be able to find a “News Articles” by Name User Story 3: As a user I should be able to comment on “News Articles” User Story 4: As a user I want to know how many comments are on a “Articles”
  • 16. What is a Comment? { title: “What is new in 2.2 MongoDB”, .... comments : [ {author : “chris”, text: “this is great” , date : new Date()}, {author : “tom”, text: “rock on”, date : new Date()} ], comments_count : 2 }
  • 17. Example 5 - Inc
  • 18. Least durability - Don't use! Driver Primary write apply in memory
  • 19. Wait for Journal Sync Same as RDBMS Driver Primary write getLastError apply in memory j:true Write to journal
  • 20. More durability Driver Primary Secondary write getLastError apply in memory w:2 replicate
  • 21. Replica Set Data Protection Multiple copies of the data Spread across Data Centers, AZs High Availability Automated Failover Automated Recovery
  • 22. Replica Sets Java Write App Primary Asynchronous Replication Read Secondary Secondary
  • 23. Replica Sets Java Write App Primary Read Secondary Secondary
  • 24. Replica Sets Java App Primary Write Primary Automatic Election of new Primary Read Secondary
  • 25. Replica Sets Java App Recovering Write New primary serves data Primary Read Secondary
  • 26. Replica Sets Java App Secondary Write Primary Read Secondary
  • 27. Durability Summary Memory Journal Secondary Other Data Center RDBMS Default "Fire & Forget" w=1 w=1 j=true w="majority" w=n w="myTag" Less More
  • 28. Example 6 - Write Concern
  • 30. Understanding Eventual Consistency Thread #1 Primary Secondary Insert v1
  • 31. Understanding Eventual Consistency Thread #1 Primary Secondary Insert v1 v1
  • 32. Understanding Eventual Consistency Thread #1 Primary Secondary Insert v1 Read v1
  • 33. Understanding Eventual Consistency Thread #1 Primary Secondary Insert v1 reads v1 Read v1
  • 34. Understanding Eventual Consistency Thread #1 Primary Secondary Insert v1 reads v1 Read v1 Update v2
  • 35. Understanding Eventual Consistency Thread #1 Primary Secondary Insert v1 reads v1 Read v1 Update v2 v2
  • 36. Understanding Eventual Consistency Thread #1 Primary Secondary Insert v1 reads v1 Read v1 Update v2 Read v2
  • 37. Understanding Eventual Consistency Thread #1 Primary Secondary Insert v1 reads v1 Read v1 Update v2 reads v2 Read v2
  • 38. Understanding Eventual Consistency Thread #1 Primary Secondary Thread #2 Insert v1 Read v1 Update v2 Read v2
  • 39. Understanding Eventual Consistency Thread #1 Primary Secondary Thread #2 Insert v1 Read v1 Update v2 Read v2
  • 40. Understanding Eventual Consistency Thread #1 Primary Secondary Thread #2 Insert v1 v1 does not exist on Read Secondary v1 Update v2 Read v2
  • 41. Understanding Eventual Consistency Thread #1 Primary Secondary Thread #2 Insert v1 v1 does not exist on Read Secondary v1 Update v2 Reads v1 but Primary at v2 Read v2 Read v2
  • 42. Example 7 - Eventual Consistency
  • 43. Questions • MongoDB 2.2 – Improved concurrency – Tag-aware sharding – Aggregation framework – TTL collections • Free online MongoDB training – Develop – Deploy – Classes start Oct. 2012

Editor's Notes