$30 off During Our Annual Pro Sale. View Details »

Integrating Node.js

Integrating Node.js

Slides from NodejsConf.it talk

Andrew Nesbitt

November 10, 2012
Tweet

More Decks by Andrew Nesbitt

Other Decks in Technology

Transcript

  1. Integrating
    Node.js
    into an existing
    technology stack

    View Slide

  2. Andrew Nesbitt
    github.com/andrew
    @teabass

    View Slide

  3. forwardtechnology.co.uk

    View Slide

  4. View Slide

  5. View Slide

  6. View Slide

  7. Show of hands

    View Slide

  8. Benefits of Node

    View Slide

  9. Legacy Systems

    View Slide

  10. Benefits of
    integration

    View Slide

  11. Let’s do this!

    View Slide

  12. 1. Standalone Tools

    View Slide

  13. Command line tools
    Asset minification
    Pixel Trackers
    Url shorteners
    Internal tools
    Monitoring
    Chat bots
    Examples

    View Slide

  14. Legacy App
    Internal tool
    Internal tool
    Internal tool
    Internal tool

    View Slide

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

    View Slide

  16. Extra dependencies
    Knowledge silos
    Cons

    View Slide

  17. 2. Shared databases

    View Slide

  18. Connect directly existing database
    Read from a data warehouse
    Share data with a key-value store
    Examples

    View Slide

  19. Legacy App
    DB
    Node

    View Slide

  20. Quick and dirty
    Adapters for almost every DB available
    Slow databases not a problem
    Pros

    View Slide

  21. Duplicating domain logic
    Race-conditions
    Your DBA will likely hate you
    Cons

    View Slide

  22. View Slide

  23. 3. Using APIs

    View Slide

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

    View Slide

  25. Legacy App
    DB
    Node

    View Slide

  26. Avoid duplication of domain logic
    JSON APIs are lovely to work with
    Plays to Nodes strengths
    Pros

    View Slide

  27. Extra load on existing application
    Might have to build/extend existing API
    What if the legacy app goes down?
    Cons

    View Slide

  28. 4. Creating APIs

    View Slide

  29. Websocket Services
    Streaming services
    APIs for Mobile Apps
    Proxy serivces
    File upload handling
    Ebay’s ql.io
    Examples

    View Slide

  30. DB
    Node
    Clients

    View Slide

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

    View Slide

  32. Cons
    You now have a dependeny on Node
    System adminstration
    Teaching others about it

    View Slide

  33. mysql
    Rails
    Disc Cache
    Nginx
    Redis
    Node
    Browser
    Pusher
    http://live.mpora.com
    Mpora Live

    View Slide

  34. 5. Message Queues

    View Slide

  35. ZeroMQ
    Resque
    Redis Pubsub
    dnode
    Examples

    View Slide

  36. Message
    Queue
    Legacy App
    Node
    Legacy
    Worker

    View Slide

  37. 6. Streams

    View Slide

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

    View Slide

  39. 7. Embedding

    View Slide

  40. Ruby Racer
    Android
    Hadoop and Timothy
    Sprintstack
    PLV8
    Examples

    View Slide

  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;

    View Slide

  42. http://pgeu-plv8.herokuapp.com

    View Slide

  43. Legacy App
    Node

    View Slide

  44. Scripting within compiled languages
    Use existing, battle tested software
    Enable Node on embedded devices
    Pros

    View Slide

  45. Under heavy development
    You need to know the host platform
    Context switching overhead
    Cons

    View Slide

  46. Take a unix-like approach
    Decoupled Systems
    Use APIs to share data
    Play to node’s strengths
    Summary

    View Slide

  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

    View Slide