Slide 1

Slide 1 text

Crónica de una escala anunciada npm i dschenkelman

Slide 2

Slide 2 text

Building a product

Slide 3

Slide 3 text

Demand

Slide 4

Slide 4 text

Stabilize

Slide 5

Slide 5 text

Auth API Identity provider DB Scenario Client

Slide 6

Slide 6 text

Expected response times

Slide 7

Slide 7 text

Actual response times

Slide 8

Slide 8 text

Admit the problem

Slide 9

Slide 9 text

The problem

Slide 10

Slide 10 text

Flame graphs

Slide 11

Slide 11 text

T-shirt time

Slide 12

Slide 12 text

Password Hashing app.post('/authenticate', (req, res) => { // fetch the user by req.username from db db.users.findOne({ email: req.body.email }, (err, user) => { ... // compare bcrypt for req.password to db hash const success = bcrypt.compare(req.body.password, user.passwordHash); res.send(success ? 200 : 401); }); });

Slide 13

Slide 13 text

Scale

Slide 14

Slide 14 text

Faster Hash

Slide 15

Slide 15 text

Caching

Slide 16

Slide 16 text

Scale up

Slide 17

Slide 17 text

Multiple IdP instances ELB IdP IdP IdP IdP

Slide 18

Slide 18 text

BaaS app.use('/login', (req, res) => { // fetch the user by req.username from db db.users.findOne({ email: req.body.email }, (err, user) => { ... // compare bcrypt for req.password to db hash baas.compare(req.body.password, user.passwordHash).then((e success) => { res.send(err || !success ? 401 : 200); }); }); });

Slide 19

Slide 19 text

Auto Scaling Identity provider ELB BaaS BaaS BaaS BaaS

Slide 20

Slide 20 text

Cost comparison Price / (1M req) #req per sec / vCPU t2-micro $0.36 10.00 t2-medium $0.76 9.50 c4-large $1.53 10.00 c3-8xlarge $1.64 8.88

Slide 21

Slide 21 text

Fail gracefully

Slide 22

Slide 22 text

Bye

Slide 23

Slide 23 text

Links • http://security.stackexchange.com/a/83382 • http://www.brendangregg.com/FlameGraphs/ cpuflamegraphs.html • https://github.com/thlorenz/v8-perf/issues/4 • https://github.com/auth0/node-baas • http://docs.aws.amazon.com/AutoScaling/latest/ DeveloperGuide/US_SetUpASLBApp.html • https://gist.github.com/trevnorris/9616784

Slide 24

Slide 24 text

Thanks https://github.com/dschenkelman/bcrypt-sample @dschenkelman npm i dschenkelman