Questline, Brett worked as a Programmer Analyst for Grange Insurance as well as an IT consultant for Agile Technologies. The handsome devil is passionate about learning new technologies and working to solve complex problems the right way. He loves music and playing and watching hockey and soccer. Currently, Brett lives in Upper Arlington with his hot, hot girlfriend. About Brett
communications for the utility industry. We send and manage Email, SMS, Fax and social communications for over 450 clients in the USA & Canada. For the last year, the focus of our entire DevOps team has been on building a next generation messaging and content system. About Questline
C++, Mongo stores schemaless binary JSON (BSON) documents and uses Javascript for primary access. Mongo is primarily lauded for its speed, ease of installation, and most importantly, its maturity.” What is MongoDB?
driver • Flexible since there is no schema • Very fast (subjective.. but mostly true) • Javascript for scripting • Scaling (through sharding) • Availability (replica sets) • Maintainability (jury is still out)
escapin’) • Text search (not great - in older versions) • Joins (nope, they don’t exist) • Array support (is awesome) • Co-existence of different data version documents (can be cool) This is not SQL
JS data types, interchangeable • UTC is DEFAULT (great! but just be aware) • Counting…sucks. Find an alternative fast. • Split large documents into their component parts (multiple collections if it makes sense) This is not SQL (Deux)
($in, $elemMatch are weird…) • The driver provides builders for all the query types (query, update, sort) • Cannot update a field based on a field in the same document • Aggregation framework vs. Map-Reduce This is not SQL (Tres) - Queries
Order of fields is KEY - query can use either all the fields or a prefix of the fields • Sparse/TTL/Full • Unique index and ‘drop dupes’ - prepare to commit to that change • Can be run in background • Queries with RegEx cannot use indexes (not just in Mongo obviously…) Indexes
names - yes, this is important • Collections - shard before 256GB, even though sharding may be possible up to 400GB • Be smart about your docs...don’t over do nesting. Things can get messy very quickly without controls • Use updates/increments where possible • Upserts work best with unique index • 2 properties with same name but different type on single document can’t be deserialized (not Mongo’s fault, but check it if you can’t deserialize a document) Schema-less doesn’t mean a free for all
per database after mongo 2.2 (per mongod - server- before 2.2) • Read locks can be reused • Write locks only allow 1 write operation at a time and block reads • Operations can yield the locks Locking
official GUI (we use MongoVue…but that’s nothing to be proud of) • MMS is alright but a tad unusable • Mongo’s baked in stats are actually pretty useful, as are running ops • Profiling - meh. Tooling (or lack thereof)
and MongoExport, but be aware you lose type info • If necessary, trickle writes back - either by message queue or capped collection • Backups - this is on YOU (for a bit longer). Our routine - a python script to cycle primaries and snapshot EBSs (Don’t steal this without paying me. Thanks!) Workload Management
is pretty sweet, but not FIFO) • ElasticSearch hooks in really nicely • We use A LOT of Windows services for background work • Compact - can solve memory issues, if you need to do often, there are other issues at hand • Use Mongo when it makes sense Last Thoughts...