Upload
daniel-doubrovkine
View
1.626
Download
2
Embed Size (px)
DESCRIPTION
Citation preview
T U E S D AY, A U G U S T 1 6 T H , 2 0 1 1
Happiness is MongoDB
Daniel Doubrovkine (dB.) | @dblockdotorg | http://art.sy
Art Genome Project
Kasimir Malevich – “Self Portrait” - vs. - William Beckman – “Self Portrait”
Nearest Neighbor Search in High-Dimensional Space
𝑑=√(100−40)2+(0−100)2+…+(0−60)2
Euclidean Distance
artworks.each { |a2| d = euclidean(a1, a2)}.sort by |d|
MySQL Prototype: Schema
MySQL Prototype: Schema
• Need a sorted vector of values, including zeroes: [ 100, 0, 20, … 60 ] on boot
Annoying …10K artworks: 5 minutes to startup
… accomplishes nothing.
MongoDB
Genome.genes – it’s a hash!{ “Career Stage” => 100, …, “Conceptual” => 20 }
Genome, Embedded in Artwork
Locality Sensitive Hashing
Choosing MongoDB
Got (too) many years of experience with *SQL / DW
@harryh uses it @ 4sq@eliothorowitz looks pretty smartdb.startups.find(
{ location : { $near : GA }, category : ‘nosql database vendor' } ).first = 10gen
install … ? … profitavailable on Heroku from MongoHQmuch better for continuous deployment
Tidbits
MongoDB retrieval by ID is as fast, if not faster, than Ruby Hash Using Rails + Rake and Mongo is safer than mongo shell
db.collection.update({x: y})
Shared Hosting is not Rubber, You Can’t Stretch It Map/reduce for live queries really doesn’t work, no really
mongoid_fulltext
Read-secondary + Map/Reduce can be fun read_secondary: <%= $rails_rake_task.nil? or !$rails_rake_task %>
Collection names are limited in length if you use mongodumphttps://jira.mongodb.org/browse/SERVER-2973
copyDatabase requires administrative privilegeshttps://jira.mongodb.org/browse/SERVER-2846
Mongo cursors aren’t snapshotted by defaultProcessing 5183 of 4012 …http://www.mongodb.org/display/DOCS/How+to+do+Snapshotted+Queries+in+the+Mongo+Database
Mongo Interest is growing, RoR + MongoId = GTDhttp://code.dblock.org/ror-win-getting-things-done-with-mongodb-mongoid
Dev/Staging/Production
MongoHQ Extensions via Heroku Production Directly w/MongoHQ
A Few Hundred Bucks / mo. Mongo 1.8.1 w/ replica sets, 2 DBs and 1 arbiter Different Availability Zones Dedicated RAM, separate EBS, shared CPU Early Issues, Now Very Stable Jason McCay + other folks @ MongoHQ = Awesome
Mongoid 2.0.2
mongoid_slug mongoid_fulltext mongoid_history delayed_job_mongoid
name: Daniel Doubrovkine (aka. dB.)
company: http://art.sy ^ work here
twitter: @dblockdotorg blog: http://code.dblock.org ^ link to slides here
email: [email protected]
We *heart* MongoDB