Effectively Scale and Operate AEM with MongoDB
Agenda MongoDB Introduction MongoMK Sizing Deployment Operational Best Practices
Introduction Norberto Leite Technical Evangelist Madrid, Spain http://www.mongodb.com/norberto @nleite norberto@mongodb.com
introduction
MongoDB GENERAL PURPOSE DOCUMENT DATABASE OPEN-SOURCE
MongoDB is Fully Featured
Query Operators Condi&onal  Operators     $all,  $exists,  $mod,  $ne,  $in,  $nin,  $nor,  $or,  $size,  $type   $lt,  $lte,  $gt,  $gte     //  find  customers  with  any  claims   >  db.customers.find(  {claims:  {$exists:  true  }}  )     //  find  customers  matching  a  regular  expression   >  db.customers.find(  {last:  /^rog*/i  }  )     //  count  customers  by  city   >  db.customers.find(  {city:  ‘Philadelphia’}  ).count()  
Indexes // Index nested documents > db.customers.ensureIndex( “policies.agent”:1 ) > db.customers.find({‘policies.agent’:’Fred’}) // geospatial index > db.customers.ensureIndex( “property.location”: “2d” ) > db.customers.find( “property.location” : { $near : [22,42] } ) // text index > db.customers.ensureIndex( “policies.notes”: “text” )
Documents are Rich Data Structures { ! first_name: ‘Paul’,! surname: ‘Miller’,! cell: 447557505611, ! city: ‘London’,! location: [45.123,47.232],! Profession: [banking, finance, trader],! cars: [ ! { model: ‘Bentley’,! year: 1973,! value: 100000, … },! { model: ‘Rolls Royce’,! year: 1965,! value: 330000, … }! ]! }! Fields can contain an array of sub-documents Fields Fields can contain arrays Typed field valuesString Number
Over 10,000,000 downloads 300,000 Students for MongoDB University 35,000 attendees to MongoDB events annually Over 1,000 Partners Over 2,000! Paying Customers
MongoMK
MongoDB MicroKernel •  AEM 6 Scalable Storage Solution •  Flexible •  Multi-Datacenter Deployments •  Geo Distributed Content •  Auto-Failover
MongoMK Nodes   Blobs   Se4ngs   Changes   ClusterNodes   Metadata  collec&on   Content  node  structure   Internal  AEM  indexes   MulL  version  structures       Blobs  collec&on   Binary  file  chunks     Enforces  data  de-­‐duplicaLon     Se4ngs,  Changes,  ClusterNodes   Internal  AEM  collecLons   ConfiguraLon  and  seRngs  data    
MongoMK - Content Metadata   Binary  /  Blobs  
Binary  /  Blobs   MongoMK – Metadata Metadata  
MongoMK – Data Model
MongoMK – Version Control Revisions  of  content  are  maintained  as  separate   trees  
MongoMK – Data Model
MongoMK – Versioning & Concurrency System  provides  version  and  concurrency  control  of   content  revisions.  
MongoMK – Versioning & Concurrency
Binary  /  Blobs   MongoMK – Binary Data Metadata  
AEM Blob Storage TAR MONGODB S3
Blobs on MongoMK Posi&ve     Penalty   Unified  Storage  Layer   More  Storage  Requirements   Reduced  OperaLonal  Overhead   More  I/O  Intensive   Binary  De-­‐duplicaLon     Higher  Bandwidth  Requirements  
MongoMK - Blobs
MongoMK - Blobs
Sizing
MONGODB SIZING Availability     Volume   Expected  Latency   Working  Data  Set  
Availability
Sizing - Availability AEM   Edi&ng   Cura&ng   Valida&ng   Primary   Secondary   Secondary  
Sizing - Availability AEM   Edi&ng   Cura&ng   Valida&ng   Primary   Secondary   Primary  
Sizing - Availability AEM  -­‐  author   AEM  -­‐  author   AEM  -­‐  author   Primary   Secondary   Secondary   Datacenter  West   Datacenter  East  Datacenter  Center   AEM  -­‐  author  AEM  -­‐  author  
Sizing - Availability AEM  -­‐  author   AEM  -­‐  author   AEM  -­‐  author   Primary   Secondary   Secondary   Backups  (hidden)   Hot  Backups  (delayed)  
Volume
Sizing - Volume Indexes   ProperLes   MulL  Version   Nodes   Blobs   Full  Text  Search   Indexes   Binary  Chunks  
Sizing - Volume •  Space required by –  Data –  Indexes •  Read / Write Ratio •  Computational Unit Capacity –  RAM –  Disk •  Types of Disks! –  CPU
Working Set
Sizing – Working Set Working  Set   Rest  of  your  Database  
Sizing – Working Set •  Percentage of data that is constantly request by the application –  Indexes –  Recent Used Data •  Read / Write –  Impacts the calculation of the RAM requirement •  Working Set Should Fit In RAM
Working Set Not in RAM
Sizing – Working Set •  AEM Calculation of Working Set – Internal MongoDB Indexes – Constantly accessed Assets • % of data access – AEM Indexes • Multi-version Indexes • Lucene Indexes
Working Set Can Be Distributed Across Shards
Sizing - Latency Primary   Secondary   Secondary   AEM   AEM   AEM   ONLY   SECONDARY   READS!  
Deploy
Rules for a Good Deployment Prototype   Test   Monitor  Scale   Automate  
AEM + Ops Manager Scale  Easily  Meet  SLAs   Best  PracLces,   Automated   Cut  Management   Overhead  
Demo
Operational Best Practices
Node Documents { "_id": "1:/norberto", "_deleted": { "r14e211fe903-0-1": "false" }, "jcr:created": { "r14e211fe903-0-1": ""dat:2015-06-23T17:53:36.257+02:00"" }, "jcr:createdBy": { "r14e211fe903-0-1": ""admin"" }, "_commitRoot": { "r14e211fe903-0-1": "0" }, "jcr:primaryType": { "r14e211fe903-0-1": ""nam:nt:folder"" }, "_modified": NumberLong("1435074815"), "_modCount": NumberLong("1") } { "_id": "1:/norberto", … "_commitRoot": { "r14e211fe903-0-1": "0", "r14e2122a4bb-0-1": "0" }, … "_modified": NumberLong("1435074995"), "_modCount": NumberLong("3"), "_children": true, "_lastRev": { "r0-0-1": "r14e2122a4bb-0-1" } }
Document Moves 2015-05-18T17:07:10.264+0200 [conn1298] command aem.$cmd command: findAndModify { findandmodify: "nodes", query: { _id: "10:/content/www/...", _modCount: 3 }, fields: { _id: 1 }, update: { $set: { ... }, $max: { _modified: 1431961630 }, $inc: { _modCount: 1 } } } update: { $set: { ... }, $max: { _modified: 1431961630 }, $inc: { _modCount: 1 } } nscanned:1 nscannedObjects:1 nmoved:1 nMatched:1 nModified:1 keyUpdates:0 numYields:0 locks(micros) w:116270 reslen:203 116ms! nscanned:1464 nscannedObjects:1044 nmoved:288 nMatched:1044 nModified:1044 keyUpdates:1 numYields:11 locks(micros) w:242369 169ms! nscanned:10829 nscannedObjects:10000 nmoved:1316 nMatched:10000 nModified:10000 keyUpdates:1 numYields:89 l! ocks(micros) w:2372208 1234ms!
Fragmentation AEM will be constantly growing the documents generating document moves and subsequently producing fragmentation db.adminCommand( { repairDatabase: 1 } )! h_p://docs.mongodb.org/manual/reference/command/repairDatabase/  
Monitoring Performance Indicators Memory, Background Flushing Avg and Opcounters: make sure you understand these metrics! h_ps://docs.mms.mongodb.com/  
Working Set Measurement h_ps://docs.mms.mongodb.com/   Page Faults and Memory aligned with Db Storage will give you and good indication of how well provision is your machine and if you need to scale out
To Sum It Up
Takeway AEM + MongoDB is a Scalable Solution Provisioning is Key Monitor, monitor, monitor Wish List is Being Attended We Want to Help You!
MongoMK Deployment for AEM h_ps://info-­‐mongodb-­‐com.s3.amazonaws.com/MongoDB_AEM6_ConsulLng_Datasheet.pdf  
Upcoming Webinar https://www.mongodb.com/webinar/aem-and-mongodb
Obrigado! Norberto Leite Technical Evangelist norberto@mongodb.com @nleite
Effectively Deploying MongoDB on AEM

Effectively Deploying MongoDB on AEM

  • 1.
    Effectively Scale andOperate AEM with MongoDB
  • 2.
  • 3.
    Introduction Norberto Leite Technical Evangelist Madrid,Spain http://www.mongodb.com/norberto @nleite norberto@mongodb.com
  • 4.
  • 5.
  • 6.
  • 7.
    Query Operators Condi&onal  Operators     $all,  $exists,  $mod,  $ne,  $in,  $nin,  $nor,  $or,  $size,  $type   $lt,  $lte,  $gt,  $gte     //  find  customers  with  any  claims   >  db.customers.find(  {claims:  {$exists:  true  }}  )     //  find  customers  matching  a  regular  expression   >  db.customers.find(  {last:  /^rog*/i  }  )     //  count  customers  by  city   >  db.customers.find(  {city:  ‘Philadelphia’}  ).count()  
  • 8.
    Indexes // Index nesteddocuments > db.customers.ensureIndex( “policies.agent”:1 ) > db.customers.find({‘policies.agent’:’Fred’}) // geospatial index > db.customers.ensureIndex( “property.location”: “2d” ) > db.customers.find( “property.location” : { $near : [22,42] } ) // text index > db.customers.ensureIndex( “policies.notes”: “text” )
  • 9.
    Documents are RichData Structures { ! first_name: ‘Paul’,! surname: ‘Miller’,! cell: 447557505611, ! city: ‘London’,! location: [45.123,47.232],! Profession: [banking, finance, trader],! cars: [ ! { model: ‘Bentley’,! year: 1973,! value: 100000, … },! { model: ‘Rolls Royce’,! year: 1965,! value: 330000, … }! ]! }! Fields can contain an array of sub-documents Fields Fields can contain arrays Typed field valuesString Number
  • 10.
    Over 10,000,000 downloads 300,000 Students for MongoDB University 35,000 attendeesto MongoDB events annually Over 1,000 Partners Over 2,000! Paying Customers
  • 12.
  • 13.
    MongoDB MicroKernel •  AEM6 Scalable Storage Solution •  Flexible •  Multi-Datacenter Deployments •  Geo Distributed Content •  Auto-Failover
  • 14.
    MongoMK Nodes   Blobs   Se4ngs   Changes   ClusterNodes   Metadata  collec&on   Content  node  structure   Internal  AEM  indexes   MulL  version  structures       Blobs  collec&on   Binary  file  chunks     Enforces  data  de-­‐duplicaLon     Se4ngs,  Changes,  ClusterNodes   Internal  AEM  collecLons   ConfiguraLon  and  seRngs  data    
  • 15.
    MongoMK - Content Metadata   Binary  /  Blobs  
  • 16.
    Binary  /  Blobs   MongoMK – Metadata Metadata  
  • 17.
  • 18.
    MongoMK – VersionControl Revisions  of  content  are  maintained  as  separate   trees  
  • 19.
  • 20.
    MongoMK – Versioning& Concurrency System  provides  version  and  concurrency  control  of   content  revisions.  
  • 21.
  • 22.
    Binary  /  Blobs   MongoMK – Binary Data Metadata  
  • 23.
  • 24.
    Blobs on MongoMK Posi&ve     Penalty   Unified  Storage  Layer   More  Storage  Requirements   Reduced  OperaLonal  Overhead   More  I/O  Intensive   Binary  De-­‐duplicaLon     Higher  Bandwidth  Requirements  
  • 25.
  • 26.
  • 27.
  • 28.
    MONGODB SIZING Availability     Volume   Expected  Latency   Working  Data  Set  
  • 29.
  • 30.
    Sizing - Availability AEM   Edi&ng   Cura&ng   Valida&ng   Primary   Secondary   Secondary  
  • 31.
    Sizing - Availability AEM   Edi&ng   Cura&ng   Valida&ng   Primary   Secondary   Primary  
  • 32.
    Sizing - Availability AEM  -­‐  author   AEM  -­‐  author   AEM  -­‐  author   Primary   Secondary   Secondary   Datacenter  West   Datacenter  East  Datacenter  Center   AEM  -­‐  author  AEM  -­‐  author  
  • 33.
    Sizing - Availability AEM  -­‐  author   AEM  -­‐  author   AEM  -­‐  author   Primary   Secondary   Secondary   Backups  (hidden)   Hot  Backups  (delayed)  
  • 34.
  • 35.
    Sizing - Volume Indexes   ProperLes   MulL  Version   Nodes   Blobs   Full  Text  Search   Indexes   Binary  Chunks  
  • 36.
    Sizing - Volume • Space required by –  Data –  Indexes •  Read / Write Ratio •  Computational Unit Capacity –  RAM –  Disk •  Types of Disks! –  CPU
  • 37.
  • 38.
    Sizing – WorkingSet Working  Set   Rest  of  your  Database  
  • 39.
    Sizing – WorkingSet •  Percentage of data that is constantly request by the application –  Indexes –  Recent Used Data •  Read / Write –  Impacts the calculation of the RAM requirement •  Working Set Should Fit In RAM
  • 40.
  • 41.
    Sizing – WorkingSet •  AEM Calculation of Working Set – Internal MongoDB Indexes – Constantly accessed Assets • % of data access – AEM Indexes • Multi-version Indexes • Lucene Indexes
  • 42.
    Working Set CanBe Distributed Across Shards
  • 43.
    Sizing - Latency Primary   Secondary   Secondary   AEM   AEM   AEM   ONLY   SECONDARY   READS!  
  • 44.
  • 45.
    Rules for aGood Deployment Prototype   Test   Monitor  Scale   Automate  
  • 46.
    AEM + OpsManager Scale  Easily  Meet  SLAs   Best  PracLces,   Automated   Cut  Management   Overhead  
  • 47.
  • 48.
  • 49.
    Node Documents { "_id": "1:/norberto", "_deleted":{ "r14e211fe903-0-1": "false" }, "jcr:created": { "r14e211fe903-0-1": ""dat:2015-06-23T17:53:36.257+02:00"" }, "jcr:createdBy": { "r14e211fe903-0-1": ""admin"" }, "_commitRoot": { "r14e211fe903-0-1": "0" }, "jcr:primaryType": { "r14e211fe903-0-1": ""nam:nt:folder"" }, "_modified": NumberLong("1435074815"), "_modCount": NumberLong("1") } { "_id": "1:/norberto", … "_commitRoot": { "r14e211fe903-0-1": "0", "r14e2122a4bb-0-1": "0" }, … "_modified": NumberLong("1435074995"), "_modCount": NumberLong("3"), "_children": true, "_lastRev": { "r0-0-1": "r14e2122a4bb-0-1" } }
  • 50.
    Document Moves 2015-05-18T17:07:10.264+0200 [conn1298]command aem.$cmd command: findAndModify { findandmodify: "nodes", query: { _id: "10:/content/www/...", _modCount: 3 }, fields: { _id: 1 }, update: { $set: { ... }, $max: { _modified: 1431961630 }, $inc: { _modCount: 1 } } } update: { $set: { ... }, $max: { _modified: 1431961630 }, $inc: { _modCount: 1 } } nscanned:1 nscannedObjects:1 nmoved:1 nMatched:1 nModified:1 keyUpdates:0 numYields:0 locks(micros) w:116270 reslen:203 116ms! nscanned:1464 nscannedObjects:1044 nmoved:288 nMatched:1044 nModified:1044 keyUpdates:1 numYields:11 locks(micros) w:242369 169ms! nscanned:10829 nscannedObjects:10000 nmoved:1316 nMatched:10000 nModified:10000 keyUpdates:1 numYields:89 l! ocks(micros) w:2372208 1234ms!
  • 51.
    Fragmentation AEM will beconstantly growing the documents generating document moves and subsequently producing fragmentation db.adminCommand( { repairDatabase: 1 } )! h_p://docs.mongodb.org/manual/reference/command/repairDatabase/  
  • 52.
    Monitoring Performance Indicators Memory,Background Flushing Avg and Opcounters: make sure you understand these metrics! h_ps://docs.mms.mongodb.com/  
  • 53.
    Working Set Measurement h_ps://docs.mms.mongodb.com/   Page Faults and Memory aligned with Db Storage will give you and good indication of how well provision is your machine and if you need to scale out
  • 54.
  • 55.
    Takeway AEM + MongoDBis a Scalable Solution Provisioning is Key Monitor, monitor, monitor Wish List is Being Attended We Want to Help You!
  • 58.
    MongoMK Deployment forAEM h_ps://info-­‐mongodb-­‐com.s3.amazonaws.com/MongoDB_AEM6_ConsulLng_Datasheet.pdf  
  • 59.
  • 60.