21
Presentation Prep (sorry, macs only…) Follow the instructions here: https://github.com/pfremm/kube-demo References: We will be playing a cloned Facebook React todo application: https://github.com/williamsbg03/todomvc https://hub.docker.com/r/williamsbg03/todomvc/

Highly available nodejs

  • Upload
    pfremm

  • View
    293

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Highly available nodejs

Presentation Prep (sorry, macs only…)Follow the instructions here:

https://github.com/pfremm/kube-demo

References:We will be playing a cloned Facebook React todo application:

https://github.com/williamsbg03/todomvchttps://hub.docker.com/r/williamsbg03/todomvc/

Page 2: Highly available nodejs

Highly Available Node.jsBryan Pfremmer / Brad Williams

April 4th, 2016

Page 3: Highly available nodejs

March 25, 2015

Page 4: Highly available nodejs

The GoalIntegrate the distinct LearnVest digital client experience with Northwestern Mutual’s financial planning and products.

Page 5: Highly available nodejs

• 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

Page 6: Highly available nodejs

The Key PrincipleBe Available

Brett Favre9/27/1992 - 12/5/2010

100% Availability

http://dailysnark.com/wp-content/uploads/2016/04/131.jpg

Page 7: Highly available nodejs

• 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.htmlhttp://slides.eightypercent.net/kubernetes-101/kubernetes-101.html#7

Page 8: Highly available nodejs

• 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

Page 9: Highly available nodejs

• 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

Page 10: Highly available nodejs

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?

Page 11: Highly available nodejs

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

Page 12: Highly available nodejs

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

Page 13: Highly available nodejs

A sea of containers…While containers provide us with a stable build and deploy platform, we still have many artifacts to deploy and maintain.

Page 14: Highly available nodejs

KubernetesAn 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

Page 15: Highly available nodejs

Kubernetes Architecture

http://kubernetes.io

Page 16: Highly available nodejs

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.

Page 17: Highly available nodejs

Automated & Immutable InfrastructurePublic 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.

Page 18: Highly available nodejs

Demo

Page 19: Highly available nodejs

Tech Stack

Page 20: Highly available nodejs

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

Page 21: Highly available nodejs

Thank You