github.com/williamsbg03/thatconf2016
Want a local running example?
Highly Available Node.js
Bryan Pfremmer / Brad Williams
August 10th, 2016
March 25, 2015
The Goal
Integrate the distinct LearnVest digital client experience with
Northwestern Mutual’s financial planning and products.
• In the cloud, highly available
• Lightweight web runtimes with
latest modern frameworks
• Automated infrastructure
• Application and infrastructure
design built for failure
• Single data center with many
maintenance windows
• Heavy server runtimes for large
batch consumption
• Classic infrastructure builds
• Application and infrastructure
design built to try to prevent
failure
The Key Principle
Be Available
Brett Favre
9/27/1992 - 12/5/2010
100% Availability
http://dailysnark.com/wp-content/uploads/2016/04/131.jpg
• Split your application into small
services that can be reused,
remixed and shared.
• Enables smaller, nimble,
decoupled teams and processes.
• Lightweight runtime, starts in
seconds
• Stateless and backwards
compatible.
Microservices
http://martinfowler.com/articles/microservices.html
http://slides.eightypercent.net/kubernetes-101/kubernetes-101.html#7
• Modules cannot be blocking, we are looking for async I/O
• Module pattern encourages lightweight packages with small footprint
• Seconds to initialize
• Excellent performance
• Express.js, async, bunyan, mysql, body-parser, config, memwatch-
next, underscore, and util
Node.js
• Log important activities and errors (bunyan, winston, log4js)
• Handle SIGTERM for graceful shutdown
• Select and review NPM modules carefully
• Lock down NPM dependencies (shrinkwrap)
• Test, Test, Test (supertest, proxyquire)
• NODE_ENV = production
Node.js Production Considerations
The number of deployable artifacts increase to the point at which
automated testing, building, deploying, and monitoring becomes
essential.
But, they come at a cost…
http://techblog.netflix.com/2013/01/announcing-ribbon-tying-netflix-mid.html
How do we make microservices easier to build and deploy?
Wrap up a piece of software in a complete filesystem that contains
everything it needs to run.
• Guaranteed to always run the same,
regardless of the environment
• Start/stop almost instantly
• Efficient use of system resources
• Portable
• Easy to configure
Containers
https://www.docker.com/what-docker
Provides an implementation of containers that is actively used in the
software community. Docker illustrates how containers differ from the
traditional VM hypervisor.
Docker
https://www.docker.com/what-docker
A sea of containers…
While containers provide us with a stable build and deploy platform, we still
have many artifacts to deploy and maintain.
Kubernetes
An open-source system for automating deployment, operations, and scaling
of containerized applications.
• Ensures containers stay running
• Abstracts port managements away from the developer
• Schedules containers based on cluster health metrics
• Provides lightweight deployment and horizontal scaling
• Stores application configuration and secrets outside the container
• Deploy a set of grouped containers as a single deployable unit
Kubernetes Architecture
http://kubernetes.io
We are ready to run, but where?
With a solid application framework we can scale our application quite easily.
Without the same capability in our infrastructure we are going nowhere fast.
Automated & Immutable Infrastructure
Public cloud providers provide APIs to create infrastructure of all types. By
leveraging infrastructure as code tools we can script our entire environment.
Guidelines to code by:
• No manual changes
• Replace containers, VM’s instead of fixing them
• Rebuilds and re-deploys should take minutes
• Goal is idempotent scripts. Rerun to ensure a known working state.
Demo
Micro-App Framework
There were many benefits to microservices that we also wanted to realize in
building our web applications. So we have built what one of our senior
engineers, Ming Fang, has coined the “micro-app” pattern.
Micro-App Framework
Micro-Apps - It isn’t all unicorns and rainbows
• You need to be diligent about using a base stylesheet or style guide at a
minimum
• Header / footer needs to be simple and without dependencies to avoid
conflicts across micro-apps
• Urls that cross micro-apps are provided by the api layer
• Client storage needs a namespace to avoid any conflicts
• Production implemented March 2016. Like front-end frameworks, this is what
is in style right now. We have yet to see if this pattern will stand up over the
coming year(s)
Tech Stack
Lessons Learned
• Architect for failure
• Tag your releases for prod, run current development in non-production
• Different purchasing considerations for vendor tools when you need to
orchestrate its install and configuration
• Orchestration can make security easier
We’re Hiring!
If any of this sounds cool come talk to us at the NM booth or contact us @
northwesternmutual.com/careers. We have a number of open positions
working on everything you have seen here!
ThatConference 2016 - Highly Available Node.js

ThatConference 2016 - Highly Available Node.js

  • 3.
  • 4.
    Highly Available Node.js BryanPfremmer / Brad Williams August 10th, 2016
  • 5.
  • 6.
    The Goal Integrate thedistinct LearnVest digital client experience with Northwestern Mutual’s financial planning and products.
  • 7.
    • In thecloud, highly available • Lightweight web runtimes with latest modern frameworks • Automated infrastructure • Application and infrastructure design built for failure • Single data center with many maintenance windows • Heavy server runtimes for large batch consumption • Classic infrastructure builds • Application and infrastructure design built to try to prevent failure
  • 8.
    The Key Principle BeAvailable Brett Favre 9/27/1992 - 12/5/2010 100% Availability http://dailysnark.com/wp-content/uploads/2016/04/131.jpg
  • 9.
    • Split yourapplication into small services that can be reused, remixed and shared. • Enables smaller, nimble, decoupled teams and processes. • Lightweight runtime, starts in seconds • Stateless and backwards compatible. Microservices http://martinfowler.com/articles/microservices.html http://slides.eightypercent.net/kubernetes-101/kubernetes-101.html#7
  • 10.
    • Modules cannotbe blocking, we are looking for async I/O • Module pattern encourages lightweight packages with small footprint • Seconds to initialize • Excellent performance • Express.js, async, bunyan, mysql, body-parser, config, memwatch- next, underscore, and util Node.js
  • 11.
    • Log importantactivities and errors (bunyan, winston, log4js) • Handle SIGTERM for graceful shutdown • Select and review NPM modules carefully • Lock down NPM dependencies (shrinkwrap) • Test, Test, Test (supertest, proxyquire) • NODE_ENV = production Node.js Production Considerations
  • 12.
    The number ofdeployable artifacts increase to the point at which automated testing, building, deploying, and monitoring becomes essential. But, they come at a cost… http://techblog.netflix.com/2013/01/announcing-ribbon-tying-netflix-mid.html How do we make microservices easier to build and deploy?
  • 13.
    Wrap up apiece of software in a complete filesystem that contains everything it needs to run. • Guaranteed to always run the same, regardless of the environment • Start/stop almost instantly • Efficient use of system resources • Portable • Easy to configure Containers https://www.docker.com/what-docker
  • 14.
    Provides an implementationof containers that is actively used in the software community. Docker illustrates how containers differ from the traditional VM hypervisor. Docker https://www.docker.com/what-docker
  • 15.
    A sea ofcontainers… While containers provide us with a stable build and deploy platform, we still have many artifacts to deploy and maintain.
  • 16.
    Kubernetes An open-source systemfor automating deployment, operations, and scaling of containerized applications. • Ensures containers stay running • Abstracts port managements away from the developer • Schedules containers based on cluster health metrics • Provides lightweight deployment and horizontal scaling • Stores application configuration and secrets outside the container • Deploy a set of grouped containers as a single deployable unit
  • 17.
  • 18.
    We are readyto run, but where? With a solid application framework we can scale our application quite easily. Without the same capability in our infrastructure we are going nowhere fast.
  • 19.
    Automated & ImmutableInfrastructure Public cloud providers provide APIs to create infrastructure of all types. By leveraging infrastructure as code tools we can script our entire environment. Guidelines to code by: • No manual changes • Replace containers, VM’s instead of fixing them • Rebuilds and re-deploys should take minutes • Goal is idempotent scripts. Rerun to ensure a known working state.
  • 20.
  • 21.
    Micro-App Framework There weremany benefits to microservices that we also wanted to realize in building our web applications. So we have built what one of our senior engineers, Ming Fang, has coined the “micro-app” pattern.
  • 22.
  • 23.
    Micro-Apps - Itisn’t all unicorns and rainbows • You need to be diligent about using a base stylesheet or style guide at a minimum • Header / footer needs to be simple and without dependencies to avoid conflicts across micro-apps • Urls that cross micro-apps are provided by the api layer • Client storage needs a namespace to avoid any conflicts • Production implemented March 2016. Like front-end frameworks, this is what is in style right now. We have yet to see if this pattern will stand up over the coming year(s)
  • 24.
  • 25.
    Lessons Learned • Architectfor failure • Tag your releases for prod, run current development in non-production • Different purchasing considerations for vendor tools when you need to orchestrate its install and configuration • Orchestration can make security easier
  • 26.
    We’re Hiring! If anyof this sounds cool come talk to us at the NM booth or contact us @ northwesternmutual.com/careers. We have a number of open positions working on everything you have seen here!