- API Gateway & Netflix OSS
Number of items in the shopping cart
Order history
Customer reviews
Low inventory warning
Shipping options
Various recommendations,
Alternative purchasing options
http://shopping.api.company.name/shopcarts
http://shipping.api.company.name/shipping/availables
http://inventory.api.company.name/invertory/101
http://recommendation.api.company.name/catalog/book
.......
mobile/productdetails?productid=xxx
2,000,000,000 requests per day to the netflix API (2013)
If we can improve the interaction between the API and our UIs, we have a better chance of making more of our customers happier.
- OSFA approach is that its emphasis is to make it convenient for the API provider, not the API consumer.
The traditional definition of "client code" is all code that lives on a given device or UI. "Server code" is typically defined as the code that resides on the server. The divide between the two is the network border.
threading, synchronization, thread-safety, concurrent data structures, non-blocking IO and other such concerns......
- The Other Microservices topic.
[1] Dynamic Endpoints
[2] Endpoint Code Repository and Management
[3] Dynamic Polyglot JVM Language Runtime
[4 & 5] Asynchronous Java API + Reactive Programming Model
[6] Hystrix Fault Tolerance
[7] Backend Services and Dependencies
MS1
MS2
MS3
MS4
http://10.2.131.11:8081/api/xxx
http://10.2.131.11:8082/api/xxx
http://10.2.151.99:8080/api/xxx
MS1
MS2
MS3
MS4
Eureka Server
Eureka Client
Eureka Client
Register
Single Entry:
http://ms1/api/xxx
MS1
MS2
MS3
MS4
Eureka Server
Eureka Client
Eureka Client
Discovery
Single Entry:
http://ms1/api/xxx
Edge Server(Zuul)
Ribbon Client
Ribbon Client
Single Entry:
http://ms2/api/xxx
List<Product> productList = restTemplate.getForObject("http://ms1/api/xxx", List.class);
MS1
MS2
MS3
MS4
Eureka Server
Eureka Client
Eureka Client
Single Entry:
http://ms1/api/xxx
Amazon ELB
Edge Server(Zuul)
Edge Server(Zuul)
Ribbon Client
Ribbon Client
Single Entry:
http://ms2/api/xxx
/ps3/movies/1
Implement by Groovy
MS1
MS2
MS3
script repository
MS1
MS2
MS3
MS4
Eureka Server
Eureka Client
Eureka Client
Single Entry:
http://ms1/api/xxx
Amazon ELB
Edge Server(Zuul)
Edge Server(Zuul)
Ribbon Client
Ribbon Client
Single Entry:
http://ms2/api/xxx
/ps3/movies/1
Implement by Groovy
MS1
MS2
MS3
MS1
MS2
MS3
MS4
Eureka Server
Eureka Client
Eureka Client
Single Entry:
http://ms1/api/xxx
Amazon ELB
Edge Server(Zuul)
Edge Server(Zuul)
Ribbon Client
Ribbon Client
Single Entry:
http://ms2/api/xxx
/ps3/movies/1
Implement by Groovy
MS1
MS2
Fallback
Zuul, The Gatekeeper (http://ghostbusters.wikia.com/wiki/Zuul)
--The Netflix API is the front door to that system, supporting over 1,000 different device types and handing over 50,000 requests per second during peak hours.
To handle all of these changes, as well as other challenges in supporting a complex and high-scale system, a robust edge service that enables rapid development, great flexibility, expansive insights, and resiliency is needed.
At the center of Zuul is a series of filters that are capable of performing a range of actions during the routing of HTTP requests and responses.
class DeviceDelayFilter extends ZuulFilter {
def static Random rand = new Random()
@Override
String filterType() {
return 'pre'
}
@Override
int filterOrder() {
return 5
}
@Override
boolean shouldFilter() {
return RequestContext.getRequest().
getParameter("deviceType")?equals("BrokenDevice"):false
}
@Override
Object run() {
sleep(rand.nextInt(20000)) //Sleep for a random number of seconds
//between [0-20]
}
}
Zuul provides a framework to dynamically read, compile, and run these filters
Because Zuul can add, change, and compile filters at run-time, system behavior can be quickly altered.
Zuul gives us a lot of insight into our systems, in part by making use of other Netflix OSS components.
(Hystrix、Ribbon、 Turbine ....)
- the others
Open-source, Microservice & API Management Layer built on top of NGINX https://getkong.org
The StrongLoop API Gateway acts as an intermediary gateway between API consumers (clients) and backend providers (API servers) that externalizes, secures, and manages APIs.
The apiman project brings an open source development methodology to API Management, coupling a rich API design & configuration layer with a blazingly fast runtime.
An open source, fast and scalable API management platform featuring an API gateway, analytics, developer portal and dashboard.