当前位置:网站首页>[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 .
边栏推荐
- Selenium webdriver page refresh
- Treap
- 3587. 连通图(吉林大学考研机试题)
- Optimization of MySQL paging query
- First acquaintance with JVM
- C # briefly describe the application of Richter's replacement principle
- Is gamefi in decline or in the future?
- Office fallback version, from 2021 to 2019
- Tiktok 16 popular categories, tiktok popular products to see which one you are suitable for?
- Rocky基础-Shell脚本基础知识
猜你喜欢

How difficult is it to build a digital collection platform?

PXE principle and configuration

Redis learning - Introduction to redis and NiO principles

林业调查巡检数据采集解决方案

Basic use of Nacos (2) -- Nacos configuration center

3587. 连通图(吉林大学考研机试题)

WordPress free theme: document, making reading more convenient

After two days of tossing and turning, I finally wrote my first fluent app, which almost tortured me into a nervous breakdown

redis学习一redis介绍及NIO原理介绍

超全总结:Go语言如何操作文件
随机推荐
Wargames NATAS (16-19) problem solving essays
Selenium webdriver page refresh
Super complete summary: how to operate files in go language
Digital collection =nft? Have you entered the digital collection?
Golang implements sanggi diagram and analyzes user behavior trajectory
Usage of volatile keyword in C language
Web3≠NFT? A digital Renaissance?
After watching the documentary "pirate treasure on Adak Island", I thought of the lost treasure in Chinese history
Discuz论坛搭建详细过程,一看就懂
[FFH] websocket practice of real-time chat room
Wargames bandit (21-33) problem solving essay
Hack the box - Web requests module detailed Chinese tutorial
如何将CAD文件导入图新地球中,与影像地形倾斜模型准确叠加
林业调查巡检数据采集解决方案
Virtual machine terminator terminal terminator installation tutorial
On express framework
C # briefly describe the application of Richter's replacement principle
pip3 带源安装大全
Change of sheetname
Pulse netizens have a go interview question, can you answer it correctly?