際際滷

際際滷Share a Scribd company logo
Mongo	
 Gotchas	
 
     by	
 Billy	
 Chasen	
 
Founder,	
 CEO	
 turntable.fm	
 
      @billychasen
video	
 
www.youtube.com/watch?v=shgHA7lKJaY
How	
 we	
 use	
 mongo	
 
≒   All	
 turntable	
 room	
 state	
 in	
 mongo	
 
≒   All	
 persistent	
 data	
 
≒   Logging	
 (use	
 safe	
 =	
 False)	
 
≒   Incredibly	
 fast,	
 make	
 sure	
 you	
 give	
 it	
 enough	
 
     RAM
ConnecPons	
 
≒ The	
 magic	
 number	
 819	
 
    Depends	
 on	
 open	
 鍖le	
 limits	
 
    Throws	
 a	
 vague	
 cannot	
 connect	
 to	
 primary/slave	
 
      error
Threads	
 
≒ CauPon	
 when	
 using	
 pymongo	
 with	
 Tornado	
 
≒ Use	
 libraries	
 like	
 async	
 mongo	
 for	
 Tornado
Indexes	
 
≒ Important!	
 	
 Analyze	
 every	
 query	
 you	
 use	
 with	
 
   explain()	
 and	
 monitor	
 slow	
 query	
 log
OpPmize	
 returned	
 data	
 
≒ If	
 you	
 have	
 large	
 objects,	
 request	
 only	
 needed	
 
   鍖elds	
 
≒ Its	
 like	
 using	
 SELECT	
 uid,name	
 FROM	
 user
Were	
 hiring!	
 
≒ jobs@turntable.fm	
 
≒ VP	
 Tech	
 
≒ Sysops

More Related Content

Mongo gotchas