SlideShare a Scribd company logo
Building Node Microservices with Docker
Rami Sayar - @ramisayar
Senior Technical Evangelist
Microsoft Canada
@RAMISAYAR
@RAMISAYAR
Something is not quite right…
Imagefrom http://www.alumaeasyset.com/galleries/monolithic-application/
Monolithic Applications are One
GIANT Point of Failure.
@RAMISAYAR
@ramisayar
@RAMISAYAR
Agenda
• What are Microservices?
• Pros and Cons of Microservice Architecture
• Converting a Monolithic Express Web App into
Microservices
• Patterns to Handle Networking Between Frontend &
Backend
• What are Containers? Docker?
• How to use Docker to Run Microservices
@RAMISAYAR
I neverintended to make a monolithicapplication,
it just happened…
@RAMISAYAR
The Problem with MonolithicApplications
@RAMISAYAR
The Problem with MonolithicApplications
@RAMISAYAR
Introducing Microservices
• A microservice can be a small, fairly-independent (decoupled)
code package that fulfils a single specific task.
• Microservices would form the building blocks of a modular
application.
• In the context of a webapp, your microservices would be
organized around capabilities e.g. authentication, web UI
storefront, recommendation, etc.
@RAMISAYAR
Introducing Microservices
@RAMISAYAR
Image from http://ryanjbaxter.com/2015/07/15/using-microservices-to-build-cloud-native-applications-part-1/
Why Node.js is Well Suited for Microservices
• Follows the UNIX philosophy: Write programs that do one thing
and do it well.
• NPM makes package management and deployment easy.
• Straight-forward networking API.
@RAMISAYAR
Benefits of Microservices Architecture
• Loosely Coupled: Each microservice is independent
• Separate teams can work at different paces
• Easier upgrade path for each microservice
• Smaller code bases make for easier deployments
• Easier for new team members to jump into development
• Refactoring no longer halts development
• Easy to scale heavily used microservices without scaling the
entire app
• You can use the best language/framework/platform for the job
• With Docker Containers, this is even easier
@RAMISAYAR
Disadvantages of Microservices Architecture
• Outsourcing in-process communication to the network stack
• Heavier DevOps requirements on the dev team
• Need to monitor more moving parts and manage more complex
infrastructure
• Networking, service discovery, etc…
• Data sharing and data modeling is hard
• Ideally, each microservice should have per-service db
@RAMISAYAR
In Practice– ConvertinganExpress App into
Microservices
@RAMISAYAR
Sample App: The PizzaBotManager
Github.com/sayar/PizzaBotManager
@RAMISAYAR
React – The Definitive Guide – ITSFREE!!!
bit.ly/reactmva
@RAMISAYAR
PizzaBotManager Web App
• Prototypical monolithic express web app that has three
functionalities:
1. Handle conversations from different chat apps using the Bot
Framework: /api/messages
2. Serve the frontend for the pizza chain manager: /
3. Provide an API to see current pizza orders and ovens in operation:
/api/orders
• Backend follows an Asynchronous Message Queue pattern
• Each functionality has different scaling requirements
• Functionality 2 would be better served by nginx.
@RAMISAYAR
ConvertingPizzaBotManagerinto Microservices
@RAMISAYAR
ConvertingPizzaBotManagerinto Microservices
@RAMISAYAR
DoingThis The Non-Hacky Way
@RAMISAYAR
Common Microservices Requirements
• Service Registration & Discovery
• Automatic Routing & Configuration
Optional:
• Service Monitoring
• Health Endpoints
• Cross-origin resource sharing (CORS) support
@RAMISAYAR
Using Express-Microservice-Starter
• An express-based bootstrapping module for building
microservices with Node.js - github.com/ph0bos/express-
microservice-starter
@RAMISAYAR
Using Express-Microservice-Starter
var express = require('express');
var micro = require('express-microservice-starter');
var app = express();
app.use(micro({ discoverable: false, debug: true }));
@RAMISAYAR
Patternsto Handle NetworkingBetweenFrontend
& Backend
@RAMISAYAR
Requirements for the Networking Stack
• Service Registration & Discovery
• Automatic Routing & Configuration
• We also want:
• Authentication
• Security
• Load Balancing
@RAMISAYAR
API Gateway Pattern
• API Gateway is basically a
Dynamically Configured
Reverse Proxy Server.
• Single Access Point for HTTP
API Requests
@RAMISAYAR
DNS Pattern
• Each microservice has it’s own publically addressable URL.
• myservice.mywebsite.com/api/v1/table
• No single point of failure and easy to setup and scale
• Doesn’t follow the DRY principle
• Individual handling of common concerns like security, authentication,
etc.
• Tempting for each microservice to become it’s own project
• Forces you to use CORS
@RAMISAYAR
Implementing API Gateways
• API Gateways can be implemented with several different
technologies:
• Docker and Swarm Mode – Containers and Orchestration
• Nginx – Reliable, high performance async web server.
• HAProxy - Reliable, high Performance TCP/HTTP load balancer.
• Kong - Open-source API Gateway and Microservices manager layer.
• Skipper - HTTP router on top of a reverse proxy.
• Træfɪk - A modern HTTP reverse proxy and load balancer made to
deploy microservices with ease.
• Tyk - Open source API gateway, dev portal and management
dashboard.
@RAMISAYAR
Deployingto the Cloud with Docker
@RAMISAYAR
Introductionto Containers & Docker
• Docker is an open source project to pack, ship and run any app as a lightweight container.
• Lightweight alternative to virtual machines
• Smaller, less expensive, faster to start up, and self-contained
Host Operating System
Hypervisor
Guest OS
Libraries
App
Guest OS
Libraries
App
Guest OS
Libraries
App
Operating System
Container Engine
Libraries
App
Libraries
App
Libraries
App
Virtual Machines
Containers
Docker
• Leading open-source
containerization platform
• Supported natively in Azure
Docker containers wrap up a piece of software
in a complete filesystem that contains
everything it needs to run: code, runtime,
system tools, system libraries – anything you
can install on a server. This guarantees that it
will always run the same, regardless of the
environment it is running in
Underneath Docker
• Docker leverages libcontainer (previously LXC containers),
which encompasses Linux features like cgroups and
namespaces for strong process isolation and resource control.
• Docker leverages a copy-on-write filesystem.
• Docker uses a “plain text” configuration language to control the
configuration of a container.
@RAMISAYAR
Docker Architecture
Docker CLI
• Command-line interface for Docker, available for Linux, OS X,
and Windows (available separately or as part of Docker
Toolbox)
Running a Container
docker run -i -t ubuntu /bin/bash
Common DockerCLI Commands
docker run - Use an image to run a container
docker pull - Pull an image from a registry
docker build - Build a Docker image
docker exec - Execute a command in a container
docker stop - Stop a running container
docker images - List available Docker images
docker ps - List running Docker containers
Azure Container Service
• Provides robust, ready-to-use Docker hosting environment
• Uses open-source orchestration tools (DC/OS and Swarm)
Container Orchestration
• Facilitates deployment and management of containers
• Containers by design are intended to be deployed in large
volumes with some applications using dozens to even
thousands of containers
• With this type of scale, automating container deployment and
management with orchestration software becomes necessary
• Azure Container service supports Kubernetes, DC/OS, and
Docker Swarm
Container Clusters
• Facilitate load balancing, scalability, and high availability
• A cluster is composed of master nodes which control the
orchestration, and agent nodes that host the containers
DeployingourPizzaBotManagerwith Docker
@RAMISAYAR
PizzaBotManager Microservices Web App
@RAMISAYAR
ReinventingThe Wheel– Building a Simple API
Gateway
Demo - Building a Simple API Gateway
Thanks to memz.co/api-gateway-microservices-docker-node-js/
@RAMISAYAR
Register/ as it’s own “API”
The API Gateway will just do an HTTP Proxy anyways.
@RAMISAYAR
Next Steps?
Docker Container Orchestration
@RAMISAYAR
Kubernetes
• Open-source orchestration engine from Google
• Provides a robust framework for container orchestration, yet
remains lightweight and scalable
• Supported by Azure Container Service and tightly integrated
with ACS, allowing Kubernetes to modify deployments
DC/OS
• Datacenter Operating System built on Apache Mesos
• Creates logical data centers and abstracts underlying hardware
• Provides resources traditionally provided by infrastructure,
including networking, DNS, and load balancing
• Natively supported by Azure Container Service
Docker Swarm
• Docker’s own orchestration engine
• Current releases of the Docker engine have
“Swarm Mode” built in and can many of the
same things that other orchestration
engines do
• Lacks a GUI, but makes up for it with tight
integration with Docker
• Natively supported by Azure Container
Service
Some Tips for Running Node.js Microservices
• Cache your DNS results: Node does not cache the results of
DNS queries (OS issue because OS doesn’t expose TTL)
• Reuse HTTP Connections: Node’s global HTTP agent disables
HTTP Keep-Alive by default.
• Tell Node if it’s running in less than 1.5G of memory:
node --max_old_space_size=400 server.js --production
@RAMISAYAR
In conclusion,what did we learn?
• Microservice Archigtecture, Pros and Cons.
• Converting a PizzaBotManager into Microservices
• Handling Networking with API Gateways & DNS
• Learned about Dockers and Containers
• Learned about Kubernetes, Swarm and DC/OS.
@RAMISAYAR
ThankYou! Questions?
tw: @ramisayar | gh: @sayar
@RAMISAYAR
Resources, References, Links
• express-microservice-starter
• Building Microservices: Using an API Gateway
• awesome-microservices
• Node.js Microservice Optimisations
• Microservices with Weave, Docker and Node.js on Ubuntu
@RAMISAYAR
Resources, References, Links
• Why Enterprises Are Embracing Microservices and Node.js
• Breaking Down the Monolith - Peter Marton, RisingStack
• express-micro-service
• How To Do Microservices with Node.js
• An Introduction to Microservices, Part 1
• API Gateway. An Introduction to Microservices, Part 2
• API Gateway for Dockerized Microservices
• Nginx as a reverse proxy for dockerized microservices
@RAMISAYAR
©2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the
U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft
must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after
the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related Content

PPTX
Why Docker
PDF
Docker HK Meetup - 201707
PDF
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
PDF
Docker Overview - Rise of the Containers
PDF
Docker for Java Developers
PPTX
Docker and Microsoft - Windows Server 2016 Technical Deep Dive
PDF
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
PDF
Docker for Java Developers
Why Docker
Docker HK Meetup - 201707
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
Docker Overview - Rise of the Containers
Docker for Java Developers
Docker and Microsoft - Windows Server 2016 Technical Deep Dive
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
Docker for Java Developers

What's hot (20)

PDF
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
PDF
Docker and Containers overview - Docker Workshop
PDF
Real-World Docker: 10 Things We've Learned
PPTX
Docker 101 - High level introduction to docker
PPTX
Docker and stuff
PDF
Docker for Java Developers - Fabiane Nardon and Arun gupta
ODP
Docker - The Linux Container
PDF
Containers, Docker, and Microservices: the Terrific Trio
PDF
A Shift from Monolith to Microservice using Docker
PDF
PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...
PDF
How we dockerized a startup? #meetup #docker
PDF
Modernizing Java Apps with Docker
PPT
Docker, a new LINUX container technology based light weight virtualization
PPTX
Your journey into the serverless world
PDF
Commit to excellence - Java in containers
PDF
Docker From Scratch
PDF
Java in a World of Containers - DockerCon 2018
PDF
Docker to the Rescue of an Ops Team
PDF
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
PDF
Docker Birthday #3 - Intro to Docker Slides
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
Docker and Containers overview - Docker Workshop
Real-World Docker: 10 Things We've Learned
Docker 101 - High level introduction to docker
Docker and stuff
Docker for Java Developers - Fabiane Nardon and Arun gupta
Docker - The Linux Container
Containers, Docker, and Microservices: the Terrific Trio
A Shift from Monolith to Microservice using Docker
PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...
How we dockerized a startup? #meetup #docker
Modernizing Java Apps with Docker
Docker, a new LINUX container technology based light weight virtualization
Your journey into the serverless world
Commit to excellence - Java in containers
Docker From Scratch
Java in a World of Containers - DockerCon 2018
Docker to the Rescue of an Ops Team
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Docker Birthday #3 - Intro to Docker Slides
Ad

Similar to Rami Sayar - Node microservices with Docker (20)

PPTX
UNITde II - Docker-Containerization.pptx,
PPTX
ma-formation-en-Docker-jlklk,nknkjn.pptx
PPTX
Containers and Docker
PPTX
Docker & aPaaS: Enterprise Innovation and Trends for 2015
PPTX
Docker - Portable Deployment
PPTX
Docker for the enterprise
PDF
Containers, microservices and serverless for realists
PDF
Orchestrating Linux Containers while tolerating failures
PPTX
Docker-Intro
PPTX
Containerization with Azure
PPTX
Microservices and Best Practices
PPTX
Docker - HieuHoang
PDF
Dockers and kubernetes
PPTX
Intro to docker and kubernetes
PPTX
Docker Overview
PDF
DEVOPS UNIT 4 docker and services commands
PDF
week8_watermark.pdfhowcanitbe minimum 40 i
PDF
Week 8 lecture material
PDF
Serverless brewbox
UNITde II - Docker-Containerization.pptx,
ma-formation-en-Docker-jlklk,nknkjn.pptx
Containers and Docker
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker - Portable Deployment
Docker for the enterprise
Containers, microservices and serverless for realists
Orchestrating Linux Containers while tolerating failures
Docker-Intro
Containerization with Azure
Microservices and Best Practices
Docker - HieuHoang
Dockers and kubernetes
Intro to docker and kubernetes
Docker Overview
DEVOPS UNIT 4 docker and services commands
week8_watermark.pdfhowcanitbe minimum 40 i
Week 8 lecture material
Serverless brewbox
Ad

More from Web à Québec (20)

PDF
Kevin Bélanger
PDF
Gabriel LeBreton
PDF
Rémi Prévost
PDF
Ludivine Durand
PDF
Julie Simard
PDF
Guillaume Labbé-Morissette
PDF
Katherine Mailloux
PDF
Denis Martel
PDF
Charles Davignon
PDF
Frédérick Capovilla
PDF
Cynthia Thibault-Larouche
PDF
Louis-André Labadie
PDF
Christophe Clouzeau
PPTX
Intelligence artificielle, Données massives et Internet des objets: Quels son...
PDF
So you want to be a service designer - Jamin Hegeman
PDF
AI & the future of the political party - Colin Megill
PPTX
comment le Canada peut Gagner dans le secteur du numérique - Alex Benay
PPTX
Rendre son équipe performante : plus simple qu'on le pense - Louis-Philippe C...
PDF
Turning Research Ripples Into Waves: Growing UX Research Capacity Through Col...
PDF
Complexité et systèmes opérables - Fred Hébert
Kevin Bélanger
Gabriel LeBreton
Rémi Prévost
Ludivine Durand
Julie Simard
Guillaume Labbé-Morissette
Katherine Mailloux
Denis Martel
Charles Davignon
Frédérick Capovilla
Cynthia Thibault-Larouche
Louis-André Labadie
Christophe Clouzeau
Intelligence artificielle, Données massives et Internet des objets: Quels son...
So you want to be a service designer - Jamin Hegeman
AI & the future of the political party - Colin Megill
comment le Canada peut Gagner dans le secteur du numérique - Alex Benay
Rendre son équipe performante : plus simple qu'on le pense - Louis-Philippe C...
Turning Research Ripples Into Waves: Growing UX Research Capacity Through Col...
Complexité et systèmes opérables - Fred Hébert

Recently uploaded (20)

PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Approach and Philosophy of On baking technology
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
KodekX | Application Modernization Development
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Weekly Chronicles - August'25 Week I
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
Approach and Philosophy of On baking technology
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Mobile App Security Testing_ A Comprehensive Guide.pdf
KodekX | Application Modernization Development
Diabetes mellitus diagnosis method based random forest with bat algorithm
“AI and Expert System Decision Support & Business Intelligence Systems”
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Unlocking AI with Model Context Protocol (MCP)
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Per capita expenditure prediction using model stacking based on satellite ima...

Rami Sayar - Node microservices with Docker

  • 1. Building Node Microservices with Docker Rami Sayar - @ramisayar Senior Technical Evangelist Microsoft Canada @RAMISAYAR
  • 2. @RAMISAYAR Something is not quite right… Imagefrom http://www.alumaeasyset.com/galleries/monolithic-application/
  • 3. Monolithic Applications are One GIANT Point of Failure. @RAMISAYAR
  • 5. Agenda • What are Microservices? • Pros and Cons of Microservice Architecture • Converting a Monolithic Express Web App into Microservices • Patterns to Handle Networking Between Frontend & Backend • What are Containers? Docker? • How to use Docker to Run Microservices @RAMISAYAR
  • 6. I neverintended to make a monolithicapplication, it just happened… @RAMISAYAR
  • 7. The Problem with MonolithicApplications @RAMISAYAR
  • 8. The Problem with MonolithicApplications @RAMISAYAR
  • 9. Introducing Microservices • A microservice can be a small, fairly-independent (decoupled) code package that fulfils a single specific task. • Microservices would form the building blocks of a modular application. • In the context of a webapp, your microservices would be organized around capabilities e.g. authentication, web UI storefront, recommendation, etc. @RAMISAYAR
  • 10. Introducing Microservices @RAMISAYAR Image from http://ryanjbaxter.com/2015/07/15/using-microservices-to-build-cloud-native-applications-part-1/
  • 11. Why Node.js is Well Suited for Microservices • Follows the UNIX philosophy: Write programs that do one thing and do it well. • NPM makes package management and deployment easy. • Straight-forward networking API. @RAMISAYAR
  • 12. Benefits of Microservices Architecture • Loosely Coupled: Each microservice is independent • Separate teams can work at different paces • Easier upgrade path for each microservice • Smaller code bases make for easier deployments • Easier for new team members to jump into development • Refactoring no longer halts development • Easy to scale heavily used microservices without scaling the entire app • You can use the best language/framework/platform for the job • With Docker Containers, this is even easier @RAMISAYAR
  • 13. Disadvantages of Microservices Architecture • Outsourcing in-process communication to the network stack • Heavier DevOps requirements on the dev team • Need to monitor more moving parts and manage more complex infrastructure • Networking, service discovery, etc… • Data sharing and data modeling is hard • Ideally, each microservice should have per-service db @RAMISAYAR
  • 14. In Practice– ConvertinganExpress App into Microservices @RAMISAYAR
  • 15. Sample App: The PizzaBotManager Github.com/sayar/PizzaBotManager @RAMISAYAR
  • 16. React – The Definitive Guide – ITSFREE!!! bit.ly/reactmva @RAMISAYAR
  • 17. PizzaBotManager Web App • Prototypical monolithic express web app that has three functionalities: 1. Handle conversations from different chat apps using the Bot Framework: /api/messages 2. Serve the frontend for the pizza chain manager: / 3. Provide an API to see current pizza orders and ovens in operation: /api/orders • Backend follows an Asynchronous Message Queue pattern • Each functionality has different scaling requirements • Functionality 2 would be better served by nginx. @RAMISAYAR
  • 20. DoingThis The Non-Hacky Way @RAMISAYAR
  • 21. Common Microservices Requirements • Service Registration & Discovery • Automatic Routing & Configuration Optional: • Service Monitoring • Health Endpoints • Cross-origin resource sharing (CORS) support @RAMISAYAR
  • 22. Using Express-Microservice-Starter • An express-based bootstrapping module for building microservices with Node.js - github.com/ph0bos/express- microservice-starter @RAMISAYAR
  • 23. Using Express-Microservice-Starter var express = require('express'); var micro = require('express-microservice-starter'); var app = express(); app.use(micro({ discoverable: false, debug: true })); @RAMISAYAR
  • 25. Requirements for the Networking Stack • Service Registration & Discovery • Automatic Routing & Configuration • We also want: • Authentication • Security • Load Balancing @RAMISAYAR
  • 26. API Gateway Pattern • API Gateway is basically a Dynamically Configured Reverse Proxy Server. • Single Access Point for HTTP API Requests @RAMISAYAR
  • 27. DNS Pattern • Each microservice has it’s own publically addressable URL. • myservice.mywebsite.com/api/v1/table • No single point of failure and easy to setup and scale • Doesn’t follow the DRY principle • Individual handling of common concerns like security, authentication, etc. • Tempting for each microservice to become it’s own project • Forces you to use CORS @RAMISAYAR
  • 28. Implementing API Gateways • API Gateways can be implemented with several different technologies: • Docker and Swarm Mode – Containers and Orchestration • Nginx – Reliable, high performance async web server. • HAProxy - Reliable, high Performance TCP/HTTP load balancer. • Kong - Open-source API Gateway and Microservices manager layer. • Skipper - HTTP router on top of a reverse proxy. • Træfɪk - A modern HTTP reverse proxy and load balancer made to deploy microservices with ease. • Tyk - Open source API gateway, dev portal and management dashboard. @RAMISAYAR
  • 29. Deployingto the Cloud with Docker @RAMISAYAR
  • 30. Introductionto Containers & Docker • Docker is an open source project to pack, ship and run any app as a lightweight container. • Lightweight alternative to virtual machines • Smaller, less expensive, faster to start up, and self-contained Host Operating System Hypervisor Guest OS Libraries App Guest OS Libraries App Guest OS Libraries App Operating System Container Engine Libraries App Libraries App Libraries App Virtual Machines Containers
  • 31. Docker • Leading open-source containerization platform • Supported natively in Azure Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in
  • 32. Underneath Docker • Docker leverages libcontainer (previously LXC containers), which encompasses Linux features like cgroups and namespaces for strong process isolation and resource control. • Docker leverages a copy-on-write filesystem. • Docker uses a “plain text” configuration language to control the configuration of a container. @RAMISAYAR
  • 34. Docker CLI • Command-line interface for Docker, available for Linux, OS X, and Windows (available separately or as part of Docker Toolbox)
  • 35. Running a Container docker run -i -t ubuntu /bin/bash
  • 36. Common DockerCLI Commands docker run - Use an image to run a container docker pull - Pull an image from a registry docker build - Build a Docker image docker exec - Execute a command in a container docker stop - Stop a running container docker images - List available Docker images docker ps - List running Docker containers
  • 37. Azure Container Service • Provides robust, ready-to-use Docker hosting environment • Uses open-source orchestration tools (DC/OS and Swarm)
  • 38. Container Orchestration • Facilitates deployment and management of containers • Containers by design are intended to be deployed in large volumes with some applications using dozens to even thousands of containers • With this type of scale, automating container deployment and management with orchestration software becomes necessary • Azure Container service supports Kubernetes, DC/OS, and Docker Swarm
  • 39. Container Clusters • Facilitate load balancing, scalability, and high availability • A cluster is composed of master nodes which control the orchestration, and agent nodes that host the containers
  • 42. ReinventingThe Wheel– Building a Simple API Gateway Demo - Building a Simple API Gateway Thanks to memz.co/api-gateway-microservices-docker-node-js/ @RAMISAYAR
  • 43. Register/ as it’s own “API” The API Gateway will just do an HTTP Proxy anyways. @RAMISAYAR
  • 44. Next Steps? Docker Container Orchestration @RAMISAYAR
  • 45. Kubernetes • Open-source orchestration engine from Google • Provides a robust framework for container orchestration, yet remains lightweight and scalable • Supported by Azure Container Service and tightly integrated with ACS, allowing Kubernetes to modify deployments
  • 46. DC/OS • Datacenter Operating System built on Apache Mesos • Creates logical data centers and abstracts underlying hardware • Provides resources traditionally provided by infrastructure, including networking, DNS, and load balancing • Natively supported by Azure Container Service
  • 47. Docker Swarm • Docker’s own orchestration engine • Current releases of the Docker engine have “Swarm Mode” built in and can many of the same things that other orchestration engines do • Lacks a GUI, but makes up for it with tight integration with Docker • Natively supported by Azure Container Service
  • 48. Some Tips for Running Node.js Microservices • Cache your DNS results: Node does not cache the results of DNS queries (OS issue because OS doesn’t expose TTL) • Reuse HTTP Connections: Node’s global HTTP agent disables HTTP Keep-Alive by default. • Tell Node if it’s running in less than 1.5G of memory: node --max_old_space_size=400 server.js --production @RAMISAYAR
  • 49. In conclusion,what did we learn? • Microservice Archigtecture, Pros and Cons. • Converting a PizzaBotManager into Microservices • Handling Networking with API Gateways & DNS • Learned about Dockers and Containers • Learned about Kubernetes, Swarm and DC/OS. @RAMISAYAR
  • 50. ThankYou! Questions? tw: @ramisayar | gh: @sayar @RAMISAYAR
  • 51. Resources, References, Links • express-microservice-starter • Building Microservices: Using an API Gateway • awesome-microservices • Node.js Microservice Optimisations • Microservices with Weave, Docker and Node.js on Ubuntu @RAMISAYAR
  • 52. Resources, References, Links • Why Enterprises Are Embracing Microservices and Node.js • Breaking Down the Monolith - Peter Marton, RisingStack • express-micro-service • How To Do Microservices with Node.js • An Introduction to Microservices, Part 1 • API Gateway. An Introduction to Microservices, Part 2 • API Gateway for Dockerized Microservices • Nginx as a reverse proxy for dockerized microservices @RAMISAYAR
  • 53. ©2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.