SlideShare une entreprise Scribd logo
1  sur  51
Télécharger pour lire hors ligne
Chapter 2
Using an API Gateway
Designing and Deploying Microservices
1
by Chris Richardson
2
1. Number of items in the shopping cart
2. Order history
3. Customer reviews
4. Low inventory warning
5. Shipping options
6. Various recommendations, including other products this product is frequently
bought with, other products bought by customers who bought this product,
and other products viewed by customers who bought this product
7. Alternative purchasing options
3
GET api.company.com/productdetails/productId
Monolithic application architecture
A load balancer routes the request to one of several identical application
instances. The application then queries various database tables and
return the response to the client
4
Microservices Architecture
● Shopping Cart Service – Number of items in the shopping cart
● Order Service – Order history
● Catalog Service – Basic product information, such as product name, image,
and price
● Review Service – Customer reviews
● Inventory Service – Low inventory warning
● Shipping Service – Shipping options, deadlines, and costs, drawn separately
from the shipping provider’s API
● Recommendation Service(s) – Suggested items
5
6
https://serviceName.api.company.name
Direct Client-to-Microservice Communication
Each microservice would have a public endpoint.
7
shopcart.api.abc.com
shipping.api.abc.com
inventory.api.abc.com
order.api.abc.com
recom.api.abc.com
review.api.abc.com
catalog.api.abc.com
8
Direct Client-to-Microservice
Communication
9
The First Problem is
the mismatch between the needs of the client and the
fine-grained APIs exposed by each of the microservices.
10
The First Problem
1. The client in this example has to make seven separate requests.
○ For example, Amazon describes how hundreds of services are involved in rendering their
product page.
2. Too inefficient over the public Internet
11
一個頁面要七個請求
一個頁面要二十個請求
一個頁面要一百個請求
The Second Problem is
the client directly calling the microservices is that some
might use protocols that are not web-friendly.
12
1. One service might use Thrift binary RPC while another service might use the
AMQP messaging protocol.
2. An application should use protocols such as HTTP and WebSocket outside
of the firewall.
The Second Problem
Apache Thrift
13
The Third Problem is
it makes it difficult to refactor the microservices.
14
The Thrid Problem
1. Over time we might want to change how the system is partitioned into
services. For example, we might merge two services or split a service into
two or more services.
2. The clients communicate directly with the services, then performing this kind
of refactoring can be extremely difficult.
15
Direct Client-to-Microservice Communication
1. fine-grained APIs exposed
2. protocols are not web-friendly.
3. difficult to refactor
16
17
Using an API Gateway
18
What is an API Gateway?
● Single entry point into the system
● similar to Facade pattern from OOD.
● other responsibilities such as authentication, monitoring, load balancing,
caching, request shaping and management, and static response handling
19
api.abc.com
20
Amazon API Gateway
Single Entry Point
21
Overview API Gateway
Microservices on AWS (AWS Whitepaper, PDF)
22
Facade Pattern
http://teddy-chen-tw.blogspot.com/2013/08/facade-pattern.html 23
http://teddy-chen-tw.blogspot.com/2013/08/facade-pattern.html 24
簡單說:就是個大門,而且只有一個
Authencation (鑰匙)
Monitoring (監控)
Cache (玄關)
Management (櫃檯)
...
25
26
The API Gateway is responsible for
1. request routing: routes requests to the appropriate microservice.
2. composition: The API Gateway will often handle a request by invoking
multiple microservices and aggregating the results
3. protocol translation: It can translate between web protocols such as HTTP
and WebSocket and web-unfriendly protocols that are used internally.
27
API Composition
https://microservices.io/patterns/data/api-composition.html
28
1. a mobile client to retrieve all of the
product details with a single
request.
2. The API Gateway handles the
request by invoking the various
services – product information,
recommendations, reviews, etc –
and combining the results
1. The Netflix streaming service is available on hundreds of different kinds of
devices including televisions, set-top boxes, smartphones, gaming systems,
tablets, etc.
2. provide a one-size-fits-all API for their streaming service.
3. they use an API Gateway that provides an API tailored for each device by
running device-specific adapter code. An adapter typically handles each
request by invoking, on average, six to seven backend services.
Example: Nextflix API Gateway
29
Benefits and Drawbacks
of an API Gateway
30
Benefits
● A major bene t of using an API Gateway is that it encapsulates the internal
structure of the application.
● The API Gateway provides each kind of client with a specific API. This
reduces the number of round trips between the client and application. It
also simplifies the client code.
31
Drawbacks
● It is yet another highly available component that must be developed,
deployed, and managed.
● There is also a risk that the API Gateway becomes a development
bottleneck.
32
Notes
● It is important that the process for updating the API Gateway be as
lightweight as possible. (Deployment and Operational)
● Despite these drawbacks, however, for most real-world applications it makes
sense to use an API Gateway.
33
34
Implementing an API Gateway
(賣產品)
35
Performance and Scalability
● Only a handful of companies operate at the scale of Netflix and need to
handle billions of requests per day.
● It makes sense, therefore, to build the API Gateway on a platform that
supports asynchronous, non-blocking I/O.
● On the JVM you can use one of the NIO-based frameworks such Netty,
Vertx, Spring Reactor, or JBoss Undertow. One popular non-JVM option is
Node.js.
● NGINX Plus o ers a mature, scalable, high-performance web server and
reverse proxy that is easily deployed, configured, and programmed.
36
37
https://microservices.io/patterns/data/api-composition.html
Authencation before
Validation the request
using the traditional async callback
approach quickly leads you to
callback hell.
Using a Reactive Programming Model
● CompletableFuture in Java 8
● Promise in JavaScript
● Reactive Extensions (also called Rx or ReactiveX), in Microsoft.NET
Platform
38
Service Invocation
● A microservices-based application is a distributed system and must use an
inter-process communication (IPC, Chapter 3) mechanism.
○ One option is to use an asynchronous, messaging-based mechanism. Some
implementations use a message broker such as JMS or AMQP. Others, such as Zeromq, are
brokerless and the services communicate directly.
○ The other style of inter-process communication is a synchronous mechanism such as HTTP
or Thrift.
● Consequently, the API Gateway will need to support a variety of
communication mechanisms.
39
Service Discovery
● The API Gateway needs to know the location (IP address and port) of each microservice with which
it communicates.
● in a modern, cloud-based microservices application, finding the needed locations is a non-trivial
problem.
● determining the location of an application service is not so easy, because of autoscaling and
upgrades.
● service discovery mechanism: either server-side discovery or client-side discovery Chapter 4
40
Amazon API Gateway
Single Entry Point
41Overview API Gateway
Resource Discovery on AWS
42
● Security Groups
● IAM Roles
● Resource Tags
● AWS SDK / CLI
Ops as Code with AWS CLI
TAG="ops:status"
VALUE="retired"
# 找出標記 retire 的機器
aws ec2 describe-instances 
--query 'Reservations[*].Instances[*].[InstanceId]' 
--filters Name=tag:$TAG,Values=$VALUE
--output text |
while IFS= read -r item
do
# 把 termination protection 關掉
aws ec2 modify-instance-attribute 
--instance-id $item 
--no-disable-api-termination
# terminate EC2 instance
aws ec2 terminate-instances --instance-ids $item
done
Handling Partial Failures
● This issue arises in all distributed systems whenever one service calls
another service that is either responding slowly or is unavailable.
● For example, if the recommendation service is unresponsive in the product details scenario, the API
Gateway should return the rest of the product details to the client since they are still useful to the
user.
● The API Gateway could also return cached data if that is available.
43
Netflix Hystrix (豪豬)
● Hystrix is a latency and fault tolerance library designed to isolate points of access to remote
systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex
distributed systems where failure is inevitable.
● implement circuit breaker pattern
● If the error rate for a service exceeds a specified threshold, Hystrix trips the circuit breaker and all
requests will fail immediately for a specified period of time. (service 的 error rate 超過指定的臨界
值,Hystrix 跳開斷路器,在一段時間之 內立即中短所有的請求。 )
● JVM base.
44
補充:Service Mesh
● 一種基礎架構 (infrastructure layer) 的服務,負責處理的是 Service 跟 Service 之間通訊的安全、可靠、速度。
● 現代網路的基礎協議是 TCP/IP,Microservice 的通訊就是 Service Mesh
45
Implementation: Envoy
46
Summary
47
48
1. makes sense to implement an API Gateway which acts as a single entry
point into a system
2. responsible for request routing, composition, and protocol translation
3. provides each of the application’s clients with a custom API.
4. mask failures in the backend services by returning cached or default data
API Gateway Features
49
https://konghq.com/kong-community-edition/
50
https://docs.microsoft.com/zh-tw/dotnet/standard/microservices-architecture/architect-microservice-container-ap
ions/direct-client-to-microservice-communication-versus-the-api-gateway-pattern
Reference
● Microservices.io
● Production-Ready Microservices (Free, 120+)
● Building Microservices
● Microservice Patterns (Manning) - MEAP
● Microservices on AWS (AWS Whitepaper, PDF)
● AWS re:Invent 2017: Building Microservice on AWS
● AWS re:Invent 2016: From Monolithic to Microservices: Evolving Architecture
Patterns
51

Contenu connexe

Tendances

Meetup milano #4 log management and anypoint advanced monitoring
Meetup milano #4   log management and anypoint advanced monitoringMeetup milano #4   log management and anypoint advanced monitoring
Meetup milano #4 log management and anypoint advanced monitoringGonzalo Marcos Ansoain
 
Driving success in the cloud with NGINX
Driving success in the cloud with NGINXDriving success in the cloud with NGINX
Driving success in the cloud with NGINXNGINX, Inc.
 
How to Overcome Data Challenges When Refactoring Monoliths to Microservices
How to Overcome Data Challenges When Refactoring Monoliths to MicroservicesHow to Overcome Data Challenges When Refactoring Monoliths to Microservices
How to Overcome Data Challenges When Refactoring Monoliths to MicroservicesVMware Tanzu
 
Continuous Delivery to the Cloud: Automate Thru Production with CI + Spinnaker
Continuous Delivery to the Cloud: Automate Thru Production with CI + SpinnakerContinuous Delivery to the Cloud: Automate Thru Production with CI + Spinnaker
Continuous Delivery to the Cloud: Automate Thru Production with CI + SpinnakerVMware Tanzu
 
Cloud-Native Fundamentals: Accelerating Development with Continuous Integration
Cloud-Native Fundamentals: Accelerating Development with Continuous IntegrationCloud-Native Fundamentals: Accelerating Development with Continuous Integration
Cloud-Native Fundamentals: Accelerating Development with Continuous IntegrationVMware Tanzu
 
Application delivery controllers
Application delivery controllersApplication delivery controllers
Application delivery controllerscubixtech
 
Agile Integration Workshop
Agile Integration WorkshopAgile Integration Workshop
Agile Integration WorkshopJudy Breedlove
 
3298 microservices and how they relate to esb api and messaging - inter con...
3298   microservices and how they relate to esb api and messaging - inter con...3298   microservices and how they relate to esb api and messaging - inter con...
3298 microservices and how they relate to esb api and messaging - inter con...Kim Clark
 
Java Application Modernization Patterns and Stories from the IBM Garage
Java Application Modernization Patterns and Stories from the IBM GarageJava Application Modernization Patterns and Stories from the IBM Garage
Java Application Modernization Patterns and Stories from the IBM GarageHolly Cummins
 
IBM Hybrid Integration Platform
IBM Hybrid Integration PlatformIBM Hybrid Integration Platform
IBM Hybrid Integration PlatformRobert Nicholson
 
Accelerate Digital Transformation with Pivotal Cloud Foundry on Azure
Accelerate Digital Transformation with Pivotal Cloud Foundry on AzureAccelerate Digital Transformation with Pivotal Cloud Foundry on Azure
Accelerate Digital Transformation with Pivotal Cloud Foundry on AzureVMware Tanzu
 
Four Steps Toward a Safer Continuous Delivery Practice (Hint: Add Monitoring)
Four Steps Toward a Safer Continuous Delivery Practice (Hint: Add Monitoring)Four Steps Toward a Safer Continuous Delivery Practice (Hint: Add Monitoring)
Four Steps Toward a Safer Continuous Delivery Practice (Hint: Add Monitoring)VMware Tanzu
 
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 Review
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 ReviewBlockchain, Integration, Serverless, Microservices - OOW / Code One 2018 Review
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 ReviewRobert van Mölken
 
Microservices Architecture & Testing Strategies
Microservices Architecture & Testing StrategiesMicroservices Architecture & Testing Strategies
Microservices Architecture & Testing StrategiesAraf Karsh Hamid
 
Accenture tech vision 2018 slideshare trend4_frictionless-biz_aw_a_mc
Accenture tech vision 2018 slideshare trend4_frictionless-biz_aw_a_mcAccenture tech vision 2018 slideshare trend4_frictionless-biz_aw_a_mc
Accenture tech vision 2018 slideshare trend4_frictionless-biz_aw_a_mcJulien Francois
 
Cloud-Native Workshop New York- Pivotal
Cloud-Native Workshop New York- PivotalCloud-Native Workshop New York- Pivotal
Cloud-Native Workshop New York- PivotalVMware Tanzu
 
Microservices Architecture & Testing Strategies
Microservices Architecture & Testing StrategiesMicroservices Architecture & Testing Strategies
Microservices Architecture & Testing StrategiesAraf Karsh Hamid
 
Secure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINX
Secure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINXSecure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINX
Secure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINXNGINX, Inc.
 

Tendances (20)

Meetup milano #4 log management and anypoint advanced monitoring
Meetup milano #4   log management and anypoint advanced monitoringMeetup milano #4   log management and anypoint advanced monitoring
Meetup milano #4 log management and anypoint advanced monitoring
 
Driving success in the cloud with NGINX
Driving success in the cloud with NGINXDriving success in the cloud with NGINX
Driving success in the cloud with NGINX
 
How to Overcome Data Challenges When Refactoring Monoliths to Microservices
How to Overcome Data Challenges When Refactoring Monoliths to MicroservicesHow to Overcome Data Challenges When Refactoring Monoliths to Microservices
How to Overcome Data Challenges When Refactoring Monoliths to Microservices
 
Continuous Delivery to the Cloud: Automate Thru Production with CI + Spinnaker
Continuous Delivery to the Cloud: Automate Thru Production with CI + SpinnakerContinuous Delivery to the Cloud: Automate Thru Production with CI + Spinnaker
Continuous Delivery to the Cloud: Automate Thru Production with CI + Spinnaker
 
Api Gateway
Api GatewayApi Gateway
Api Gateway
 
Cloud-Native Fundamentals: Accelerating Development with Continuous Integration
Cloud-Native Fundamentals: Accelerating Development with Continuous IntegrationCloud-Native Fundamentals: Accelerating Development with Continuous Integration
Cloud-Native Fundamentals: Accelerating Development with Continuous Integration
 
Application delivery controllers
Application delivery controllersApplication delivery controllers
Application delivery controllers
 
Agile Integration Workshop
Agile Integration WorkshopAgile Integration Workshop
Agile Integration Workshop
 
3298 microservices and how they relate to esb api and messaging - inter con...
3298   microservices and how they relate to esb api and messaging - inter con...3298   microservices and how they relate to esb api and messaging - inter con...
3298 microservices and how they relate to esb api and messaging - inter con...
 
Java Application Modernization Patterns and Stories from the IBM Garage
Java Application Modernization Patterns and Stories from the IBM GarageJava Application Modernization Patterns and Stories from the IBM Garage
Java Application Modernization Patterns and Stories from the IBM Garage
 
IBM Hybrid Integration Platform
IBM Hybrid Integration PlatformIBM Hybrid Integration Platform
IBM Hybrid Integration Platform
 
Accelerate Digital Transformation with Pivotal Cloud Foundry on Azure
Accelerate Digital Transformation with Pivotal Cloud Foundry on AzureAccelerate Digital Transformation with Pivotal Cloud Foundry on Azure
Accelerate Digital Transformation with Pivotal Cloud Foundry on Azure
 
Four Steps Toward a Safer Continuous Delivery Practice (Hint: Add Monitoring)
Four Steps Toward a Safer Continuous Delivery Practice (Hint: Add Monitoring)Four Steps Toward a Safer Continuous Delivery Practice (Hint: Add Monitoring)
Four Steps Toward a Safer Continuous Delivery Practice (Hint: Add Monitoring)
 
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 Review
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 ReviewBlockchain, Integration, Serverless, Microservices - OOW / Code One 2018 Review
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 Review
 
Microservices Architecture & Testing Strategies
Microservices Architecture & Testing StrategiesMicroservices Architecture & Testing Strategies
Microservices Architecture & Testing Strategies
 
Accenture tech vision 2018 slideshare trend4_frictionless-biz_aw_a_mc
Accenture tech vision 2018 slideshare trend4_frictionless-biz_aw_a_mcAccenture tech vision 2018 slideshare trend4_frictionless-biz_aw_a_mc
Accenture tech vision 2018 slideshare trend4_frictionless-biz_aw_a_mc
 
Cloud-Native Workshop New York- Pivotal
Cloud-Native Workshop New York- PivotalCloud-Native Workshop New York- Pivotal
Cloud-Native Workshop New York- Pivotal
 
Microservices Architecture & Testing Strategies
Microservices Architecture & Testing StrategiesMicroservices Architecture & Testing Strategies
Microservices Architecture & Testing Strategies
 
IBM Cloud Direct Link 2.0
IBM Cloud Direct Link 2.0IBM Cloud Direct Link 2.0
IBM Cloud Direct Link 2.0
 
Secure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINX
Secure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINXSecure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINX
Secure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINX
 

Similaire à Study Notes - Using an API Gateway

Comparison of Current Service Mesh Architectures
Comparison of Current Service Mesh ArchitecturesComparison of Current Service Mesh Architectures
Comparison of Current Service Mesh ArchitecturesMirantis
 
Intro to Microservices Architecture
Intro to Microservices ArchitectureIntro to Microservices Architecture
Intro to Microservices ArchitecturePeter Nijem
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitectureABDEL RAHMAN KARIM
 
IBM API Connect Deployment `Good Practices - IBM Think 2018
IBM API Connect Deployment `Good Practices - IBM Think 2018IBM API Connect Deployment `Good Practices - IBM Think 2018
IBM API Connect Deployment `Good Practices - IBM Think 2018Chris Phillips
 
Istio Triangle Kubernetes Meetup Aug 2019
Istio Triangle Kubernetes Meetup Aug 2019Istio Triangle Kubernetes Meetup Aug 2019
Istio Triangle Kubernetes Meetup Aug 2019Ram Vennam
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architectureFaren faren
 
Do You Need A Service Mesh?
Do You Need A Service Mesh?Do You Need A Service Mesh?
Do You Need A Service Mesh?NGINX, Inc.
 
Arsitektur Aplikasi Modern - Faisal Henry Susanto
Arsitektur Aplikasi Modern - Faisal Henry SusantoArsitektur Aplikasi Modern - Faisal Henry Susanto
Arsitektur Aplikasi Modern - Faisal Henry SusantoDicodingEvent
 
APIGATEWAY in Microservices
APIGATEWAY in MicroservicesAPIGATEWAY in Microservices
APIGATEWAY in MicroservicesIRJET Journal
 
Acme Freight: Developing Microservices and APIs on Bluemix
Acme Freight: Developing Microservices and APIs on BluemixAcme Freight: Developing Microservices and APIs on Bluemix
Acme Freight: Developing Microservices and APIs on BluemixJoe Sepi
 
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
API Gateway How-To: The Many Ways to Apply the Gateway PatternAPI Gateway How-To: The Many Ways to Apply the Gateway Pattern
API Gateway How-To: The Many Ways to Apply the Gateway PatternVMware Tanzu
 
MuleSoft Surat Meetup#43 - Combine Service Mesh With Anypoint API Management ...
MuleSoft Surat Meetup#43 - Combine Service Mesh With Anypoint API Management ...MuleSoft Surat Meetup#43 - Combine Service Mesh With Anypoint API Management ...
MuleSoft Surat Meetup#43 - Combine Service Mesh With Anypoint API Management ...Jitendra Bafna
 
API Management within a Microservice Architecture
API Management within a Microservice ArchitectureAPI Management within a Microservice Architecture
API Management within a Microservice ArchitectureWSO2
 
API Management Within a Microservices Architecture
API Management Within a Microservices Architecture API Management Within a Microservices Architecture
API Management Within a Microservices Architecture Nadeesha Gamage
 
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...WSO2
 
Microservices and Deployment Methodologies
Microservices and Deployment MethodologiesMicroservices and Deployment Methodologies
Microservices and Deployment MethodologiesYash Gupta
 
Uncover the Flex Gateway with a Demonstration (1).pdf
Uncover the Flex Gateway with a Demonstration (1).pdfUncover the Flex Gateway with a Demonstration (1).pdf
Uncover the Flex Gateway with a Demonstration (1).pdfPankaj Goyal
 

Similaire à Study Notes - Using an API Gateway (20)

Comparison of Current Service Mesh Architectures
Comparison of Current Service Mesh ArchitecturesComparison of Current Service Mesh Architectures
Comparison of Current Service Mesh Architectures
 
WEB API Gateway
WEB API GatewayWEB API Gateway
WEB API Gateway
 
Intro to Microservices Architecture
Intro to Microservices ArchitectureIntro to Microservices Architecture
Intro to Microservices Architecture
 
Microservices
MicroservicesMicroservices
Microservices
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitecture
 
IBM API Connect Deployment `Good Practices - IBM Think 2018
IBM API Connect Deployment `Good Practices - IBM Think 2018IBM API Connect Deployment `Good Practices - IBM Think 2018
IBM API Connect Deployment `Good Practices - IBM Think 2018
 
Istio Triangle Kubernetes Meetup Aug 2019
Istio Triangle Kubernetes Meetup Aug 2019Istio Triangle Kubernetes Meetup Aug 2019
Istio Triangle Kubernetes Meetup Aug 2019
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architecture
 
Do You Need A Service Mesh?
Do You Need A Service Mesh?Do You Need A Service Mesh?
Do You Need A Service Mesh?
 
Arsitektur Aplikasi Modern - Faisal Henry Susanto
Arsitektur Aplikasi Modern - Faisal Henry SusantoArsitektur Aplikasi Modern - Faisal Henry Susanto
Arsitektur Aplikasi Modern - Faisal Henry Susanto
 
APIGATEWAY in Microservices
APIGATEWAY in MicroservicesAPIGATEWAY in Microservices
APIGATEWAY in Microservices
 
Microservice architecture-api-gateway-considerations
Microservice architecture-api-gateway-considerationsMicroservice architecture-api-gateway-considerations
Microservice architecture-api-gateway-considerations
 
Acme Freight: Developing Microservices and APIs on Bluemix
Acme Freight: Developing Microservices and APIs on BluemixAcme Freight: Developing Microservices and APIs on Bluemix
Acme Freight: Developing Microservices and APIs on Bluemix
 
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
API Gateway How-To: The Many Ways to Apply the Gateway PatternAPI Gateway How-To: The Many Ways to Apply the Gateway Pattern
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
 
MuleSoft Surat Meetup#43 - Combine Service Mesh With Anypoint API Management ...
MuleSoft Surat Meetup#43 - Combine Service Mesh With Anypoint API Management ...MuleSoft Surat Meetup#43 - Combine Service Mesh With Anypoint API Management ...
MuleSoft Surat Meetup#43 - Combine Service Mesh With Anypoint API Management ...
 
API Management within a Microservice Architecture
API Management within a Microservice ArchitectureAPI Management within a Microservice Architecture
API Management within a Microservice Architecture
 
API Management Within a Microservices Architecture
API Management Within a Microservices Architecture API Management Within a Microservices Architecture
API Management Within a Microservices Architecture
 
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
 
Microservices and Deployment Methodologies
Microservices and Deployment MethodologiesMicroservices and Deployment Methodologies
Microservices and Deployment Methodologies
 
Uncover the Flex Gateway with a Demonstration (1).pdf
Uncover the Flex Gateway with a Demonstration (1).pdfUncover the Flex Gateway with a Demonstration (1).pdf
Uncover the Flex Gateway with a Demonstration (1).pdf
 

Plus de Rick Hwang

在生命轉彎的地方 - 從軟體開發職涯,探索人生
在生命轉彎的地方 - 從軟體開發職涯,探索人生在生命轉彎的地方 - 從軟體開發職涯,探索人生
在生命轉彎的地方 - 從軟體開發職涯,探索人生Rick Hwang
 
20230829 - 探索職涯,複利人生
20230829 - 探索職涯,複利人生20230829 - 探索職涯,複利人生
20230829 - 探索職涯,複利人生Rick Hwang
 
2023 08 - SRE 實踐與開發平台指南 - 書友見面會
2023 08 - SRE 實踐與開發平台指南 - 書友見面會2023 08 - SRE 實踐與開發平台指南 - 書友見面會
2023 08 - SRE 實踐與開發平台指南 - 書友見面會Rick Hwang
 
20230215 - 凝聚團隊共識的溝通方法 (Effective Team Communication)
20230215 - 凝聚團隊共識的溝通方法 (Effective Team Communication)20230215 - 凝聚團隊共識的溝通方法 (Effective Team Communication)
20230215 - 凝聚團隊共識的溝通方法 (Effective Team Communication)Rick Hwang
 
軟體測試實務新書發表會 - 從品質與測試,讓軟體再次偉大
軟體測試實務新書發表會 - 從品質與測試,讓軟體再次偉大軟體測試實務新書發表會 - 從品質與測試,讓軟體再次偉大
軟體測試實務新書發表會 - 從品質與測試,讓軟體再次偉大Rick Hwang
 
CH02 API Governance
CH02 API Governance CH02 API Governance
CH02 API Governance Rick Hwang
 
Chapter 8. Partial updates and retrievals.pdf
Chapter 8. Partial updates and retrievals.pdfChapter 8. Partial updates and retrievals.pdf
Chapter 8. Partial updates and retrievals.pdfRick Hwang
 
Ch09 Custom Methods
Ch09 Custom MethodsCh09 Custom Methods
Ch09 Custom MethodsRick Hwang
 
AWS Career Exploration Day
AWS Career Exploration DayAWS Career Exploration Day
AWS Career Exploration DayRick Hwang
 
從理想、到現實的距離,開啟品味軟體測試之路 - 台灣軟體工程協會 (20220813)
從理想、到現實的距離,開啟品味軟體測試之路 - 台灣軟體工程協會 (20220813)從理想、到現實的距離,開啟品味軟體測試之路 - 台灣軟體工程協會 (20220813)
從理想、到現實的距離,開啟品味軟體測試之路 - 台灣軟體工程協會 (20220813)Rick Hwang
 
SRE Conf 2022 - 91APP 在 AWS 上的 SRE 實踐之路
SRE Conf 2022 - 91APP 在 AWS 上的 SRE 實踐之路SRE Conf 2022 - 91APP 在 AWS 上的 SRE 實踐之路
SRE Conf 2022 - 91APP 在 AWS 上的 SRE 實踐之路Rick Hwang
 
導讀持續交付 2.0 - CH02 價值探索環
導讀持續交付 2.0 - CH02 價值探索環 導讀持續交付 2.0 - CH02 價值探索環
導讀持續交付 2.0 - CH02 價值探索環 Rick Hwang
 
2020 AWS Summit - 如何有效管理 AWS 的成本結構與系統架構
2020 AWS Summit - 如何有效管理 AWS 的成本結構與系統架構2020 AWS Summit - 如何有效管理 AWS 的成本結構與系統架構
2020 AWS Summit - 如何有效管理 AWS 的成本結構與系統架構Rick Hwang
 
災難演練 @ AWS 實戰分享 (Using AWS for Disaster Recovery)
災難演練 @ AWS 實戰分享 (Using AWS for Disaster Recovery)災難演練 @ AWS 實戰分享 (Using AWS for Disaster Recovery)
災難演練 @ AWS 實戰分享 (Using AWS for Disaster Recovery)Rick Hwang
 
Software Development Process v1.5 - 20121214
Software Development Process v1.5 - 20121214Software Development Process v1.5 - 20121214
Software Development Process v1.5 - 20121214Rick Hwang
 
第三章 建立良好的人際關係網路
第三章 建立良好的人際關係網路第三章 建立良好的人際關係網路
第三章 建立良好的人際關係網路Rick Hwang
 
Wiki in Teamroom - Connected Mind
Wiki in Teamroom - Connected MindWiki in Teamroom - Connected Mind
Wiki in Teamroom - Connected MindRick Hwang
 
導讀持續交付 2.0 - 談當代軟體交付之虛實融合
導讀持續交付 2.0 - 談當代軟體交付之虛實融合導讀持續交付 2.0 - 談當代軟體交付之虛實融合
導讀持續交付 2.0 - 談當代軟體交付之虛實融合Rick Hwang
 
從緊急事件 談 SRE 應變能力的培養 - DevOpsDays Taipei 2018
從緊急事件  談 SRE 應變能力的培養 - DevOpsDays Taipei 2018從緊急事件  談 SRE 應變能力的培養 - DevOpsDays Taipei 2018
從緊急事件 談 SRE 應變能力的培養 - DevOpsDays Taipei 2018Rick Hwang
 
Continuous Delivery - Opening
Continuous Delivery - OpeningContinuous Delivery - Opening
Continuous Delivery - OpeningRick Hwang
 

Plus de Rick Hwang (20)

在生命轉彎的地方 - 從軟體開發職涯,探索人生
在生命轉彎的地方 - 從軟體開發職涯,探索人生在生命轉彎的地方 - 從軟體開發職涯,探索人生
在生命轉彎的地方 - 從軟體開發職涯,探索人生
 
20230829 - 探索職涯,複利人生
20230829 - 探索職涯,複利人生20230829 - 探索職涯,複利人生
20230829 - 探索職涯,複利人生
 
2023 08 - SRE 實踐與開發平台指南 - 書友見面會
2023 08 - SRE 實踐與開發平台指南 - 書友見面會2023 08 - SRE 實踐與開發平台指南 - 書友見面會
2023 08 - SRE 實踐與開發平台指南 - 書友見面會
 
20230215 - 凝聚團隊共識的溝通方法 (Effective Team Communication)
20230215 - 凝聚團隊共識的溝通方法 (Effective Team Communication)20230215 - 凝聚團隊共識的溝通方法 (Effective Team Communication)
20230215 - 凝聚團隊共識的溝通方法 (Effective Team Communication)
 
軟體測試實務新書發表會 - 從品質與測試,讓軟體再次偉大
軟體測試實務新書發表會 - 從品質與測試,讓軟體再次偉大軟體測試實務新書發表會 - 從品質與測試,讓軟體再次偉大
軟體測試實務新書發表會 - 從品質與測試,讓軟體再次偉大
 
CH02 API Governance
CH02 API Governance CH02 API Governance
CH02 API Governance
 
Chapter 8. Partial updates and retrievals.pdf
Chapter 8. Partial updates and retrievals.pdfChapter 8. Partial updates and retrievals.pdf
Chapter 8. Partial updates and retrievals.pdf
 
Ch09 Custom Methods
Ch09 Custom MethodsCh09 Custom Methods
Ch09 Custom Methods
 
AWS Career Exploration Day
AWS Career Exploration DayAWS Career Exploration Day
AWS Career Exploration Day
 
從理想、到現實的距離,開啟品味軟體測試之路 - 台灣軟體工程協會 (20220813)
從理想、到現實的距離,開啟品味軟體測試之路 - 台灣軟體工程協會 (20220813)從理想、到現實的距離,開啟品味軟體測試之路 - 台灣軟體工程協會 (20220813)
從理想、到現實的距離,開啟品味軟體測試之路 - 台灣軟體工程協會 (20220813)
 
SRE Conf 2022 - 91APP 在 AWS 上的 SRE 實踐之路
SRE Conf 2022 - 91APP 在 AWS 上的 SRE 實踐之路SRE Conf 2022 - 91APP 在 AWS 上的 SRE 實踐之路
SRE Conf 2022 - 91APP 在 AWS 上的 SRE 實踐之路
 
導讀持續交付 2.0 - CH02 價值探索環
導讀持續交付 2.0 - CH02 價值探索環 導讀持續交付 2.0 - CH02 價值探索環
導讀持續交付 2.0 - CH02 價值探索環
 
2020 AWS Summit - 如何有效管理 AWS 的成本結構與系統架構
2020 AWS Summit - 如何有效管理 AWS 的成本結構與系統架構2020 AWS Summit - 如何有效管理 AWS 的成本結構與系統架構
2020 AWS Summit - 如何有效管理 AWS 的成本結構與系統架構
 
災難演練 @ AWS 實戰分享 (Using AWS for Disaster Recovery)
災難演練 @ AWS 實戰分享 (Using AWS for Disaster Recovery)災難演練 @ AWS 實戰分享 (Using AWS for Disaster Recovery)
災難演練 @ AWS 實戰分享 (Using AWS for Disaster Recovery)
 
Software Development Process v1.5 - 20121214
Software Development Process v1.5 - 20121214Software Development Process v1.5 - 20121214
Software Development Process v1.5 - 20121214
 
第三章 建立良好的人際關係網路
第三章 建立良好的人際關係網路第三章 建立良好的人際關係網路
第三章 建立良好的人際關係網路
 
Wiki in Teamroom - Connected Mind
Wiki in Teamroom - Connected MindWiki in Teamroom - Connected Mind
Wiki in Teamroom - Connected Mind
 
導讀持續交付 2.0 - 談當代軟體交付之虛實融合
導讀持續交付 2.0 - 談當代軟體交付之虛實融合導讀持續交付 2.0 - 談當代軟體交付之虛實融合
導讀持續交付 2.0 - 談當代軟體交付之虛實融合
 
從緊急事件 談 SRE 應變能力的培養 - DevOpsDays Taipei 2018
從緊急事件  談 SRE 應變能力的培養 - DevOpsDays Taipei 2018從緊急事件  談 SRE 應變能力的培養 - DevOpsDays Taipei 2018
從緊急事件 談 SRE 應變能力的培養 - DevOpsDays Taipei 2018
 
Continuous Delivery - Opening
Continuous Delivery - OpeningContinuous Delivery - Opening
Continuous Delivery - Opening
 

Dernier

Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一ffjhghh
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 

Dernier (20)

Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 

Study Notes - Using an API Gateway

  • 1. Chapter 2 Using an API Gateway Designing and Deploying Microservices 1 by Chris Richardson
  • 2. 2
  • 3. 1. Number of items in the shopping cart 2. Order history 3. Customer reviews 4. Low inventory warning 5. Shipping options 6. Various recommendations, including other products this product is frequently bought with, other products bought by customers who bought this product, and other products viewed by customers who bought this product 7. Alternative purchasing options 3
  • 4. GET api.company.com/productdetails/productId Monolithic application architecture A load balancer routes the request to one of several identical application instances. The application then queries various database tables and return the response to the client 4
  • 5. Microservices Architecture ● Shopping Cart Service – Number of items in the shopping cart ● Order Service – Order history ● Catalog Service – Basic product information, such as product name, image, and price ● Review Service – Customer reviews ● Inventory Service – Low inventory warning ● Shipping Service – Shipping options, deadlines, and costs, drawn separately from the shipping provider’s API ● Recommendation Service(s) – Suggested items 5
  • 6. 6
  • 10. The First Problem is the mismatch between the needs of the client and the fine-grained APIs exposed by each of the microservices. 10
  • 11. The First Problem 1. The client in this example has to make seven separate requests. ○ For example, Amazon describes how hundreds of services are involved in rendering their product page. 2. Too inefficient over the public Internet 11 一個頁面要七個請求 一個頁面要二十個請求 一個頁面要一百個請求
  • 12. The Second Problem is the client directly calling the microservices is that some might use protocols that are not web-friendly. 12
  • 13. 1. One service might use Thrift binary RPC while another service might use the AMQP messaging protocol. 2. An application should use protocols such as HTTP and WebSocket outside of the firewall. The Second Problem Apache Thrift 13
  • 14. The Third Problem is it makes it difficult to refactor the microservices. 14
  • 15. The Thrid Problem 1. Over time we might want to change how the system is partitioned into services. For example, we might merge two services or split a service into two or more services. 2. The clients communicate directly with the services, then performing this kind of refactoring can be extremely difficult. 15
  • 16. Direct Client-to-Microservice Communication 1. fine-grained APIs exposed 2. protocols are not web-friendly. 3. difficult to refactor 16
  • 17. 17
  • 18. Using an API Gateway 18
  • 19. What is an API Gateway? ● Single entry point into the system ● similar to Facade pattern from OOD. ● other responsibilities such as authentication, monitoring, load balancing, caching, request shaping and management, and static response handling 19
  • 21. Amazon API Gateway Single Entry Point 21 Overview API Gateway
  • 22. Microservices on AWS (AWS Whitepaper, PDF) 22
  • 26. 26
  • 27. The API Gateway is responsible for 1. request routing: routes requests to the appropriate microservice. 2. composition: The API Gateway will often handle a request by invoking multiple microservices and aggregating the results 3. protocol translation: It can translate between web protocols such as HTTP and WebSocket and web-unfriendly protocols that are used internally. 27
  • 28. API Composition https://microservices.io/patterns/data/api-composition.html 28 1. a mobile client to retrieve all of the product details with a single request. 2. The API Gateway handles the request by invoking the various services – product information, recommendations, reviews, etc – and combining the results
  • 29. 1. The Netflix streaming service is available on hundreds of different kinds of devices including televisions, set-top boxes, smartphones, gaming systems, tablets, etc. 2. provide a one-size-fits-all API for their streaming service. 3. they use an API Gateway that provides an API tailored for each device by running device-specific adapter code. An adapter typically handles each request by invoking, on average, six to seven backend services. Example: Nextflix API Gateway 29
  • 30. Benefits and Drawbacks of an API Gateway 30
  • 31. Benefits ● A major bene t of using an API Gateway is that it encapsulates the internal structure of the application. ● The API Gateway provides each kind of client with a specific API. This reduces the number of round trips between the client and application. It also simplifies the client code. 31
  • 32. Drawbacks ● It is yet another highly available component that must be developed, deployed, and managed. ● There is also a risk that the API Gateway becomes a development bottleneck. 32
  • 33. Notes ● It is important that the process for updating the API Gateway be as lightweight as possible. (Deployment and Operational) ● Despite these drawbacks, however, for most real-world applications it makes sense to use an API Gateway. 33
  • 34. 34
  • 35. Implementing an API Gateway (賣產品) 35
  • 36. Performance and Scalability ● Only a handful of companies operate at the scale of Netflix and need to handle billions of requests per day. ● It makes sense, therefore, to build the API Gateway on a platform that supports asynchronous, non-blocking I/O. ● On the JVM you can use one of the NIO-based frameworks such Netty, Vertx, Spring Reactor, or JBoss Undertow. One popular non-JVM option is Node.js. ● NGINX Plus o ers a mature, scalable, high-performance web server and reverse proxy that is easily deployed, configured, and programmed. 36
  • 37. 37 https://microservices.io/patterns/data/api-composition.html Authencation before Validation the request using the traditional async callback approach quickly leads you to callback hell.
  • 38. Using a Reactive Programming Model ● CompletableFuture in Java 8 ● Promise in JavaScript ● Reactive Extensions (also called Rx or ReactiveX), in Microsoft.NET Platform 38
  • 39. Service Invocation ● A microservices-based application is a distributed system and must use an inter-process communication (IPC, Chapter 3) mechanism. ○ One option is to use an asynchronous, messaging-based mechanism. Some implementations use a message broker such as JMS or AMQP. Others, such as Zeromq, are brokerless and the services communicate directly. ○ The other style of inter-process communication is a synchronous mechanism such as HTTP or Thrift. ● Consequently, the API Gateway will need to support a variety of communication mechanisms. 39
  • 40. Service Discovery ● The API Gateway needs to know the location (IP address and port) of each microservice with which it communicates. ● in a modern, cloud-based microservices application, finding the needed locations is a non-trivial problem. ● determining the location of an application service is not so easy, because of autoscaling and upgrades. ● service discovery mechanism: either server-side discovery or client-side discovery Chapter 4 40
  • 41. Amazon API Gateway Single Entry Point 41Overview API Gateway
  • 42. Resource Discovery on AWS 42 ● Security Groups ● IAM Roles ● Resource Tags ● AWS SDK / CLI Ops as Code with AWS CLI TAG="ops:status" VALUE="retired" # 找出標記 retire 的機器 aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId]' --filters Name=tag:$TAG,Values=$VALUE --output text | while IFS= read -r item do # 把 termination protection 關掉 aws ec2 modify-instance-attribute --instance-id $item --no-disable-api-termination # terminate EC2 instance aws ec2 terminate-instances --instance-ids $item done
  • 43. Handling Partial Failures ● This issue arises in all distributed systems whenever one service calls another service that is either responding slowly or is unavailable. ● For example, if the recommendation service is unresponsive in the product details scenario, the API Gateway should return the rest of the product details to the client since they are still useful to the user. ● The API Gateway could also return cached data if that is available. 43
  • 44. Netflix Hystrix (豪豬) ● Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable. ● implement circuit breaker pattern ● If the error rate for a service exceeds a specified threshold, Hystrix trips the circuit breaker and all requests will fail immediately for a specified period of time. (service 的 error rate 超過指定的臨界 值,Hystrix 跳開斷路器,在一段時間之 內立即中短所有的請求。 ) ● JVM base. 44
  • 45. 補充:Service Mesh ● 一種基礎架構 (infrastructure layer) 的服務,負責處理的是 Service 跟 Service 之間通訊的安全、可靠、速度。 ● 現代網路的基礎協議是 TCP/IP,Microservice 的通訊就是 Service Mesh 45
  • 48. 48 1. makes sense to implement an API Gateway which acts as a single entry point into a system 2. responsible for request routing, composition, and protocol translation 3. provides each of the application’s clients with a custom API. 4. mask failures in the backend services by returning cached or default data
  • 51. Reference ● Microservices.io ● Production-Ready Microservices (Free, 120+) ● Building Microservices ● Microservice Patterns (Manning) - MEAP ● Microservices on AWS (AWS Whitepaper, PDF) ● AWS re:Invent 2017: Building Microservice on AWS ● AWS re:Invent 2016: From Monolithic to Microservices: Evolving Architecture Patterns 51