SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Drupal + Mongo: Bigger  is Better? A  lightning  talk by Forest Mars
Drupal (FTW!) Drupal: Aspect-oriented (modular) “social-publishing” framework, written in php (pdo) that allows easy creation and integration of multiple data-rich social networking sites and robust web applications & services.  Used on large high-performance websites. Roadmap anticipates future web (rdf, ggg) & emerging technologies (MongoDB!)
The Problem with SQL* Webapps > Once you have related data, you need joins > Indexing on joins does not work that well ...So you:  >  Introduce denormalisation >  Build extra tables *(RDBMS)
The Problem with Schema > Changes broadly lock data, requiring downtime or putting excessive, short-term load on the system. > The data integrity constraints don’t quite support application integrity constraints. For example, there’s no standard way in SQL to require a column to contain only valid URLs. > Coordinating schema changes with application code changes is difficult, largely because schema changes lack convenient coupling with code.
“ In theory, theory in practice are exactly the same.   In practice, they're completely different.” Practice WiP (works in practice) Scales well Future-proof Theory Clean abstractions Strong semantics Smart-proof
A C I D  /  B A S E Base Basically Available Scales well Eventually consistant Acid Atomic Consistent Isolated Durable
( Why Mongo ?)  Highly Available Easily Scalable Partition Tolerant
( Why Mongo ?)  Tableless Queriless Schemaless  Blazingly fast Faster Development times  Nicer learning curves  Code is trimmer  Future-proof
Performance / Scaling Whitehouse.gov / direct engagement 15K/day contact requests 2M records in db  4GB db: replication risks MongoDB:  180M+ documents in 1 collection
Writing Performant Queries Sort column must be the last column used in the index.  Range query must also be the last column in an index,  Only use a range query or sort on one column.  Conserve indexes by re-ordering columns used in straight = queries  Never use Mongo's $ne or $nin operator's  Never use Mongo's $exists operator  http://jira.mongodb.org/browse/WEBSITE-12
Install Mongo public array authenticate  (string $username,  string $password ) public array command ( array $data ) __construct ( Mongo $conn , string $name ) public MongoCollection createCollection ( string $name [, bool $capped = FALSE [, int $size = 0 [, int $max = 0 ]]] ) public array createDBRef ( string $collection , mixed $a ) public array drop ( void ) public array dropCollection ( mixed $coll ) public array execute ( mixed $code [, array $args = array() ] ) public bool forceError ( void ) public MongoCollection __get ( string $name ) public array getDBRef ( array $ref ) public MongoGridFS getGridFS ([ string $prefix = "fs" ] ) public int getProfilingLevel ( void ) public array lastError ( void ) public array listCollections ( void ) public array prevError ( void ) public array repair ([ bool $preserve_cloned_files = FALSE [, bool $backup_original_files = FALSE ]] ) public array resetError ( void ) public MongoCollection selectCollection ( string $name ) public int setProfilingLevel ( int $level ) public string __toString ( void )
Real World Example list the nodes of a user ordered by comment count uid is stored in the node table and the comment count is in node_comment_statistics > thus query cannot be indexed (Comparison of dissimilar columns may prevent use of indexes if values cannot be compared directly without conversion.)
What's already in Drupal *  mongodb: support library for the other modules (D7/D6) *  mongodb_block: Store block information in mongodb.  Very close to the core block API. *  mongodb_cache: Store cache items in mongodb. *  mongodb_session: Store sessions in mongodb. *  mongodb_watchdog: Store watchdog messages in mongodb *  mongodb_queue: DrupalQueueInterface implementation using mongodb. *  mongodb_field_storage: Store the fields in mongodb.
Mongo Watchdog
mongodb_watchdog mongo> db.watchdog.drop(); mongo> db.createCollection("watchdog", {capped:true, size:1000000, max:10000} );
"It's really incredible how much you don't have to do."  -chx
mongodb_cache $conf['page_cache_without_database'] = TRUE;
mongodb_sessions $conf['session_inc'] = 'sites/all/modules/mongodb/ mongodb_session/mongodb_session.inc';
mongodb_sessions function mongodb_session_user_update($edit, $account) { if (!module_exists('mongodb_field_storage')) { $roles = _mongodb_session_get_roles($account); $save = (array) $account + array( '_id' => (int) $account->uid, '@bundle' => 'user', '@fields' => array(), 'roles' => $roles, ); foreach (array('uid', 'created', 'access', 'login', 'status', 'picture') as $key) { $save[$key] = (int) $save[$key]; } mongodb_collection('fields_current', 'user')->save($save); } return $roles; }
mongodb_sessions * The user-level session storage handlers: * - _drupal_session_open() * - _drupal_session_close() * - _drupal_session_read() * - _drupal_session_write() * - _drupal_session_destroy() * - _drupal_session_garbage_collection() are assigned by session_set_save_handler() in bootstrap.inc
mongodb_block function hook_block_view_alter(&$data, $block) { // Remove the contextual links on all blocks that provide them. if (is_array($data['content']) && isset($data['content']['#contextual_links'])) { unset($data['content']['#contextual_links']); } // Add a theme wrapper function defined by the current module to all blocks // provided by the "somemodule" module. if (is_array($data['content']) && $block->module == 'somemodule') { $data['content']['#theme_wrappers'][] = 'mymodule_special_block'; } }
Block rebuild Notice :  Undefined variable: block_html_id  in  include()  (line  4  of  /var/www/Drupal/drupal-7.0-alpha4/themes/garland/block.tpl.php ). Notice :  Undefined variable: block_html_id  in  include()  (line  4  of  /var/www/Drupal/drupal-7.0-alpha4/themes/garland/block.tpl.php ). Notice :  Undefined variable: block_html_id  in  include()  (line  4  of  /var/www/Drupal/drupal-7.0-alpha4/themes/garland/block.tpl.php ). Notice :  Undefined variable: block_html_id  in  include()  (line  4  of  /var/www/Drupal/drupal-7.0-alpha4/themes/garland/block.tpl.php ). Notice :  Undefined variable: block_html_id  in  include()  (line  4  of  /var/www/Drupal/drupal-7.0-alpha4/themes/garland/block.tpl.php ).
Render main content block function mongodb_block_theme() { 'block' => array( 'render element' => 'elements', 'template' => 'block', 'path' => drupal_get_path('module', 'block'),  ),  } function mongodb_block_mongodb_block_info_alter(&$blocks) { // Enable the main content block. $blocks['system_main']['region'] = 'content'; $blocks['system_main']['weight'] = 0; $blocks['system_main']['status'] = 1;  } function mongodb_block_rehash($redirect = FALSE) { $collection = mongodb_collection('block'); $theme = variable_get('theme_default', 'garland');
mongodb_field_storage don't :   variable_set('field_storage_default', 'mongodb_field_storage'); instead : $conf['field_storage_default'] = 'mongodb_field_storage'; in settings.php ESP. for session/caching backends
Drupal 7 Everything In MongoDB
Import all Nodes > MongoDB* (* in 14 l.o.c.) // Connect $mongo = new Mongo(); // Get the database (it is created automatically) $db = $mongo->testDatabase; // Get the collection for nodes (it is created automatically) $collection = $db->nodes; // Get a listing of all of the node IDs $r = db_query('SELECT nid FROM {node}'); // Loop through all of the nodes... while($row = db_fetch_object($r)) { print "Writing node $row->nid"; // Load each node and convert it to an array. $node = (array)node_load($row->nid); // Store the node in MongoDB $collection->save($node); }
Import all Nodes > MongoDB* (* in 14 l.o.c.) # drush script mongoimport.php # use testDatabase; # db.nodes.find( {title: /about/i} , {title: true}).limit(4);
Import all Nodes > MongoDB* (* in 14 l.o.c.) <?php // Connect $mongo = new Mongo(); // Write our search filter (same as shell example above) $filter = array( 'title' => new MongoRegex('/about/i'), ); // Run the query, getting only 5 results. $res = $mongo->quiddity->nodes->find($filter)->limit(5); // Loop through and print the title of each article. foreach ($res as $row) { print $row['title'] . PHP_EOL; } ?>
What's Next? Multiple DB servers – Data Persistance Query logging - Devel support Query builder – Views integration DBTNG – Full DB Abstraction  MongoDB API
Query Logging Extend Mongo collection class Pass instance back from mongodb_collection Implement all collection methods
Drupal Mongo API  $collection = mongodb_collection('myname'); $collection->find(array('key' => $value)); $collection->insert($object); $collection->remove(array('_id' => $item->id));
Full DBTNG Impementation  DO NOT USE !!!
awesomesauce page callback => 'drupal_json' $items['node/%node/json']  = array('page callback'  => 'drupal_json', 'page arguments'  => array(1), 'type'  => MENU_CALLBACK);
Where Mongo Won't Work Ex. list nodes belonging to users whose usernames starts with 'Ab'
Thanks! Comments & questions to:  ForestMars @gmail.com ForestMars @googlewave.com Facebook, LinkedIn, etc.  twitter: @elvetica (identica@forest)

Weitere ähnliche Inhalte

Was ist angesagt?

mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introductionTse-Ching Ho
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBTobias Trelle
 
Elastic Search Training#1 (brief tutorial)-ESCC#1
Elastic Search Training#1 (brief tutorial)-ESCC#1Elastic Search Training#1 (brief tutorial)-ESCC#1
Elastic Search Training#1 (brief tutorial)-ESCC#1medcl
 
MongoDB + Java + Spring Data
MongoDB + Java + Spring DataMongoDB + Java + Spring Data
MongoDB + Java + Spring DataAnton Sulzhenko
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDBDavid Coallier
 
MongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB
 
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right Way
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right WayMongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right Way
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right WayMongoDB
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMJonathan Wage
 
Introduction to couch_db
Introduction to couch_dbIntroduction to couch_db
Introduction to couch_dbRomain Testard
 
Storing tree structures with MongoDB
Storing tree structures with MongoDBStoring tree structures with MongoDB
Storing tree structures with MongoDBVyacheslav
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperJonathan Wage
 
Morphia, Spring Data & Co.
Morphia, Spring Data & Co.Morphia, Spring Data & Co.
Morphia, Spring Data & Co.Tobias Trelle
 
Symfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMSymfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMJonathan Wage
 
Map/Confused? A practical approach to Map/Reduce with MongoDB
Map/Confused? A practical approach to Map/Reduce with MongoDBMap/Confused? A practical approach to Map/Reduce with MongoDB
Map/Confused? A practical approach to Map/Reduce with MongoDBUwe Printz
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 

Was ist angesagt? (19)

mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introduction
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
Elastic Search Training#1 (brief tutorial)-ESCC#1
Elastic Search Training#1 (brief tutorial)-ESCC#1Elastic Search Training#1 (brief tutorial)-ESCC#1
Elastic Search Training#1 (brief tutorial)-ESCC#1
 
MongoDB + Java + Spring Data
MongoDB + Java + Spring DataMongoDB + Java + Spring Data
MongoDB + Java + Spring Data
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDB
 
MongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB Performance
 
Doctrine for NoSQL
Doctrine for NoSQLDoctrine for NoSQL
Doctrine for NoSQL
 
Doctrine and NoSQL
Doctrine and NoSQLDoctrine and NoSQL
Doctrine and NoSQL
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
 
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right Way
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right WayMongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right Way
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right Way
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODM
 
Introduction to couch_db
Introduction to couch_dbIntroduction to couch_db
Introduction to couch_db
 
Storing tree structures with MongoDB
Storing tree structures with MongoDBStoring tree structures with MongoDB
Storing tree structures with MongoDB
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document Mapper
 
Morphia, Spring Data & Co.
Morphia, Spring Data & Co.Morphia, Spring Data & Co.
Morphia, Spring Data & Co.
 
Symfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMSymfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODM
 
Map/Confused? A practical approach to Map/Reduce with MongoDB
Map/Confused? A practical approach to Map/Reduce with MongoDBMap/Confused? A practical approach to Map/Reduce with MongoDB
Map/Confused? A practical approach to Map/Reduce with MongoDB
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 

Ähnlich wie This upload requires better support for ODP format

Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardArchitecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardJAX London
 
Agile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansAgile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansCarol McDonald
 
Java Development with MongoDB (James Williams)
Java Development with MongoDB (James Williams)Java Development with MongoDB (James Williams)
Java Development with MongoDB (James Williams)MongoSF
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Murat Yener
 
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Guillaume Laforge
 
Intro To Mongo Db
Intro To Mongo DbIntro To Mongo Db
Intro To Mongo Dbchriskite
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's CodeWildan Maulana
 
Spring Data MongoDB 介紹
Spring Data MongoDB 介紹Spring Data MongoDB 介紹
Spring Data MongoDB 介紹Kuo-Chun Su
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRick Copeland
 
The Power of Rails 2.3 Engines & Templates
The Power of Rails 2.3 Engines & TemplatesThe Power of Rails 2.3 Engines & Templates
The Power of Rails 2.3 Engines & TemplatesTse-Ching Ho
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalystdwm042
 
Compass Framework
Compass FrameworkCompass Framework
Compass FrameworkLukas Vlcek
 
Getting started with MongoDB and Scala - Open Source Bridge 2012
Getting started with MongoDB and Scala - Open Source Bridge 2012Getting started with MongoDB and Scala - Open Source Bridge 2012
Getting started with MongoDB and Scala - Open Source Bridge 2012sullis
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentationipolevoy
 
Tips of CakePHP and MongoDB - Cakefest2011 ichikaway
Tips of CakePHP and MongoDB - Cakefest2011 ichikaway Tips of CakePHP and MongoDB - Cakefest2011 ichikaway
Tips of CakePHP and MongoDB - Cakefest2011 ichikaway ichikaway
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)MongoDB
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplicationolegmmiller
 

Ähnlich wie This upload requires better support for ODP format (20)

Mongo-Drupal
Mongo-DrupalMongo-Drupal
Mongo-Drupal
 
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardArchitecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
 
Agile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansAgile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with Netbeans
 
Java Development with MongoDB (James Williams)
Java Development with MongoDB (James Williams)Java Development with MongoDB (James Williams)
Java Development with MongoDB (James Williams)
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15
 
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
 
Intro To Mongo Db
Intro To Mongo DbIntro To Mongo Db
Intro To Mongo Db
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 
Spring Data MongoDB 介紹
Spring Data MongoDB 介紹Spring Data MongoDB 介紹
Spring Data MongoDB 介紹
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
 
The Power of Rails 2.3 Engines & Templates
The Power of Rails 2.3 Engines & TemplatesThe Power of Rails 2.3 Engines & Templates
The Power of Rails 2.3 Engines & Templates
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Compass Framework
Compass FrameworkCompass Framework
Compass Framework
 
Getting started with MongoDB and Scala - Open Source Bridge 2012
Getting started with MongoDB and Scala - Open Source Bridge 2012Getting started with MongoDB and Scala - Open Source Bridge 2012
Getting started with MongoDB and Scala - Open Source Bridge 2012
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Tips of CakePHP and MongoDB - Cakefest2011 ichikaway
Tips of CakePHP and MongoDB - Cakefest2011 ichikaway Tips of CakePHP and MongoDB - Cakefest2011 ichikaway
Tips of CakePHP and MongoDB - Cakefest2011 ichikaway
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
MongoDB-presentation.pptx
MongoDB-presentation.pptxMongoDB-presentation.pptx
MongoDB-presentation.pptx
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 

Kürzlich hochgeladen

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 

Kürzlich hochgeladen (20)

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 

This upload requires better support for ODP format

  • 1. Drupal + Mongo: Bigger is Better? A lightning talk by Forest Mars
  • 2. Drupal (FTW!) Drupal: Aspect-oriented (modular) “social-publishing” framework, written in php (pdo) that allows easy creation and integration of multiple data-rich social networking sites and robust web applications & services. Used on large high-performance websites. Roadmap anticipates future web (rdf, ggg) & emerging technologies (MongoDB!)
  • 3. The Problem with SQL* Webapps > Once you have related data, you need joins > Indexing on joins does not work that well ...So you: > Introduce denormalisation > Build extra tables *(RDBMS)
  • 4. The Problem with Schema > Changes broadly lock data, requiring downtime or putting excessive, short-term load on the system. > The data integrity constraints don’t quite support application integrity constraints. For example, there’s no standard way in SQL to require a column to contain only valid URLs. > Coordinating schema changes with application code changes is difficult, largely because schema changes lack convenient coupling with code.
  • 5. “ In theory, theory in practice are exactly the same. In practice, they're completely different.” Practice WiP (works in practice) Scales well Future-proof Theory Clean abstractions Strong semantics Smart-proof
  • 6. A C I D / B A S E Base Basically Available Scales well Eventually consistant Acid Atomic Consistent Isolated Durable
  • 7. ( Why Mongo ?) Highly Available Easily Scalable Partition Tolerant
  • 8. ( Why Mongo ?) Tableless Queriless Schemaless Blazingly fast Faster Development times Nicer learning curves Code is trimmer Future-proof
  • 9. Performance / Scaling Whitehouse.gov / direct engagement 15K/day contact requests 2M records in db 4GB db: replication risks MongoDB: 180M+ documents in 1 collection
  • 10. Writing Performant Queries Sort column must be the last column used in the index. Range query must also be the last column in an index, Only use a range query or sort on one column. Conserve indexes by re-ordering columns used in straight = queries Never use Mongo's $ne or $nin operator's Never use Mongo's $exists operator http://jira.mongodb.org/browse/WEBSITE-12
  • 11. Install Mongo public array authenticate (string $username, string $password ) public array command ( array $data ) __construct ( Mongo $conn , string $name ) public MongoCollection createCollection ( string $name [, bool $capped = FALSE [, int $size = 0 [, int $max = 0 ]]] ) public array createDBRef ( string $collection , mixed $a ) public array drop ( void ) public array dropCollection ( mixed $coll ) public array execute ( mixed $code [, array $args = array() ] ) public bool forceError ( void ) public MongoCollection __get ( string $name ) public array getDBRef ( array $ref ) public MongoGridFS getGridFS ([ string $prefix = &quot;fs&quot; ] ) public int getProfilingLevel ( void ) public array lastError ( void ) public array listCollections ( void ) public array prevError ( void ) public array repair ([ bool $preserve_cloned_files = FALSE [, bool $backup_original_files = FALSE ]] ) public array resetError ( void ) public MongoCollection selectCollection ( string $name ) public int setProfilingLevel ( int $level ) public string __toString ( void )
  • 12. Real World Example list the nodes of a user ordered by comment count uid is stored in the node table and the comment count is in node_comment_statistics > thus query cannot be indexed (Comparison of dissimilar columns may prevent use of indexes if values cannot be compared directly without conversion.)
  • 13. What's already in Drupal * mongodb: support library for the other modules (D7/D6) * mongodb_block: Store block information in mongodb. Very close to the core block API. * mongodb_cache: Store cache items in mongodb. * mongodb_session: Store sessions in mongodb. * mongodb_watchdog: Store watchdog messages in mongodb * mongodb_queue: DrupalQueueInterface implementation using mongodb. * mongodb_field_storage: Store the fields in mongodb.
  • 15. mongodb_watchdog mongo> db.watchdog.drop(); mongo> db.createCollection(&quot;watchdog&quot;, {capped:true, size:1000000, max:10000} );
  • 16. &quot;It's really incredible how much you don't have to do.&quot; -chx
  • 18. mongodb_sessions $conf['session_inc'] = 'sites/all/modules/mongodb/ mongodb_session/mongodb_session.inc';
  • 19. mongodb_sessions function mongodb_session_user_update($edit, $account) { if (!module_exists('mongodb_field_storage')) { $roles = _mongodb_session_get_roles($account); $save = (array) $account + array( '_id' => (int) $account->uid, '@bundle' => 'user', '@fields' => array(), 'roles' => $roles, ); foreach (array('uid', 'created', 'access', 'login', 'status', 'picture') as $key) { $save[$key] = (int) $save[$key]; } mongodb_collection('fields_current', 'user')->save($save); } return $roles; }
  • 20. mongodb_sessions * The user-level session storage handlers: * - _drupal_session_open() * - _drupal_session_close() * - _drupal_session_read() * - _drupal_session_write() * - _drupal_session_destroy() * - _drupal_session_garbage_collection() are assigned by session_set_save_handler() in bootstrap.inc
  • 21. mongodb_block function hook_block_view_alter(&$data, $block) { // Remove the contextual links on all blocks that provide them. if (is_array($data['content']) && isset($data['content']['#contextual_links'])) { unset($data['content']['#contextual_links']); } // Add a theme wrapper function defined by the current module to all blocks // provided by the &quot;somemodule&quot; module. if (is_array($data['content']) && $block->module == 'somemodule') { $data['content']['#theme_wrappers'][] = 'mymodule_special_block'; } }
  • 22. Block rebuild Notice : Undefined variable: block_html_id in include() (line 4 of /var/www/Drupal/drupal-7.0-alpha4/themes/garland/block.tpl.php ). Notice : Undefined variable: block_html_id in include() (line 4 of /var/www/Drupal/drupal-7.0-alpha4/themes/garland/block.tpl.php ). Notice : Undefined variable: block_html_id in include() (line 4 of /var/www/Drupal/drupal-7.0-alpha4/themes/garland/block.tpl.php ). Notice : Undefined variable: block_html_id in include() (line 4 of /var/www/Drupal/drupal-7.0-alpha4/themes/garland/block.tpl.php ). Notice : Undefined variable: block_html_id in include() (line 4 of /var/www/Drupal/drupal-7.0-alpha4/themes/garland/block.tpl.php ).
  • 23. Render main content block function mongodb_block_theme() { 'block' => array( 'render element' => 'elements', 'template' => 'block', 'path' => drupal_get_path('module', 'block'), ), } function mongodb_block_mongodb_block_info_alter(&$blocks) { // Enable the main content block. $blocks['system_main']['region'] = 'content'; $blocks['system_main']['weight'] = 0; $blocks['system_main']['status'] = 1; } function mongodb_block_rehash($redirect = FALSE) { $collection = mongodb_collection('block'); $theme = variable_get('theme_default', 'garland');
  • 24. mongodb_field_storage don't : variable_set('field_storage_default', 'mongodb_field_storage'); instead : $conf['field_storage_default'] = 'mongodb_field_storage'; in settings.php ESP. for session/caching backends
  • 25. Drupal 7 Everything In MongoDB
  • 26. Import all Nodes > MongoDB* (* in 14 l.o.c.) // Connect $mongo = new Mongo(); // Get the database (it is created automatically) $db = $mongo->testDatabase; // Get the collection for nodes (it is created automatically) $collection = $db->nodes; // Get a listing of all of the node IDs $r = db_query('SELECT nid FROM {node}'); // Loop through all of the nodes... while($row = db_fetch_object($r)) { print &quot;Writing node $row->nid&quot;; // Load each node and convert it to an array. $node = (array)node_load($row->nid); // Store the node in MongoDB $collection->save($node); }
  • 27. Import all Nodes > MongoDB* (* in 14 l.o.c.) # drush script mongoimport.php # use testDatabase; # db.nodes.find( {title: /about/i} , {title: true}).limit(4);
  • 28. Import all Nodes > MongoDB* (* in 14 l.o.c.) <?php // Connect $mongo = new Mongo(); // Write our search filter (same as shell example above) $filter = array( 'title' => new MongoRegex('/about/i'), ); // Run the query, getting only 5 results. $res = $mongo->quiddity->nodes->find($filter)->limit(5); // Loop through and print the title of each article. foreach ($res as $row) { print $row['title'] . PHP_EOL; } ?>
  • 29. What's Next? Multiple DB servers – Data Persistance Query logging - Devel support Query builder – Views integration DBTNG – Full DB Abstraction MongoDB API
  • 30. Query Logging Extend Mongo collection class Pass instance back from mongodb_collection Implement all collection methods
  • 31. Drupal Mongo API $collection = mongodb_collection('myname'); $collection->find(array('key' => $value)); $collection->insert($object); $collection->remove(array('_id' => $item->id));
  • 32. Full DBTNG Impementation DO NOT USE !!!
  • 33. awesomesauce page callback => 'drupal_json' $items['node/%node/json'] = array('page callback' => 'drupal_json', 'page arguments' => array(1), 'type' => MENU_CALLBACK);
  • 34. Where Mongo Won't Work Ex. list nodes belonging to users whose usernames starts with 'Ab'
  • 35. Thanks! Comments & questions to: ForestMars @gmail.com ForestMars @googlewave.com Facebook, LinkedIn, etc. twitter: @elvetica (identica@forest)

Hinweis der Redaktion

  1. soft arch at mnn the first and largest community broadcast facility, producing more original content than any network in the world incl. any major network, abc, hbo. With thousands of producers, city-approved to expand to 9 on-air channels, and every episode stored in database, currently metadata only, with a roadmap to archive all broadcast content in a system that integrates with both the playout system and an on-demand web delivery system. And we&apos;re doing it with Drupal with which we&apos;re starting to use MongoDB. In fact, despite the surprising lack of information out there, MongoDB is getting a lot of traction in Drupal, in fact MongoDB is being more and more seen as a natural match for Drupal for a number of reasons. Document-oriented non-relational DB + Drupal = the Shiznit
  2. Using MongoDB with Drupal. the social graph is not a term you hear but it&apos;s uber apt It&apos;s surprising not more is being written about MongoDB for Drupal given how exciting it is. (I know exciting here is a relative term dependent on yr level of geekinees.) In fact if you&apos;re reading this, that&apos;s pretty much it, ATM. &amp; if you&apos;re reading this it&apos;s assumed you know what Drupal is, while you may or may not know that MongoDB is a stand-alone database server, barely a year old, that gains enormous improvements in speed by virtue of its schema-free design, trading off resource hungry features of RDBMS (joins, transactions) to achieve much better performance, It&apos;s optimized for web development and makes a great match with Drupal for a number of reasons. One of the first things you may ask about Mongo Drupal, apart from “why do all these softwarez have such funny names,” is why you would want to use them together. The answer is a word is speed, or rather its availability. More esoterically, MongoDB can give Drupal sites a rather high CAP coefficient* (a metric measuring performance in CAP space) while providing functional isomorphism between application and database layers that bears more of a resemblance to Internet programming patterns hey can we add some social media to out website
  3. Essentially the web applications architecture issue such as Sun encountered into when they tried to build web-apps in Java. They had to *adjust* the meanings of some terms to gloss over architectural shortcomings since internet programming patterns turned out to differ in important ways from traditional, even distributed applications. Today we see the same thing with RDBMS (NoSQL is catchier than NoRDBMS) oob mysql is not- lack of relational features 1 foreign constraints 2 ??? 3 row level locking but as it was the only tool in the tool box (object db&apos;s ran out of steam 10 years ago when they hit the i/o wall) that&apos;s what we&apos;ve been using, and we&apos;ve managed to make it work, problems notwithstanding. In particular, schema-based RDBMS don&apos;t play well with web-apps (&gt;&gt;&gt;slide&gt;&gt;&gt;) as your requirements for availability and scalability grow.
  4. However Schema-based RDBMS tend to be the worst offenders; SQL in particular has a number of issues: &gt; MySQL / InnoDB has a very unfriendly method of doing schema changes: it rebuilds the table and blocks all writes until the new table is ready. &gt; Big price – transactions. Worked so hard to get transactions in, wait, why are we working hard? &gt; Rich feature set string functions you&apos;ve never used &gt; More abstractly, reality, or at least the reality of the Interwebs doesn&apos;t play nice with SQL as the former doesn&apos;t have a rigid schema that the later wants to enforce. A thousand blog posts bear witness to the list of reasons that essentially boil down to the big price you have to pay to support features of a system that reality doesn&apos;t map well to reality. And this is of course is one of the most important things these systems/machines/programs do: map reality. And while it may seem to be a fairly high level of abstraction to compare database models to reality (&apos;itself&apos;) there is in fact a crucial dialogue in database programming between abstraction and actuality that is exemplified by what my signature quote &lt;blockquote&gt;In Theory, ...
  5. behaviour you experience comes from fundamental decisions made long ago in t programming Relations in theory and objects in practice If someone is getting too religious about the lack of schemas they&apos;re going to be more on the theory side even if mongodb itself has more affinitiy with the practical side Mongo encourages you to: have no data model and admit it
  6. Sidebar: CAP theorem – availability, consistency, partition tolerance. “ available and scalable” Dont want to spend too much time, but devs still don&apos;t seem to have the full sense of why mongodb is making big waves despite only being a year old.... atomic - everything you need is in 1 doc simple-one query, one thing fast - no cross table queries, one collection mysql trades availability for speed In asking why mongo you may as well be asking why not sql or simply, why nosql? don&apos;t hit database? then how do you keep it consistant Without going into to much detail, we can list out the main benefits realised in MongoDB as follows:
  7. 1. It is just blindingly, blazingy, insaningly fast. It also gives you faster development times (no data mapping to speak of, no schemas to manage…) 50 hour SQL import in 2 hours? Believe it. 2. It&apos;s tableless. Based on collections/documents 3. Goodbye queries, hello save/find arrays (querying inside arrarys_ There&apos;s no need to learn/use a querying language (such as there is with CouchDB) you can arbitrarily query inside collections, it doesn&apos;t matter what&apos;s in the document. Mongo&apos;s indexing is one reason it&apos;s so fast. (querying part still needed some structure to be added to the unstructured collection, in the form of indexes, because without them the result sets had to be filtered client-side) 4. It&apos;s Schemaless – no place to define types, which is good bc contrary to what relation db devs may believe, reality is schemaless, it has order of course, not not a rigid schema. Yet supports full indexing you can index over it, in fact you can index across documents that don&apos;t share the field you&apos;re indexing on. 5. Devel time faster also - no schemas to manage, very little (if any) data mapping. 6. Learning curves less steep - because there is no new query language to learn. 7. Code is trimmer – Don&apos;t need other ORM, thin wrappers 8. Future-proof - trivially easy to add more fields -even complex fields- to objects. As requirements change, you can adapt code quickly. Sharding built-in when volumes start increasing, indexes are necessary, and these in some sense are based on an underlying schema assumption: that of the fields to index. However when volumes start increasing, you can be sure that MongoDB is going to serve this data up in an highly available and highly scalable way.
  8. Whitehose direct citizen engagement – 100K questions, 1.7M votes just on one topic Experimenting with Drupal6 + MongoDB, comments experiment, 7X improvement over SQL Not completely magical- to scale out you will need to learn how to write performanct queries.
  9. Not completely magical- to scale out you will need to learn how to write performanct queries.
  10. Installing Mongo Obviously if you are serious you will build from source and not install from the package at http://www.anthonyw.net/mongodb-deb-package . Actually even if you weren&apos;t serious you wouldn&apos;t have to anyway bc it&apos;s in the latest Debian not to mention the last few Ubuntus. aptitude install mongodb-stable After you have mongod running you&apos;ll need to install the drivers for your language, which in Drupal&apos;s case is php of course. If you have dh-make-php tools installed you can easily invoke pecl install mongodb to do that. Right right away you&apos;ll notice you don&apos;t even need half as many mongodb functions as you do mysql (18 vs. 54) and that&apos;s if you only had one SQL driver loaded. One thing you will need however is to load the extension in php or so if you haven&apos;t added &lt;span class=”code”&gt;load extension = mongodb.so&lt;/span&gt;to php.ini&lt;/span&gt; (reqs. reload) Drupal will complain (PECL doesn&apos;t do this when it builds) when the module&apos;s install file checks for this. In fact, that&apos;s pretty much the only thing the installer does, much unlike the relational based modules that have to pre-create their entire schemas. Installing mongodb (shoutout to AOP*) into your Drupal site (using drush of course) will give you mongodb.module, essentially a collections manager that implements hook_help (sort of) and gives you mongo(), collection_name() &amp; get sequential ID (the later since MongoDB uses pointers/k-v&apos;s).
  11. rejected approaches: de-normalise data (really want to duplicate yr data anytime you need to index a type-mismatched query?) MongoDB solution: node is a document, stores all comments directly on the node document
  12. Installing the dev version also gives you a host of submodules implementing various MongoDB related handlers (such as blocks, fields, sessions &amp; cache.) Some of these are already available in the Drupal 6 version, and in fact MongoDB is used in production Drupal sites, however if you are planning a new deployment there&apos;s no good reason not to use Seven. [sic]
  13. Mongo Watchdog and blocks are drop-in replacements for their core counterparts. Enable watchdog on a server running mongoDB and you&apos;ve just created a watchdog collection. Disable dblogging module to stop writing the same information to sql, and my favourite part, drop the watchdog table. (Mongo watchdog is also rumoured to work in 6 although it doesn&apos;t seem to be included in the drupal6 release.) What you get: the ability to send off structured content to a server that is - completely separated from the MySQL cluster, hence saving on MySQL load - faster from Drupal to log than going through ksyslogd then a custom logger - still querable from the standard Drupal UI, which a custom logger wouldn&apos;t have been so easily - convenient auto-trimming with fixed-size partitions without a need for client code, which maps very nicely to logging applications
  14. Great for statistics Capping a collection Despamming a capped collection
  15. That&apos;s all there is to it. As chx wryly noted.... There&apos;s a reason people use Drupal- ease of admin leveraging forgive the expression Humongous backend of contrib community &amp; testing framework Because your databases and collections -- collections are like the equivalent of tables in MongoDB -- are created on demand as you write to them, there&apos;s no schema to load in. There&apos;s no setup to do. You simply start writing your data. You say &amp;quot;I want to write to this database, this collection, write out this data structure.&amp;quot; You can instantly start writing php objects to it, reading them and finding them. It&apos;s so amazingly easy.
  16. Conf variable in settings.php ported to 6 - http://drupal.org/node/778150
  17. problme: more users = slower lookups in Drupal one workaround has been &amp;quot;noanonymous sessios&amp;quot; of course this kills your reporting… (also anon functions &amp; targeted advertising) better: caching (apc/memcached) So enable the sessions sub-module override session.inc in settings.php: $conf[&apos;session_inc&apos;] = &apos;sites/all/modules/mongodb/mongodb_session/mongodb_session.inc&apos;; (if all goes well you will need to log in again) And yes delete the sessions table...
  18. This + simpletest + user roles (sql)
  19. Assigned by session set handler and are called * automatically by PHP. These functions should not be called directly. Session * data should instead be accessed via the $_SESSION superglobal. perlscript: http://tracy.hurleyit.com/content/using-mongodb-replace-sessions-table
  20. install block &amp; block ui disable block (core) &amp; drop table &gt; can store arrays such as paths the block is visible to and i think it&apos;s patched to give you paths that block is IN visible to &gt; Again, block.install only a warning (since writes=creates in mongo) &gt; How it differs- for display, so Block has a tipplefip Has API instead of include &gt; there was a time in the past where there was no dependency in the ui module (on block) &gt; of course implements (a hook for) block_view_alter &gt; Note that instead of hook_block_view_alter(), which is called for all blocks, you can also use hook_block_view_MODULE_DELTA_alter() to alter a specific bloc
  21. block rebuild quirk
  22. Render main content block via mongodb_block Patch http://drupal.org/node/ 725444 Actually a few months old
  23. Storing fielded entities in Mongodb - storing whole fielded entities Everything is an entity incl. Taxonomy (it&apos;s just not fieldable) d7 big big big thing = field storage d6 field storage engine not pluggable JSON objects are not something we tend to manipulate within drupal or swap unchanged between browser and DB. IIRC, this has led to M devs implementing something to make it easier for our field storage to map more cleanly to the API
  24. Storing fielded entities in Mongodb - storing whole fielded entities Everything is an entity incl. Taxonomy (it&apos;s just not fieldable) d7 big big big thing = field storage d6 field storage engine not pluggable JSON objects are not something we tend to manipulate within drupal or swap unchanged between browser and DB. IIRC, this has led to M devs implementing something to make it easier for our field storage to map more cleanly to the API
  25. Why this works: * Drupal&apos;s node_load() function can load a node as an object * Drush can let me write a quick import/export script to run on the command line * And MongoDB can store just about any old array of primitives
  26. Why this works: * Drupal&apos;s node_load() function can load a node as an object * Drush can let me write a quick import/export script to run on the command line * And MongoDB can store just about any old array of primitives
  27. Do it in PHP! The data stored in MongoDB is basically exactly the data that one would get from doing a (array)node_load(). (There will be exceptions to this where non-primitives are stored in a node.) Note this is not a solution for manipulating nodes IN Drupal
  28. new Drupal MongoDB module will manage persistence of data across two servers
  29. write a class that extends the MongoCollection class and pass an instance of that back from mongodb_collection . You need to implement MOST methods collecting arguments and passing to parent.
  30. DAL api: “The intent of this layer is to preserve the syntax and power of SQL as much as possible” http://drupal.org/project/mongodb_dbtng
  31. But the new twist with some of the new NoSQL stores is storage in JSON. more scalable than an RDBMS, but to me the real attraction seems to be the innate hierarchical storage structure which JSON (or even XML) allows. Much of our data come in a hierarchical format, so simply converting that to JSON may be easier than the gymnastics required by conversion to a relational format. http://luhman.org/blog/2010/04/09/nosql-data-stores-mongo JSON objects are not something we tend to manipulate within drupal or swap unchanged between browser and DB. IIRC, this has led to M devs implementing something to make it easier for our field storage to map more cleanly to the API page callback =&gt; &apos;drupal_json&apos;. Cross with the object loading notation of the new menu and you can get your objects in JSON with remarkable ease: $items[&apos;node/%node/json&apos;] = array(&apos;page callback&apos; =&gt; &apos;drupal_json&apos;, &apos;page arguments&apos; =&gt; array(1), &apos;type&apos; =&gt; MENU_CALLBACK); will get you the node in JSON format, access checked and all. Noone stops you from writing foo_object_load and using %foo_object to return anything in JSON... http://drupal4hu.com/node/90
  32. f you want list nodes belonging to users whose usernames starts with &amp;quot;Ab&amp;quot; then you are back in denormalization land -- you need to store the username into the node collection. Only one example--- but it typifies something we do a lot &amp;quot;it&apos;s not relational data....&amp;quot; except when it is Solution: do joins in app layer or fail Overall the type of Drupal queries that can be easily done in Mongo are going to be far more common than the exceptions that don&apos;t index well in Mongo.... (Informed) Banking: http://www.docunext.com/blog/2010/03/example-mongodb-application.html
  33. I have seen the future and it is Mongo(DB)