highly available nodejs
TRANSCRIPT
![Page 1: Highly available nodejs](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/1.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/2.jpg)
Highly Available Node.jsBryan Pfremmer / Brad Williams
April 4th, 2016
![Page 3: Highly available nodejs](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/3.jpg)
March 25, 2015
![Page 4: Highly available nodejs](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/4.jpg)
The GoalIntegrate the distinct LearnVest digital client experience with Northwestern Mutual’s financial planning and products.
![Page 5: Highly available nodejs](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/5.jpg)
• 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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/6.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/7.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.htmlhttp://slides.eightypercent.net/kubernetes-101/kubernetes-101.html#7
![Page 8: Highly available nodejs](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/8.jpg)
• 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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/9.jpg)
• 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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/10.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/11.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/12.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/13.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/14.jpg)
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 16: Highly available nodejs](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/16.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/17.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/18.jpg)
Demo
![Page 19: Highly available nodejs](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/19.jpg)
Tech Stack
![Page 20: Highly available nodejs](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/20.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062401/58edb6a21a28abf6328b45cd/html5/thumbnails/21.jpg)
Thank You