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

Integrating Node.js

Integrating Node.js

Slides from NodejsConf.it talk

Andrew Nesbitt

November 10, 2012

More Decks by Andrew Nesbitt

Other Decks in Technology


  1. Integrating Node.js into an existing technology stack

  2. Andrew Nesbitt github.com/andrew @teabass

  3. forwardtechnology.co.uk

  4. None
  5. None
  6. None
  7. Show of hands

  8. Benefits of Node

  9. Legacy Systems

  10. Benefits of integration

  11. Let’s do this!

  12. 1. Standalone Tools

  13. Command line tools Asset minification Pixel Trackers Url shorteners Internal

    tools Monitoring Chat bots Examples
  14. Legacy App Internal tool Internal tool Internal tool Internal tool

  15. Easy to setup Very little integration Little experience needed Pros

  16. Extra dependencies Knowledge silos Cons

  17. 2. Shared databases

  18. Connect directly existing database Read from a data warehouse Share

    data with a key-value store Examples
  19. Legacy App DB Node

  20. Quick and dirty Adapters for almost every DB available Slow

    databases not a problem Pros
  21. Duplicating domain logic Race-conditions Your DBA will likely hate you

  22. None
  23. 3. Using APIs

  24. Use API from existing application Linkedin Mobile Github Downloads Examples

  25. Legacy App DB Node

  26. Avoid duplication of domain logic JSON APIs are lovely to

    work with Plays to Nodes strengths Pros
  27. Extra load on existing application Might have to build/extend existing

    API What if the legacy app goes down? Cons
  28. 4. Creating APIs

  29. Websocket Services Streaming services APIs for Mobile Apps Proxy serivces

    File upload handling Ebay’s ql.io Examples
  30. DB Node Clients

  31. Handle very load Lots of concurrent connections JSON comes naturally

  32. Cons You now have a dependeny on Node System adminstration

    Teaching others about it
  33. mysql Rails Disc Cache Nginx Redis Node Browser Pusher http://live.mpora.com

    Mpora Live
  34. 5. Message Queues

  35. ZeroMQ Resque Redis Pubsub dnode Examples

  36. Message Queue Legacy App Node Legacy Worker

  37. 6. Streams

  38. Twitter, Facebook, Salesforce HTTP long polling Comet XMPP Examples

  39. 7. Embedding

  40. Ruby Racer Android Hadoop and Timothy Sprintstack PLV8 Examples

  41. create or replace function fib(n int) returns int as $$

    function fib(n) { return n<2 ? n : fib(n-1) + fib(n-2) } return fib(n) $$ LANGUAGE plv8 IMMUTABLE STRICT;
  42. http://pgeu-plv8.herokuapp.com

  43. Legacy App Node

  44. Scripting within compiled languages Use existing, battle tested software Enable

    Node on embedded devices Pros
  45. Under heavy development You need to know the host platform

    Context switching overhead Cons
  46. Take a unix-like approach Decoupled Systems Use APIs to share

    data Play to node’s strengths Summary
  47. Node on Andriod - lanyrd.com/smpbg Rails and Node.js - lanyrd.com/srmwr

    Hadoop and Timothy - lanyrd.com/sttxx Rhinode (Sprintstack) - lanyrd.com/srmwx These slides - lanyrd.com/szwyc Links