当前位置:网站首页>[translation] integration challenges in microservice architecture using grpc and rest
[translation] integration challenges in microservice architecture using grpc and rest
2022-07-24 08:53:00 【programmer_ ada】
author :Rakesh Girija Ramesan Nair,Infosys Limited Senior technical architect ;Gourishankar ValsalakumariNeelakantapillai,Infosys Limited Technical director .
Abstract : This blog aims to explain gRPC and REST Wait for technology E2E Integration challenges brought by microservice architecture . It summarizes the obvious problems in the implementation of microservices , These services mainly need
- Internal communication between services and
- External with users or The third party System Communication for
It also provides unique insights into standardized solutions that do not have any open source frameworks available throughout the technology stack .
Architecture brief introduction
The adoption of microservice architecture is on the rise , And because of the flexibility it brings ( Including maintainability and scalability ) And is widely accepted . With containerization , The microservice architecture has become more powerful , Allow users to create applications that focus on their capabilities , Instead of solving the dependency problem . Cloud native application development is powered by a container based microservice architecture .
The design of distributed system is very complicated , And it becomes more complex with the different business needs . In order to achieve E2E Professional capability , Multiple microservices need to be connected or called . The choice of integration technology becomes critical , At present, the commonly used method is , Communication between any services gRPC( Google remote procedure call ), Any customer facing service utilization REST( Indicates a sexual state transition )API.
gRPC-- follow RPC API Realization , utilize HTTP 2.0 Protocol and protocol buffer for message exchange .
REST-- Architecture follows HTTP agreement , The data format used for messaging is JSON or XML.
Problem statement
Design and develop a service that needs to be consumed internally by other services and exposed to The third party Challenges to the capabilities of systems or users .
Let's consider an example scenario , An order management system composed of order manager and product inventory micro service .
- Product inventory service holds all the product details and its relationship , Including various categories . need REST API To disclose product details and relationships to external systems and user interfaces .
- The order manager service interfaces with another digital channel , As a front-end system ordered by customers . This internally invokes the product inventory service to verify the product inventory details .
In the current plan , There are many possible ways , We can solve such requirements , Here are some of these options in detail .-
choice 1.
Follow a method , Any communication between services takes advantage of gRPC, Any customer facing service takes advantage of REST.

- adopt gRPC Expose product inventory services , For inter service communication


We use Protobuf Define the contract , And use java To generate the server-side implementation .
- Extra coding , Such as creating a rest controller and translating responses , It needs to be used as REST API Exposed to the The third party System .



To deal with gRPC and REST, Requires additional coding complexity and dependency management .
Follow the microservice aggregator pattern .
Options 2:

- Create an aggregator service , Show by aggregating the responses of different services REST API function , Or realize packaging REST API service . There will be gRPC The implementation of client , It needs to communicate with other internal services to aggregate responses . This will include creating from the protocol buffer API The translation code of the response .


gRPC And protocol buffers force developers to strictly abide by contracts , Ensure that information is secure , There will be no loss between communications . Although the nature of the contract first and the definition of joint development RPC The method is very good between related services , But aggregator services bring overhead .
Reasoning
Architects spend a lot of time designing distributed systems . Having an efficient integration pattern definition is the key to the success of the solution .
The following is a summary of various integration solutions and challenges .-
- Taking data to REST( be based on JSON) The form of is open internally and externally :- This method is the most popular , Unfortunately , It can't meet all the requirements . because JSON Payload and HTTP Limitations of the agreement , This is not ideal for data intensive inter service communication .
- Open internally and externally gRPC:- Data exchange is carried out in binary format , Humans can't read .gRPC Depend on HTTP2.0, Modern browsers have limited support for it .
- establish REST and gRPC :-
- As explained in the previous options , Additional coding and integration overhead .
- Lacking maturity gRPC implementation technique , Such as java python Or any widely adopted open source framework node.
When we consider designing the next microservice based solution , These different integration patterns must be considered .
边栏推荐
- Wargames bandit (11-20) problem solving essay
- Okaleido tiger NFT is about to log in to binance NFT platform, and the era of NFT rights and interests is about to start
- Using OpenCV to do a simple face recognition
- table-rowspan
- 看了纪录片《埃达克岛的海盗宝藏》,想到我国历史上的遗失秘宝
- Taking advantage of the momentum, oceanbase promotes the lean growth of digital payment
- 剑指 Offer II 024. 反转链表
- The solution of [an error occurred while trying to create a file in the destination directory: access denied] is prompted when installing the software
- 5、 Use of environment variables in midway
- 3587. 连通图(吉林大学考研机试题)
猜你喜欢

Is yuancosmos hype? Or the future

VGA character display based on FPGA

WordPress free theme: document, making reading more convenient

The beta version of move protocol is stable, and it is temporarily decided to expand the scale of the prize pool

Route interceptor

在npm上发布自己的库

Houdini official HDA sidefx labs installation
![[Shangshui Shuo series together] June summary +no anxiety +july plan + how to test + how to improve](/img/75/e8f5a1dfe7594b75b6c7facb49ccfa.png)
[Shangshui Shuo series together] June summary +no anxiety +july plan + how to test + how to improve

1、 Midwey addition, deletion, modification and query

Using OpenCV to do a simple face recognition
随机推荐
Houdini 笔记
Relationship between fork and pipeline
Grpc learning notes
Overseas media, domestic we media, media publicity
Unity solves the package manager "you see to be offline"
Rk3566 add project under external
Rocky基础-Shell脚本基础知识
C# 简述里氏替换原则的应用
Hack the box - File Inclusion module detailed Chinese tutorial
[emotion] what is "excellent"
The beta version of move protocol is stable, and it is temporarily decided to expand the scale of the prize pool
C语言练习题目+答案:
Xiaobai learns Jenkins - installation and quick start
pip3 带源安装大全
【一起上水硕系列】Final RAD-new literacies
2、 Encapsulation and tool classes for adding, deleting, modifying and checking in midway
Tongxin UOS developer account has supported uploading the HAP package format of Hongmeng application
[FFH] openharmony gnawing paper growth plan -- Application of cjson in traditional c/s model
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
Optimization of MySQL paging query