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

Scale your node application...forget the infrastructure

Scale your node application...forget the infrastructure

Delivered at CodeMash 2017 - You don’t have to look far to find yet another article on scaling your NodeJS app to handle large numbers of users. But the techniques covered usually involve becoming an expert in deploying hardware or a guaranteed minimum outlay of cash to handle your expected load. But what if there were a way to scale almost infinitely without having to worry about the infrastructure to run any of it. Using platforms like AWS Lambda, Azure Functions, and IBM OpenWhisk, you can focus on providing scalable functionality in your NodeJS application without having to think about any of infrastructure details. In this session, Matt Williams will show you how to get started building a complex Node application on AWS Lambda from scratch. Starting with the standard CLI, we move to other frameworks like Node Lambda and Serverless to add more functionality to serve your users. We will consider some key architectural decisions that affect how the application is designed. And all the way along we look at ways to monitor the application to help find the bottlenecks. By the end of the session, you will be eager to start working on your next application on AWS Lambda.

Matt Williams

January 12, 2017
Tweet

More Decks by Matt Williams

Other Decks in Technology

Transcript

  1. HOW DO YOU FIX THIS? Do Less Tweak & Tune

    Throw Hardware at it Refactor Rearchitect
  2. You have spent as much time on the app as

    on the infrastructure THIS TIME IS DIFFERENT
  3. t2.large t2.xl t2.2xl m4.large m4.2xl c4.large r4.large 1 67 135

    270.72 77.76 310.32 72 95.76 2 135 271 541 155 621 144 192 3 203 406 812 233 931 216 287
  4. RUN THE NUMBERS Run a Lambda function every 5 minutes

    s/m 1s 5s 10s 128 3,200,000 370 74 37 256 1,600,000 185 37 18 512 800,000 93 18 9 1024 400,000 46 9 5 1536 266,666 31 6 3 0.0025 cents / second thereafter for 1.5G
  5. NATIVE GOTCHAS Lambda runs on an Amazon Linux container... ...and

    your dev box is probably not Amazon Linux... ...so native NPM modules are problematic
  6. NATIVE NPM 1. Launch Amazon Linux ec2 2. Use a

    node version manager 3. Install node 4.3 4. Install the native modules you need 5. Package the modules and dl to your box 6. Deploy
  7. 3 OPTIONS FOR MONITORING LAMBDA 1. Add a custom metric

    to CloudWatch 2. Add metric directly to monitoring application 3. Add a line to the CloudWatch logs
  8. HOW WE DO IT Add a line to the CloudWatch

    logs:          !"