SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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
 

Mais de 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
 

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

Último

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Último (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

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