meteor-4-mongodb-chicago

 meteor-4-mongodb-chicago

096f047781bb62f845ce89793fd9ab29?s=128

Pallavi Anderson

November 19, 2013
Tweet

Transcript

  1. Real-­‐Time  Web   Apps  Using   MongoDB  and   Meteor

      Pallavi  Anderson     MongoDB  Chicago  2013    
  2.              “…the  best  teams,  with

     the  biggest  budgets  and  the   longest  schedules,  now  build  applicaBons  in   JavaScript  that  run  on  the  client.  These  apps  have   stellar  interfaces.  They  don't  reload  pages.  They  are   reacBve:  changes  from  any  client  immediately   appear  on  everyone's  screen.  They've  built  them  the   hard  way.  Meteor  makes  it  an  order  of  magnitude   simpler,  and  a  lot  more  fun.”     “...an  ultra-­‐simple  environment  for  building    modern  web  apps.”  
  3. A  BRIEF  HISTORY  OF     APPLICATION  ARCHITECTURE  

  4. View   Client   Thin   Client   Server  

    Master   Model   Model   Controller   VT100  /  3270     SERVE  PRESENTATION   (frame  buffers)   View   Controller   View   Server   MAINFRAME  APPS  
  5. Local   Model   Model   Controller   View  

    Controller   View   Thick   Client   Server   Master   Model   Model   Controller   RPC,  ONC,  NFS,  IPX     SERVE  DATA   DESKTOP  APPS  
  6. View   Client   Thin   Client   Server  

    Master   Model   Model   Controller   HTTP       SERVE  PRESENTATION   (HTML)   WEB  APPS   View   Controller   View   Server  
  7. View   Controller   View   Thin(-­‐ish)   Client  

    Server   Master   Model   Model   Controller   WEB  2.0  APPS   Model   Controller   View   Controller   View   JSON  over  HTTP     SERVE  DATA  
  8. Local   Model   Model   Controller   View  

    Controller   View   Thick   Client   Server   Master   Model   Model   Controller   DDP     SERVE  DATA   METEOR  APPS  
  9. THE  NEW  RULES  

  10. RICH   HIGHLY  INTERACTIVE   MOST  APP  LOGIC  ON  CLIENT

      REAL  DATABASE  CACHE  ON  CLIENT  
  11. CONCURRENT   MULTI  USER  ×  MULTI  DEVICE   POLLING  FOR

     DATABASE  UPDATES  =  EVIL   NEED  DISTRIBUTED  OBSERVER  PATTERN   NEED  COORDINATED  DATABASE  INVALIDATIONS  
  12. MOBILE   UNRELIABLE  NETWORK:  LATENCY,  CONNECTION  LOSS    USABLE  OFFLINE

      POLLING  =  TRULY  EVIL  
  13. LONG  LIVED   NEED  “REAL-­‐TIME”  (ASYNCHRONOUS)  UPDATES   NEED  BI-­‐DI

     CLIENT-­‐SERVER  COMMUNICATION   HTTP  STATELESS  &  UNIDIRECTIONAL   REST  DOES  NOT  SUPPORT  A-­‐11-­‐ITY  INHERENTLY  
  14. ENTER  METEOR  

  15. DATABASE   EVERYWHERE   MINIMONGO  ON  CLIENT   OBSERVABLE  COLLECTIONS

      DYNAMIC  DATA  PROTOCOL  (DDP)  
  16. None
  17. DATA  ON  THE  WIRE   PUBLISH     SUBSCRIBE  

      LIVE  QUERIES  ON  COLLECTIONS        
  18. /client   /server  

  19. LATENCY   COMPENSATION   METHODS:  REPEAT  MODEL  CODE  ON  CLIENT

     &  SERVER   CLIENT  DATABASE  DRIVES  UI   (ALSO  ADDRESS  OFFLINE  SURVIVAL)   LAZY  SYNC  WITH  OPTIMISTIC  CONCURRENCY    
  20. /common  

  21. REALTIME  MONGO            NOW:  HEURISTICS  AND

     POLLING          1.0:  OPLOG  TAIL          FUTURE:  NATIVE  OBSERVE  IN  DB  ENGINE?    
  22. FULL  STACK  REACTIVITY   REALTIME  MONGO  ON  SERVER   MINIMONGO

     LIVE  QUERIES   REACTIVE  HANDLEBARS  TEMPLATES     REACTIVE  SESSION  VARIABLE   HOT  CODE  PUSHES  TO  CLIENTS    
  23. /client  HTML   /client  JS  helper  

  24. ONE  LANGUAGE   JAVASCRIPT  NODE  MONGO   BUT  APP  ASSETS

     ARE  HANDLED  DIFFERENTLY   /client   /server   /*  
  25. ADVANCED  TOPICS  

  26. SECURITY   SECURE  DATA  API  FOR  ACCESS  CONTROL   SECURITY

     MODEL:  TRUST  BUT  VERIFY   FULL  FEATURED  AUTH  SYSTEM   OPTIONAL  CUSTOMIZABLE  ACCOUNTS  UI  WIDGETS   DROP-­‐IN  FEDERATED  OAUTH  2.0  MODULES     (FB,  GOOGLE,  TWITTER,  GITHUB,  WEIBO)    
  27. /common  

  28. /server  

  29. /client  

  30. FIBERS   +  EXPLICITLY  YIELDING  NON-­‐PREEMPTIVE  BLOCKS   +  LOW

     SYNCHRONIZATION  OVERLOAD   -­‐  NO  REAL  PARALLELISM    -­‐  IMPACT  ON  CONCURRENCY  /  PERFORMANCE?   -­‐  REQUIRE  DOES  NOT  WORK  ON  CLIENT  
  31. HOW  DO  I…?            TEMPLATE:  

       HANDLEBARS          STYLE:        BOOTSTRAP          ROUTE:        MINI-­‐PAGES,  IRONROUTER          TEST:        LAIKA          CI?:        TRAVIS    
  32. THE  BIG  PICTURE  

  33. FOUNDERS  HAVE   SERIOUS  CRED   HUSTLE:  ETHERPAD,  MIXAPP,  ASANA,

     ACTBLUE      PAAS:  GOOGLE  APP  ENGINE  &  APPJET     REAL-­‐TIME:  GOOGLE  WAVE,  ETHERPAD  &  MIXAPP   GEEK:  MIT  UNDERGRADS  
  34. POWERFUL,  FLEXIBLE  &   FREE   MIT  LICENSED   OPEN

     ROADMAP   OPEN  ABOUT  MONETIZATION  PLANS  
  35. …AND  IT  HAS   MOMENTUM   MOORE’S  LAW   HTML5

     &  ADVANCED  MOBILE  BROWSERS   OPEN  STANDARDS  &  TOOLING     $11.2M  IN  FUNDING  
  36. HELPFUL  LINKS   •  hTp://www.meetup.com/Meteor-­‐Chicago/  (Meteor  Chicago)   •  hlp://docs.meteor.com

     (pay  alenmon  to  the  upper-­‐right  Server  /  Client  /  Anywhere)   •  hlps://github.com/oortcloud/unofficial-­‐meteor-­‐faq  (FAQ  for  development  in  meteor)   •  hlps://trello.com/board/meteor-­‐roadmap/508721606e02bb9d570016ae  (Roadmap)   •  hlps://github.com/oortcloud/meteorite  (smart  package  manager)   •  hlps://atmosphere.meteor.com/  (community  package  repository)   •  Discover  Meteor  (Book)  hlp://www.discovermeteor.com   •  Evented  Mind  (Screencasts)  hlps://www.eventedmind.com   •  Meteor  Hacks  (Blog,  Newsleler)  hlp://meteorhacks.com    
  37. OH  BTW…  

  38. HELLO!   Feedback  welcome  (content,  coverage,  meetups,  classes)!   Twiler:

     @pkaushik   Email:  pkaushik@alum.mit.edu   Web:  hlp://asynchrotron.com     hlps://speakerdeck.com/pkaushik/meteor-­‐4-­‐mongodb-­‐chicago  
  39. DEMO