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

Node At Collective

Node At Collective

Short presentation for the Charlottesville Javascript Group on why we use Node.js for our HTTP APIs at Collective.com

Avatar for brendengrace

brendengrace

June 13, 2012
Tweet

Other Decks in Programming

Transcript

  1. Your Moderator Director of Engineering, Collective Collective is a brand

    focused, online display advertiser. ... which means we put ads on your web pages ... Wrote and maintain em- mongo, a ruby eventmachine MongoDB* driver. What's this Ruby guy doing here?
  2. A Day At Collective Serves around one Billion ad requests

    and receives about 2.5 Billion http requests Generates around 500 Gb of log data Dozens of partners with strict SLAs Hundreds of active campaigns driving hundreds of thousands of dollars in revenue
  3. Why We Node / Async 30k times a second we

    have the potential to respond in more than 10 ms 30k requests a second ... is a lot Sub 10 ms response times* ... is not a lot Every time we don't respond to a request quickly enough it costs us money. Errors cascade very quickly at this scale
  4. Synchronous Process Browser Single Process 1 ms 15 ms 16

    ms 8 ms Browser 16 ms 24 ms 11 ms 4 ms Single path of execution Easy to test Easy to debug Clean code Trickle down latency IO blocks execution !@?$ Your Ad Could Be Here!
  5. MOAR Synchronous Processes Browser Single Process 1 ms 15 ms

    16 ms 8 ms Browser 16 ms 24 ms Browser Single Process 1 ms 15 ms 16 ms 8 ms Browser 16 ms 24 ms Too Lazy To Draw The Backend Services Again
  6. Asynchronous Single Process Browser Single Async Process 1 ms 15

    ms 1 ms 8 ms Browser 16 ms 9 ms 1 ms 9 ms Browser 10 ms 11 ms 4 ms 5 ms Callbacks Can't block the event loop Harder to test Nasty to debug Web scale !!! IO is "free"
  7. Topics For Discussion • At what scale is the additional

    complexity warranted? • How can one mitigate the complexity of callbacks and events? • Javascript "all the way down" a good thing? • Easier than threads? • Using evented / async models in other programming languages (Ruby, Python, etc) • V8 is awesome. • Clojure (we are at Roomkey...)