More Related Content
Similar to 月間10億pvを支えるmongo db
Similar to 月間10億pvを支えるmongo db (20)
月間10億pvを支えるmongo db
- 16. user = new mongoose.Schema
first: {type: String, required: true, index: true}
last: {type: String, required: true, index: true}
city: {type: String, required: true, index: true}
...
created_at: {type: Date, default: Date.now, index: true}
書き込みが犠牲になっても読み込みが早ければいいじゃん!
Before
- 17. user = new mongoose.Schema
first: {type: String, required: true}
last: {type: String, required: true}
city: {type: String, required: true}
...
created_at: {type: Date, default: Date.now, index: true}
書き込みが犠牲になっても読み込みが早ければいいじゃん!
After
- 29. Schema Design at Scale
http://www.mongodb.com/presentations/schema-design-scale-1
- 36. without
db.col.update({_id: 1}, {$push: {data: {x: 151, y: 100, ...}});
db.col.update({_id: 1}, {$push: {data: {x: 151, y: 179, ...}});
db.col.update({_id: 1}, {$push: {data: {x: 151, y: 266, ...}});
db.col.update({_id: 1}, {$push: {data: {x: 151, y: 295, ...}});
db.col.update({_id: 1}, {$push: {data: {x: 151, y: 322, ...}});
db.col.update({_id: 1}, {$push: {data: {x: 151, y: 333, ...}});
db.col.update({_id: 1}, {$push: {data: {x: 151, y: 340, ...}});
...
- 37. db.col.insert({data: [
{x: 151, y: 100, ...}, {x: 151, y: 179, ...},
{x: 151, y: 266, ...}, {x: 151, y: 295, ...},
{x: 151, y: 322, ...}, {x: 151, y: 333, ...},
{x: 151, y: 340, ...}, ...
]});
with
- 39. db.col.insert([
{first: Yuji , last: Isobe , city: Osaka },
{first: Yuji , last: Isobe , city: Tokyo }
]);
使い方
var bulk = db.col.intializeOrderedBulkOp()
bulk.find({first: Yuji })
.updateOne({$set: {city: Tokyo }});
Bulk Inserts
Bulk Operations From 2.6.0
- 52. r3.2xlarge
-> vCPU: 8
-> Memory: 61GiB
-> SSD: 160GB
-> Cost: $0.840 per Hour
i2.2xlarge
-> vCPU: 8
-> Memory: 61GiB
-> SSD: 800GB x 2
-> Cost: $2.001 per Hour
主に使用しているインスタンス