Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building a Firehose with NodeJS

Building a Firehose with NodeJS

August 2011 Forward First Tuesday - building a firehose in nodeJS

Avatar for Luca Grulla

Luca Grulla

April 23, 2012
Tweet

More Decks by Luca Grulla

Other Decks in Technology

Transcript

  1. Firehose   Building    a  real-­‐1me  data  stream  with  NodeJS

        Luca  Grulla@Forward   London,  2/8/2011    
  2. Living  the  asynchronous  dream     •  Error  manifests  itself

     only  at  high  throughput   (7MB/secs)   •  The  few  implementa1ons  you  can  find  around   are  wrong  (including  Log.io  –  we  are  planning   to  contribute  back)  
  3. Learnings   •  You  need  to  think  asynchronous  to  write

      asynchronous  code   •  Dispatch  internal  events  if  you  need  to  keep   control  of  the  flow   •  “Internal  queues”  to  scale(up  to  a  certain   limit)  
  4. Performance   •  Beyond  5MB  we  start  to  fill  the

     internal  queue   •  We  are  limited  by  IO,  not  from  CPU/memory   •  Consistent  throughput  
  5. Event-­‐driven  approach   •  Event-­‐driven  is  implicitly  declara1ve   – You

     tell  to  the  world  that  something  just   happened  and  do  not  care  of  what  next   •  Fire  events  instead  of  passing  around  states   – It’s  cleaner   – It’s  simpler  to  maintain   – It’s  idioma1c