SlideShare a Scribd company logo
1 of 47
Download to read offline
Be a Microservices Hero | MesosCon’16
Dragos Dascalita Haut | Project Lead | Adobe I/O
Adobe I/O provides the definitive destination for Developers looking to
learn about, engage with and integrate Adobe cloud, mobile, and web
technologies.
Adobe Creative Cloud Apps
A CreativeCloud Microservice: Content-Aware Fill
A CreativeCloud Microservice: send to Photoshop from the mobile device
Focus of this presentation:
§  How to make it simple and consistent for developers to consume APIs
§  How to make it straight forward to publish APIs
There are 2 players in Microservices
There are common aspects surrounding an API
There are common aspects surrounding an API
There are common aspects surrounding an API
There are common aspects surrounding an API
API Management
API Management
api1 api2
Adobe I/O & Apache Mesos
Fill the API Management gap in Apache Mesos
by sharing the technology behind Adobe I/O
and develop it further with the community.
GOAL
§  Make it simple and consistent for developers to consume APIs
§  … and straight forward to publish APIs
API GATEWAY : The Adobe I/O Engine
•  OPEN SOURCE:
•  https://github.com/adobe-apiplatform/apigateway
•  FEATURES:
•  API Façade - to build a unified API from mutiple microservices
•  Controls Access by validating requests
•  Prevents Attacks through Throttling and Rate Limiting rules
•  Provides Analytics based on usage data
•  OOTB Service Discovery using Marathon and Mesos
•  With hooks for other service discovery implementations
API GATEWAY : The Adobe I/O Engine
•  FEATURES THE API GATEWAY SHOULD AVOID:
•  Payload transformation
•  Any other business logic particular to the domain of an API
DESIGN PRINCIPLES
Simple
Scalable
Secure
Super fast
API GATEWAY : The Adobe I/O Engine
OPENRESTY
•  Nginx Lua Module
•  Nginx Redis
•  Headers more
•  Set misc
•  LuaJIT
•  ….
API Gateway Modules
•  Request Validation
•  Throttling & Rate Limiting
•  HTTP Logger
NGINX
•  Upstream
•  HTTP Proxy
•  PCRE
•  SSL
•  ….
API GATEWAY : " …TAKE ONE OF THE MOST POPULAR WEB SERVER AND
ADD API GATEWAY CAPABILITIES TO IT…"
{
"id": "api-gateway",
"container": {
"type": "DOCKER",
"docker": {
"image": "adobeapiplatform/apigateway:throttling",
"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 '
API GATEWAY : Deployment with Marathon
API GATEWAY : Deployment with Marathon
{
"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 '
Optionally you can include health-check
"healthChecks": [

{

"protocol": "HTTP",

"portIndex": 0,

"path": "/health-check",

"gracePeriodSeconds": 3,

"intervalSeconds": 10,

"timeoutSeconds": 10

}

]
server {
listen 80;
server_name hello-world.gw.mesosconference.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;
...
access_by_lua "ngx.apiGateway.validation.validateRequest()";
# -------------------------------------------------
# Proxy the request to the actual microservice
# -------------------------------------------------
proxy_pass http://hello-world;
}
}
API GATEWAY : Simple Service Definition to validate requests
server {
listen 80;
server_name hello-world.api.mesoscon.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;
...
access_by_lua "ngx.apiGateway.validation.validateRequest()";
# -------------------------------------------------
# Proxy the request to the actual microservice
# -------------------------------------------------
proxy_pass http://hello-world;
}
}
API GATEWAY : Routing is done based on Service Discovery
...
upstream hello-world {
# --------------------------------
# Specify the list of backends
# where hello-world microservice
# is running
# --------------------------------
server 10.0.0.7:13780;
server 10.0.0.8:11900;
...
}
server {
listen 80;
server_name hello-world.api.mesoscon.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;
...
access_by_lua "ngx.apiGateway.validation.validateRequest()";
# -------------------------------------------------
# Proxy the request to the actual microservice
# -------------------------------------------------
proxy_pass http://hello-world;
}
}
...
upstream hello-world {
# --------------------------------
# Specify the list of backends
# where hello-world microservice
# is running
# --------------------------------
server 10.0.0.7:13780;
server 10.0.0.8:11900;
...
}
SERVICE DEFINITION vs SERVICE DISCOVERY
server {
listen 80;
server_name hello-world.api.mesoscon.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;
...
access_by_lua "ngx.apiGateway.validation.validateRequest()";
# -------------------------------------------------
# Proxy the request to the actual microservice
# -------------------------------------------------
proxy_pass http://hello-world;
}
}
...
upstream hello-world {
# --------------------------------
# Specify the list of backends
# where hello-world microservice
# is running
# --------------------------------
server 10.0.0.7:13780;
server 10.0.0.8:11900;
...
}
SERVICE DEFINITION vs SERVICE DISCOVERY
•  Demo
curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data '
{
"id": "hello-world",
"container": {
"type": "DOCKER",
"docker": {
"image": "adobeapiplatform/echo-microservice:latest",
"forcePullImage": false,
"network": "BRIDGE",
"portMappings": [
{
"containerPort": 8080,
"hostPort": 0,
"protocol": "tcp"
}
]
}
},
"cpus": 0.5,
"mem": 1024.0,
"ports": [ 0 ],
"instances": 1
}'
DEPLOY THE SAMPLE hello-world MICROSERVICE :
… WITH 2 SIMPLE ENDPOINTS
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": "BRIDGE",
"portMappings": [
{
"containerPort": 6379,
"hostPort": 0,
"protocol": "tcp"
}
]
}
},
"cpus": 0.5,
"mem": 1024.0,
"constraints": [ [ "hostname", "UNIQUE" ] ],
"ports": [ 0 ],
"instances": 1
}'
API GATEWAY : API KEY Management with Redis
set $marathon_app_name hello-world;
location / {
…
# identify the service

set $service_id $marathon_app_name;



# READ THE API KEY
# either from the query string or from the "X-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;
Create a new Vhost for server_name ~hello-world.api.(?<domain>.+);
API GATEWAY : API KEY Management with Redis
Protecting a service with API-KEY Validation
# 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=demo-app&
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"
API GATEWAY : API KEY Management with Redis
Create a new API-KEY and save it into Redis cache
•  Demo: Throttling / Rate Limiting
THROTTLING: Installing the Microservice
curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data '
{
"id": "cell-os/gateway-tracking-service",
"container": {
"type": "DOCKER",
"docker": {
"image": "adobeapiplatform/gateway-tracking-service:latest",
"forcePullImage": false,
"network": "BRIDGE",
"portMappings": [ {"containerPort": 8080, "hostPort": 0, "protocol": "tcp"} ]
}
},
"env": {
"mesos.api.endpoint":"http://<marathon-host>/v2/apps/cell-os/api-gateway/tasks",
"spring.profiles.active":"mesos-cluster",
"gw.http.port":"5000",
"zmq.port":"6001",
"logging.level.com.adobe.api.platform.gwts.metrics.MetricsService":"WARN",
"redis.host":"<redis-host>",
"redis.port":"<redis_port>"
},
"cpus": 2,
"mem": 4096.0,
"ports": [ 0 ],
"instances": 1
}'
API GATEWAY : Adding a new throttling policy
curl -i -X POST "http://cell-os_gateway-tracking-service.<domain>/api/policies/throttling"
-H "Content-Type:application/json" -H "X-AMS-Policy-Type:THROTTLING_POLICY" --data '
[{
"id": "2",
"softLimit": 3,
"maxDelayPeriod": 4,
"hardLimit": 5,
"timeUnit": "SECONDS",
"span": 30,
"lastModified": 1438019079000,
"domain": {
"$api_key": "key-1"
}
}]'
A Low Water Mark after which the Gateway DELAYS requests
A High Water Mark after which the Gateway BLOCKS requests
Limits are enforced on a 30s time window
This policy is enforced only on requests with api_key=key-1
API GATEWAY : Listing existing throttling policies
curl "http://cell-os_gateway-tracking-service.<domain>/api/policies/throttling"
[{
id: 2,
lastModified: 1438019079000,
domain: {
$api_key: "key-1"
},
softLimit: 5,
hardLimit: 9,
timeUnit: "SECONDS",
span: 30,
maxDelayPeriod: 3
}]
•  Demo: Analytics
Key Takeaways
1.  Think holistically at microservices
2.  "Less is more." "Does my microservice really need to care about ..."
•  Identify Provider, Access Control, Throttling
3.  Think about integrating a microservice API Gateway into your
Mesos clusters
•  Consider using a proven solution used by Adobe I/O
https://github.com/adobe-apiplatform/apigateway
Resources:
https://github.com/adobe-apiplatform/apigateway
http://adobe.io
MesosCon - Be a microservices hero

More Related Content

What's hot

Plack basics for Perl websites - YAPC::EU 2011
Plack basics for Perl websites - YAPC::EU 2011Plack basics for Perl websites - YAPC::EU 2011
Plack basics for Perl websites - YAPC::EU 2011leo lapworth
 
Environments - Fundamentals Webinar Series Week 5
Environments - Fundamentals Webinar Series Week 5Environments - Fundamentals Webinar Series Week 5
Environments - Fundamentals Webinar Series Week 5Chef
 
RESTful Web Applications with Apache Sling
RESTful Web Applications with Apache SlingRESTful Web Applications with Apache Sling
RESTful Web Applications with Apache SlingBertrand Delacretaz
 
Common configuration with Data Bags - Fundamentals Webinar Series Part 4
Common configuration with Data Bags - Fundamentals Webinar Series Part 4Common configuration with Data Bags - Fundamentals Webinar Series Part 4
Common configuration with Data Bags - Fundamentals Webinar Series Part 4Chef
 
Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Jeff Jones
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)mfrancis
 
RESTful modules in zf2
RESTful modules in zf2RESTful modules in zf2
RESTful modules in zf2Corley S.r.l.
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Mario Cardinal
 
Deploying configurable frontend web application containers
Deploying configurable frontend web application containersDeploying configurable frontend web application containers
Deploying configurable frontend web application containersJosé Moreira
 
Jcon 2017 How to use Swagger to develop REST applications
Jcon 2017 How to use Swagger to develop REST applicationsJcon 2017 How to use Swagger to develop REST applications
Jcon 2017 How to use Swagger to develop REST applicationsjohannes_fiala
 
Modern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on RailsModern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on RailsJonathan Johnson
 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play appsYevgeniy Brikman
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB
 
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Services
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Servicesewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Services
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST ServicesRob Tweed
 
MuleSoft Integration with AWS Cognito Client Credentials and Mule JWT Validat...
MuleSoft Integration with AWS Cognito Client Credentials and Mule JWT Validat...MuleSoft Integration with AWS Cognito Client Credentials and Mule JWT Validat...
MuleSoft Integration with AWS Cognito Client Credentials and Mule JWT Validat...Manish Kumar Yadav
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Codemotion
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsC4Media
 
OSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian SchneiderOSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian Schneidermfrancis
 
DEVNET-2002 Coding 201: Coding Skills 201: Going Further with REST and Python...
DEVNET-2002	Coding 201: Coding Skills 201: Going Further with REST and Python...DEVNET-2002	Coding 201: Coding Skills 201: Going Further with REST and Python...
DEVNET-2002 Coding 201: Coding Skills 201: Going Further with REST and Python...Cisco DevNet
 

What's hot (20)

Plack basics for Perl websites - YAPC::EU 2011
Plack basics for Perl websites - YAPC::EU 2011Plack basics for Perl websites - YAPC::EU 2011
Plack basics for Perl websites - YAPC::EU 2011
 
Environments - Fundamentals Webinar Series Week 5
Environments - Fundamentals Webinar Series Week 5Environments - Fundamentals Webinar Series Week 5
Environments - Fundamentals Webinar Series Week 5
 
RESTful Web Applications with Apache Sling
RESTful Web Applications with Apache SlingRESTful Web Applications with Apache Sling
RESTful Web Applications with Apache Sling
 
Common configuration with Data Bags - Fundamentals Webinar Series Part 4
Common configuration with Data Bags - Fundamentals Webinar Series Part 4Common configuration with Data Bags - Fundamentals Webinar Series Part 4
Common configuration with Data Bags - Fundamentals Webinar Series Part 4
 
Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
 
Node.js Workshop
Node.js WorkshopNode.js Workshop
Node.js Workshop
 
RESTful modules in zf2
RESTful modules in zf2RESTful modules in zf2
RESTful modules in zf2
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
 
Deploying configurable frontend web application containers
Deploying configurable frontend web application containersDeploying configurable frontend web application containers
Deploying configurable frontend web application containers
 
Jcon 2017 How to use Swagger to develop REST applications
Jcon 2017 How to use Swagger to develop REST applicationsJcon 2017 How to use Swagger to develop REST applications
Jcon 2017 How to use Swagger to develop REST applications
 
Modern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on RailsModern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on Rails
 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play apps
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
 
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Services
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Servicesewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Services
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Services
 
MuleSoft Integration with AWS Cognito Client Credentials and Mule JWT Validat...
MuleSoft Integration with AWS Cognito Client Credentials and Mule JWT Validat...MuleSoft Integration with AWS Cognito Client Credentials and Mule JWT Validat...
MuleSoft Integration with AWS Cognito Client Credentials and Mule JWT Validat...
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
OSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian SchneiderOSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian Schneider
 
DEVNET-2002 Coding 201: Coding Skills 201: Going Further with REST and Python...
DEVNET-2002	Coding 201: Coding Skills 201: Going Further with REST and Python...DEVNET-2002	Coding 201: Coding Skills 201: Going Further with REST and Python...
DEVNET-2002 Coding 201: Coding Skills 201: Going Further with REST and Python...
 

Similar to MesosCon - Be a microservices hero

ContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices HeroContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices HeroDragos Dascalita
 
Be a microservices hero
Be a microservices heroBe a microservices hero
Be a microservices heroOpenRestyCon
 
Consull7 webinar hasicorp
Consull7 webinar hasicorpConsull7 webinar hasicorp
Consull7 webinar hasicorpHien Nguyen Van
 
Consul 1.6: Layer 7 Traffic Management and Mesh Gateways
Consul 1.6: Layer 7 Traffic Management and Mesh GatewaysConsul 1.6: Layer 7 Traffic Management and Mesh Gateways
Consul 1.6: Layer 7 Traffic Management and Mesh GatewaysMitchell Pronschinske
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack apiLiang Bo
 
Integrating Jira Software Cloud With the AWS Code Suite
Integrating Jira Software Cloud With the AWS Code SuiteIntegrating Jira Software Cloud With the AWS Code Suite
Integrating Jira Software Cloud With the AWS Code SuiteAtlassian
 
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 JavaManish Pandit
 
Containers as a Service with Docker
Containers as a Service with DockerContainers as a Service with Docker
Containers as a Service with DockerDocker, Inc.
 
Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Patrick Chanezon
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeBen Hall
 
Making a small QA system with Docker
Making a small QA system with DockerMaking a small QA system with Docker
Making a small QA system with DockerNaoki AINOYA
 
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...NGINX, Inc.
 
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayMigrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayAmazon Web Services
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefNathen Harvey
 
Building a REST API Microservice for the DevNet API Scavenger Hunt
Building a REST API Microservice for the DevNet API Scavenger HuntBuilding a REST API Microservice for the DevNet API Scavenger Hunt
Building a REST API Microservice for the DevNet API Scavenger HuntAshley Roach
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop OverviewShubhra Kar
 
Working with PowerVC via its REST APIs
Working with PowerVC via its REST APIsWorking with PowerVC via its REST APIs
Working with PowerVC via its REST APIsJoe Cropper
 
(ARC401) Cloud First: New Architecture for New Infrastructure
(ARC401) Cloud First: New Architecture for New Infrastructure(ARC401) Cloud First: New Architecture for New Infrastructure
(ARC401) Cloud First: New Architecture for New InfrastructureAmazon Web Services
 
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014Puppet
 

Similar to MesosCon - 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
 
Be a microservices hero
Be a microservices heroBe a microservices hero
Be a microservices hero
 
Consull7 webinar hasicorp
Consull7 webinar hasicorpConsull7 webinar hasicorp
Consull7 webinar hasicorp
 
Consul 1.6: Layer 7 Traffic Management and Mesh Gateways
Consul 1.6: Layer 7 Traffic Management and Mesh GatewaysConsul 1.6: Layer 7 Traffic Management and Mesh Gateways
Consul 1.6: Layer 7 Traffic Management and Mesh Gateways
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack api
 
Integrating Jira Software Cloud With the AWS Code Suite
Integrating Jira Software Cloud With the AWS Code SuiteIntegrating Jira Software Cloud With the AWS Code Suite
Integrating Jira Software Cloud With the AWS Code Suite
 
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
 
Containers as a Service with Docker
Containers as a Service with DockerContainers as a Service with Docker
Containers as a Service with Docker
 
Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016
 
Docker In Bank Unrated
Docker In Bank UnratedDocker In Bank Unrated
Docker In Bank Unrated
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud Native
 
Making a small QA system with Docker
Making a small QA system with DockerMaking a small QA system with Docker
Making a small QA system with Docker
 
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
 
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayMigrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Building a REST API Microservice for the DevNet API Scavenger Hunt
Building a REST API Microservice for the DevNet API Scavenger HuntBuilding a REST API Microservice for the DevNet API Scavenger Hunt
Building a REST API Microservice for the DevNet API Scavenger Hunt
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
Working with PowerVC via its REST APIs
Working with PowerVC via its REST APIsWorking with PowerVC via its REST APIs
Working with PowerVC via its REST APIs
 
(ARC401) Cloud First: New Architecture for New Infrastructure
(ARC401) Cloud First: New Architecture for New Infrastructure(ARC401) Cloud First: New Architecture for New Infrastructure
(ARC401) Cloud First: New Architecture for New Infrastructure
 
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
 

Recently uploaded

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 

Recently uploaded (20)

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 

MesosCon - Be a microservices hero

  • 1. Be a Microservices Hero | MesosCon’16 Dragos Dascalita Haut | Project Lead | Adobe I/O
  • 2. Adobe I/O provides the definitive destination for Developers looking to learn about, engage with and integrate Adobe cloud, mobile, and web technologies.
  • 4. A CreativeCloud Microservice: Content-Aware Fill
  • 5. A CreativeCloud Microservice: send to Photoshop from the mobile device
  • 6. Focus of this presentation: §  How to make it simple and consistent for developers to consume APIs §  How to make it straight forward to publish APIs
  • 7. There are 2 players in Microservices
  • 8. There are common aspects surrounding an API
  • 9. There are common aspects surrounding an API
  • 10. There are common aspects surrounding an API
  • 11. There are common aspects surrounding an API
  • 12.
  • 13.
  • 17.
  • 18.
  • 19. Adobe I/O & Apache Mesos
  • 20. Fill the API Management gap in Apache Mesos by sharing the technology behind Adobe I/O and develop it further with the community.
  • 21. GOAL §  Make it simple and consistent for developers to consume APIs §  … and straight forward to publish APIs
  • 22. API GATEWAY : The Adobe I/O Engine •  OPEN SOURCE: •  https://github.com/adobe-apiplatform/apigateway •  FEATURES: •  API Façade - to build a unified API from mutiple microservices •  Controls Access by validating requests •  Prevents Attacks through Throttling and Rate Limiting rules •  Provides Analytics based on usage data •  OOTB Service Discovery using Marathon and Mesos •  With hooks for other service discovery implementations
  • 23. API GATEWAY : The Adobe I/O Engine •  FEATURES THE API GATEWAY SHOULD AVOID: •  Payload transformation •  Any other business logic particular to the domain of an API
  • 25. OPENRESTY •  Nginx Lua Module •  Nginx Redis •  Headers more •  Set misc •  LuaJIT •  …. API Gateway Modules •  Request Validation •  Throttling & Rate Limiting •  HTTP Logger NGINX •  Upstream •  HTTP Proxy •  PCRE •  SSL •  …. API GATEWAY : " …TAKE ONE OF THE MOST POPULAR WEB SERVER AND ADD API GATEWAY CAPABILITIES TO IT…"
  • 26. { "id": "api-gateway", "container": { "type": "DOCKER", "docker": { "image": "adobeapiplatform/apigateway:throttling", "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 ' API GATEWAY : Deployment with Marathon
  • 27. API GATEWAY : Deployment with Marathon { "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 ' Optionally you can include health-check "healthChecks": [
 {
 "protocol": "HTTP",
 "portIndex": 0,
 "path": "/health-check",
 "gracePeriodSeconds": 3,
 "intervalSeconds": 10,
 "timeoutSeconds": 10
 }
 ]
  • 28. server { listen 80; server_name hello-world.gw.mesosconference.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; ... access_by_lua "ngx.apiGateway.validation.validateRequest()"; # ------------------------------------------------- # Proxy the request to the actual microservice # ------------------------------------------------- proxy_pass http://hello-world; } } API GATEWAY : Simple Service Definition to validate requests
  • 29. server { listen 80; server_name hello-world.api.mesoscon.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; ... access_by_lua "ngx.apiGateway.validation.validateRequest()"; # ------------------------------------------------- # Proxy the request to the actual microservice # ------------------------------------------------- proxy_pass http://hello-world; } } API GATEWAY : Routing is done based on Service Discovery ... upstream hello-world { # -------------------------------- # Specify the list of backends # where hello-world microservice # is running # -------------------------------- server 10.0.0.7:13780; server 10.0.0.8:11900; ... }
  • 30. server { listen 80; server_name hello-world.api.mesoscon.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; ... access_by_lua "ngx.apiGateway.validation.validateRequest()"; # ------------------------------------------------- # Proxy the request to the actual microservice # ------------------------------------------------- proxy_pass http://hello-world; } } ... upstream hello-world { # -------------------------------- # Specify the list of backends # where hello-world microservice # is running # -------------------------------- server 10.0.0.7:13780; server 10.0.0.8:11900; ... } SERVICE DEFINITION vs SERVICE DISCOVERY
  • 31. server { listen 80; server_name hello-world.api.mesoscon.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; ... access_by_lua "ngx.apiGateway.validation.validateRequest()"; # ------------------------------------------------- # Proxy the request to the actual microservice # ------------------------------------------------- proxy_pass http://hello-world; } } ... upstream hello-world { # -------------------------------- # Specify the list of backends # where hello-world microservice # is running # -------------------------------- server 10.0.0.7:13780; server 10.0.0.8:11900; ... } SERVICE DEFINITION vs SERVICE DISCOVERY
  • 33. curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data ' { "id": "hello-world", "container": { "type": "DOCKER", "docker": { "image": "adobeapiplatform/echo-microservice:latest", "forcePullImage": false, "network": "BRIDGE", "portMappings": [ { "containerPort": 8080, "hostPort": 0, "protocol": "tcp" } ] } }, "cpus": 0.5, "mem": 1024.0, "ports": [ 0 ], "instances": 1 }' DEPLOY THE SAMPLE hello-world MICROSERVICE :
  • 34. … WITH 2 SIMPLE ENDPOINTS
  • 35. 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": "BRIDGE", "portMappings": [ { "containerPort": 6379, "hostPort": 0, "protocol": "tcp" } ] } }, "cpus": 0.5, "mem": 1024.0, "constraints": [ [ "hostname", "UNIQUE" ] ], "ports": [ 0 ], "instances": 1 }' API GATEWAY : API KEY Management with Redis
  • 36. set $marathon_app_name hello-world; location / { … # identify the service
 set $service_id $marathon_app_name;
 
 # READ THE API KEY # either from the query string or from the "X-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; Create a new Vhost for server_name ~hello-world.api.(?<domain>.+); API GATEWAY : API KEY Management with Redis Protecting a service with API-KEY Validation
  • 37. # 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=demo-app& 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" API GATEWAY : API KEY Management with Redis Create a new API-KEY and save it into Redis cache
  • 38. •  Demo: Throttling / Rate Limiting
  • 39. THROTTLING: Installing the Microservice curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data ' { "id": "cell-os/gateway-tracking-service", "container": { "type": "DOCKER", "docker": { "image": "adobeapiplatform/gateway-tracking-service:latest", "forcePullImage": false, "network": "BRIDGE", "portMappings": [ {"containerPort": 8080, "hostPort": 0, "protocol": "tcp"} ] } }, "env": { "mesos.api.endpoint":"http://<marathon-host>/v2/apps/cell-os/api-gateway/tasks", "spring.profiles.active":"mesos-cluster", "gw.http.port":"5000", "zmq.port":"6001", "logging.level.com.adobe.api.platform.gwts.metrics.MetricsService":"WARN", "redis.host":"<redis-host>", "redis.port":"<redis_port>" }, "cpus": 2, "mem": 4096.0, "ports": [ 0 ], "instances": 1 }'
  • 40. API GATEWAY : Adding a new throttling policy curl -i -X POST "http://cell-os_gateway-tracking-service.<domain>/api/policies/throttling" -H "Content-Type:application/json" -H "X-AMS-Policy-Type:THROTTLING_POLICY" --data ' [{ "id": "2", "softLimit": 3, "maxDelayPeriod": 4, "hardLimit": 5, "timeUnit": "SECONDS", "span": 30, "lastModified": 1438019079000, "domain": { "$api_key": "key-1" } }]' A Low Water Mark after which the Gateway DELAYS requests A High Water Mark after which the Gateway BLOCKS requests Limits are enforced on a 30s time window This policy is enforced only on requests with api_key=key-1
  • 41. API GATEWAY : Listing existing throttling policies curl "http://cell-os_gateway-tracking-service.<domain>/api/policies/throttling" [{ id: 2, lastModified: 1438019079000, domain: { $api_key: "key-1" }, softLimit: 5, hardLimit: 9, timeUnit: "SECONDS", span: 30, maxDelayPeriod: 3 }]
  • 43.
  • 44.
  • 45. Key Takeaways 1.  Think holistically at microservices 2.  "Less is more." "Does my microservice really need to care about ..." •  Identify Provider, Access Control, Throttling 3.  Think about integrating a microservice API Gateway into your Mesos clusters •  Consider using a proven solution used by Adobe I/O https://github.com/adobe-apiplatform/apigateway