12. 12
Waypoint
{ _id: ObjectId(),
user: UUID,
tour: UUDI
name: "Doug's Dogs",
desc: "The best hot-dog",
clues: [
"Hungry for a Coney Island?",
"Ask for Dr. Frankenfurter",
"Look for the hot dog stand"
],
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1] }
};
13. 13
Waypoint
{ _id: ObjectId(),
user: UUID,
tour: UUDI
name: "Doug's Dogs",
desc: "The best hot-dog",
clues: [
"Hungry for a Coney Island?",
"Ask for Dr. Frankenfurter",
"Look for the hot dog stand"
],
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1] }
};
14. 14
Waypoint
{ _id: ObjectId(),
user: UUID,
tour: UUDI
name: "Doug's Dogs",
desc: "The best hot-dog",
clues: [
"Hungry for a Coney Island?",
"Ask for Dr. Frankenfurter",
"Look for the hot dog stand"
],
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1] }
};
Geospacial Index:
ensureIndex(
{ geometry: “2dsphere” }
)
27. 30
Notifications / Messaging
Message
{
sender: “Hypatia”,
recipients: [
“Democritus”,
“Euripides”,
“Eratosthenes”
]
date: ISODate(),
message: “truth is a point of view, and
so is changeable”
}
28. 31
Notifications / Messaging
Message
{
sender: “Hypatia”,
recipients: [
“Democritus”,
“Euripides”,
“Eratosthenes”
]
date: ISODate(),
message: “truth is a point of view, and
so is changeable”
}
db.messages.find(
{ recipients: “Democritus”}
);
33. 36
One Document per Message per Recipient
{
sender: “Hypatia”,
recipient: “Democritus”,
date: ISODate(),
message: “truth is a point of view, and so is changeable”
}
{
sender: “Hypatia”,
recipient: “Euripides”,
date: ISODate(),
message: “truth is a point of view, and so is changeable”
}
{
sender: “Hypatia”,
recipient: “Eratosthenes”,
date: ISODate(),
message: “truth is a point of view, and so is changeable”
}
50. 60
The Scavenger Hunt App
Basic Requirements
• Mark target points
• Identify our users
51. 61
The Scavenger Hunt App
Basic Requirements
• Mark target points
• Identify our users
• Mark users’ progress
during hunts
52. 62
Waypoint
{ _id: ObjectId(),
user: UUID,
tour: UUDI
name: "Doug's Dogs",
desc: "The best hot-dog",
clues: [
"Hungry for a Coney Island?",
"Ask for Dr. Frankenfurter",
"Look for the hot dog stand"
],
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1] }
};
53. 63
Waypoint
{ _id: ObjectId(),
user: UUID,
tour: UUDI
name: "Doug's Dogs",
desc: "The best hot-dog",
clues: [
"Hungry for a Coney Island?",
"Ask for Dr. Frankenfurter",
"Look for the hot dog stand"
],
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1] }
};
Geospacial Index:
ensureIndex(
{ geometry: “2dsphere” }
)
87. 97
Coordinate Reference System
• A system to locate geographical entities
• WGS84 datum
• Geoid - the shape of the surface of the oceans
• EGM96 gravitational model
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
}
103. 113
Sizing
• Indexes need to be in RAM
• Working set needs to be in RAM
• I/O Bandwidth
- write load
- Index updates
- Working set migration
{ _id: ObjectId(),
tour: UUID,
user: UUID,
name: "Doug's Dogs",
desc: "The best hot-dog",
clues: [
"Hungry for a Coney Island?",
"Ask for Dr. Frankenfurter",
"Look for the hot dog stand"
]
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
}
}
107. 120
Load Testing
• Test it like you use it, benchmarks don’t count
• Test to failure
• Instrument your code!
108. 121
Load Testing
• Test it like you use it, benchmarks don’t count
• Test to failure
• Instrument your code!
https://github.com/breinero/Firehose
https://github.com/ParsePlatform/flashback
109. 122
Load Testing
• Test it like you use it, benchmarks don’t count
• Test to failure
• Instrument your code!
There’s me
119. 132
Security
• Firewall
• Bind ip
• Encrypt Networks
• Enable Access Control
• Don’t enable REST interface
• Auditing
Limit Exposure
and use
Principal of Least Privileges
120. 133
Tuning
Best Practices
• Disable Transparent hugepages
• NTP to synchronize time
• Set ulimits
• Use XFS or Ext4
• Don’t use NFS
• Disable NUMA
• Have swap
Read Production Notes
Tunables
• Set IO Scheduler NOOP
• Adjust readaheads ( MMapV1 )
• Avoid cgroups
• SE Linux (?)
• RAID
140. 156
Client Side
• Don’t use ensureIndex() in application
• Look out for connection bombs
--maxConnect
• DO use operation timeouts
• DON’T cause socket timeouts
Lower keepalives
• Avoid retry bombs
141. 157
Requirements & Specs
Make a DevOps Contract
• Database Access Requirements
• Database Access Fulfillment Specification
• Cluster Configuration
• Monitoring and Alerting Specification