Gateway API

API Gateway

Reprinted from: http://www.cnblogs.com/Leo_wl/p/4934036.html
< p style="line-height:18px;font-family:'宋体' !important;"> Original address: http://microservices.io/patterns/apigateway.html, the following is a translation of the original text using Google Translate.

Let us imagine that you are building an online store using the microservice model, and the product details page you use . You need to develop multiple versions of the product detail interface:

  l HTML generated by the server-side web application-HTML5 / JavaScript desktop and mobile browser user interface.

  l Native Android and iPhone clients-these clients interact through the REST API server.

In addition, the online store must use the product details disclosed by the third-party application REST API. A product detailed information interface can display a lot of information about the product. For example, the detailed information page of Amazon.com includes:

  l About the book, such as title, author, price And other basic information

  l The purchase history of this book

  l Availability

  l Purchase options

  l Customers who bought this book also bought those

  l Customer reviews

  l Seller ranking

  l …

   Because the online store uses the microservice model, the product detailed information data is distributed across multiple services. For example,

  l Product information-related products, such as title, basic information about the author

  l Pricing Service-Product Price

  l Ordering Service-Purchase History Products

  l Inventory Service-Product Supply

  l Comment service-customer comments…

   Therefore, codes that display product details need to obtain information in all these services.

Difficulties

How does the client of the    microservice access the individual service?

Considerations

  l The granularity of the API provided through microservices is often different from what the client needs. Microservices usually provide fine-grained APIs, which means that the client needs to interact with multiple services. For example, as described above, the details of the product required by the client need to obtain data from a variety of services.

  l Different clients need different data. For example, the desktop browser version of the product details page is usually more complicated than the mobile version.

  l Network performance is different due to different types of clients. For example, mobile networks are generally much slower and have much higher latency. Of course, any wide area network is much slower than a local area network. This means that the performance characteristics of the network used by the mobile phone’s local client and the LAN of the server web application are very different. The server-side web application can send a large number of requests to the back-end service without affecting the user experience, but the mobile client can only send a small number of requests.

  l The number of service instances and their locations (host + port) change dynamically.

  l Service may change over time, so the details should be hidden from the client.

Solution

   can implement an API gateway, which is the entrance of all clients. The API Gateway has two ways to process requests. Some requests are simply proxied/routed to the appropriate service, and other requests are forwarded to a set of services.

  

   This API gateway can provide different Instead of providing an API suitable for all situations. For example, Netflix’s API gateway runs client-specific adapter code and provides each client with the API they need.

  API gateway can also implement security, for example: verify that the client is authorized to execute the request.

Conclusion

  Using API​​gateway has the following advantages:

  l Make Service and client decoupling.

  l Decoupling the client and service deployment environment.

  l Provides the best API for each client.

  l Reduced number of requests/round trips. For example, the API gateway can retrieve data for multiple services at once. Fewer requests also means less overhead, which improves the user experience. An API gateway is essential for mobile applications.

  l simplifies client calls, because the API gateway can combine services and provide a combined façade interface.

The   API gateway model also has some disadvantages:

  l Increased complexity, API Gateway is another application that must be developed, deployed, and managed.

  l Increased response time because there is an extra layer of network jump through the API gateway. However, the cost of the extra round trip for most applications is negligible.

Question

   How to implement the API gateway? The API gateway needs to support high concurrency and high load, and use event response mechanisms (two IO mechanisms: one is blocking, the other is event response, and the latest one is GO language micro-threading). the best method. On JVM, NIO-based libraries such as Netty can be used, and NodeJS is another option.

API Gateway

Reprinted from: http://www.cnblogs.com/Leo_wl/p/4934036.html

Original address: http://microservices.io/patterns/apigateway.html, the following is used Google Translate’s translation of the original text.

Let us imagine that you are building an online store using the microservice model, and the product details page you use . You need to develop multiple versions of the product detail interface:

  l HTML generated by the server-side web application-HTML5 / JavaScript desktop and mobile browser user interface.

  l Native Android and iPhone clients-these clients interact through the REST API server.

In addition, the online store must use the product details disclosed by the third-party application REST API. A product detailed information interface can display a lot of information about the product. For example, the detailed information page of Amazon.com includes:

  l About the book, such as title, author, price And other basic information

  l The purchase history of this book

  l Availability

  l Purchase options

  l Customers who bought this book also bought those

  l Customer reviews

  l Seller ranking

  l …

   Because the online store uses the microservice model, the product detailed information data is distributed across multiple services. For example,

  l Product information-related products, such as title, basic information about the author

  l Pricing Service-Product Price

  l Ordering Service-Purchase History Products

  l Inventory Service-Product Supply

  l Comment service-customer comments…

   Therefore, codes that display product details need to obtain information in all these services.

Difficulties

How does the client of the    microservice access the individual service?

Considerations

  l The granularity of the API provided through microservices is often different from what the client needs. Microservices usually provide fine-grained APIs, which means that the client needs to interact with multiple services. For example, as described above, the details of the product required by the client need to obtain data from a variety of services.

  l Different clients need different data. For example, the desktop browser version of the product details page is usually more complicated than the mobile version.

  l Network performance is different due to different types of clients. For example, mobile networks are generally much slower and have much higher latency. Of course, any wide area network is much slower than a local area network. This means that the performance characteristics of the network used by the mobile phone’s local client and the LAN of the server web application are very different. The server-side web application can send a large number of requests to the back-end service without affecting the user experience, but the mobile client can only send a small number of requests.

  l The number of service instances and their locations (host + port) change dynamically.

  l Service may change over time, so the details should be hidden from the client.

Solution

   can implement an API gateway, which is the entrance of all clients. The API Gateway has two ways to process requests. Some requests are simply proxied/routed to the appropriate service, and other requests are forwarded to a set of services.

  

   This API gateway can provide different Instead of providing an API suitable for all situations. For example, Netflix’s API gateway runs client-specific adapter code and provides each client with the API they need.

  API gateway can also implement security, for example: verify that the client is authorized to execute the request.

Conclusion

  Using API​​gateway has the following advantages:

  l Make Service and client decoupling.

  l Decoupling the client and service deployment environment.

  l Provides the best API for each client.

  l Reduced number of requests/round trips. For example, the API gateway can retrieve data for multiple services at once. Fewer requests also means less overhead, which improves the user experience. An API gateway is essential for mobile applications.

  l simplifies client calls, because the API gateway can combine services and provide a combined façade interface.

The   API gateway model also has some disadvantages:

  l Increased complexity, API Gateway is another application that must be developed, deployed, and managed.

  l Increased response time because there is an extra layer of network jump through the API gateway. However, the cost of the extra round trip for most applications is negligible.

Question

   How to implement the API gateway? The API gateway needs to support high concurrency and high load, and use event response mechanisms (two IO mechanisms: one is blocking, the other is event response, and the latest one is GO language micro-threading). the best method. On JVM, NIO-based libraries such as Netty can be used, and NodeJS is another option.

Reposted from: http://www.cnblogs.com/Leo_wl/p/4934036.html

Original address: http://microservices.io/patterns/apigateway.html, the following is a translation of the original text using Google Translate.

Let us imagine that you are building an online store using the microservice model, and the product details page you use . You need to develop multiple versions of the product detail interface:

  l HTML generated by the server-side web application-HTML5 / JavaScript desktop and mobile browser user interface.

  l Native Android and iPhone clients-these clients interact through the REST API server.

In addition, the online store must use the product details disclosed by the third-party application REST API. A product detailed information interface can display a lot of information about the product. For example, the detailed information page of Amazon.com includes:

  l About the book, such as title, author, price And other basic information

  l The purchase history of this book

  l Availability

  l Purchase options

  l Customers who bought this book also bought those

  l Customer reviews

  l Seller ranking

  l …

   Because the online store uses the microservice model, the product detailed information data is distributed across multiple services. For example,

  l Product information-related products, such as title, basic information about the author

  l Pricing Service-Product Price

  l Ordering Service-Purchase History Products

  l Inventory Service-Product Supply

  l Comment service-customer comments…

   Therefore, codes that display product details need to obtain information in all these services.

Difficulties

How does the client of the    microservice access the individual service?

Considerations

  l The granularity of the API provided through microservices is often different from what the client needs. Microservices usually provide fine-grained APIs, which means that the client needs to interact with multiple services. For example, as described above, the details of the product required by the client need to obtain data from a variety of services.

  l Different clients need different data. For example, the desktop browser version of the product details page is usually more complicated than the mobile version.

  l Network performance is different due to different types of clients. For example, mobile networks are generally much slower and have much higher latency. Of course, any wide area network is much slower than a local area network. This means that the performance characteristics of the network used by the mobile phone’s local client and the LAN of the server web application are very different. The server-side web application can send a large number of requests to the back-end service without affecting the user experience, but the mobile client can only send a small number of requests.

  l The number of service instances and their locations (host + port) change dynamically.

  l Service may change over time, so the details should be hidden from the client.

Solution

   can implement an API gateway, which is the entrance of all clients. The API Gateway has two ways to process requests. Some requests are simply proxied/routed to the appropriate service, and other requests are forwarded to a set of services.

  

   This API gateway can provide different Instead of providing an API suitable for all situations. For example, Netflix’s API gateway runs client-specific adapter code and provides each client with the API they need.

  API gateway can also implement security, for example: verify that the client is authorized to execute the request.

Conclusion

  Using API​​gateway has the following advantages:

  l Make Service and client decoupling.

  l Decoupling the client and service deployment environment.

  l Provides the best API for each client.

  l Reduced number of requests/round trips. For example, the API gateway can retrieve data for multiple services at once. Fewer requests also means less overhead, which improves the user experience. An API gateway is essential for mobile applications.

  l simplifies client calls, because the API gateway can combine services and provide a combined façade interface.

The   API gateway model also has some disadvantages:

  l Increased complexity, API Gateway is another application that must be developed, deployed, and managed.

  l Increased response time because there is an extra layer of network jump through the API gateway. However, the cost of the extra round trip for most applications is negligible.

Question

   How to implement the API gateway? The API gateway needs to support high concurrency and high load, and use event response mechanisms (two IO mechanisms: one is blocking, the other is event response, and the latest one is GO language micro-threading). the best method. On JVM, NIO-based libraries such as Netty can be used, and NodeJS is another option.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 338 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.