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

The Node.js Scalability Myth

The Node.js Scalability Myth

Presentation given at the BerlinJS user group on March 15, 2012.

23968f0ca75b13463d2db5343e5c2096?s=128

Felix Geisendörfer

March 16, 2012
Tweet

Transcript

  1. The Node.js Scalability Myth Felix Geisendörfer 15.03.2012 at BerlinJS user

    group
  2. (@)felixge(.de)

  3. transloadit.com (using node since v0.0.6)

  4. core contributor

  5. I need to build an über-scalable web service. It will

    be the next big thing!
  6. Easy! I will use node.js and MongoDB!

  7. Easy! I will use node.js and MongoDB!

  8. Because node.js is “scalable”, right?

  9. None
  10. Audience?

  11. Backend Developers?

  12. Are you measuring app performance in production?

  13. 1000 req / s

  14. 100 req / s

  15. 10 req / s

  16. 10 requests / per second = 864000 requests / day

    10 req / s
  17. Scalability

  18. None
  19. The Node.js Scalability Myth • Threads don’t scale • Event

    loops do
  20. The Node.js Scalability Myth • Threads don’t scale • Event

    loops do (Probably) not true in 2012 (Very likely) not relevant
  21. More relevant • Understanding scalability • Using the right tool

    for the job
  22. Vertical Scalability

  23. Adding more resources to a single node

  24. None
  25. Vertical Scalability • CPU • GPUs • Memory • Disk

    • Network
  26. CPU

  27. Computers of the future will have hundreds of cores!

  28. CPU • Node is single threaded (runs on a single

    CPU) • Using multiple CPUs requires multiple node processes (usually via prefork) • No shared memory
  29. CPU (v8) • V8 compiles JS to Assembly • Just-in-time

    compilation (JIT) • Does reasonably well in those language “benchmarks”
  30. GPUs

  31. GPUs • No support in node itself • node-cuda addon

    by Kashif Rasul
  32. Memory

  33. Memory • No hard memory limit on 64 bit (since

    node-0.6 / v8-3.6.5) • JS is a garbage collected language (avoid huge heaps) • Buffers do not count towards heap
  34. Network

  35. Network • Node’s network stack is a thin layer on

    top of underlaying system calls • Good at fully saturating network interfaces
  36. Disk

  37. Disk • Done in thread pool • Unfortunately along with

    DNS at this point • Throughput ok, but not ideal yet
  38. Horizontal Scalability

  39. Adding more nodes to a system

  40. Horizontal Scalability • Node has no horizontal scaling specific features,

    but ... • Fast networking & JSON / Buffers -> DIY
  41. Horizontal Scalability • Simple stack (requires only build tools, python)

    • Deployable without container server • Good package management via npm
  42. Horizontal Solution “I have the full solution ...”

  43. Horizontal Solution “... but unfortunately it did not fit on

    this slide”
  44. tl;dr • Know your requirements • There are no silver

    bullets
  45. Questions? Slides will be available at felixge.de

  46. Thanks