SlideShare a Scribd company logo
Be a Microservices Hero
Shuai Zhang | Adobe
https://github.com/adobe-apiplatform
Presentation scripts: https://gist.github.com/ddragosd/608bf8d3d13e3f688874
Be a microservices hero
A CreativeCloud Microservice Sample: Content-Aware fill
A CreativeCloud Microservice Sample: send to Photoshop
from the mobile device
Lifecycle of a microservice
Growing the microservices ecosystem
API Platform
API Platform
ap
i1
ap
i2
Be a microservices hero
How to make it easier to scale Microservices in this model ?
Microservices
,
Containers & Apache
Mesos
write containerize & deploy
write containerize & deploy
write containerize & deploy
Apache
Mesos
Apache Mesos
& Microservices
“Program for the data
center
Just like you program for
the OS”
Computer:
Kernel:
OS:
Services:
Traffic Ctrl:
Data Center
Mesos
Mesos Frameworks, Marathon,
Mesosphere’s DCOS
Microservices
API Gateway
•  Facilitates inter-API communication
•  Routing, Throttling, rate limiting
Apache Mesos
& Microservices
SETUP A MINI-DATA-CENTER
4 VMs: 1 Leader, 3 Slaves
#DEMO
THE “KERNEL”: MESOS
1 Leader, 3 Slaves
Apache Mesos
& Microservices
#DEMO
THE “OS” : MARATHON
( it will start our
microservices )
Apache Mesos
& Microservices
#DEMO
START A “SERVICE” IN THE
“OS”:
Hello-world microservice{!
"id": "hello-world",!
"container": {!
"type": "DOCKER",!
"docker": {!
"image": "tutum/hello-world",!
"forcePullImage": true,!
"network": "BRIDGE",!
"portMappings": [!
{!
"containerPort": 80,!
"hostPort": 0,!
"protocol": "tcp"!
}!
]!
}!
},!
"cpus": 0.5,!
"mem": 512,!
"instances": 1!
}!
curl "http://<marathon_url>/v2/apps"  !
-H "Content-Type: application/json"  !
-H "Accept:application/json"  !
--data @/tmp/hello_world_app.json!
Apache Mesos
& Microservices
#DEMO
START A “SERVICE” IN THE
“OS”:
Hello-world microservice
Apache Mesos
& Microservices
#DEMO
THE “TRAFFIC CTRL” : API
GATEWAY
Apache Mesos
& Microservices
#DEMO
OPENRESTY
•  Nginx Lua Module
•  Nginx Redis
•  Headers more
•  Set misc
•  LuaJIT
•  ….
Custom Modules
•  NAXSI – WAF
•  api-gateway request-
validation
•  api-gateway-async-logger
NGINX
•  Upstream
•  HTTP Proxy
•  PCRE
•  SSL
•  ….
THE “TRAFFIC CTRL” : API
GATEWAY
Simple configuration blending in
Nginx configuration
Apache Mesos
& Microservices
#DEMO
server {!
listen 80;!
server_name hello-world.api.container-con.org;!
!
location / {!
#
-------------------------------------------------!
# Specify what to validate for this location!
#
-------------------------------------------------!
set $validate_api_key on;!
set $validate_oauth_token on;!
set $validate_user_profile on;!
set $validate_service_plan on;!
...!
#
-------------------------------------------------!
# Proxy the request to the actual microservice!
#
-------------------------------------------------!
THE “TRAFFIC CTRL” : API
GATEWAY
Service Discovery Example
Apache Mesos
& Microservices
#DEMO
server {

listen 80;

server_name ~^(?<app_name>.[^.]+) .api.(?
<domain>.+);!
…!
}!
hello-world .api.openresty.org!
THE “TRAFFIC CTRL” : API
GATEWAY
( OPENRESTY & NGINX based)
Apache Mesos
& Microservices
#DEMO
THE “TRAFFIC CTRL” : API
GATEWAY
DEPLOYMENT
Apache Mesos
& Microservices
#DEMO
{!
"id": "api-gateway",!
"container": {!
"type": "DOCKER",!
"docker": {!
"image": "adobeapiplatform/apigateway:latest",!
"forcePullImage": true,!
"network": "HOST"!
}!
},!
"cpus": 4,!
"mem": 4028.0,!
"env": { "MARATHON_HOST": "http://<marathon_host>" },!
"acceptedResourceRoles": ["slave_public"],!
"constraints": [ [ "hostname", "UNIQUE" ] ],!
"ports": [ 80 ],!
"instances": 1!
}!
curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data '!
THE “TRAFFIC CTRL” : API
GATEWAY
DEPLOYMENT
Apache Mesos
& Microservices
#DEMO
{!
"id": "api-gateway",!
"container": {!
"type": "DOCKER",!
"docker": {!
"image": "apiplatform/apigateway:latest",!
"forcePullImage": true,!
"network": "HOST"!
}!
},!
"cpus": 4,!
"mem": 4028.0,!
"env": { "MARATHON_HOST": "http://<marathon_host>" },!
"acceptedResourceRoles": ["slave_public"],!
"constraints": [ [ "hostname", "UNIQUE" ] ],!
"ports": [ 80 ],!
"instances": 1,!
<health_check_block>!
}!
curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data '!
"healthChecks": [

{

"protocol": "HTTP",

"portIndex": 0,

"path": "/health-check",

"gracePeriodSeconds": 3,

"intervalSeconds": 10,

"timeoutSeconds": 10

}

]!
Optionally you can include health-
check!
THE “TRAFFIC CTRL” : API
GATEWAY
Apache Mesos
& Microservices
#DEMO
•  Demo: API KEY Management
THE “TRAFFIC CTRL” : API
GATEWAY
API KEY Management with
Redis
Apache Mesos
& Microservices
#DEMO
curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data '!
{!
"id": "api-gateway-redis",!
"container": {!
"type": "DOCKER",!
"docker": {!
"image": "redis:latest",!
"forcePullImage": true,!
"network": "HOST"!
}!
},!
"cpus": 0.5,!
"mem": 1024.0,!
"constraints": [ [ "hostname", "UNIQUE" ] ],!
"ports": [ 6379 ],!
"instances": 1!
}'!
THE “TRAFFIC CTRL” : API
GATEWAY
Protect a service with API-KEY
Apache Mesos
& Microservices
#DEMO
set $marathon_app_name hello-world;!
!
location / {!
… !
# identify the service

set $service_id $marathon_app_name;



# identify the api key

# either from the query params or from the "Api-Key" header

set $api_key $arg_api_key;

set_if_empty $api_key $http_x_api_key;



# add the api-key validator

set $validate_api_key on;



# validate request

access_by_lua "ngx.apiGateway.validation.validateRequest()";!
!
proxy_pass http://$marathon_app_name$request_uri;!
Create a new Vhost for server_name ~hello-world.api.(?<domain>.+);!
THE “TRAFFIC CTRL” : API
GATEWAY
Protect a service with API-KEY
Apache Mesos
& Microservices
#DEMO
# ADD an API-KEY for the HELLO-WORLD service!
# NOTE: this API SHOULD not be exposed publicly!
!
curl -X POST "http://api-gateway.${API_DOMAIN}/cache/api_key?key=key-1&!
app_name=app-1&!
service_id=hello-world&!
service_name=hello-world&!
consumer_org_name=demo-consumer"!
!
# update hello-world microservice to require an API-KEY!
curl "http://hello-world.${API_DOMAIN}/hello" !
# {"error_code":"403000","message":"Api Key is required"}!
!
# make another call including the api-key!
curl "http://hello-world.${API_DOMAIN}/hello" -H "X-Api-Key:key-1"!
!
THE “TRAFFIC CTRL” : API
GATEWAY
Capture Analytics
Apache Mesos
& Microservices
#DEMO
•  Demo: Analytics using Graphite and
Grafana
THE “TRAFFIC CTRL” : API
GATEWAY
Capture Analytics: update config
Apache Mesos
& Microservices
#DEMO
set $marathon_app_name hello-world;!
!
location / {!
… !
!
proxy_pass http://$marathon_app_name$request_uri;!
!
…!
# capture usage data!
log_by_lua '!
if ( ngx.apiGateway.metrics ~= nil ) then!
ngx.apiGateway.metrics.captureUsageData()!
end!
';!
!
}!
THE “TRAFFIC CTRL” : API
GATEWAY
Capture Analytics
Apache Mesos
& Microservices
#DEMO
curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --
data '!
{!
"id": "api-gateway-graphite",!
"container": {!
"type": "DOCKER",!
"docker": {!
"image": "hopsoft/graphite-statsd:latest",!
"forcePullImage": true,!
"network": "BRIDGE",!
"portMappings": [!
{ "containerPort": 80, "hostPort": 0, "protocol": "tcp" },!
{ "containerPort": 8125,"hostPort": 8125, "protocol": "udp"}!
]!
}!
},!
"cpus": 2,!
"mem": 4096.0,!
"instances": 1!
}'!
THE “TRAFFIC CTRL” : API
GATEWAY
Capture Analytics
Apache Mesos
& Microservices
#DEMO
# verify that the Graphite instance is up by accessing it through the API Gateway!
curl "http://api-gateway-graphite.${API_DOMAIN}/render/?
from=-5min&format=raw&target=carbon.aggregator.*.metricsReceived"!
# to open Graphite in a browser!
python -mwebbrowser "http://api-gateway-graphite.${API_DOMAIN}/"!
!
# generate traffic for the hello-world service in order to capture metrics!
docker run jordi/ab ab -k -n 10000 -c 500 "http://hello-world.${API_DOMAIN}/hello?api_key=key-1"!
!
# then check the Graphite stats in the browser!
python -mwebbrowser "http://api-gateway-graphite.${API_DOMAIN}/render/?
from=-15min&format=png&target=stats_counts.publisher.*.consumer.demo-
consumer.application.app-1.service.hello-world.sandbox.region.undefined.request.hello.GET.
200.count"!
THE “TRAFFIC CTRL” : API
GATEWAY
View Analytics with Grafana
Apache Mesos
& Microservices
#DEMO
curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --
data '!
{!
"id": "api-gateway-grafana",!
"container": {!
"type": "DOCKER",!
"docker": {!
"image": "grafana/grafana:latest",!
"forcePullImage": true,!
"network": "BRIDGE",!
"portMappings": [ { "containerPort": 3000, "hostPort": 0, "protocol": "tcp" } ]!
}!
},!
"cpus": 1,!
"mem": 2048.0,!
"instances": 1!
}'!
THE “TRAFFIC CTRL” : API
GATEWAY
View Analytics with Grafana
Apache Mesos
& Microservices
#DEMO
Be a microservices hero
API Gateway is Open Source
https://github.com/adobe-apiplatform/apigateway
Gist script used in this presentation:
https://gist.github.com/ddragosd/608bf8d3d13e3f688874
Be a microservices hero
Ad

More Related Content

What's hot (20)

Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
Tatsuhiko Miyagawa
 
Application Logging With The ELK Stack
Application Logging With The ELK StackApplication Logging With The ELK Stack
Application Logging With The ELK Stack
benwaine
 
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Etiene Dalcol
 
[Community Open Camp] 給 PHP 開發者的 VS Code 指南
[Community Open Camp] 給 PHP 開發者的 VS Code 指南[Community Open Camp] 給 PHP 開發者的 VS Code 指南
[Community Open Camp] 給 PHP 開發者的 VS Code 指南
Shengyou Fan
 
Mongodb - drupal dev days
Mongodb - drupal dev daysMongodb - drupal dev days
Mongodb - drupal dev days
Pierre Joye
 
Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
AboutYouGmbH
 
Intro to PSGI and Plack
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and Plack
Tatsuhiko Miyagawa
 
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatGrand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Ryan Weaver
 
New EEA Plone Add-ons
New EEA Plone Add-onsNew EEA Plone Add-ons
New EEA Plone Add-ons
Alin Voinea
 
Building a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQueryBuilding a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 
Web development with Lua @ Bulgaria Web Summit 2016
Web development with Lua @ Bulgaria Web Summit 2016Web development with Lua @ Bulgaria Web Summit 2016
Web development with Lua @ Bulgaria Web Summit 2016
Etiene Dalcol
 
Web development with Lua and Sailor @ GeeCon 2015
Web development with Lua and Sailor @ GeeCon 2015Web development with Lua and Sailor @ GeeCon 2015
Web development with Lua and Sailor @ GeeCon 2015
Etiene Dalcol
 
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜 AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
崇之 清水
 
Lisp in the Cloud
Lisp in the CloudLisp in the Cloud
Lisp in the Cloud
Mike Travers
 
Logstash: Get to know your logs
Logstash: Get to know your logsLogstash: Get to know your logs
Logstash: Get to know your logs
SmartLogic
 
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
PatrickCrompton
 
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
DrupalDay
 
Apache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middlewareApache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middleware
Robert Munteanu
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPress
Taylor Lovett
 
Dexador Rises
Dexador RisesDexador Rises
Dexador Rises
fukamachi
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
Tatsuhiko Miyagawa
 
Application Logging With The ELK Stack
Application Logging With The ELK StackApplication Logging With The ELK Stack
Application Logging With The ELK Stack
benwaine
 
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Etiene Dalcol
 
[Community Open Camp] 給 PHP 開發者的 VS Code 指南
[Community Open Camp] 給 PHP 開發者的 VS Code 指南[Community Open Camp] 給 PHP 開發者的 VS Code 指南
[Community Open Camp] 給 PHP 開發者的 VS Code 指南
Shengyou Fan
 
Mongodb - drupal dev days
Mongodb - drupal dev daysMongodb - drupal dev days
Mongodb - drupal dev days
Pierre Joye
 
Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
AboutYouGmbH
 
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatGrand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Ryan Weaver
 
New EEA Plone Add-ons
New EEA Plone Add-onsNew EEA Plone Add-ons
New EEA Plone Add-ons
Alin Voinea
 
Building a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQueryBuilding a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 
Web development with Lua @ Bulgaria Web Summit 2016
Web development with Lua @ Bulgaria Web Summit 2016Web development with Lua @ Bulgaria Web Summit 2016
Web development with Lua @ Bulgaria Web Summit 2016
Etiene Dalcol
 
Web development with Lua and Sailor @ GeeCon 2015
Web development with Lua and Sailor @ GeeCon 2015Web development with Lua and Sailor @ GeeCon 2015
Web development with Lua and Sailor @ GeeCon 2015
Etiene Dalcol
 
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜 AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
崇之 清水
 
Logstash: Get to know your logs
Logstash: Get to know your logsLogstash: Get to know your logs
Logstash: Get to know your logs
SmartLogic
 
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
PatrickCrompton
 
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
DrupalDay
 
Apache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middlewareApache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middleware
Robert Munteanu
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPress
Taylor Lovett
 
Dexador Rises
Dexador RisesDexador Rises
Dexador Rises
fukamachi
 

Viewers also liked (17)

Alvaro y brando la robotica
Alvaro y brando la roboticaAlvaro y brando la robotica
Alvaro y brando la robotica
alvarogonzi
 
Surat keterangan-gaji
Surat keterangan-gajiSurat keterangan-gaji
Surat keterangan-gaji
temondex
 
Abc czy potrzebna mi wentylacja mechaniczna z odzyskiem ciepla
Abc czy potrzebna mi wentylacja mechaniczna z odzyskiem cieplaAbc czy potrzebna mi wentylacja mechaniczna z odzyskiem ciepla
Abc czy potrzebna mi wentylacja mechaniczna z odzyskiem ciepla
abc-kotly
 
Pdf
PdfPdf
Pdf
Bert-Johan Mullender
 
Presentación y info
Presentación y infoPresentación y info
Presentación y info
Yan Ortiz
 
Resumo do projeto GAME - Gerar Aprendizagem, Motivação e Empenho
Resumo do projeto GAME - Gerar Aprendizagem, Motivação e EmpenhoResumo do projeto GAME - Gerar Aprendizagem, Motivação e Empenho
Resumo do projeto GAME - Gerar Aprendizagem, Motivação e Empenho
Biblioteca da Escola E.B. 2,3/Secundária de Baião - Agrupamento de Escolas do Vale de Ovil
 
Hypertext system TWAD
Hypertext system TWADHypertext system TWAD
Hypertext system TWAD
group1_TWAD
 
Cateq pt 22
Cateq pt 22Cateq pt 22
Cateq pt 22
Cursos Católicos
 
Prepositions of place
Prepositions of placePrepositions of place
Prepositions of place
Lazaro Martinez Rosas
 
My presentation
My presentationMy presentation
My presentation
Anamika yadav
 
Tics maria camila henao posada
Tics maria camila henao posadaTics maria camila henao posada
Tics maria camila henao posada
Maria Camila Henao Posada
 
Html5 게임 기술의 개요
Html5 게임 기술의 개요Html5 게임 기술의 개요
Html5 게임 기술의 개요
Changhwan Yi
 
Dobór kotła do powierzchni domu
Dobór kotła do powierzchni domuDobór kotła do powierzchni domu
Dobór kotła do powierzchni domu
Vaillant Saunier Duval Sp. z o.o.
 
Sprężarka inwerterowa w pompie ciepła
Sprężarka inwerterowa w pompie ciepłaSprężarka inwerterowa w pompie ciepła
Sprężarka inwerterowa w pompie ciepła
Vaillant Saunier Duval Sp. z o.o.
 
CSIL - World Furniture International Markets Review - #61 March 2014
CSIL - World Furniture International Markets Review - #61 March 2014CSIL - World Furniture International Markets Review - #61 March 2014
CSIL - World Furniture International Markets Review - #61 March 2014
CSIL, Furniture and Industry Studies
 
Abc czym rozni sie kociol kondensacyjny od tradycyjnego
Abc czym rozni sie kociol kondensacyjny od tradycyjnegoAbc czym rozni sie kociol kondensacyjny od tradycyjnego
Abc czym rozni sie kociol kondensacyjny od tradycyjnego
abc-kotly
 
The Basics of Branding by Marco de Boer
The Basics of Branding by Marco de BoerThe Basics of Branding by Marco de Boer
The Basics of Branding by Marco de Boer
Bohemia Amsterdam
 
Alvaro y brando la robotica
Alvaro y brando la roboticaAlvaro y brando la robotica
Alvaro y brando la robotica
alvarogonzi
 
Surat keterangan-gaji
Surat keterangan-gajiSurat keterangan-gaji
Surat keterangan-gaji
temondex
 
Abc czy potrzebna mi wentylacja mechaniczna z odzyskiem ciepla
Abc czy potrzebna mi wentylacja mechaniczna z odzyskiem cieplaAbc czy potrzebna mi wentylacja mechaniczna z odzyskiem ciepla
Abc czy potrzebna mi wentylacja mechaniczna z odzyskiem ciepla
abc-kotly
 
Presentación y info
Presentación y infoPresentación y info
Presentación y info
Yan Ortiz
 
Hypertext system TWAD
Hypertext system TWADHypertext system TWAD
Hypertext system TWAD
group1_TWAD
 
Html5 게임 기술의 개요
Html5 게임 기술의 개요Html5 게임 기술의 개요
Html5 게임 기술의 개요
Changhwan Yi
 
CSIL - World Furniture International Markets Review - #61 March 2014
CSIL - World Furniture International Markets Review - #61 March 2014CSIL - World Furniture International Markets Review - #61 March 2014
CSIL - World Furniture International Markets Review - #61 March 2014
CSIL, Furniture and Industry Studies
 
Abc czym rozni sie kociol kondensacyjny od tradycyjnego
Abc czym rozni sie kociol kondensacyjny od tradycyjnegoAbc czym rozni sie kociol kondensacyjny od tradycyjnego
Abc czym rozni sie kociol kondensacyjny od tradycyjnego
abc-kotly
 
The Basics of Branding by Marco de Boer
The Basics of Branding by Marco de BoerThe Basics of Branding by Marco de Boer
The Basics of Branding by Marco de Boer
Bohemia Amsterdam
 
Ad

Similar to Be a microservices hero (20)

ContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices HeroContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices Hero
Dragos Dascalita
 
MesosCon - Be a microservices hero
MesosCon - Be a microservices heroMesosCon - Be a microservices hero
MesosCon - Be a microservices hero
Dragos Dascalita Haut
 
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-ServicesNode Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Chris Bailey
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
Robert Nyman
 
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data... Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Spain
 
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js MicroservicesIBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
Chris Bailey
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with Git
Danilo Poccia
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with Git
Danilo Poccia
 
API Technical Writing
API Technical WritingAPI Technical Writing
API Technical Writing
Sarah Maddox
 
Containerizing a REST API and Deploying to Kubernetes
Containerizing a REST API and Deploying to KubernetesContainerizing a REST API and Deploying to Kubernetes
Containerizing a REST API and Deploying to Kubernetes
Ashley Roach
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
Jorge Ferrer
 
Always on! Or not?
Always on! Or not?Always on! Or not?
Always on! Or not?
Carsten Sandtner
 
Pivorak.javascript.global domination
Pivorak.javascript.global dominationPivorak.javascript.global domination
Pivorak.javascript.global domination
Андрей Вандакуров
 
Andriy Vandakurov about "Frontend. Global domination"
Andriy Vandakurov about  "Frontend. Global domination" Andriy Vandakurov about  "Frontend. Global domination"
Andriy Vandakurov about "Frontend. Global domination"
Pivorak MeetUp
 
About Clack
About ClackAbout Clack
About Clack
fukamachi
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack api
Liang Bo
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
Taylor Lovett
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
Danilo Poccia
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
NAVER D2
 
Testing API platform with Behat BDD tests
Testing API platform with Behat BDD testsTesting API platform with Behat BDD tests
Testing API platform with Behat BDD tests
Stefan Adolf
 
ContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices HeroContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices Hero
Dragos Dascalita
 
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-ServicesNode Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Chris Bailey
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
Robert Nyman
 
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data... Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Spain
 
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js MicroservicesIBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
Chris Bailey
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with Git
Danilo Poccia
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with Git
Danilo Poccia
 
API Technical Writing
API Technical WritingAPI Technical Writing
API Technical Writing
Sarah Maddox
 
Containerizing a REST API and Deploying to Kubernetes
Containerizing a REST API and Deploying to KubernetesContainerizing a REST API and Deploying to Kubernetes
Containerizing a REST API and Deploying to Kubernetes
Ashley Roach
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
Jorge Ferrer
 
Andriy Vandakurov about "Frontend. Global domination"
Andriy Vandakurov about  "Frontend. Global domination" Andriy Vandakurov about  "Frontend. Global domination"
Andriy Vandakurov about "Frontend. Global domination"
Pivorak MeetUp
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack api
Liang Bo
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
Taylor Lovett
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
Danilo Poccia
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
NAVER D2
 
Testing API platform with Behat BDD tests
Testing API platform with Behat BDD testsTesting API platform with Behat BDD tests
Testing API platform with Behat BDD tests
Stefan Adolf
 
Ad

More from OpenRestyCon (6)

Nginx+Lua在京东商品详情页的大规模应用
Nginx+Lua在京东商品详情页的大规模应用Nginx+Lua在京东商品详情页的大规模应用
Nginx+Lua在京东商品详情页的大规模应用
OpenRestyCon
 
Nginx+lua在阿里巴巴的使用
Nginx+lua在阿里巴巴的使用Nginx+lua在阿里巴巴的使用
Nginx+lua在阿里巴巴的使用
OpenRestyCon
 
基于OpenResty的百万级长连接推送
基于OpenResty的百万级长连接推送基于OpenResty的百万级长连接推送
基于OpenResty的百万级长连接推送
OpenRestyCon
 
Using ngx_lua in upyun 2
Using ngx_lua in upyun 2Using ngx_lua in upyun 2
Using ngx_lua in upyun 2
OpenRestyCon
 
Nginx+lua+py构建高性能处理服务
Nginx+lua+py构建高性能处理服务Nginx+lua+py构建高性能处理服务
Nginx+lua+py构建高性能处理服务
OpenRestyCon
 
OpenRestyCon 2015
OpenRestyCon 2015OpenRestyCon 2015
OpenRestyCon 2015
OpenRestyCon
 
Nginx+Lua在京东商品详情页的大规模应用
Nginx+Lua在京东商品详情页的大规模应用Nginx+Lua在京东商品详情页的大规模应用
Nginx+Lua在京东商品详情页的大规模应用
OpenRestyCon
 
Nginx+lua在阿里巴巴的使用
Nginx+lua在阿里巴巴的使用Nginx+lua在阿里巴巴的使用
Nginx+lua在阿里巴巴的使用
OpenRestyCon
 
基于OpenResty的百万级长连接推送
基于OpenResty的百万级长连接推送基于OpenResty的百万级长连接推送
基于OpenResty的百万级长连接推送
OpenRestyCon
 
Using ngx_lua in upyun 2
Using ngx_lua in upyun 2Using ngx_lua in upyun 2
Using ngx_lua in upyun 2
OpenRestyCon
 
Nginx+lua+py构建高性能处理服务
Nginx+lua+py构建高性能处理服务Nginx+lua+py构建高性能处理服务
Nginx+lua+py构建高性能处理服务
OpenRestyCon
 

Recently uploaded (19)

APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 

Be a microservices hero

  • 1. Be a Microservices Hero Shuai Zhang | Adobe https://github.com/adobe-apiplatform Presentation scripts: https://gist.github.com/ddragosd/608bf8d3d13e3f688874
  • 3. A CreativeCloud Microservice Sample: Content-Aware fill
  • 4. A CreativeCloud Microservice Sample: send to Photoshop from the mobile device
  • 5. Lifecycle of a microservice
  • 11. How to make it easier to scale Microservices in this model ?
  • 12. Microservices , Containers & Apache Mesos write containerize & deploy write containerize & deploy write containerize & deploy
  • 14. Apache Mesos & Microservices “Program for the data center Just like you program for the OS” Computer: Kernel: OS: Services: Traffic Ctrl: Data Center Mesos Mesos Frameworks, Marathon, Mesosphere’s DCOS Microservices API Gateway •  Facilitates inter-API communication •  Routing, Throttling, rate limiting
  • 15. Apache Mesos & Microservices SETUP A MINI-DATA-CENTER 4 VMs: 1 Leader, 3 Slaves #DEMO
  • 16. THE “KERNEL”: MESOS 1 Leader, 3 Slaves Apache Mesos & Microservices #DEMO
  • 17. THE “OS” : MARATHON ( it will start our microservices ) Apache Mesos & Microservices #DEMO
  • 18. START A “SERVICE” IN THE “OS”: Hello-world microservice{! "id": "hello-world",! "container": {! "type": "DOCKER",! "docker": {! "image": "tutum/hello-world",! "forcePullImage": true,! "network": "BRIDGE",! "portMappings": [! {! "containerPort": 80,! "hostPort": 0,! "protocol": "tcp"! }! ]! }! },! "cpus": 0.5,! "mem": 512,! "instances": 1! }! curl "http://<marathon_url>/v2/apps" ! -H "Content-Type: application/json" ! -H "Accept:application/json" ! --data @/tmp/hello_world_app.json! Apache Mesos & Microservices #DEMO
  • 19. START A “SERVICE” IN THE “OS”: Hello-world microservice Apache Mesos & Microservices #DEMO
  • 20. THE “TRAFFIC CTRL” : API GATEWAY Apache Mesos & Microservices #DEMO OPENRESTY •  Nginx Lua Module •  Nginx Redis •  Headers more •  Set misc •  LuaJIT •  …. Custom Modules •  NAXSI – WAF •  api-gateway request- validation •  api-gateway-async-logger NGINX •  Upstream •  HTTP Proxy •  PCRE •  SSL •  ….
  • 21. THE “TRAFFIC CTRL” : API GATEWAY Simple configuration blending in Nginx configuration Apache Mesos & Microservices #DEMO server {! listen 80;! server_name hello-world.api.container-con.org;! ! location / {! # -------------------------------------------------! # Specify what to validate for this location! # -------------------------------------------------! set $validate_api_key on;! set $validate_oauth_token on;! set $validate_user_profile on;! set $validate_service_plan on;! ...! # -------------------------------------------------! # Proxy the request to the actual microservice! # -------------------------------------------------!
  • 22. THE “TRAFFIC CTRL” : API GATEWAY Service Discovery Example Apache Mesos & Microservices #DEMO server {
 listen 80;
 server_name ~^(?<app_name>.[^.]+) .api.(? <domain>.+);! …! }! hello-world .api.openresty.org!
  • 23. THE “TRAFFIC CTRL” : API GATEWAY ( OPENRESTY & NGINX based) Apache Mesos & Microservices #DEMO
  • 24. THE “TRAFFIC CTRL” : API GATEWAY DEPLOYMENT Apache Mesos & Microservices #DEMO {! "id": "api-gateway",! "container": {! "type": "DOCKER",! "docker": {! "image": "adobeapiplatform/apigateway:latest",! "forcePullImage": true,! "network": "HOST"! }! },! "cpus": 4,! "mem": 4028.0,! "env": { "MARATHON_HOST": "http://<marathon_host>" },! "acceptedResourceRoles": ["slave_public"],! "constraints": [ [ "hostname", "UNIQUE" ] ],! "ports": [ 80 ],! "instances": 1! }! curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data '!
  • 25. THE “TRAFFIC CTRL” : API GATEWAY DEPLOYMENT Apache Mesos & Microservices #DEMO {! "id": "api-gateway",! "container": {! "type": "DOCKER",! "docker": {! "image": "apiplatform/apigateway:latest",! "forcePullImage": true,! "network": "HOST"! }! },! "cpus": 4,! "mem": 4028.0,! "env": { "MARATHON_HOST": "http://<marathon_host>" },! "acceptedResourceRoles": ["slave_public"],! "constraints": [ [ "hostname", "UNIQUE" ] ],! "ports": [ 80 ],! "instances": 1,! <health_check_block>! }! curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data '! "healthChecks": [
 {
 "protocol": "HTTP",
 "portIndex": 0,
 "path": "/health-check",
 "gracePeriodSeconds": 3,
 "intervalSeconds": 10,
 "timeoutSeconds": 10
 }
 ]! Optionally you can include health- check!
  • 26. THE “TRAFFIC CTRL” : API GATEWAY Apache Mesos & Microservices #DEMO •  Demo: API KEY Management
  • 27. THE “TRAFFIC CTRL” : API GATEWAY API KEY Management with Redis Apache Mesos & Microservices #DEMO curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data '! {! "id": "api-gateway-redis",! "container": {! "type": "DOCKER",! "docker": {! "image": "redis:latest",! "forcePullImage": true,! "network": "HOST"! }! },! "cpus": 0.5,! "mem": 1024.0,! "constraints": [ [ "hostname", "UNIQUE" ] ],! "ports": [ 6379 ],! "instances": 1! }'!
  • 28. THE “TRAFFIC CTRL” : API GATEWAY Protect a service with API-KEY Apache Mesos & Microservices #DEMO set $marathon_app_name hello-world;! ! location / {! … ! # identify the service
 set $service_id $marathon_app_name;
 
 # identify the api key
 # either from the query params or from the "Api-Key" header
 set $api_key $arg_api_key;
 set_if_empty $api_key $http_x_api_key;
 
 # add the api-key validator
 set $validate_api_key on;
 
 # validate request
 access_by_lua "ngx.apiGateway.validation.validateRequest()";! ! proxy_pass http://$marathon_app_name$request_uri;! Create a new Vhost for server_name ~hello-world.api.(?<domain>.+);!
  • 29. THE “TRAFFIC CTRL” : API GATEWAY Protect a service with API-KEY Apache Mesos & Microservices #DEMO # ADD an API-KEY for the HELLO-WORLD service! # NOTE: this API SHOULD not be exposed publicly! ! curl -X POST "http://api-gateway.${API_DOMAIN}/cache/api_key?key=key-1&! app_name=app-1&! service_id=hello-world&! service_name=hello-world&! consumer_org_name=demo-consumer"! ! # update hello-world microservice to require an API-KEY! curl "http://hello-world.${API_DOMAIN}/hello" ! # {"error_code":"403000","message":"Api Key is required"}! ! # make another call including the api-key! curl "http://hello-world.${API_DOMAIN}/hello" -H "X-Api-Key:key-1"! !
  • 30. THE “TRAFFIC CTRL” : API GATEWAY Capture Analytics Apache Mesos & Microservices #DEMO •  Demo: Analytics using Graphite and Grafana
  • 31. THE “TRAFFIC CTRL” : API GATEWAY Capture Analytics: update config Apache Mesos & Microservices #DEMO set $marathon_app_name hello-world;! ! location / {! … ! ! proxy_pass http://$marathon_app_name$request_uri;! ! …! # capture usage data! log_by_lua '! if ( ngx.apiGateway.metrics ~= nil ) then! ngx.apiGateway.metrics.captureUsageData()! end! ';! ! }!
  • 32. THE “TRAFFIC CTRL” : API GATEWAY Capture Analytics Apache Mesos & Microservices #DEMO curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true -- data '! {! "id": "api-gateway-graphite",! "container": {! "type": "DOCKER",! "docker": {! "image": "hopsoft/graphite-statsd:latest",! "forcePullImage": true,! "network": "BRIDGE",! "portMappings": [! { "containerPort": 80, "hostPort": 0, "protocol": "tcp" },! { "containerPort": 8125,"hostPort": 8125, "protocol": "udp"}! ]! }! },! "cpus": 2,! "mem": 4096.0,! "instances": 1! }'!
  • 33. THE “TRAFFIC CTRL” : API GATEWAY Capture Analytics Apache Mesos & Microservices #DEMO # verify that the Graphite instance is up by accessing it through the API Gateway! curl "http://api-gateway-graphite.${API_DOMAIN}/render/? from=-5min&format=raw&target=carbon.aggregator.*.metricsReceived"! # to open Graphite in a browser! python -mwebbrowser "http://api-gateway-graphite.${API_DOMAIN}/"! ! # generate traffic for the hello-world service in order to capture metrics! docker run jordi/ab ab -k -n 10000 -c 500 "http://hello-world.${API_DOMAIN}/hello?api_key=key-1"! ! # then check the Graphite stats in the browser! python -mwebbrowser "http://api-gateway-graphite.${API_DOMAIN}/render/? from=-15min&format=png&target=stats_counts.publisher.*.consumer.demo- consumer.application.app-1.service.hello-world.sandbox.region.undefined.request.hello.GET. 200.count"!
  • 34. THE “TRAFFIC CTRL” : API GATEWAY View Analytics with Grafana Apache Mesos & Microservices #DEMO curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true -- data '! {! "id": "api-gateway-grafana",! "container": {! "type": "DOCKER",! "docker": {! "image": "grafana/grafana:latest",! "forcePullImage": true,! "network": "BRIDGE",! "portMappings": [ { "containerPort": 3000, "hostPort": 0, "protocol": "tcp" } ]! }! },! "cpus": 1,! "mem": 2048.0,! "instances": 1! }'!
  • 35. THE “TRAFFIC CTRL” : API GATEWAY View Analytics with Grafana Apache Mesos & Microservices #DEMO
  • 37. API Gateway is Open Source https://github.com/adobe-apiplatform/apigateway Gist script used in this presentation: https://gist.github.com/ddragosd/608bf8d3d13e3f688874