SlideShare a Scribd company logo
What’s new in the
                           PHP Driver (1.3.0)


                             Hannes Magnusson, 10gen
                                     bjori@10gen.com
                                               @bjori
                                 November 15th, 2012


Thursday, 15 November 12
About me


     • Hannes / @bjori
     • Icelandic
        – Oslo, Norway
        – London, England
        – San Francisco, USA
     • PHP Contributor
     • PHP Driver Engineer
              » @10gen
                                      3

Thursday, 15 November 12
Agenda



     • Removed not-so-cool stuff
     • New cool stuff



     • Connection handling / Replica Sets
           – Write Concerns
           – Read Preferences



Thursday, 15 November 12
Removed stuff




Thursday, 15 November 12
Pooling



     •   Bye bye!
     •   MongoPool::*()
     •   Mongo->poolDebug();
     •   Mongo->get/setPoolSize();

           – Replaced by one persistent connection per
                • host:port;replicaSetName;credentials;pid combo



                                                                   6

Thursday, 15 November 12
Deprecated



     •   Mongo->connectUtil()
     •   Mongo->get/setSlaveOkay()
     •   Mongo->last/prev/reset/forceError()
     •   Mongo->switchSlave()




                                               7

Thursday, 15 November 12
New stuff




Thursday, 15 November 12
MongoClient !!



     • Acknowledged writes by default! o/o/
     • No deprecated methods
       – Old Mongo class now extends MongoClient
         and adds back the old behaviour and
         methods




                                                   9

Thursday, 15 November 12
• $mongoCollection->aggregate()
     • $mongoCollection->findAndModify()
     • TTL Collections

                           $mongoCollection->ensureIndex(
                               array("dateField" => 1),
                               array("expireAfterSeconds" => 3600)
                           );




                                                                     10

Thursday, 15 November 12
Aggregation Framework




                $ops = array(
                    array(
                        '$project' => array(
                            "author" => 1,
                            "tags"   => 1,
                        )
                    ),
                    array('$unwind' => '$tags'),
                    array(
                        '$group' => array(
                            "_id" => array("tags" => '$tags'),
                            "authors" => array('$addToSet' => '$author'),
                        ),
                    ),
                );
                $results = $collection->aggregate($ops);




                                                                            11

Thursday, 15 November 12
New cool stuff



     • ReadPreferences
     • WriteConcerns
     • Connection handling




                                            12

Thursday, 15 November 12
What does the driver do?




                                           Its responsibilities
                                  Connection handling/failover




Thursday, 15 November 12
The Driver


     • Full C level client library, no external dependencies
        – Connection handling
        – Memory usage reported by PHP (almost)
        – Connection handling
        – MongoDB Wire protocol (OP_[CRUD], KILL_CURSOR)
        – Connection handling
        – Authentication
        – Connection handling
     • BSON serialization
     • Connection handling
     • Command wrappers/helpers
     • Connection handling
                                                               14

Thursday, 15 November 12
Replica Sets




                           Establishing connections




Thursday, 15 November 12
Replica Set – Configuration Options


      > conf = {
        _id : "mySet",
        members : [
           {_id : 0, host : "Node1”, tags : {"dc": "us"}},
           {_id : 1, host : "Node2", priority : 20, tags : {"dc": "is"}},
           {_id : 2, host : "Node3”, priority : 30, tags : {"dc": "is"}},
           {_id : 3, host : "Node4", hidden : true},
           {_id : 4, host : "Node5", hidden : true, slaveDelay : 3600}
         ]
      }

      > rs.initiate(conf)


Thursday, 15 November 12
Replica Set – Configuration Options


      > conf = {
        _id : "mySet",                                Primary DC

        members : [
           {_id : 0, host : "Node1”, tags : {"dc": "us"}},
           {_id : 1, host : "Node2", priority : 20, tags : {"dc": "is"}},
           {_id : 2, host : "Node3”, priority : 30, tags : {"dc": "is"}},
           {_id : 3, host : "Node4", hidden : true},
           {_id : 4, host : "Node5", hidden : true, slaveDelay : 3600}
         ]
      }

      > rs.initiate(conf)


Thursday, 15 November 12
Replica Set – Configuration Options


      > conf = {
                                                      Secondary DC
        _id : "mySet",
                                                      Default priority = 1
        members : [
           {_id : 0, host : "Node1”, tags : {"dc": "us"}},
           {_id : 1, host : "Node2", priority : 20, tags : {"dc": "is"}},
           {_id : 2, host : "Node3”, priority : 30, tags : {"dc": "is"}},
           {_id : 3, host : "Node4", hidden : true},
           {_id : 4, host : "Node5", hidden : true, slaveDelay : 3600}
         ]
      }

      > rs.initiate(conf)


Thursday, 15 November 12
Replica Set – Configuration Options


      > conf = {
        _id : "mySet",                                Analytics node
        members : [
           {_id : 0, host : "Node1”, tags : {"dc": "us"}},
           {_id : 1, host : "Node2", priority : 20, tags : {"dc": "is"}},
           {_id : 2, host : "Node3”, priority : 30, tags : {"dc": "is"}},
           {_id : 3, host : "Node4", hidden : true},
           {_id : 4, host : "Node5", hidden : true, slaveDelay : 3600}
         ]
      }

      > rs.initiate(conf)


Thursday, 15 November 12
Replica Set – Configuration Options


      > conf = {
        _id : "mySet",
        members : [
           {_id : 0, host : "Node1”, tags : {"dc": "us"}},
           {_id : 1, host : "Node2", priority : 20, tags : {"dc": "is"}},
           {_id : 2, host : "Node3”, priority : 30, tags : {"dc": "is"}},
           {_id : 3, host : "Node4", hidden : true},
           {_id : 4, host : "Node5", hidden : true, slaveDelay : 3600}
         ]
      }
                                                      Backup node

      > rs.initiate(conf)


Thursday, 15 November 12
Replica Set - Creation




                 Node 1                       Node 2




            Node 4               Node 3             Node 5




Thursday, 15 November 12
Replica Set - Initialize




                                   RS Init



                 Node 1                         Node 2




            Node 4                Node 3              Node 5




Thursday, 15 November 12
Replica Set - Initializing




                 Node 1                          Node 2
                                  Heartbeat
                                  Election



            Node 4                 Node 3               Node 5




Thursday, 15 November 12
Replica Set - Initialized




                Node 1                          Node 2
               Secondary                       Secondary



            Node 4                Node 3               Node 5
            (hidden)              Primary              (hidden)




Thursday, 15 November 12
Replica Set - Driver view



                                   Driver




                Node 1                          Node 2
               Secondary                       Secondary



                                   Node 3
                                   Primary




Thursday, 15 November 12
Connecting to Replica Set

             <?php
             $servers = "mongodb://Node1,Node3";
             $options = array(
                 "replicaSet" => "mySet",
             );
             $m = new MongoClient($servers, $options);
             ?>


               • Connect to Node1
                    – send `ismaster` then `ping`
               • Connect to Node3...
               • Topology discovery
                    – Match hostnames & Replica Set names
                    – Verify the seedlist
                    – Discover more nodes
                    – Connect to Node2...
                                                            26

Thursday, 15 November 12
Connections



     • Each unique connection string
                • host:port;replicaSetName;user/pass/db;pid
     • Once per process
     • Closed & Cleaned up during shutdown
           – Please don’t close connections manually :)




                                                              27

Thursday, 15 November 12
Read Preference




                                          Secondary reads
                           Prioritise servers / datacenters




Thursday, 15 November 12
Replica Set - Default only primary



                                    Driver




                Node 1                          Node 2
               Secondary                       Secondary



                                   Node 3
                                   Primary




Thursday, 15 November 12
Read Preferences


         • Only read from primary
         • Read from secondaries
         • Read from specific secondaries
         • Only read from secondaries when primary
           down
         • Don’t care, just the nearest one
         • Preferably node with a given tag


                                                     30

Thursday, 15 November 12
Read Preferences


         • Modes (readPreference)
             – primary, primaryPreferred
             – secondary, secondaryPreferred
             – nearest

         • Tag Sets (readPreferenceTags)
             – Uses Replica Set tags
             – Passed Tag is used to find matching members




                                                             31

Thursday, 15 November 12
Detecting failures / failovers



     • Runs `ping` every 5 seconds
         (mongo.ping_interval)

     • Runs `ismaster` every 60 seconds
         (mongo.is_master_interval)

     • Server/connection failure/force close
           –   rs.stepDown()
           –   service mongod stop
           –   Query failure
           –   ...

                                                            32

Thursday, 15 November 12
Read Preference
                                      +
                                  Failovers



                              No primary available




Thursday, 15 November 12
Replica Set - all well



                                 Driver




                Node 1                         Node 2
               Secondary                      Secondary



                                 Node 3
                                 Primary




Thursday, 15 November 12
Replica Set



                            Driver




                Node 1                    Node 2
               Secondary                 Secondary



                            Node 3
                            Primary




Thursday, 15 November 12
Read Preferences


          <?php
          $servers = "mongodb://Node1,Node2,Node3";
          $options = array(
              "replicaSet"         => "mySet",
              "readPreference"     => "primaryPreferred",
              "readPreferenceTagS" => "dc:is",
          );
          $m = new MongoClient($servers, $options);
          ?>


     • Read from Primary if available
         • Otherwise from a secondary in Iceland


                                                            36

Thursday, 15 November 12
WriteConcerns




                           How much do you love your data?
                             (not actually new, but still cool)




Thursday, 15 November 12
Write Preference



     • Unacknowledged (w=0)
     • Acknowledged (w=1)
     • Wait for replication (w=2+)
     • Wait for replication to tagset (w=string)
     • Wait for journal sync (j=1)




Thursday, 15 November 12
Write Preference



              <?php

              $examples = $mongo->test->example;
              $data = array("Hello" => "World");
              $examples->insert($data, array("w" => 2));
              $examples->insert($data, array("w" => "is"));

              ?>




       • w=majority
         • (replicate to the majority of the RS)


Thursday, 15 November 12
New Connection handling
                           Read Preferences
                Acknowledged writes by default

                            RC2 released last Monday...
                            RC3 this coming Monday...
                            Final .. 2weeks?




Thursday, 15 November 12
download at mongodb.org
                                   We’re Hiring !
                                 bjori@10gen.com   @bjori



                conferences, appearances, and meetups
                            http://www.10gen.com/events



            Facebook |                 Twitter       | LinkedIn
         http://bit.ly/mongofb        @mongodb      http://linkd.in/joinmongo




Thursday, 15 November 12

More Related Content

What's hot

Redis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPRedis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPChen Huang
 
Replication and Replica Sets
Replication and Replica SetsReplication and Replica Sets
Replication and Replica SetsMongoDB
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know Norberto Leite
 
Riak at The NYC Cloud Computing Meetup Group
Riak at The NYC Cloud Computing Meetup GroupRiak at The NYC Cloud Computing Meetup Group
Riak at The NYC Cloud Computing Meetup Groupsiculars
 
Kickin' Ass with Cache-Fu (without notes)
Kickin' Ass with Cache-Fu (without notes)Kickin' Ass with Cache-Fu (without notes)
Kickin' Ass with Cache-Fu (without notes)err
 
Morphia: Simplifying Persistence for Java and MongoDB
Morphia:  Simplifying Persistence for Java and MongoDBMorphia:  Simplifying Persistence for Java and MongoDB
Morphia: Simplifying Persistence for Java and MongoDBJeff Yemin
 
Kickin' Ass with Cache-Fu (with notes)
Kickin' Ass with Cache-Fu (with notes)Kickin' Ass with Cache-Fu (with notes)
Kickin' Ass with Cache-Fu (with notes)err
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redisDvir Volk
 
Redis SoCraTes 2014
Redis SoCraTes 2014Redis SoCraTes 2014
Redis SoCraTes 2014steffenbauer
 
MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用iammutex
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialWim Godden
 
Distributed systems at ok.ru #rigadevday
Distributed systems at ok.ru #rigadevdayDistributed systems at ok.ru #rigadevday
Distributed systems at ok.ru #rigadevdayodnoklassniki.ru
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeWim Godden
 
groovy rules
groovy rulesgroovy rules
groovy rulesPaul King
 
Gpu programming with java
Gpu programming with javaGpu programming with java
Gpu programming with javaGary Sieling
 

What's hot (20)

Redis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPRedis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHP
 
Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
 
Replication and Replica Sets
Replication and Replica SetsReplication and Replica Sets
Replication and Replica Sets
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know
 
Django cryptography
Django cryptographyDjango cryptography
Django cryptography
 
Riak at The NYC Cloud Computing Meetup Group
Riak at The NYC Cloud Computing Meetup GroupRiak at The NYC Cloud Computing Meetup Group
Riak at The NYC Cloud Computing Meetup Group
 
Kickin' Ass with Cache-Fu (without notes)
Kickin' Ass with Cache-Fu (without notes)Kickin' Ass with Cache-Fu (without notes)
Kickin' Ass with Cache-Fu (without notes)
 
Morphia: Simplifying Persistence for Java and MongoDB
Morphia:  Simplifying Persistence for Java and MongoDBMorphia:  Simplifying Persistence for Java and MongoDB
Morphia: Simplifying Persistence for Java and MongoDB
 
Kickin' Ass with Cache-Fu (with notes)
Kickin' Ass with Cache-Fu (with notes)Kickin' Ass with Cache-Fu (with notes)
Kickin' Ass with Cache-Fu (with notes)
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
 
Redis SoCraTes 2014
Redis SoCraTes 2014Redis SoCraTes 2014
Redis SoCraTes 2014
 
Redis basics
Redis basicsRedis basics
Redis basics
 
MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorial
 
Distributed systems at ok.ru #rigadevday
Distributed systems at ok.ru #rigadevdayDistributed systems at ok.ru #rigadevday
Distributed systems at ok.ru #rigadevday
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
 
groovy rules
groovy rulesgroovy rules
groovy rules
 
Gpu programming with java
Gpu programming with javaGpu programming with java
Gpu programming with java
 

Similar to What's New in the PHP Driver

Use Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB GuruUse Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB GuruTim Callaghan
 
2013 london advanced-replication
2013 london advanced-replication2013 london advanced-replication
2013 london advanced-replicationMarc Schwering
 
Replication
ReplicationReplication
ReplicationMongoDB
 
Replication MongoDB Days 2013
Replication MongoDB Days 2013Replication MongoDB Days 2013
Replication MongoDB Days 2013Randall Hunt
 
Advanced Replication
Advanced ReplicationAdvanced Replication
Advanced ReplicationMongoDB
 
Replication and Replica Sets
Replication and Replica SetsReplication and Replica Sets
Replication and Replica SetsMongoDB
 
MongoSV Schema Workshop
MongoSV Schema WorkshopMongoSV Schema Workshop
MongoSV Schema WorkshopMongoDB
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Rajmahendra Hegde
 
Mongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeMongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeSpyros Passas
 
NoSQL Infrastructure - Late 2013
NoSQL Infrastructure - Late 2013NoSQL Infrastructure - Late 2013
NoSQL Infrastructure - Late 2013Server Density
 
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...MongoDB
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsagniklal
 
Webinar: Replication and Replica Sets
Webinar: Replication and Replica SetsWebinar: Replication and Replica Sets
Webinar: Replication and Replica SetsMongoDB
 
Redis the better NoSQL
Redis the better NoSQLRedis the better NoSQL
Redis the better NoSQLOpenFest team
 
Deploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard WayDeploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard WayAsko Soukka
 

Similar to What's New in the PHP Driver (20)

Use Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB GuruUse Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB Guru
 
2013 london advanced-replication
2013 london advanced-replication2013 london advanced-replication
2013 london advanced-replication
 
Replication
ReplicationReplication
Replication
 
Replication MongoDB Days 2013
Replication MongoDB Days 2013Replication MongoDB Days 2013
Replication MongoDB Days 2013
 
Advanced Replication
Advanced ReplicationAdvanced Replication
Advanced Replication
 
Replication and Replica Sets
Replication and Replica SetsReplication and Replica Sets
Replication and Replica Sets
 
MongoSV Schema Workshop
MongoSV Schema WorkshopMongoSV Schema Workshop
MongoSV Schema Workshop
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
Mongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeMongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappe
 
NoSQL Infrastructure - Late 2013
NoSQL Infrastructure - Late 2013NoSQL Infrastructure - Late 2013
NoSQL Infrastructure - Late 2013
 
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
 
Latinoware
LatinowareLatinoware
Latinoware
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsag
 
Webinar: Replication and Replica Sets
Webinar: Replication and Replica SetsWebinar: Replication and Replica Sets
Webinar: Replication and Replica Sets
 
Redis the better NoSQL
Redis the better NoSQLRedis the better NoSQL
Redis the better NoSQL
 
About Data::ObjectDriver
About Data::ObjectDriverAbout Data::ObjectDriver
About Data::ObjectDriver
 
Deploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard WayDeploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard Way
 
veracruz
veracruzveracruz
veracruz
 
veracruz
veracruzveracruz
veracruz
 
veracruz
veracruzveracruz
veracruz
 

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...
 

Recently uploaded

Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Product School
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...Product School
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaRTTS
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backElena Simperl
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Thierry Lestable
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...Elena Simperl
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Product School
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 

Recently uploaded (20)

Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 

What's New in the PHP Driver

  • 1. What’s new in the PHP Driver (1.3.0) Hannes Magnusson, 10gen bjori@10gen.com @bjori November 15th, 2012 Thursday, 15 November 12
  • 2. About me • Hannes / @bjori • Icelandic – Oslo, Norway – London, England – San Francisco, USA • PHP Contributor • PHP Driver Engineer » @10gen 3 Thursday, 15 November 12
  • 3. Agenda • Removed not-so-cool stuff • New cool stuff • Connection handling / Replica Sets – Write Concerns – Read Preferences Thursday, 15 November 12
  • 5. Pooling • Bye bye! • MongoPool::*() • Mongo->poolDebug(); • Mongo->get/setPoolSize(); – Replaced by one persistent connection per • host:port;replicaSetName;credentials;pid combo 6 Thursday, 15 November 12
  • 6. Deprecated • Mongo->connectUtil() • Mongo->get/setSlaveOkay() • Mongo->last/prev/reset/forceError() • Mongo->switchSlave() 7 Thursday, 15 November 12
  • 8. MongoClient !! • Acknowledged writes by default! o/o/ • No deprecated methods – Old Mongo class now extends MongoClient and adds back the old behaviour and methods 9 Thursday, 15 November 12
  • 9. • $mongoCollection->aggregate() • $mongoCollection->findAndModify() • TTL Collections $mongoCollection->ensureIndex( array("dateField" => 1), array("expireAfterSeconds" => 3600) ); 10 Thursday, 15 November 12
  • 10. Aggregation Framework $ops = array(     array(         '$project' => array(             "author" => 1,             "tags"   => 1,         )     ),     array('$unwind' => '$tags'),     array(         '$group' => array(             "_id" => array("tags" => '$tags'),             "authors" => array('$addToSet' => '$author'),         ),     ), ); $results = $collection->aggregate($ops); 11 Thursday, 15 November 12
  • 11. New cool stuff • ReadPreferences • WriteConcerns • Connection handling 12 Thursday, 15 November 12
  • 12. What does the driver do? Its responsibilities Connection handling/failover Thursday, 15 November 12
  • 13. The Driver • Full C level client library, no external dependencies – Connection handling – Memory usage reported by PHP (almost) – Connection handling – MongoDB Wire protocol (OP_[CRUD], KILL_CURSOR) – Connection handling – Authentication – Connection handling • BSON serialization • Connection handling • Command wrappers/helpers • Connection handling 14 Thursday, 15 November 12
  • 14. Replica Sets Establishing connections Thursday, 15 November 12
  • 15. Replica Set – Configuration Options > conf = { _id : "mySet", members : [ {_id : 0, host : "Node1”, tags : {"dc": "us"}}, {_id : 1, host : "Node2", priority : 20, tags : {"dc": "is"}}, {_id : 2, host : "Node3”, priority : 30, tags : {"dc": "is"}}, {_id : 3, host : "Node4", hidden : true}, {_id : 4, host : "Node5", hidden : true, slaveDelay : 3600} ] } > rs.initiate(conf) Thursday, 15 November 12
  • 16. Replica Set – Configuration Options > conf = { _id : "mySet", Primary DC members : [ {_id : 0, host : "Node1”, tags : {"dc": "us"}}, {_id : 1, host : "Node2", priority : 20, tags : {"dc": "is"}}, {_id : 2, host : "Node3”, priority : 30, tags : {"dc": "is"}}, {_id : 3, host : "Node4", hidden : true}, {_id : 4, host : "Node5", hidden : true, slaveDelay : 3600} ] } > rs.initiate(conf) Thursday, 15 November 12
  • 17. Replica Set – Configuration Options > conf = { Secondary DC _id : "mySet", Default priority = 1 members : [ {_id : 0, host : "Node1”, tags : {"dc": "us"}}, {_id : 1, host : "Node2", priority : 20, tags : {"dc": "is"}}, {_id : 2, host : "Node3”, priority : 30, tags : {"dc": "is"}}, {_id : 3, host : "Node4", hidden : true}, {_id : 4, host : "Node5", hidden : true, slaveDelay : 3600} ] } > rs.initiate(conf) Thursday, 15 November 12
  • 18. Replica Set – Configuration Options > conf = { _id : "mySet", Analytics node members : [ {_id : 0, host : "Node1”, tags : {"dc": "us"}}, {_id : 1, host : "Node2", priority : 20, tags : {"dc": "is"}}, {_id : 2, host : "Node3”, priority : 30, tags : {"dc": "is"}}, {_id : 3, host : "Node4", hidden : true}, {_id : 4, host : "Node5", hidden : true, slaveDelay : 3600} ] } > rs.initiate(conf) Thursday, 15 November 12
  • 19. Replica Set – Configuration Options > conf = { _id : "mySet", members : [ {_id : 0, host : "Node1”, tags : {"dc": "us"}}, {_id : 1, host : "Node2", priority : 20, tags : {"dc": "is"}}, {_id : 2, host : "Node3”, priority : 30, tags : {"dc": "is"}}, {_id : 3, host : "Node4", hidden : true}, {_id : 4, host : "Node5", hidden : true, slaveDelay : 3600} ] } Backup node > rs.initiate(conf) Thursday, 15 November 12
  • 20. Replica Set - Creation Node 1 Node 2 Node 4 Node 3 Node 5 Thursday, 15 November 12
  • 21. Replica Set - Initialize RS Init Node 1 Node 2 Node 4 Node 3 Node 5 Thursday, 15 November 12
  • 22. Replica Set - Initializing Node 1 Node 2 Heartbeat Election Node 4 Node 3 Node 5 Thursday, 15 November 12
  • 23. Replica Set - Initialized Node 1 Node 2 Secondary Secondary Node 4 Node 3 Node 5 (hidden) Primary (hidden) Thursday, 15 November 12
  • 24. Replica Set - Driver view Driver Node 1 Node 2 Secondary Secondary Node 3 Primary Thursday, 15 November 12
  • 25. Connecting to Replica Set <?php $servers = "mongodb://Node1,Node3"; $options = array( "replicaSet" => "mySet", ); $m = new MongoClient($servers, $options); ?> • Connect to Node1 – send `ismaster` then `ping` • Connect to Node3... • Topology discovery – Match hostnames & Replica Set names – Verify the seedlist – Discover more nodes – Connect to Node2... 26 Thursday, 15 November 12
  • 26. Connections • Each unique connection string • host:port;replicaSetName;user/pass/db;pid • Once per process • Closed & Cleaned up during shutdown – Please don’t close connections manually :) 27 Thursday, 15 November 12
  • 27. Read Preference Secondary reads Prioritise servers / datacenters Thursday, 15 November 12
  • 28. Replica Set - Default only primary Driver Node 1 Node 2 Secondary Secondary Node 3 Primary Thursday, 15 November 12
  • 29. Read Preferences • Only read from primary • Read from secondaries • Read from specific secondaries • Only read from secondaries when primary down • Don’t care, just the nearest one • Preferably node with a given tag 30 Thursday, 15 November 12
  • 30. Read Preferences • Modes (readPreference) – primary, primaryPreferred – secondary, secondaryPreferred – nearest • Tag Sets (readPreferenceTags) – Uses Replica Set tags – Passed Tag is used to find matching members 31 Thursday, 15 November 12
  • 31. Detecting failures / failovers • Runs `ping` every 5 seconds (mongo.ping_interval) • Runs `ismaster` every 60 seconds (mongo.is_master_interval) • Server/connection failure/force close – rs.stepDown() – service mongod stop – Query failure – ... 32 Thursday, 15 November 12
  • 32. Read Preference + Failovers No primary available Thursday, 15 November 12
  • 33. Replica Set - all well Driver Node 1 Node 2 Secondary Secondary Node 3 Primary Thursday, 15 November 12
  • 34. Replica Set Driver Node 1 Node 2 Secondary Secondary Node 3 Primary Thursday, 15 November 12
  • 35. Read Preferences <?php $servers = "mongodb://Node1,Node2,Node3"; $options = array( "replicaSet" => "mySet", "readPreference" => "primaryPreferred", "readPreferenceTagS" => "dc:is", ); $m = new MongoClient($servers, $options); ?> • Read from Primary if available • Otherwise from a secondary in Iceland 36 Thursday, 15 November 12
  • 36. WriteConcerns How much do you love your data? (not actually new, but still cool) Thursday, 15 November 12
  • 37. Write Preference • Unacknowledged (w=0) • Acknowledged (w=1) • Wait for replication (w=2+) • Wait for replication to tagset (w=string) • Wait for journal sync (j=1) Thursday, 15 November 12
  • 38. Write Preference <?php $examples = $mongo->test->example; $data = array("Hello" => "World"); $examples->insert($data, array("w" => 2)); $examples->insert($data, array("w" => "is")); ?> • w=majority • (replicate to the majority of the RS) Thursday, 15 November 12
  • 39. New Connection handling Read Preferences Acknowledged writes by default RC2 released last Monday... RC3 this coming Monday... Final .. 2weeks? Thursday, 15 November 12
  • 40. download at mongodb.org We’re Hiring ! bjori@10gen.com @bjori conferences, appearances, and meetups http://www.10gen.com/events Facebook | Twitter | LinkedIn http://bit.ly/mongofb @mongodb http://linkd.in/joinmongo Thursday, 15 November 12