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

Node.js - In Production

Node.js - In Production

Talk given on 25.05.2012 at Web Rebels in Oslo. Included a lot of live coding, video available here: https://vimeo.com/43380478

Felix Geisendörfer

June 16, 2012
Tweet

More Decks by Felix Geisendörfer

Other Decks in Programming

Transcript

  1. Transloadit Today • 75 TB files processed • 5 -

    100 Servers • Bootstrapped & Profitable
  2. The Smart Way to node(tm) • Wait for node to

    be stable enough • Learn how to host on PaaS • Learn how to host it yourself
  3. The Smart Way to node(tm) • Wait for node to

    be stable enough • Learn how to host on PaaS • Learn how to host it yourself ✔
  4. The Smart Way to node(tm) • Wait for node to

    be stable enough • Learn how to host on PaaS • Learn how to host it yourself ✔ ‏
  5. The Smart Way to node(tm) • Wait for node to

    be stable enough • Learn how to host on PaaS • Learn how to host it yourself ✔ ✔
  6. The Smart Way to node(tm) • Wait for node to

    be stable enough • Learn how to host on PaaS • Learn how to host it yourself ✔ ✔ ‏
  7. iptables • Forward traffic from port 80 to another port

    • sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000 • Safe, simple, flexible
  8. Reverse Proxy • Haproxy, Nginx, etc. • Useful for other

    routing, file serving • Watch out for buffering, web sockets, etc.
  9. The Build • I recommend to vendor node with your

    app • Build server makes sure node is compiled • *.tar.gz can be deployed to same Kernel / Architecture
  10. The Deploy • Another CI job • Get’s list of

    machines to deploy to • Uploads .tar.gz, stops old app, starts new one via SSH
  11. Gather metrics • Requests / Events per Second (Meters) •

    Response times (Histograms) • Number of items in queue (Gauges)
  12. The Smart Way to node(tm) • Wait for node to

    be stable enough • Learn how to host on PaaS • Learn how to host it yourself ✔ ✔ ✔
  13. Node.js is good for: • I/O bound workloads (streaming data)

    • Long running connections (web sockets) • Code sharing between server / client