CN114928596A - Data transmission method and device in micro-service communication process - Google Patents

Data transmission method and device in micro-service communication process Download PDF

Info

Publication number
CN114928596A
CN114928596A CN202210420368.8A CN202210420368A CN114928596A CN 114928596 A CN114928596 A CN 114928596A CN 202210420368 A CN202210420368 A CN 202210420368A CN 114928596 A CN114928596 A CN 114928596A
Authority
CN
China
Prior art keywords
service
service agent
micro
message
character codes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210420368.8A
Other languages
Chinese (zh)
Other versions
CN114928596B (en
Inventor
王正生
孙栋
黄胜涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Yuji Technology Co ltd
Original Assignee
Shanghai Yuji Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Yuji Technology Co ltd filed Critical Shanghai Yuji Technology Co ltd
Priority to CN202210420368.8A priority Critical patent/CN114928596B/en
Publication of CN114928596A publication Critical patent/CN114928596A/en
Application granted granted Critical
Publication of CN114928596B publication Critical patent/CN114928596B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention discloses a data transmission method in a micro-service communication process, which comprises the following steps: establishing a preset communication channel in a micro-service communication channel between a client and a server; converting a first http micro-service communication message between the client and the server into a gPC message; and transmitting the gPC message by using a preset communication channel to be converted into a second http micro-service communication message for being called by the server or the client, so that the communication performance in the micro-service communication process can be improved, and the communication efficiency is improved.

Description

Data transmission method and device in micro-service communication process
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for data transmission in a micro-service communication process.
Background
Generally, the micro service platforms communicate with each other through an http protocol, one service may invoke one service or a plurality of services, and the invoked service may invoke other services, and if any one of the services runs slowly, the running speed of the whole system is affected. In addition, the traditional Restful interface uses JSON, XML or other formats as data carriers, so that the service runs slowly, the memory occupation is high, the transmission process is not compressed, and the WebSocket needs to keep long connection, and the server overhead and cost are not small. Based on this, how to improve the communication performance in the microservice platform becomes a technical problem which needs to be solved urgently.
Disclosure of Invention
In order to solve the existing technical problems, embodiments of the present invention provide a data transmission method and apparatus in a micro service communication process, a computer device, and a readable storage medium.
In order to achieve the above purpose, the technical solution of the embodiment of the present invention is realized as follows:
the embodiment of the invention provides a data transmission method in a micro-service communication process, which comprises the following steps:
establishing a preset communication channel in a micro-service communication channel between a client and a server;
converting a first http micro-service communication message between the client and the server into a gPRC message;
transmitting the gPRC message by using a preset communication channel;
and converting the transmitted gPRC message into a second http micro-service communication message for the server or the client to call.
Optionally, the method further includes:
establishing a plurality of service agent terminals in the preset communication channel;
the converting the first http micro-service communication message between the client and the server into a gRPC message includes:
splitting a character formed by a first http micro-service communication message between the client and the server into a plurality of single character codes, and marking each character code with a sequence number to represent the arrangement sequence of the character codes;
using each character code with a serial number as the gPRC message;
the transmitting the gPRC message by using a preset communication channel comprises the following steps:
and utilizing the plurality of service agent terminals to transmit a plurality of character codes in parallel.
Optionally, the method further includes:
determining the historical agent capacity of each service agent end;
the parallel transmission of the character codes by using the agent servers comprises:
distributing the corresponding character codes to the service agent side based on the historical agent capacity of the service agent side and the serial numbers of the character codes;
and processing the distributed corresponding character codes by utilizing each service agent terminal.
Optionally, the method further includes:
establishing a protocol buffer on each service agent end;
the processing the character codes correspondingly distributed by using each service agent terminal comprises:
and in response to the fact that the load of the current service agent end exceeds a load threshold value, putting the character codes which are distributed and correspond to the current service agent end into a protocol buffer area for caching, and under the condition that the load of the current service end does not exceed the load threshold value, transmitting the character codes to the current agent service end according to the sequence number of the character codes.
The method further comprises the following steps:
monitoring the abnormal condition of the service agent end;
determining a non-abnormal agent server side of which the service agent side is not abnormal;
the allocating the corresponding character code to the service agent based on the historical agent capability of the service agent and the serial number of the character code comprises:
and distributing the corresponding character codes for the service agent side based on the historical agent capability of the non-abnormal service agent side and the serial numbers of the character codes.
Optionally, the method further includes:
determining an abnormal service agent end with abnormal service agent end;
extracting the residual character codes buffered in the protocol buffer area of the abnormal service agent end;
the allocating the corresponding character code to the service agent end based on the historical agent capability of the non-abnormal service agent end and the serial number of the character code comprises:
and distributing the corresponding residual character codes for the service agent side based on the historical agent capability of the non-abnormal service agent side and the serial numbers of the residual character codes.
Optionally, the monitoring an abnormal condition of the service agent includes:
and monitoring the abnormal condition of the service agent terminal according to a preset time period.
An embodiment of the present invention further provides a device for transmitting data in a microservice communication process, where the device includes:
the system comprises a first establishing module, a second establishing module and a third establishing module, wherein the first establishing module is used for establishing a preset communication channel in a micro-service communication channel between a client and a server;
the first conversion module is used for converting a first http micro service communication message between the client and the server into a gPRC message;
the transmission module is used for transmitting the gPC message by utilizing a preset communication channel;
and the second conversion module is used for converting the transmitted gPC message into a second http micro-service communication message for the server or the client to call.
An embodiment of the present invention further provides a computing device, including: a processor and a memory for storing a computer program capable of running on the processor, wherein the processor is configured to implement the data transmission method in the micro-service communication process as described above when the computer program is run by the processor.
The embodiment of the invention also provides a terminal, which stores an executable program, and when the executable program is executed by a processor, the data transmission method in the micro-service communication process is realized.
The data transmission method in the micro-service communication process provided by the embodiment is executed by computer equipment, and a preset communication channel is established in a micro-service communication channel between a client and a server; converting a first http micro-service message between the client and the server into a gPC message; transmitting the gPRC message by using a preset communication channel; and converting the transmitted gPC message into a second http micro-service communication message for the server or the client to call. Therefore, because a new communication channel is established in the micro-service communication channel and the communication channel can be transmitted in a message format corresponding to the gPRC message, compared with the prior art that JSON, XML or other formats are used as data carriers to perform micro-service communication transmission in an http protocol, the gPRC message indicates the multi-path service and the bidirectional flow model of http2, the problems of slow micro-service operation and high memory occupation are reduced, the communication delay between micro-service communication is reduced, and the communication performance in the micro-service communication process is effectively improved.
Drawings
Fig. 1 is a schematic flowchart illustrating a data transmission method in a micro service communication process according to an embodiment of the present invention;
fig. 2 is a schematic view of a scenario of a data transmission method in a micro service communication process according to an embodiment of the present invention;
fig. 3 is another schematic flow chart illustrating a data transmission method in a micro service communication process according to an embodiment of the present invention;
fig. 4 is a schematic flowchart illustrating a data transmission method in a micro service communication process according to an embodiment of the present invention;
fig. 5 is a schematic functional structure diagram of a data transmission apparatus in a micro service communication process according to an embodiment of the present invention;
fig. 6 is a schematic hardware structure diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail below with reference to the drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The microservice can be understood as a service provided by a microservice public account number, a microservice applet, or the like. Nowadays, the wechat service covers several parts of wechat housekeeping, wechat application solutions, wechat client servers and manual wechat customer service. The micro service is a service management platform provided for the account number of the micro-letter public platform, and the interactive marketing promotion and customer relationship maintenance functions of the micro-letter public account are enhanced. The micro service platform develops several important operation management modes of personalized management, marketing promotion, customer relationship, member management and the like customized for merchants.
Here, the micro service communication is understood that the micro service platform can link one client with another client to perform communication between the clients. For example, on a public platform in a hospital, a patient can find a doctor for on-line inquiry through the micro-service platform, and the doctor can also reply through the micro-service platform. However, in the prior art, the micro service communication usually employs JSON data interface communication, because the Restful call combines and uses JOSN, XML or some other formats as data carriers, so that the service runs slowly, the memory usage is high, and the transmission process is not compressed, and in addition, the micro communication service needs to maintain long connection, and the start-up and cost of the server are not small. Based on this, there is a need to provide a new data transmission method for micro-service communication to improve the communication performance of micro-service communication.
The technical solution of the present invention is further described in detail below with reference to the drawings and the specific embodiments of the present invention.
Fig. 1 is a schematic flow diagram of a data transmission method in a micro service communication process according to an embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
step 101: establishing a preset communication channel in a micro-service communication channel between a client and a server;
step 102: converting a first http micro-service communication message between the client and the server into a gPC message;
step 103: transmitting the gPRC message by using a preset communication channel;
step 104: and converting the transmitted gPC message into a second http micro-service communication message for the server or the client to call.
Computer devices herein include any computer device having data processing capabilities; specifically, the computer device may be a fixed terminal or a mobile terminal. The fixed terminal can be a desktop computer or a one-piece computer; the mobile terminal can be a mobile phone, a tablet computer or a wearable terminal.
In practical applications, the computer device may be the client or the server. It should be noted that, the server here may be a micro service platform, and the client here may be a user terminal. Taking the micro service platform as a hospital service platform as an example, the client can be a mobile phone end of a patient or a mobile phone end of a doctor.
Here, the http micro service communication packet is a packet transmitted based on the http1 protocol, and the packet format of the http micro service communication packet may be a format that can be called by Restful, such as JSON, XML, or some other format.
The gRPC (remote procedure call) framework actually provides a set of mechanisms, and uses an http2 protocol for communication, so that applications can communicate with each other by using the gRPC framework, and the gRPC framework also conforms to a client/server model, and when in use, a client calls an interface provided by a server as a local function is called. The gRPC message here refers to a message defined based on a gRPC framework, and is adapted to the http2 protocol.
It should be noted that the http2 mainly solves the problem of inefficient interaction of the http1 protocol. http uses TCP as a transport layer protocol, in the http1 protocol, a TCP connection needs to be reestablished whenever an http1 request is established, the TCP connection is released immediately after the request is completed, three handshakes are required for a client and a server for establishing one TCP connection, and four handshakes are required for releasing the TCP connection, so that the interaction efficiency of http1 is very low.
In the http2 protocol, because the two parties already negotiate the application layer protocol used by the two parties through the ALPN extension field in the TLS handshake phase, the communication interaction of the http2 can be performed after the TLS handshake is completed, so that the transmission efficiency of transmission by using the http2 protocol is higher without performing multiple handshakes.
In a communication scenario of micro service communication, one service may invoke one or more services, and the invoked service may also invoke other services, and if any one of the services runs slowly, the running speed of the whole system is affected, so that the micro service communication process needs to continuously perform handshake connection, and long connection between the client and the server cannot be maintained.
For example, referring to fig. 2, fig. 2 is a schematic view of a scenario of a data transmission method in a micro service communication process according to an embodiment of the present invention, as shown in fig. 2, a first http message formed after information sent by a client or a server is called through a common Rest interface may be converted into multiple gRPC messages and transmitted in a preset communication channel; and then, the multiple gPC messages can be converted into a second http message, and the second http message is called through a public Rest interface to finally form information received by a server or a client.
Thus, in the embodiment, a preset communication channel is established in the micro-service communication channel between the client and the server; and finally, converting the gPC message into a second http micro service message specified by a protocol of the server or the client for the server or the client to call. Therefore, the http2 protocol can be implemented in a new communication channel between the client and the server for communication, and compared with the http1 protocol for communication in the prior art, the gRPC message indicates the multipath and bidirectional flow model of the http2, so that the problems of slow micro-service operation and high memory occupation are reduced, the communication delay between micro-service communication is reduced, and the communication performance in the micro-service communication process is effectively improved.
In other embodiments, please refer to fig. 3, fig. 3 is another schematic flow chart of a data transmission method in a micro service communication process according to an embodiment of the present invention, and as shown in fig. 2, the method further includes:
step 301: establishing a plurality of service agent terminals in the preset communication channel;
step 102, namely, converting the first http microservice message between the client and the server into a gRPC message, includes:
step 1021: splitting a character string formed by a first http micro-service communication message between the client and the server into a plurality of single character codes, and marking each character code with a sequence number to represent the arrangement sequence of the character codes;
step 1022: using each character code with a serial number as the gPRC message;
the step 103, namely, the transmitting the gRPC packet by using the preset communication channel, includes:
step 1031: and utilizing the plurality of service agent terminals to transmit a plurality of character codes in parallel.
It should be noted that, when performing communication in the preset communication channel, multiple service agents may be used to perform parallel transmission. In addition, the single character code carries the serial number, so that the single character code can be quickly integrated based on the serial number, and a foundation is laid for converting the gPC message into the second http message subsequently.
Therefore, in this embodiment, the first http micro-service communication message can be split into a plurality of single character codes, and the plurality of service agent terminals perform parallel transmission, so that not only can the communication speed between the client and the service terminal be further improved, but also each split character code can be accurately and rapidly combined because each character code has a serial number, so as to provide a favorable basis for rapidly converting into the second http micro-service communication message, and further improve the effectiveness of conversion in the transmission process.
Further, in order to better implement parallel transmission of multiple service agents and ensure load balancing of multiple agent service ends, in some embodiments, the load balancing implements gRPC load balancing by using Linkerd on an application layer over kubernets (k8s), adding Linkerd for micro services such as inquiry, which is equivalent to adding a small and very efficient monitoring agent for each data structure, monitoring an API interface of k8s by the monitoring agents, and automatically implementing load balancing of gRPC.
In some embodiments, the method further comprises:
determining the historical agent capacity of each service agent end;
the parallel transmission of the plurality of character codes by using the plurality of service agent terminals comprises:
distributing the corresponding character codes for the service agent side based on the historical agent capability of the service agent side and the serial numbers of the character codes;
and processing the distributed corresponding character codes by utilizing each service agent terminal.
It should be noted that, here, the historical proxy capability of each service proxy may be determined by adding a small and very high monitoring proxy to each data structure, where the monitoring proxy may monitor the historical proxy capability of its corresponding service proxy and other proxy condition information, so as to help implement load balancing of the gRPC.
In this embodiment, by determining the historical proxy capabilities of the multiple service proxy terminals and the serial numbers of the character codes, more or more difficult-to-process character codes can be allocated to the service proxy terminal with stronger historical proxy capability, thereby effectively providing the transmission efficiency of parallel transmission.
In other embodiments, the method further comprises:
establishing a protocol buffer on each service agent terminal;
the processing, by each of the service agents, the correspondingly assigned character code includes:
and in response to the fact that the load of the current service agent end exceeds an overload threshold value, putting the character codes which are distributed and correspond to the current service agent into a protocol buffer area for caching, and under the condition that the load of the current service agent end does not exceed the load threshold value, transmitting the character codes to the current service agent end according to the sequence number of the character codes.
It should be noted that the load thresholds corresponding to different service agent terminals are different. It can be understood that, for a service agent with stronger agent capability, the corresponding load threshold is relatively larger. When the load of the service agent exceeds the load threshold, if the data to be processed is still continuously transmitted to the service agent, the service agent may be congested or restarted, thereby reducing the working efficiency of the service agent.
Therefore, in this embodiment, the protocol buffer can further increase the serialization speed, alleviate the congestion of the service agent, reduce the size of the pending data packet, and reduce the delay of data interaction.
In other embodiments, the method further comprises:
monitoring the abnormal condition of the service agent end;
determining a non-abnormal service agent end which is not abnormal by the service agent end;
the allocating the corresponding character code to the service agent based on the historical agent capability of the service agent and the serial number of the character code comprises:
and distributing the corresponding character codes for the service agent side based on the historical agent capability of the non-abnormal service agent side and the serial numbers of the character codes.
For example, the monitoring of the abnormal condition of the service agent can be performed by a service monitoring system, such as Big Brother Monitor. For example, the service monitoring system is used for monitoring the health condition or self-healing restarting capability of a service agent side of micro-service such as k8s container gRPC inquiry. Of course, in other embodiments, the service monitoring system may also be used to monitor whether the data structure is abnormal, for example, to monitor whether the character code is abnormal.
In this embodiment, by monitoring the abnormal condition of the service agent side, excluding the abnormal agent side, and only processing the character code corresponding to the non-abnormal service agent side, the problems of transmission delay and low transmission performance caused by the abnormal service agent side agent can be further reduced.
In other embodiments, the method further comprises:
determining an abnormal service agent end with abnormal service agent end;
extracting the residual character codes cached in the protocol buffer area of the abnormal service agent end;
the allocating the corresponding character code to the service agent side based on the historical agent capability of the non-abnormal service agent side and the serial number of the character code comprises:
and distributing the corresponding residual character codes for the service agent side based on the historical agent capability of the non-abnormal service agent side and the serial numbers of the residual character codes.
In this embodiment, the abnormal service agent is found, and the remaining character codes cached in the protocol buffer of the abnormal service agent are allocated to the non-abnormal service agent for processing, so that the processing efficiency of the remaining character codes can be improved, and the transmission performance can be improved.
In other embodiments, the monitoring the abnormal condition of the service agent includes:
and monitoring the abnormal condition of the service agent terminal according to a preset time period.
Therefore, the abnormal service agent end can be checked in a certain time period, so that the residual character codes in the protocol buffer area of the abnormal service agent end can be extracted in time, the processing speed of the residual character codes is increased, and the transmission performance is improved.
It should be added that, in some embodiments, the service monitoring system may be used not only to monitor whether the service agent side is abnormal, but also to monitor the condition of the data structure, for example, whether the character code is abnormal, so that the abnormal condition such as the abnormal character code may be fed back to the wechat front end in time.
For example, please refer to fig. 4, fig. 4 is a schematic flow chart of a data transmission method in a micro-service communication process according to an embodiment of the present invention, as shown in fig. 4, a BB-Monitor starts a first thread again, and performs a loop interval of 18 minutes to check data, where the data may be the data structure or the split character codes; white list matching and filtering; a second thread is newly opened by the service monitoring system BB-Monitor, new and old data are compared and merged, data structure information is cached, the cycle interval is 10 seconds, health check is started, whether the service agent end of the gPC is healthy or not is detected, if the service agent end is healthy, whether the service is abnormal or not is determined, and if the service is abnormal, a WeChat alarm or a notification message is delivered; and on the other hand, whether the data structure is abnormal is detected, if so, 1 is added to determine whether the alarm rule is met, and if so, the WeChat alarm is delivered or the message is informed.
It should be added that the above embodiments can be implemented independently, or implemented in any combination, and are not limited in any way herein.
As shown in fig. 5, an embodiment of the present invention further provides a data transmission apparatus in a micro service communication process, which is executed by a computer, and the apparatus includes:
a first establishing module 51, configured to establish a preset communication channel in a micro-service communication channel between a client and a server;
a first conversion module 52, configured to convert a first http microservice communication packet between the client and the server into a gprs packet;
a transmission module 53, configured to transmit the gRPC packet through a preset communication channel;
and a second conversion module 54, configured to convert the gRPC packet transmitted by the gRPC server into a second http microservice communication packet, so as to be called by the server or the client.
In some embodiments, the apparatus further comprises:
the second establishing module is used for establishing a plurality of service agent terminals in the preset communication channel;
the first conversion module 52 is further configured to:
splitting a character string formed by a first http micro-service communication message between the client and the server into a plurality of single character codes, and marking a sequence number on each character code to represent the arrangement sequence of the character codes;
using each character code with a serial number as the gPRC message;
the transmission module 53 is further configured to:
and utilizing the plurality of service agent terminals to transmit a plurality of character codes in parallel.
In some embodiments, the apparatus further comprises:
the first determining module is used for determining the historical agent capacity of each service agent end;
the transmission module 53 is further configured to:
distributing the corresponding character codes to the service agent side based on the historical agent capacity of the service agent side and the serial numbers of the character codes;
and processing the distributed corresponding character codes by utilizing each service agent terminal.
In some embodiments, the apparatus further comprises:
establishing a protocol buffer on each service agent end;
the transmission module 53 is specifically further configured to:
and in response to the fact that the load of the current service agent end exceeds a load threshold value, putting the rest of the character codes which are distributed and correspond to the current service agent end into a protocol buffer area for caching, and under the condition that the load of the current service agent end does not exceed the load threshold value, transmitting the character codes to the current service agent end according to the sequence based on the sequence numbers of the character codes.
In some embodiments, the apparatus further comprises:
the monitoring module is used for monitoring the abnormal condition of the service agent end;
the second determining module is further used for determining the non-abnormal service agent end which is not abnormal by the service agent end;
the determining module is further configured to:
and distributing the corresponding character codes for the service agent side based on the historical agent capability of the non-abnormal service agent side and the serial numbers of the character codes.
In some embodiments, the apparatus further comprises:
a third determining module, configured to determine an abnormal service agent end where the service agent end is abnormal;
the extracting module is used for extracting the residual character codes cached in the protocol buffer area of the abnormal service agent end;
the transmission module is specifically further configured to:
and distributing the corresponding residual character codes for the service agent side based on the historical agent capability of the non-abnormal service agent side and the serial numbers of the residual character codes.
In some embodiments, the monitoring module is further configured to:
and monitoring the abnormal condition of the service agent terminal according to a preset time period.
Here, it should be noted that: the description of the data transmission device item in the micro service communication process is similar to the description of the data transmission method item in the micro service communication process, and the description of the beneficial effect of the method is omitted for redundancy. For technical details not disclosed in the embodiment of the data transmission device in the process of micro service communication, please refer to the description of the embodiment of the data transmission method in the process of micro service communication applied in the present invention.
As shown in fig. 6, an embodiment of the present invention further provides a computer device, which includes a memory 62, a processor 61, and computer instructions stored on the memory 62 and executable on the processor 61; when the processor 61 executes the instructions, the steps of the data transmission method in the micro service communication process applied to the client or the server are implemented.
In some embodiments, memory 62 in embodiments of the present invention may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of illustration and not limitation, many forms of RAM are available, such as Static random access memory (Static RAM, SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (ddr Data Rate SDRAM, ddr SDRAM), Enhanced Synchronous SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 62 of the systems and methods described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
And the processor 61 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 61. The Processor 61 may be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 62, and the processor 61 reads the information in the memory 62, and completes the steps of the method in combination with the hardware thereof.
In some embodiments, the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the Processing units may be implemented within one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented with modules (e.g., procedures, functions, and so on) that perform the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
Still another embodiment of the present invention provides a computer storage medium, which stores an executable program, and when the executable program is executed by a processor 61, the steps of the data transmission method in the micro service communication process as described in fig. 1 to fig. 4 can be implemented.
In some embodiments, the computer storage medium may include: a U-disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It should be noted that: the technical schemes described in the embodiments of the present invention can be combined arbitrarily without conflict.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (10)

1. A data transmission method in micro service communication process is characterized in that the method comprises the following steps:
establishing a preset communication channel in a micro-service communication channel between a client and a server;
converting a first http micro-service communication message between the client and the server into a gPC message;
transmitting the gPRC message by using a preset communication channel;
and converting the transmitted gPC message into a second http micro-service communication message for the server or the client to call.
2. The method of claim 1, further comprising:
establishing a plurality of service agent terminals in the preset communication channel;
the converting the first http microservice communication message between the client and the server into a gRPC message includes:
splitting a character string formed by a first http micro-service communication message between the client and the server into a plurality of single character codes, and marking a sequence number on each character code to represent the arrangement sequence of the character codes;
taking each character code with a serial number as the gPRC message;
the transmitting the gPRC message by using a preset communication channel comprises the following steps:
and utilizing the plurality of service agent terminals to transmit a plurality of character codes in parallel.
3. The method of claim 2, further comprising:
determining the historical agent capacity of each service agent end;
the parallel transmission of the plurality of character codes by using the plurality of service agent terminals comprises:
distributing the corresponding character codes for the service agent side based on the historical agent capability of the service agent side and the serial numbers of the character codes;
and processing the distributed corresponding character codes by utilizing each service agent terminal.
4. The method of claim 3, further comprising:
establishing a protocol buffer on each service agent terminal;
the processing the character codes correspondingly distributed by using each service agent terminal comprises:
and in response to the fact that the load of the current service agent end exceeds a load threshold value, putting the character codes which are distributed and correspond to the current service agent end into a protocol buffer area for caching, and under the condition that the load of the current service agent end does not exceed the load threshold value, transmitting the character codes to the current service agent end according to the sequence number of the character codes.
5. The method of claim 4, further comprising:
monitoring the abnormal condition of the service agent end;
determining a non-abnormal service agent end which is not abnormal by the service agent end;
the allocating the corresponding character code to the service agent side based on the historical agent capability of the service agent side and the serial number of the character code comprises:
and distributing the corresponding character codes for the service agent side based on the historical agent capability of the non-abnormal service agent side and the serial numbers of the character codes.
6. The method of claim 5, further comprising:
determining an abnormal service agent end with abnormal service agent end;
extracting the residual character codes cached in the protocol buffer area of the abnormal service agent end;
the allocating the corresponding character code to the service agent side based on the historical agent capability of the non-abnormal service agent side and the serial number of the character code comprises:
and distributing the corresponding residual character codes for the service agent side based on the historical agent capability of the non-abnormal service agent side and the serial numbers of the residual character codes.
7. The method according to claim 5 or 6, wherein the monitoring the abnormal condition of the service agent side comprises:
and monitoring the abnormal condition of the service agent terminal according to a preset time period.
8. A data transmission apparatus in micro-service communication, the apparatus comprising:
the system comprises a first establishing module, a second establishing module and a third establishing module, wherein the first establishing module is used for establishing a preset communication channel in a micro-service communication channel between a client and a server;
the first conversion module is used for converting a first http micro service communication message between the client and the server into a gPRC message;
the transmission module is used for transmitting the gPC message by utilizing a preset communication channel;
and the second conversion module is used for converting the transmitted gPC message into a second http micro-service communication message for the server or the client to call.
9. A computer device, comprising: a processor and a memory for storing a computer program capable of running on the processor, wherein the processor is configured to implement the method for data transmission during microservice communication according to any of claims 1 to 7 when the computer program is run.
10. A computer-readable storage medium, comprising: the executable program, when executed by a processor, implements a method for data transmission during microservice communication according to any of claims 1 to 7.
CN202210420368.8A 2022-04-20 2022-04-20 Data transmission method and device in micro-service communication process Active CN114928596B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210420368.8A CN114928596B (en) 2022-04-20 2022-04-20 Data transmission method and device in micro-service communication process

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210420368.8A CN114928596B (en) 2022-04-20 2022-04-20 Data transmission method and device in micro-service communication process

Publications (2)

Publication Number Publication Date
CN114928596A true CN114928596A (en) 2022-08-19
CN114928596B CN114928596B (en) 2024-06-21

Family

ID=82806419

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210420368.8A Active CN114928596B (en) 2022-04-20 2022-04-20 Data transmission method and device in micro-service communication process

Country Status (1)

Country Link
CN (1) CN114928596B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108449312A (en) * 2018-01-31 2018-08-24 北京奇艺世纪科技有限公司 A kind of method for converting protocol, device, system and gateway
CN109445968A (en) * 2018-11-09 2019-03-08 金瓜子科技发展(北京)有限公司 Service request processing method, device, equipment and the storage medium of different agreement
US20190087178A1 (en) * 2017-09-18 2019-03-21 International Business Machines Corporation Adaptable management of web application state in a micro-service architecture
CN110120854A (en) * 2018-02-07 2019-08-13 华为技术有限公司 The method and apparatus for transmitting data
CN112350973A (en) * 2019-08-07 2021-02-09 广州虎牙科技有限公司 Remote procedure call load balancing method and device and data processing system
CN112860431A (en) * 2021-01-20 2021-05-28 重庆六花网络科技有限公司 Connection method, system, equipment and storage medium of micro service node
CN113676336A (en) * 2021-10-22 2021-11-19 深圳市明源云采购科技有限公司 Microservice access proxy method, apparatus and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190087178A1 (en) * 2017-09-18 2019-03-21 International Business Machines Corporation Adaptable management of web application state in a micro-service architecture
CN108449312A (en) * 2018-01-31 2018-08-24 北京奇艺世纪科技有限公司 A kind of method for converting protocol, device, system and gateway
CN110120854A (en) * 2018-02-07 2019-08-13 华为技术有限公司 The method and apparatus for transmitting data
CN109445968A (en) * 2018-11-09 2019-03-08 金瓜子科技发展(北京)有限公司 Service request processing method, device, equipment and the storage medium of different agreement
CN112350973A (en) * 2019-08-07 2021-02-09 广州虎牙科技有限公司 Remote procedure call load balancing method and device and data processing system
CN112860431A (en) * 2021-01-20 2021-05-28 重庆六花网络科技有限公司 Connection method, system, equipment and storage medium of micro service node
CN113676336A (en) * 2021-10-22 2021-11-19 深圳市明源云采购科技有限公司 Microservice access proxy method, apparatus and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
辛园园;钮俊;谢志军;张开乐;毛昕怡;: "微服务体系结构实现框架综述", 计算机工程与应用, no. 19, 1 October 2018 (2018-10-01) *

Also Published As

Publication number Publication date
CN114928596B (en) 2024-06-21

Similar Documents

Publication Publication Date Title
CN109547511B (en) WEB message real-time pushing method, server, client and system
CN110913000A (en) Method, system and computer readable storage medium for processing service information
US9565218B2 (en) Resource management for WebRTC
WO2021237433A1 (en) Message pushing method and apparatus, and electronic device and computer-readable medium
US9172765B2 (en) Polling-based secure network message notification system and method with performance enhancing features
CN112422497B (en) Message transmission method and device and computer equipment
CN105874773B (en) Task processing device, intelligent equipment, task processing method and baseband processor
CN102662776B (en) Inter-application communication method, client side and application process manager of online application platform
CN109120687B (en) Data packet transmitting method, device, system, equipment and storage medium
EP3417598A1 (en) Communication system
CN103548315A (en) Method and apparatus for high performance low latency real time notification delivery
CN112769945B (en) Distributed service calling method and device
CN116134798A (en) Communication method and device based on MQTT protocol
CN114363351B (en) Proxy connection suppression method, network architecture and proxy server
US20150067066A1 (en) Provisioning Communication Services using Proxy Server in a Cloud
CN113783822B (en) Service timeout management method and device, electronic equipment and readable medium
KR101367265B1 (en) Push server, push service providing system and method of the same
CN114928596B (en) Data transmission method and device in micro-service communication process
CN110933122B (en) Method, apparatus and computer storage medium for managing server
US8799377B2 (en) Method and apparatus for mobile presence aggregation
US8200845B2 (en) Queuing of invocations for mobile web services
CN109766347B (en) Data updating method, device, system, computer equipment and storage medium
CN116320039A (en) Message compression method and device and electronic equipment
CN113542324A (en) Message pushing method and device
CN116192927A (en) Data transmission method and device based on SaaS service, computer equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant