Slide 1

Slide 1 text

Effective Node.js Architectures @dshaw

Slide 2

Slide 2 text

Daniel D. Shaw @dshaw

Slide 3

Slide 3 text

I like to build things with Node

Slide 4

Slide 4 text

Build Node Things • Storify • Spreecast • Node Knockout • Voxer • The Node Firm

Slide 5

Slide 5 text

Do Less Well

Slide 6

Slide 6 text

FP for Distributed Architectures

Slide 7

Slide 7 text

What do I do? - your processes

Slide 8

Slide 8 text

Evolutionary Shapes • ALL THE THINGS! • Generalization • Specialization • One Thing

Slide 9

Slide 9 text

ALL THE THINGS Mixture

Slide 10

Slide 10 text

ALL THE THINGS Easy to run, multi-process, single execution point.

Slide 11

Slide 11 text

Generalization Not all apps need to aspire to be the next Facebook.

Slide 12

Slide 12 text

Scale Will you really need it?

Slide 13

Slide 13 text

Building and Planning Node.js application

Slide 14

Slide 14 text

Generalization • Express + Socket.io + API • Website + API • Restify

Slide 15

Slide 15 text

Am I doing too much?

Slide 16

Slide 16 text

Trade-offs

Slide 17

Slide 17 text

Trade-offs • Expensive loads limit conjoined services. • Impact of exceptions and crashes. • Deployment complexity. • Deployment isolation. • Evolve services independently.

Slide 18

Slide 18 text

Dumb Clusters Simple Pooling

Slide 19

Slide 19 text

Dumb Cluster • Static file server • Simple web sites • Minimal client/server • API server hosts

Slide 20

Slide 20 text

Pooling Tools • Round Robin DNS • Varnish • Nginx • HAProxy • ...more node

Slide 21

Slide 21 text

Pooling Tools • Substack - seaport, etc • Nodejitsu - node-http-proxy • Poolee - battle tested at Voxer

Slide 22

Slide 22 text

Distribute Load Data store(s) have the definitive answers

Slide 23

Slide 23 text

Smarter Clusters Session Affinity

Slide 24

Slide 24 text

Sticky Sessions

Slide 25

Slide 25 text

Sticky Sessions Resources • 3rd party infrastructure • HAProxy • nginx • stud-proxy - Mikeal

Slide 26

Slide 26 text

Smart Clusters (Consistent Hash Rings)

Slide 27

Slide 27 text

Why? Complex interactions or data persistence

Slide 28

Slide 28 text

Properties of Consistent Hash Rings • Deterministic • Change has minimal impact on determinism • Crunchy middle?

Slide 29

Slide 29 text

House of Pain Complexity

Slide 30

Slide 30 text

Consistent Hash Ring Resources • node-hashring - 3rdEden • node-hash-ring - Brian Noguchi, C++, dated • Build your own

Slide 31

Slide 31 text

Right for the Task As simple as possible

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

Thank You! <3 dshaw