SlideShare ist ein Scribd-Unternehmen logo
1 von 70
Downloaden Sie, um offline zu lesen
Highly Scalable

Node.js Microservices




Chris Bailey
(@Chris__Bailey) 

Node.js and Swift Runtimes
Chris Vignola
(@ChrisVignola) 

Cloud Native Node.js
: Key Technologies
: Key Technologies
Container
: Key Technologies
Container Orchestration
: Key Technologies
Container Orchestration
Package and Deploy
: Key Technologies
Container Orchestration
MonitoringPackage and Deploy
: Key Technologies
Container Orchestration
Monitoring Distributed TracingPackage and Deploy
MICROSERVICES: Key Performance Characteristics
IO Speed
• Performance
• Scale
0
300
600
900
200
0
1,150
IO Speed
• Performance
• Scale
MICROSERVICES: Key Performance Characteristics
0
300
600
900
200
0
1,150
IO Speed
• Performance
• Scale
MICROSERVICES: Key Performance Characteristics
0
300
600
900
200
897
1,150
MICROSERVICES: Key Performance Characteristics
IO Speed
• Performance
• Scale
0
300
600
900
200
897
1,150
Startup
• Availability
• Scaling
MICROSERVICES: Key Performance Characteristics
IO Speed
• Performance
• Scale
0
300
600
900
200
897
1,150
00.9
Startup
• Availability
• Scaling
MICROSERVICES: Key Performance Characteristics
IO Speed
• Performance
• Scale
0
300
600
900
200
897
1,150 13.7
0.9
Startup
• Availability
• Scaling
MICROSERVICES: Key Performance Characteristics
IO Speed
• Performance
• Scale
0
300
600
900
200
897
1,150 13.7
0.9
Startup
• Availability
• Scaling
Memory
• Efficiency
• Cost
MICROSERVICES: Key Performance Characteristics
IO Speed
• Performance
• Scale
0
300
600
900
200
897
1,150 13.7
0.9 023.6
Startup
• Availability
• Scaling
Memory
• Efficiency
• Cost
MICROSERVICES: Key Performance Characteristics
IO Speed
• Performance
• Scale
0
300
600
900
200
897
1,150 13.7
0.9
422
23.6
Startup
• Availability
• Scaling
Memory
• Efficiency
• Cost
MICROSERVICES: Key Performance Characteristics
IO Speed
• Performance
• Scale
Startup
• Availability
• Scaling
Memory
• Efficiency
• Cost
Benchmarking WG: Performance Gains
IO Speed
• Performance
• Scale
Startup
• Availability
• Scaling
Memory
• Efficiency
• Cost
3,049
2,914
2,076
1,866
4.x master6.x 8.x
Benchmarking WG: Performance Gains
IO Speed
• Performance
• Scale
Startup
• Availability
• Scaling
Memory
• Efficiency
• Cost
50,42052,640
42,500
71,000
3,049
2,914
2,076
1,866
4.x master6.x 8.x 4.x master6.x 8.x
Benchmarking WG: Performance Gains
IO Speed
• Performance
• Scale
Startup
• Availability
• Scaling
Memory
• Efficiency
• Cost
50,42052,640
42,500
71,000
89,024
92,84091,47688,9603,049
2,914
2,076
1,866
4.x master6.x 8.x 4.x master6.x 8.x 4.x master6.x 8.x
Benchmarking WG: Performance Gains
IO Speed
• Performance
• Scale
Building Scalable
Microservices
func add(_ a: Int,
to b: Int) -> Void
{
print(a + b)
}
let a = ”5”
let b = 3
public/*
test/*
server/server.js
package.json
README.md
.gitignore
func add(_ a: Int,
to b: Int) -> Void
{
print(a + b)
}
let a = ”5”
let b = 3
public/*
test/*
server/server.js
package.json
README.md
.gitignore
const appName = require('./../package').name;
const express = require('express');
const log4js = require(‘log4js');
const logger = log4js.getLogger(appName);
const app = express();
app.get('/', function (req, res) {
res.send('Hello World!')
})
const port = process.env.PORT || 3000;
app.listen(port, function(){
logger.info(`Express listening on: ` + port);
});
func add(_ a: Int,
to b: Int) -> Void
{
print(a + b)
}
let a = ”5”
let b = 3
public/*
test/*
server/server.js
package.json
README.md
.gitignore
Dockerfile
Dockerfile-tools
.dockerignore
func add(_ a: Int,
to b: Int) -> Void
{
print(a + b)
}
let a = ”5”
let b = 3
public/*
test/*
server/server.js
package.json
README.md
.gitignore
Dockerfile
Dockerfile-tools
.dockerignore
FROM ibmcom/ibmnode
ENV NODE_ENV production
ENV PORT 3000
WORKDIR "/app"
# Install app dependencies
COPY package.json /app/
RUN cd /app; npm install
# Bundle app source
COPY . /app
EXPOSE 3000
CMD ["npm", "start"]
func add(_ a: Int,
to b: Int) -> Void
{
print(a + b)
}
let a = ”5”
let b = 3
public/*
test/*
server/server.js
package.json
README.md
.gitignore
Dockerfile
Dockerfile-tools
.dockerignore
node_modules/
npm-debug.log
$ docker build -t <your username>/node-app .

$ docker build -t <your username>/node-app .

$ docker run -p 49160:3000 -d <your username>/node-app
$ docker build -t <your username>/node-app .

$ docker run -p 49160:3000 -d <your username>/node-app
$ docker build -t <your username>/node-app .

$ docker run -p 49160:3000 -d <your username>/node-app
func add(_ a: Int,
to b: Int) -> Void
{
print(a + b)
}
let a = ”5”
let b = 3
public/*
test/*
server/server.js
package.json
README.md
.gitignore
Dockerfile
Dockerfile-tools
.dockerignore
chart/node-app/Chart.yaml
chart/node-app/templates/deployment.yaml
chart/node-app/templates/hpa.yaml
chart/node-app/templates/service.yaml
chart/node-app/values.yaml
HELM CHARTS
func add(_ a: Int,
to b: Int) -> Void
{
print(a + b)
}
let a = ”5”
let b = 3
public/*
test/*
server/server.js
package.json
README.md
.gitignore
Dockerfile
Dockerfile-tools
.dockerignore
chart/node-app/Chart.yaml
chart/node-app/templates/deployment.yaml
chart/node-app/templates/hpa.yaml
chart/node-app/templates/service.yaml
chart/node-app/values.yaml
HELM CHARTS
apiVersion: v1
description: A Helm chart for Kubernetes
name: node-app
version: 1.0.0
func add(_ a: Int,
to b: Int) -> Void
{
print(a + b)
}
let a = ”5”
let b = 3
public/*
test/*
server/server.js
package.json
README.md
.gitignore
Dockerfile
Dockerfile-tools
.dockerignore
chart/node-app/Chart.yaml
chart/node-app/templates/deployment.yaml
chart/node-app/templates/hpa.yaml
chart/node-app/templates/service.yaml
chart/node-app/values.yaml
HELM CHARTS
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: “node-app-deployment"
labels:
chart: “node-app-1.0.0”
spec:
replicas: “5”
revisionHistoryLimit: “1”
template:
metadata:
labels:
app: “node-app-selector"
version: “1.0.0”
spec:
containers:
- name: “node-app”
image: “repository:1.0.0”
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 3000
periodSeconds: 1000
resources:
requests:
cpu: "200m"
memory: "300Mi"
env:
- name: PORT
value : “3000”
func add(_ a: Int,
to b: Int) -> Void
{
print(a + b)
}
let a = ”5”
let b = 3
public/*
test/*
server/server.js
package.json
README.md
.gitignore
Dockerfile
Dockerfile-tools
.dockerignore
chart/node-app/Chart.yaml
chart/node-app/templates/deployment.yaml
chart/node-app/templates/hpa.yaml
chart/node-app/templates/service.yaml
chart/node-app/values.yaml
HELM CHARTS
apiVersion: autoscaling/v2alpha1
kind: HorizontalPodAutoscaler
metadata:
name: “node-app-hpa-policy"
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1beta1
kind: Deployment
name: “node-app-deployment"
minReplicas: 5
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 70
- type: Resource
resource:
name: memory
targetAverageUtilization: 70
func add(_ a: Int,
to b: Int) -> Void
{
print(a + b)
}
let a = ”5”
let b = 3
public/*
test/*
server/server.js
package.json
README.md
.gitignore
Dockerfile
Dockerfile-tools
.dockerignore
chart/node-app/Chart.yaml
chart/node-app/templates/deployment.yaml
chart/node-app/templates/hpa.yaml
chart/node-app/templates/service.yaml
chart/node-app/values.yaml
HELM CHARTS
apiVersion: v1
kind: Service
metadata:
name: “node-app“
labels:
chart: “node-app-1.0.0”
spec:
type: NodePort
ports:
- port: 3000
selector:
app: “node-app-selector"
$ helm package ./chart/node-app
$ helm package ./chart/node-app
$ helm install ./node-app-1.0.0.tgz
$ helm package ./chart/node-app
$ helm install ./node-app-1.0.0.tgz
$ helm package ./chart/node-app
$ helm install ./node-app-1.0.0.tgz
Understanding
Microservices Performance
PUBLIC NETWORK CLOUD NETWORK
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR

FRONTEND
MICROSERVICES SERVICES
LOAD

BALANCER
PUBLIC NETWORK CLOUD NETWORK
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR

FRONTEND
MICROSERVICES SERVICES
LOAD

BALANCER
PUBLIC NETWORK CLOUD NETWORK
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR

FRONTEND
MICROSERVICES SERVICES
LOAD

BALANCER
PUBLIC NETWORK CLOUD NETWORK
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR

FRONTEND
MICROSERVICES SERVICES
LOAD

BALANCER
PUBLIC NETWORK CLOUD NETWORK
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR

FRONTEND
MICROSERVICES SERVICES
LOAD

BALANCER
PUBLIC NETWORK CLOUD NETWORK
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR

FRONTEND
MICROSERVICES SERVICES
LOAD

BALANCER
PUBLIC NETWORK CLOUD NETWORK
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR

FRONTEND
MICROSERVICES SERVICES
LOAD

BALANCER
BROWSER
TIME
BROWSER
LOAD BALANCER
TIME
BROWSER
LOAD BALANCER
WEB BFF
TIME
BROWSER
LOAD BALANCER
WEB BFF
ORDER SERVICE
TIME
BROWSER
LOAD BALANCER
WEB BFF
ORDER SERVICE
MongoDB
TIME
BROWSER
LOAD BALANCER
WEB BFF
ORDER SERVICE
MongoDB
INVENTORY SERVICE
TIME
MySQL
BROWSER
LOAD BALANCER
WEB BFF
ORDER SERVICE
MongoDB
INVENTORY SERVICE
TIME
MySQL
BROWSER
LOAD BALANCER
WEB BFF
ORDER SERVICE
MongoDB
INVENTORY SERVICE
MongoDB
TIME
• Collects data from each enabled service

• Propagates correlation ID using HTTP headers

• Provides sampling, tracing, and debug capabilities
• Collects microsecond timestamps

• Correlates data in Zipkin server
• Presents data in Zipkin dashboard
Request Tracking: OpenTracing and Zipkin
const zipkin = require(‘appmetrics-zipkin’);
const rest = require(‘rest');
const express = require('express');
const app = express();
app.get('/', (req, res) => {
rest('http://localhost:9000/api')
.then(response => res.send(response.entity))
.catch(err => console.error('Error', err.stack));
});
const port = process.env.PORT || 3000;
app.listen(port, function(){
logger.info(`Express listening on: ` + port);
});
• Collects data from each enabled service

• Requires /metrics endpoint providing data

• Provides storage and correlation capabilities
• Provide customisable dashboard

• Integrates with Graphana, Graphite, etc
Microservice Metrics: Prometheus
const zipkin = require(‘appmetrics-zipkin’);
const prometheus = require(‘appmetrics-prometheus’).attach();
const rest = require(‘rest');
const express = require('express');
const app = express();
app.get('/', (req, res) => {
rest('http://localhost:9000/api')
.then(response => res.send(response.entity))
.catch(err => console.error('Error', err.stack));
});
const port = process.env.PORT || 3000;
app.listen(port, function(){
logger.info(`Express listening on: ` + port);
});
• ‘appmetrics-dash’ provides self-hosted monitoring

• Inbound and Outbound request performance
• Resource and event loop monitoring
• Request a node-report

• Enable profiling and flame graphs
Deep Analysis: ‘appmetrics-dash’ and Flame Graphs
const zipkin = require(‘appmetrics-zipkin’);
const prometheus = require(‘appmetrics-prometheus’).attach();
const dash = require(‘appmetrics-dash’).attach();
const rest = require(‘rest');
const express = require('express');
const app = express();
app.get('/', (req, res) => {
rest('http://localhost:9000/api')
.then(response => res.send(response.entity))
.catch(err => console.error('Error', err.stack));
});
const port = process.env.PORT || 3000;
app.listen(port, function(){
logger.info(`Express listening on: ` + port);
});
‘appmetrics-dash’
‘appmetrics-dash’
‘appmetrics-dash’
$ yo nodeserver$ yo nodeserver
developer.ibm.com/node
const rest = require(‘rest');
const express = require('express');
const CLSContext = require('zipkin-context-cls');
const {Tracer} = require('zipkin');
const {recorder} = require('./recorder');
const ctxImpl = new CLSContext('zipkin');
const tracer = new Tracer({ctxImpl, recorder});
const app = express();
const zipkinMiddleware = require('zipkin-instrumentation-express').expressMiddleware;
app.use(zipkinMiddleware({tracer, serviceName: 'frontend'}));
const {restInterceptor} = require('zipkin-instrumentation-cujojs-rest');
const zipkinRest = rest.wrap(restInterceptor, {tracer, remoteServiceName: ‘backend'});

app.get('/', (req, res) => {
zipkinRest('http://localhost:9000/api')
.then(response => res.send(response.entity))
.catch(err => console.error('Error', err.stack));
});

Weitere ähnliche Inhalte

Was ist angesagt?

Deploying deep learning models with Kubernetes and Kubeflow
Deploying deep learning models with Kubernetes and KubeflowDeploying deep learning models with Kubernetes and Kubeflow
Deploying deep learning models with Kubernetes and Kubeflow
DataPhoenix
 

Was ist angesagt? (20)

Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
 
Final terraform
Final terraformFinal terraform
Final terraform
 
Run your Java apps on Cloud Foundry
Run your Java apps on Cloud FoundryRun your Java apps on Cloud Foundry
Run your Java apps on Cloud Foundry
 
Debasihish da final.ppt
Debasihish da final.pptDebasihish da final.ppt
Debasihish da final.ppt
 
Helm intro
Helm introHelm intro
Helm intro
 
Using Terraform.io (Human Talks Montpellier, Epitech, 2014/09/09)
Using Terraform.io (Human Talks Montpellier, Epitech, 2014/09/09)Using Terraform.io (Human Talks Montpellier, Epitech, 2014/09/09)
Using Terraform.io (Human Talks Montpellier, Epitech, 2014/09/09)
 
Heat and its resources
Heat and its resourcesHeat and its resources
Heat and its resources
 
Terraform - Taming Modern Clouds
Terraform  - Taming Modern CloudsTerraform  - Taming Modern Clouds
Terraform - Taming Modern Clouds
 
Developingapiplug insforcs-151112204727-lva1-app6891
Developingapiplug insforcs-151112204727-lva1-app6891Developingapiplug insforcs-151112204727-lva1-app6891
Developingapiplug insforcs-151112204727-lva1-app6891
 
Heat optimization
Heat optimizationHeat optimization
Heat optimization
 
Deploying deep learning models with Kubernetes and Kubeflow
Deploying deep learning models with Kubernetes and KubeflowDeploying deep learning models with Kubernetes and Kubeflow
Deploying deep learning models with Kubernetes and Kubeflow
 
Scaling terraform
Scaling terraformScaling terraform
Scaling terraform
 
Introduction to Cloud Foundry #JJUG
Introduction to Cloud Foundry #JJUGIntroduction to Cloud Foundry #JJUG
Introduction to Cloud Foundry #JJUG
 
Terraform 101
Terraform 101Terraform 101
Terraform 101
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile Infrastructures
 
Helm 3
Helm 3Helm 3
Helm 3
 
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
 
So I Wrote a Manifest
So I Wrote a ManifestSo I Wrote a Manifest
So I Wrote a Manifest
 
(CMP302) Amazon ECS: Distributed Applications at Scale
(CMP302) Amazon ECS: Distributed Applications at Scale(CMP302) Amazon ECS: Distributed Applications at Scale
(CMP302) Amazon ECS: Distributed Applications at Scale
 
BOSH / CF Deployment in modern ways #cf_tokyo
BOSH / CF Deployment in modern ways #cf_tokyoBOSH / CF Deployment in modern ways #cf_tokyo
BOSH / CF Deployment in modern ways #cf_tokyo
 

Ähnlich wie Node Interactive: Node.js Performance and Highly Scalable Micro-Services

Ähnlich wie Node Interactive: Node.js Performance and Highly Scalable Micro-Services (20)

Node Summit 2018: Cloud Native Node.js
Node Summit 2018: Cloud Native Node.jsNode Summit 2018: Cloud Native Node.js
Node Summit 2018: Cloud Native Node.js
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...
Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...
Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...
 
Open shift enterprise 3.1 paas on kubernetes
Open shift enterprise 3.1   paas on kubernetesOpen shift enterprise 3.1   paas on kubernetes
Open shift enterprise 3.1 paas on kubernetes
 
Building Web Scale Apps with Docker and Mesos by Alex Rukletsov (Mesosphere)
Building Web Scale Apps with Docker and Mesos by Alex Rukletsov (Mesosphere)Building Web Scale Apps with Docker and Mesos by Alex Rukletsov (Mesosphere)
Building Web Scale Apps with Docker and Mesos by Alex Rukletsov (Mesosphere)
 
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
 Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
 
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexusMicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
 
Ato2019 weave-services-istio
Ato2019 weave-services-istioAto2019 weave-services-istio
Ato2019 weave-services-istio
 
All Things Open 2019 weave-services-istio
All Things Open 2019 weave-services-istioAll Things Open 2019 weave-services-istio
All Things Open 2019 weave-services-istio
 
Weave Your Microservices with Istio
Weave Your Microservices with IstioWeave Your Microservices with Istio
Weave Your Microservices with Istio
 
London Node.js User Group - Cloud-native Node.js
London Node.js User Group - Cloud-native Node.jsLondon Node.js User Group - Cloud-native Node.js
London Node.js User Group - Cloud-native Node.js
 
What's New in Docker - February 2017
What's New in Docker - February 2017What's New in Docker - February 2017
What's New in Docker - February 2017
 
AWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and JavaAWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and Java
 
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 Cloud-native applications with Java and Kubernetes - Yehor Volkov Cloud-native applications with Java and Kubernetes - Yehor Volkov
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 
Silicon Valley Code Camp 2019 - Reaching the Cloud Native World
Silicon Valley Code Camp 2019 - Reaching the Cloud Native WorldSilicon Valley Code Camp 2019 - Reaching the Cloud Native World
Silicon Valley Code Camp 2019 - Reaching the Cloud Native World
 
Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to production
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
 
[DevDay 2017] OpenShift Enterprise - Speaker: Linh Do - DevOps Engineer at Ax...
[DevDay 2017] OpenShift Enterprise - Speaker: Linh Do - DevOps Engineer at Ax...[DevDay 2017] OpenShift Enterprise - Speaker: Linh Do - DevOps Engineer at Ax...
[DevDay 2017] OpenShift Enterprise - Speaker: Linh Do - DevOps Engineer at Ax...
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 

Mehr von Chris Bailey

Mehr von Chris Bailey (20)

NodeJS Interactive 2019: FaaS meets Frameworks
NodeJS Interactive 2019:  FaaS meets FrameworksNodeJS Interactive 2019:  FaaS meets Frameworks
NodeJS Interactive 2019: FaaS meets Frameworks
 
Voxxed Micro-services: Serverless JakartaEE - JAX-RS comes to FaaS
Voxxed Micro-services: Serverless JakartaEE - JAX-RS comes to FaaSVoxxed Micro-services: Serverless JakartaEE - JAX-RS comes to FaaS
Voxxed Micro-services: Serverless JakartaEE - JAX-RS comes to FaaS
 
FaaS Meets Java EE: Developing Cloud Native Applications at Speed
FaaS Meets Java EE: Developing Cloud Native Applications at SpeedFaaS Meets Java EE: Developing Cloud Native Applications at Speed
FaaS Meets Java EE: Developing Cloud Native Applications at Speed
 
AltConf 2019: Server-Side Swift State of the Union
AltConf 2019:  Server-Side Swift State of the UnionAltConf 2019:  Server-Side Swift State of the Union
AltConf 2019: Server-Side Swift State of the Union
 
Server-side Swift with Swagger
Server-side Swift with SwaggerServer-side Swift with Swagger
Server-side Swift with Swagger
 
Index - BFFs vs GraphQL
Index - BFFs vs GraphQLIndex - BFFs vs GraphQL
Index - BFFs vs GraphQL
 
Swift Cloud Workshop - Codable, the key to Fullstack Swift
Swift Cloud Workshop - Codable, the key to Fullstack SwiftSwift Cloud Workshop - Codable, the key to Fullstack Swift
Swift Cloud Workshop - Codable, the key to Fullstack Swift
 
Try!Swift India 2017: All you need is Swift
Try!Swift India 2017: All you need is SwiftTry!Swift India 2017: All you need is Swift
Try!Swift India 2017: All you need is Swift
 
Swift Summit 2017: Server Swift State of the Union
Swift Summit 2017: Server Swift State of the UnionSwift Summit 2017: Server Swift State of the Union
Swift Summit 2017: Server Swift State of the Union
 
IBM Cloud University: Java, Node.js and Swift
IBM Cloud University: Java, Node.js and SwiftIBM Cloud University: Java, Node.js and Swift
IBM Cloud University: Java, Node.js and Swift
 
FrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftFrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) Swift
 
AltConf 2017: Full Stack Swift in 30 Minutes
AltConf 2017: Full Stack Swift in 30 MinutesAltConf 2017: Full Stack Swift in 30 Minutes
AltConf 2017: Full Stack Swift in 30 Minutes
 
InterConnect: Server Side Swift for Java Developers
InterConnect:  Server Side Swift for Java DevelopersInterConnect:  Server Side Swift for Java Developers
InterConnect: Server Side Swift for Java Developers
 
InterConnect: Java, Node.js and Swift - Which, Why and When
InterConnect: Java, Node.js and Swift - Which, Why and WhenInterConnect: Java, Node.js and Swift - Which, Why and When
InterConnect: Java, Node.js and Swift - Which, Why and When
 
Playgrounds: Mobile + Swift = BFF
Playgrounds: Mobile + Swift = BFFPlaygrounds: Mobile + Swift = BFF
Playgrounds: Mobile + Swift = BFF
 
Swift Summit: Pushing the boundaries of Swift to the Server
Swift Summit: Pushing the boundaries of Swift to the ServerSwift Summit: Pushing the boundaries of Swift to the Server
Swift Summit: Pushing the boundaries of Swift to the Server
 
O'Reilly Software Architecture Conf: Cloud Economics
O'Reilly Software Architecture Conf: Cloud EconomicsO'Reilly Software Architecture Conf: Cloud Economics
O'Reilly Software Architecture Conf: Cloud Economics
 
FrenchKit: End to End Application Development with Swift
FrenchKit: End to End Application Development with SwiftFrenchKit: End to End Application Development with Swift
FrenchKit: End to End Application Development with Swift
 
Node Summit 2016: Web App Architectures
Node Summit 2016:  Web App ArchitecturesNode Summit 2016:  Web App Architectures
Node Summit 2016: Web App Architectures
 
Cloud Economics
Cloud EconomicsCloud Economics
Cloud Economics
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Kürzlich hochgeladen (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 

Node Interactive: Node.js Performance and Highly Scalable Micro-Services

  • 1. Highly Scalable
 Node.js Microservices 
 
 Chris Bailey (@Chris__Bailey) 
 Node.js and Swift Runtimes Chris Vignola (@ChrisVignola) 
 Cloud Native Node.js
  • 5. : Key Technologies Container Orchestration Package and Deploy
  • 6. : Key Technologies Container Orchestration MonitoringPackage and Deploy
  • 7. : Key Technologies Container Orchestration Monitoring Distributed TracingPackage and Deploy
  • 8. MICROSERVICES: Key Performance Characteristics IO Speed • Performance • Scale
  • 9. 0 300 600 900 200 0 1,150 IO Speed • Performance • Scale MICROSERVICES: Key Performance Characteristics
  • 10. 0 300 600 900 200 0 1,150 IO Speed • Performance • Scale MICROSERVICES: Key Performance Characteristics
  • 11. 0 300 600 900 200 897 1,150 MICROSERVICES: Key Performance Characteristics IO Speed • Performance • Scale
  • 12. 0 300 600 900 200 897 1,150 Startup • Availability • Scaling MICROSERVICES: Key Performance Characteristics IO Speed • Performance • Scale
  • 13. 0 300 600 900 200 897 1,150 00.9 Startup • Availability • Scaling MICROSERVICES: Key Performance Characteristics IO Speed • Performance • Scale
  • 14. 0 300 600 900 200 897 1,150 13.7 0.9 Startup • Availability • Scaling MICROSERVICES: Key Performance Characteristics IO Speed • Performance • Scale
  • 15. 0 300 600 900 200 897 1,150 13.7 0.9 Startup • Availability • Scaling Memory • Efficiency • Cost MICROSERVICES: Key Performance Characteristics IO Speed • Performance • Scale
  • 16. 0 300 600 900 200 897 1,150 13.7 0.9 023.6 Startup • Availability • Scaling Memory • Efficiency • Cost MICROSERVICES: Key Performance Characteristics IO Speed • Performance • Scale
  • 17. 0 300 600 900 200 897 1,150 13.7 0.9 422 23.6 Startup • Availability • Scaling Memory • Efficiency • Cost MICROSERVICES: Key Performance Characteristics IO Speed • Performance • Scale
  • 18. Startup • Availability • Scaling Memory • Efficiency • Cost Benchmarking WG: Performance Gains IO Speed • Performance • Scale
  • 19. Startup • Availability • Scaling Memory • Efficiency • Cost 3,049 2,914 2,076 1,866 4.x master6.x 8.x Benchmarking WG: Performance Gains IO Speed • Performance • Scale
  • 20. Startup • Availability • Scaling Memory • Efficiency • Cost 50,42052,640 42,500 71,000 3,049 2,914 2,076 1,866 4.x master6.x 8.x 4.x master6.x 8.x Benchmarking WG: Performance Gains IO Speed • Performance • Scale
  • 21. Startup • Availability • Scaling Memory • Efficiency • Cost 50,42052,640 42,500 71,000 89,024 92,84091,47688,9603,049 2,914 2,076 1,866 4.x master6.x 8.x 4.x master6.x 8.x 4.x master6.x 8.x Benchmarking WG: Performance Gains IO Speed • Performance • Scale
  • 23. func add(_ a: Int, to b: Int) -> Void { print(a + b) } let a = ”5” let b = 3 public/* test/* server/server.js package.json README.md .gitignore
  • 24. func add(_ a: Int, to b: Int) -> Void { print(a + b) } let a = ”5” let b = 3 public/* test/* server/server.js package.json README.md .gitignore const appName = require('./../package').name; const express = require('express'); const log4js = require(‘log4js'); const logger = log4js.getLogger(appName); const app = express(); app.get('/', function (req, res) { res.send('Hello World!') }) const port = process.env.PORT || 3000; app.listen(port, function(){ logger.info(`Express listening on: ` + port); });
  • 25. func add(_ a: Int, to b: Int) -> Void { print(a + b) } let a = ”5” let b = 3 public/* test/* server/server.js package.json README.md .gitignore Dockerfile Dockerfile-tools .dockerignore
  • 26. func add(_ a: Int, to b: Int) -> Void { print(a + b) } let a = ”5” let b = 3 public/* test/* server/server.js package.json README.md .gitignore Dockerfile Dockerfile-tools .dockerignore FROM ibmcom/ibmnode ENV NODE_ENV production ENV PORT 3000 WORKDIR "/app" # Install app dependencies COPY package.json /app/ RUN cd /app; npm install # Bundle app source COPY . /app EXPOSE 3000 CMD ["npm", "start"]
  • 27. func add(_ a: Int, to b: Int) -> Void { print(a + b) } let a = ”5” let b = 3 public/* test/* server/server.js package.json README.md .gitignore Dockerfile Dockerfile-tools .dockerignore node_modules/ npm-debug.log
  • 28. $ docker build -t <your username>/node-app .

  • 29. $ docker build -t <your username>/node-app .
 $ docker run -p 49160:3000 -d <your username>/node-app
  • 30. $ docker build -t <your username>/node-app .
 $ docker run -p 49160:3000 -d <your username>/node-app
  • 31. $ docker build -t <your username>/node-app .
 $ docker run -p 49160:3000 -d <your username>/node-app
  • 32. func add(_ a: Int, to b: Int) -> Void { print(a + b) } let a = ”5” let b = 3 public/* test/* server/server.js package.json README.md .gitignore Dockerfile Dockerfile-tools .dockerignore chart/node-app/Chart.yaml chart/node-app/templates/deployment.yaml chart/node-app/templates/hpa.yaml chart/node-app/templates/service.yaml chart/node-app/values.yaml HELM CHARTS
  • 33. func add(_ a: Int, to b: Int) -> Void { print(a + b) } let a = ”5” let b = 3 public/* test/* server/server.js package.json README.md .gitignore Dockerfile Dockerfile-tools .dockerignore chart/node-app/Chart.yaml chart/node-app/templates/deployment.yaml chart/node-app/templates/hpa.yaml chart/node-app/templates/service.yaml chart/node-app/values.yaml HELM CHARTS apiVersion: v1 description: A Helm chart for Kubernetes name: node-app version: 1.0.0
  • 34. func add(_ a: Int, to b: Int) -> Void { print(a + b) } let a = ”5” let b = 3 public/* test/* server/server.js package.json README.md .gitignore Dockerfile Dockerfile-tools .dockerignore chart/node-app/Chart.yaml chart/node-app/templates/deployment.yaml chart/node-app/templates/hpa.yaml chart/node-app/templates/service.yaml chart/node-app/values.yaml HELM CHARTS apiVersion: extensions/v1beta1 kind: Deployment metadata: name: “node-app-deployment" labels: chart: “node-app-1.0.0” spec: replicas: “5” revisionHistoryLimit: “1” template: metadata: labels: app: “node-app-selector" version: “1.0.0” spec: containers: - name: “node-app” image: “repository:1.0.0” imagePullPolicy: Always livenessProbe: httpGet: path: /health port: 3000 initialDelaySeconds: 3000 periodSeconds: 1000 resources: requests: cpu: "200m" memory: "300Mi" env: - name: PORT value : “3000”
  • 35. func add(_ a: Int, to b: Int) -> Void { print(a + b) } let a = ”5” let b = 3 public/* test/* server/server.js package.json README.md .gitignore Dockerfile Dockerfile-tools .dockerignore chart/node-app/Chart.yaml chart/node-app/templates/deployment.yaml chart/node-app/templates/hpa.yaml chart/node-app/templates/service.yaml chart/node-app/values.yaml HELM CHARTS apiVersion: autoscaling/v2alpha1 kind: HorizontalPodAutoscaler metadata: name: “node-app-hpa-policy" namespace: default spec: scaleTargetRef: apiVersion: apps/v1beta1 kind: Deployment name: “node-app-deployment" minReplicas: 5 maxReplicas: 10 metrics: - type: Resource resource: name: cpu targetAverageUtilization: 70 - type: Resource resource: name: memory targetAverageUtilization: 70
  • 36. func add(_ a: Int, to b: Int) -> Void { print(a + b) } let a = ”5” let b = 3 public/* test/* server/server.js package.json README.md .gitignore Dockerfile Dockerfile-tools .dockerignore chart/node-app/Chart.yaml chart/node-app/templates/deployment.yaml chart/node-app/templates/hpa.yaml chart/node-app/templates/service.yaml chart/node-app/values.yaml HELM CHARTS apiVersion: v1 kind: Service metadata: name: “node-app“ labels: chart: “node-app-1.0.0” spec: type: NodePort ports: - port: 3000 selector: app: “node-app-selector"
  • 37. $ helm package ./chart/node-app
  • 38. $ helm package ./chart/node-app $ helm install ./node-app-1.0.0.tgz
  • 39. $ helm package ./chart/node-app $ helm install ./node-app-1.0.0.tgz
  • 40. $ helm package ./chart/node-app $ helm install ./node-app-1.0.0.tgz
  • 42. PUBLIC NETWORK CLOUD NETWORK CATALOG ORDER INVENTORY USER MySQL MongoDB SPARK ELASTICSEARCH BACKEND FOR
 FRONTEND MICROSERVICES SERVICES LOAD
 BALANCER
  • 43. PUBLIC NETWORK CLOUD NETWORK CATALOG ORDER INVENTORY USER MySQL MongoDB SPARK ELASTICSEARCH BACKEND FOR
 FRONTEND MICROSERVICES SERVICES LOAD
 BALANCER
  • 44. PUBLIC NETWORK CLOUD NETWORK CATALOG ORDER INVENTORY USER MySQL MongoDB SPARK ELASTICSEARCH BACKEND FOR
 FRONTEND MICROSERVICES SERVICES LOAD
 BALANCER
  • 45. PUBLIC NETWORK CLOUD NETWORK CATALOG ORDER INVENTORY USER MySQL MongoDB SPARK ELASTICSEARCH BACKEND FOR
 FRONTEND MICROSERVICES SERVICES LOAD
 BALANCER
  • 46. PUBLIC NETWORK CLOUD NETWORK CATALOG ORDER INVENTORY USER MySQL MongoDB SPARK ELASTICSEARCH BACKEND FOR
 FRONTEND MICROSERVICES SERVICES LOAD
 BALANCER
  • 47. PUBLIC NETWORK CLOUD NETWORK CATALOG ORDER INVENTORY USER MySQL MongoDB SPARK ELASTICSEARCH BACKEND FOR
 FRONTEND MICROSERVICES SERVICES LOAD
 BALANCER
  • 48. PUBLIC NETWORK CLOUD NETWORK CATALOG ORDER INVENTORY USER MySQL MongoDB SPARK ELASTICSEARCH BACKEND FOR
 FRONTEND MICROSERVICES SERVICES LOAD
 BALANCER
  • 53. BROWSER LOAD BALANCER WEB BFF ORDER SERVICE MongoDB TIME
  • 54. BROWSER LOAD BALANCER WEB BFF ORDER SERVICE MongoDB INVENTORY SERVICE TIME
  • 55. MySQL BROWSER LOAD BALANCER WEB BFF ORDER SERVICE MongoDB INVENTORY SERVICE TIME
  • 56. MySQL BROWSER LOAD BALANCER WEB BFF ORDER SERVICE MongoDB INVENTORY SERVICE MongoDB TIME
  • 57. • Collects data from each enabled service
 • Propagates correlation ID using HTTP headers
 • Provides sampling, tracing, and debug capabilities • Collects microsecond timestamps
 • Correlates data in Zipkin server • Presents data in Zipkin dashboard Request Tracking: OpenTracing and Zipkin
  • 58. const zipkin = require(‘appmetrics-zipkin’); const rest = require(‘rest'); const express = require('express'); const app = express(); app.get('/', (req, res) => { rest('http://localhost:9000/api') .then(response => res.send(response.entity)) .catch(err => console.error('Error', err.stack)); }); const port = process.env.PORT || 3000; app.listen(port, function(){ logger.info(`Express listening on: ` + port); });
  • 59.
  • 60. • Collects data from each enabled service
 • Requires /metrics endpoint providing data
 • Provides storage and correlation capabilities • Provide customisable dashboard
 • Integrates with Graphana, Graphite, etc Microservice Metrics: Prometheus
  • 61. const zipkin = require(‘appmetrics-zipkin’); const prometheus = require(‘appmetrics-prometheus’).attach(); const rest = require(‘rest'); const express = require('express'); const app = express(); app.get('/', (req, res) => { rest('http://localhost:9000/api') .then(response => res.send(response.entity)) .catch(err => console.error('Error', err.stack)); }); const port = process.env.PORT || 3000; app.listen(port, function(){ logger.info(`Express listening on: ` + port); });
  • 62.
  • 63.
  • 64. • ‘appmetrics-dash’ provides self-hosted monitoring
 • Inbound and Outbound request performance • Resource and event loop monitoring • Request a node-report
 • Enable profiling and flame graphs Deep Analysis: ‘appmetrics-dash’ and Flame Graphs
  • 65. const zipkin = require(‘appmetrics-zipkin’); const prometheus = require(‘appmetrics-prometheus’).attach(); const dash = require(‘appmetrics-dash’).attach(); const rest = require(‘rest'); const express = require('express'); const app = express(); app.get('/', (req, res) => { rest('http://localhost:9000/api') .then(response => res.send(response.entity)) .catch(err => console.error('Error', err.stack)); }); const port = process.env.PORT || 3000; app.listen(port, function(){ logger.info(`Express listening on: ` + port); }); ‘appmetrics-dash’
  • 68. $ yo nodeserver$ yo nodeserver
  • 70. const rest = require(‘rest'); const express = require('express'); const CLSContext = require('zipkin-context-cls'); const {Tracer} = require('zipkin'); const {recorder} = require('./recorder'); const ctxImpl = new CLSContext('zipkin'); const tracer = new Tracer({ctxImpl, recorder}); const app = express(); const zipkinMiddleware = require('zipkin-instrumentation-express').expressMiddleware; app.use(zipkinMiddleware({tracer, serviceName: 'frontend'})); const {restInterceptor} = require('zipkin-instrumentation-cujojs-rest'); const zipkinRest = rest.wrap(restInterceptor, {tracer, remoteServiceName: ‘backend'});
 app.get('/', (req, res) => { zipkinRest('http://localhost:9000/api') .then(response => res.send(response.entity)) .catch(err => console.error('Error', err.stack)); });