慕課網 《MongoDB 2014北京大會》視頻筆記

學習地址:MongoDB 2014北京大會

第一章 MongoDB歡迎致辭及MongoDB簡介

General purpose
Document database
Open-source

Create Applications — Never Before Possible

creat_applications

MongoDB Business Value:
- Enabiling New Apps
- BetterCustomer Experience
- Faster Time to Marker
- Lower TCO

What we sell?

  • MongoDB Enterprise Advanced
    Management platform, advanced security, proactive support, and more.
  • MongoDB Management Service(MMS)
    Automated deployment, upgrades, backup and monitoring in the cloud.
  • Production Support
    Support for production deployments.
  • Development Support
    Support, on-demand training and health check for teams in development.
  • Consulting
    Packaged service offerings for critical points in the project lifecycle.
  • Training
    Certification and training in development and ops - online & in-person.

THE LARGEST ECOSYSTEM
- 9,000,000+
MongoDB Downloads
- 250,000+
Online Education Registrants
- 35,000+
MongoDB User Group Members
- 40,000+
MongoDB Management Service(MMS) Users
- 600+
Technology and Services Partners
- 1,000+
Custormers Across All Industries

Document Level Locking
( Coming early 2015 )

pluggable : In-memory, RocksDB, TokuKV, FusionIO
What is the storage engine today?
MMAP & WiredTiger

Automation

第2章 MongoDB模式設計的藝術:該做的與不該做的

The Fine Art of Schema Design: Dos and Don’ts

(Matias Cas callares
Senior Solutions Architect, MongoB Inc.
[email protected])

RDBMs

  • Relational databases are made up of tables
  • Tables are made up of rows:

    • All rows have identical structure
    • Each row has the same number of columns
    • Every cell in a column stores the same type of data

    MongoDB is a Document Oriented database

Document Model

  • MongoDB is made up of collections
  • Collections are composed of documents
    • Each document is a set of key-value pairs
    • No predefined schema
    • Keys are always strings
    • Values can be any(supported) data type
    • Values can also be an array
    • Values can also be a document

document inside documents
Benifits of these document model….?

  • Flexibility

    • Each document can have different fields
    • No need of long migrations, easier to be agile
    • Common structure enforced at application level
  • Arrays

    • Documents can have field with array values
    • Ability to query and index array elements
    • We can model relationships with no need of different tables or collections
  • Embedded documents

    • Documents can have field with document values
    • Ability to query and index nested documents
    • Semantic closer to Object Oriented Programming

    Relational Schema Design:
    Focus on data storage.
    Document Schema Design:
    Focus on data usage.

SCHEMA DESIGN IS AN ART

A task tracking app

Requirement #1
“We need to store user information” like name, email and their addresses…yes they can have mort than one.”
—Bill, a project manager, contemporary

Requirement #2
“We have to be able to store tasks, assign them to users and track their progress…”
—Bill, a project manager, contemporary

Embedding tasks

  • Tasks are unbounded items: initially we do not know how many tasks we are going to have
  • A user along time can end with thousands of tasks
  • Maximum document size in MongoDB: 16MB!
  • It is harder to access task information without a user context

Array update operators

  • pop
  • push
  • pull
  • pullAll

Why is expensive to move a document?

  • We need to write the document in another locaion($$)

  • We need to mark the original position as free for new documents($)

  • We need to update all those index entries pointing to the moved document to the new location($$$)

Considerations with arrays

  • Limited number of items
  • Avoid document movements
    • Document movements can be delayed with padding factor
    • Document movement can be mitigated with preallocation

RECIPE #4
USE DATA MODELS THAT MINIMIZE THE NEED FOR DOCUMENT GROWTH

RECIPE #5
DENORMALIZE TO AVOID APP-LEVEL JOINS

RECIPI #6
DENORMALIZE ONLY WHEN YOU HAVE A HIGH READ TO WRITE RATIO

Bucketing
What’s th idea?

  • Reduce number of documents to be retrieved
  • Less documents to retrieve mean less disk seeks
  • Using arrays we can store more than one entity per document
  • We group things that are accessed together
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章