10
TUESDAY, AUGUST16 TH , 2011 Happiness is MongoDB Daniel Doubrovkine (dB.) | @dblockdotorg | http://art.sy

2011 08-16 MongoNYC

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: 2011 08-16 MongoNYC

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

Page 2: 2011 08-16 MongoNYC

Art Genome Project

Kasimir Malevich – “Self Portrait” - vs. - William Beckman – “Self Portrait”

Page 3: 2011 08-16 MongoNYC

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|

Page 4: 2011 08-16 MongoNYC

MySQL Prototype: Schema

Page 5: 2011 08-16 MongoNYC

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.

Page 6: 2011 08-16 MongoNYC

MongoDB

Genome.genes – it’s a hash!{ “Career Stage” => 100, …, “Conceptual” => 20 }

Genome, Embedded in Artwork

Locality Sensitive Hashing

Page 7: 2011 08-16 MongoNYC

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

Page 8: 2011 08-16 MongoNYC

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

Page 9: 2011 08-16 MongoNYC

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

Page 10: 2011 08-16 MongoNYC

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