CN116405544A - Micro-service data processing method and device, electronic equipment and medium - Google Patents

Micro-service data processing method and device, electronic equipment and medium Download PDF

Info

Publication number
CN116405544A
CN116405544A CN202310481460.XA CN202310481460A CN116405544A CN 116405544 A CN116405544 A CN 116405544A CN 202310481460 A CN202310481460 A CN 202310481460A CN 116405544 A CN116405544 A CN 116405544A
Authority
CN
China
Prior art keywords
service
micro
atomic
compensation
processing
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.)
Pending
Application number
CN202310481460.XA
Other languages
Chinese (zh)
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.)
Iss Technology Co ltd
Original Assignee
Iss 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 Iss Technology Co ltd filed Critical Iss Technology Co ltd
Priority to CN202310481460.XA priority Critical patent/CN116405544A/en
Publication of CN116405544A publication Critical patent/CN116405544A/en
Pending legal-status Critical Current

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/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/50Network service management, e.g. ensuring proper service fulfilment according to agreements

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Hardware Redundancy (AREA)

Abstract

The invention discloses a method, a device, electronic equipment and a medium for processing microservice data, wherein the method comprises the following steps: splitting the micro-service business into a preset number of atomic services, and establishing the corresponding relation between each atomic service and the compensation service; for atomic services, constructing a forward service chain according to the atomic service execution sequence, and for compensation services corresponding to the atomic services, constructing a reverse service chain according to the reverse sequence of the atomic service execution sequence; if the target atomic service fails to be executed in the forward service chain, processing the micro service data according to the reverse service chain from the compensation service corresponding to the target atomic service, and determining the subsequent processing process of the micro service data according to the processing result. The method improves the robustness of processing the micro-service business and ensures the consistency of the micro-service business processing result data by establishing a forward business chain of the atomic service and establishing a reverse business chain of the compensation service corresponding to the atomic service.

Description

Micro-service data processing method and device, electronic equipment and medium
Technical Field
The present invention relates to the field of distributed service data processing technologies, and in particular, to a method and apparatus for processing micro service data, an electronic device, and a medium.
Background
Before micro-service is prevalent, enterprises mostly process services based on single-body architecture, and with the continuous development of technology, many enterprises face to upgrade and reform own single-body architecture to micro-service, so as to realize cross-service distribution transaction, and the technical difficulty of realizing cross-service distribution of the services is to achieve final consistency of service data.
In the prior art, a third party framework is introduced to realize cross-service distribution of services by a distributed method, so that the services which can be solved by a server with huge computing power can be divided into a plurality of atomic services, the atomic services are distributed to a plurality of servers and completed, and finally, the service results are integrated, but the operation mode for executing the services is not idempotent, and the consistency of service data results cannot be ensured.
Disclosure of Invention
The invention provides a method, a device, electronic equipment and a medium for processing micro service data, which are used for solving the problem that the execution result data of micro service are inconsistent.
According to an aspect of the present invention, there is provided a method of processing micro service data, the method comprising:
splitting the micro-service business into a preset number of atomic services, and establishing the corresponding relation between each atomic service and the compensation service;
constructing a forward service chain according to the atomic service execution sequence aiming at the atomic service, and constructing a reverse service chain according to the reverse sequence of the atomic service execution sequence aiming at the compensation service corresponding to the atomic service;
if the target atomic service fails to be executed in the forward service chain, processing the micro service data according to the reverse service chain from the compensation service corresponding to the target atomic service, and determining a subsequent processing process of the micro service data according to a processing result.
According to another aspect of the present invention, there is provided an apparatus for processing micro service data, the apparatus comprising:
the corresponding relation modeling module is used for splitting the micro-service business into a preset number of atomic services and establishing corresponding relation between each atomic service and the compensation service;
the service chain construction module is used for constructing a forward service chain according to the atomic service execution sequence aiming at the atomic service, and constructing a reverse service chain according to the reverse sequence of the atomic service execution sequence aiming at the compensation service corresponding to the atomic service;
And the micro service subsequent processing module is used for processing the micro service data according to the reverse service chain from the compensation service corresponding to the target atomic service if the target atomic service fails to be executed in the forward service chain, and determining the subsequent processing process of the micro service data according to the processing result.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of processing microservice data according to any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement the method for processing micro service data according to any of the embodiments of the present invention when executed.
According to the technical scheme of the embodiment of the invention, through the functions and execution sequences of each module of the micro service, the micro service is split into a preset number of atomic services, compensation services corresponding to all the atomic services are established, a forward service chain of the atomic services is established according to the forward execution sequence of the atomic services, a reverse service chain opposite to the atomic service execution sequence is established according to the compensation services corresponding to the atomic services, if the atomic services with failure execution exist in the forward service chain, the compensation services in the reverse service chain are executed from the compensation services corresponding to the failed atomic services, and the processing results and processes of all the compensation services on micro service data are determined. The method improves the robustness of processing the micro-service business and ensures the consistency of the micro-service business processing result data by establishing a forward business chain of the atomic service and establishing a reverse business chain of the compensation service corresponding to the atomic service.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for processing micro service data according to a first embodiment of the present invention;
FIG. 2 is a flow chart of a method for processing micro service data according to a second embodiment of the present invention;
fig. 3 is a schematic diagram of the forward service link and the reverse service link of a method for processing micro service data versus micro service processing according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a micro service data processing apparatus according to a fourth embodiment of the present invention;
Fig. 5 is a schematic structural diagram of an electronic device implementing a method for processing micro service data according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a method for processing micro service data according to an embodiment of the present invention, where the method may be performed by a micro service data processing device, and the micro service data processing device may be implemented in hardware and/or software, and the micro service data processing device may be configured in any electronic device with a network communication function. As shown in fig. 1, the method may include:
s110, splitting the micro service business into a preset number of atomic services, and establishing the corresponding relation between each atomic service and the compensation service.
Wherein, the atomic service can be sub-service program or data which splits the micro-service business into a predetermined number; the compensation service may be a business program or data consistent with the atomic service.
Specifically, according to the execution sequence of the whole micro service and the internal program logic of each functional module, the whole micro service is split into a plurality of atomic services, and the storage space is redistributed to store all the atomic services backed up, wherein the backup of the atomic services is called as compensation service, and the compensation service has a one-to-one correspondence with the atomic services.
As an optional implementation manner, but not limited to, splitting the micro service business into a predetermined number of atomic services and establishing a corresponding relationship between each atomic service and the compensation service may include steps A1-A2:
and A1, backing up the atomic services according to the atomic services, and taking the backed-up atomic services as compensation services of the atomic services.
Specifically, the micro service business is split into a plurality of partial micro service businesses, the number of the partial micro service businesses is counted to be called as the preset number, namely, the micro service businesses are split into the preset number of atomic services, the atomic services are backed up, a storage space is set for the backup atomic services, and the backup atomic services are taken as compensation services.
And step A2, establishing the corresponding relation between the atomic service and the compensation service.
Specifically, a connection relation between the atomic service and the compensation service in program operation logic is established, and then a corresponding relation between the atomic service and the compensation service is established.
For example, each atomic service program file of the micro service splitting is stored in a chained storage manner or a sequential storage manner, and a function corresponding to an atomic service can call a function of a compensation service corresponding to the atomic service internally, so that a corresponding relationship exists between the atomic service and the compensation service corresponding to the atomic service.
S120, constructing a forward service chain according to the atomic service execution sequence aiming at the atomic service, and constructing a reverse service chain according to the reverse sequence of the atomic service execution sequence aiming at the compensation service corresponding to the atomic service.
Specifically, according to the execution rule and execution flow of the micro service, dividing the micro service into a plurality of atomic services according to the execution sequence, marking sequence numbers for the plurality of atomic services according to the forward execution sequence of the micro service, establishing a forward service chain related to the atomic services according to the forward execution sequence of the micro service and the atomic services corresponding to the sequence numbers, and establishing a reverse service chain opposite to the forward execution sequence of the micro service according to the compensation services corresponding to the plurality of atomic services.
The program logic feature of each functional module and the execution sequence of each functional module are provided in the whole micro service, and the forward execution sequence of each micro service sub-service in the micro service is executed according to the sequence specified by each functional module of the whole micro service.
For example, an execution sequence is established for the compensation service corresponding to each atomic service against the execution sequence rule of each functional module, that is, against the atomic service execution sequence rule, so as to establish a reverse service chain containing the compensation service, where the compensation service initiated in the reverse service chain corresponds to the last atomic service in the forward service chain, and the last compensation service in the reverse service chain corresponds to the atomic service initiated in the forward service chain.
S130, if the target atomic service fails to be executed in the forward service chain, processing the micro service data according to the reverse service chain from the compensation service corresponding to the target atomic service, and determining a subsequent processing process of the micro service data according to a processing result.
Specifically, executing all the atomic services included in the forward service chain according to the forward execution sequence of the micro service, if the atomic service in the forward service chain fails to execute, executing the compensation service of the reverse service chain according to the reverse direction of the forward service chain from the compensation service corresponding to the atomic service with the execution failure as a starting point, and determining the subsequent processing process of the micro service and the micro service data according to the execution result of the compensation service corresponding to the atomic service with the execution failure and the execution result of the compensation service after the compensation service in the reverse service chain.
For example, the micro service is executed according to the sequence specified by each functional module of the whole micro service, because the forward service chain of the atomic service related to each functional module is established according to the execution sequence of each functional module, the execution sequence of the forward service chain is the execution sequence specified by each functional module, when the execution of an atomic service in the forward service chain fails, the smooth execution of the atomic service needs to be ensured by repeatedly executing the compensation service corresponding to the atomic service, and further, the smooth execution of a certain functional module in the whole micro service is ensured. Judging whether the compensation service corresponding to the atomic service is executed successfully, and executing the atomic service after the atomic service in the forward service chain according to the execution sequence of the forward service chain when the compensation service corresponding to the atomic service is executed successfully; when the number of times of repeatedly executing the compensation service corresponding to the atomic service reaches the preset number of times, the compensation service is still not successfully executed, the compensation service after the compensation service is executed according to the execution sequence of the reverse service chain, the execution data of the subsequent compensation service is obtained, and the subsequent execution process of the whole micro service is further judged according to the execution data.
The embodiment of the application provides a processing method of micro service data, which divides the micro service into a preset number of atomic services through the functions and execution sequence of each module of the micro service, establishes compensation services corresponding to all the atomic services, establishes a forward service chain of the atomic services according to the forward execution sequence of the atomic services, establishes a reverse service chain opposite to the atomic service execution sequence according to the compensation services corresponding to the atomic services, and if the atomic services with failure execution exist in the forward service chain, starts to execute the compensation services in the reverse service chain from the compensation services corresponding to the failed atomic services, and determines the processing result and the processing process of all the compensation services on the micro service data. The method improves the robustness of processing the micro-service business and ensures the consistency of the micro-service business processing result data by establishing a forward business chain of the atomic service and establishing a reverse business chain of the compensation service corresponding to the atomic service.
Example two
Fig. 2 is a flowchart of a method for processing micro service data according to a second embodiment of the present invention, where the method for processing micro service data by micro service business is described in detail on the basis of the foregoing embodiment. As shown in fig. 2, the method may include:
S210, splitting the micro service business into a preset number of atomic services, and establishing the corresponding relation between each atomic service and the compensation service.
Specifically, the execution module and unit of the micro service, the sub service program functions and execution sequence of the micro service and other micro service attributes of the micro service are determined, the micro service is divided according to the micro service attributes to form a preset number of atomic services, each atomic service is backed up, storage space is redistributed for each backed up atomic service, all the backed up atomic services are used as compensation services corresponding to the atomic services, and the atomic services can be conveniently called and executed when the atomic services fail to execute.
S220, constructing a forward service chain according to the atomic service execution sequence aiming at the atomic service, and constructing a reverse service chain according to the reverse sequence of the atomic service execution sequence aiming at the compensation service corresponding to the atomic service.
Specifically, the execution sequence of the atoms in the forward service chain formed by all the atomic services is determined according to the execution sequence of the atomic services in the micro service, and the reverse service chain opposite to the forward service chain execution sequence is formed according to all the compensation services corresponding to all the atomic services.
For example, the micro service is split into a plurality of atomic services, fig. 3 shows the principle of the forward service chain and the reverse service chain on the micro service processing, the micro service S is split into n atomic services, which are named as S1, S2, … and sn, the forward service chain on the left side in fig. 3 is established, the n atomic service backups are generated to form compensation services, which are named as c1, c2, … and cn, respectively, the reverse service chain on the right side in fig. 3 is established, the micro service data processing result of the forward service chain should be consistent with the micro service data processing result of the bidirectional responsibility chain, wherein the bidirectional responsibility mechanism is a mechanism which consists of the forward service chain and the reverse service chain and can repeatedly execute the micro service sub-service, but the micro service sub-service is repeatedly processed only if the micro service sub-service fails to execute, namely the atomic service.
S230, judging whether the atomic service in the forward service chain successfully processes the micro service data.
Specifically, according to the processing result of the atomic service on the micro service data in the forward service chain, whether each atomic service in the forward service chain processes the micro service data successfully is judged.
S240, if the target atomic service fails to be executed in the forward service chain, processing the micro service data according to the reverse service chain from the compensation service corresponding to the target atomic service, and determining a subsequent processing process of the micro service data according to a processing result.
Specifically, if the result of processing the micro service data by the atomic service in the forward service chain shows that the micro service data is not successfully processed by the atomic service, executing the compensation service corresponding to the atomic service and the reverse service chain where the compensation service is located, and determining the subsequent processing process of the micro service data according to the result of processing the micro service data by all the compensation services in the reverse service chain.
As an optional implementation manner, but not limited to, processing the micro service data according to a reverse service chain from the compensation service corresponding to the target atomic service, and determining a subsequent processing procedure of the micro service data according to a processing result, where the subsequent processing procedure may include steps B1-B2:
and B1, if the compensation service is successful in processing the micro service data, processing the micro service data according to a forward service chain from an atomic service corresponding to the compensation service.
Specifically, if the result of processing the micro service data by the compensation service indicates that the micro service data has been successfully processed, the atomic service after the atomic service on the forward service chain is executed from the atomic service corresponding to the compensation service, that is, the atomic service processes the micro service data and displays the result of processing the micro service data.
And B2, if the compensation service fails to process the micro service data, processing the micro service data through the compensation service positioned behind the compensation service in the reverse service chain.
Specifically, if the result of the processing of the micro service data by the compensation service indicates that the micro service data has been successfully processed, the compensation service located after the compensation service in the reverse service chain is continuously executed from the compensation service, and the result of the processing of the micro service data by the compensation service located after the compensation service in the reverse service chain is continuously acquired.
Optionally, the micro service data is processed by the compensation service located after the compensation service in the reverse service chain until the micro service data is successfully processed by the compensation service, or the micro service data is processed by the last compensation service in the reverse service chain and fails to be processed.
Specifically, the corresponding micro-service data is processed according to the compensation service located after the compensation service in the reverse service chain, the result of the compensation service processing the micro-service data is obtained, whether the compensation service is successful in processing the corresponding micro-service data is determined, if the compensation service is successful in processing the corresponding micro-service data, the method is switched to execute the atomic service after the atomic service on the corresponding forward service chain of the compensation service, and if the last compensation service in the reverse service chain is executed, the last compensation service is successful or failed in processing the corresponding micro-service data.
Optionally, if the micro service data is processed by a compensation service located after the compensation service in the reverse service chain, and the last compensation service in the reverse service chain ends the processing of the micro service data and fails to process, determining that the micro service has a problem, and generating a problem prompt message.
Specifically, the last compensation service in the reverse service chain finishes processing the corresponding micro service data and obtains a processing result, if the last compensation service in the reverse service chain fails to process the corresponding micro service data, the problem of the micro service is determined, and prompt information about the problem of the micro service is generated.
As an alternative but not limiting implementation, the process of determining whether the compensation service has successfully processed the microservice data may comprise the steps D1-D2:
and D1, if the compensation service fails to execute the micro-service data, continuing to process the micro-service data through the compensation service.
Specifically, in the whole process of executing the compensation service in the reverse service chain, each compensation service may fail to process the corresponding micro service data, if the compensation service fails to process the corresponding micro service data, the compensation service in the reverse service chain needs to be continuously executed, and the processing result of the subsequent compensation service on the micro service data is continuously judged.
And D2, if the times of processing the micro-service data by the compensation service reach the preset times and the processing fails, determining that the processing of the micro-service data by the compensation service fails.
Specifically, the times of processing micro-service data by the compensation service are set for all the compensation services in the reverse service chain, if the atomic service fails to process the corresponding micro-service data, the corresponding compensation service of the atomic service is executed in the reverse service chain, if the times of processing the compensation service reach the preset times, the subsequent compensation service of the compensation service is continuously executed, and if the subsequent compensation service reaches the preset times of processing and fails to process the corresponding micro-service data, the failure of the compensation service to process the micro-service data is determined, and further, the problem of the micro-service exists is determined, and prompt information about the problem of the micro-service is generated.
S250, if the atomic service in the forward service chain processes the micro service data successfully, the atomic service after the atomic service which is processed successfully in the forward service chain processes the micro service data.
Specifically, if the atomic service in the forward service chain successfully processes the corresponding micro service data, the atomic service after the atomic service in the forward service chain is continuously executed, if all the atomic services successfully process the corresponding micro service data, the micro service is determined to have no problem, and prompt information about the successful execution of the micro service is generated.
The embodiment of the application provides a processing method of micro service data, which divides the micro service into a preset number of atomic services through the functions and execution sequence of each module of the micro service, establishes compensation services corresponding to all the atomic services, establishes a forward service chain of the atomic services according to the forward execution sequence of the atomic services, establishes a reverse service chain opposite to the atomic service execution sequence according to the compensation services corresponding to the atomic services, and if the atomic services with failure execution exist in the forward service chain, starts to execute the compensation services in the reverse service chain from the compensation services corresponding to the failed atomic services, and determines the processing result and the processing process of all the compensation services on the micro service data. The method improves the robustness of processing the micro-service business and ensures the consistency of the micro-service business processing result data by establishing a forward business chain of the atomic service and establishing a reverse business chain of the compensation service corresponding to the atomic service.
Example III
Fig. 3 is a flowchart of a method for processing micro service data according to a third embodiment of the present invention, where the flow of processing micro service data by micro service business is described in detail on the basis of the foregoing embodiment. As shown in fig. 3, the method may include:
S11, executing the processing operation of the original service S1 to the corresponding micro-service data in the forward service chain.
Specifically, a bidirectional responsibility mechanism is introduced for the micro service business, the micro service business is divided into a plurality of atomic services according to the function modules, the execution sequence of each function module of the micro service business is set to the execution sequence of the plurality of atomic services, and then a forward business chain is established, each atomic service is backed up, the backed up atomic service is defined as a compensation service corresponding to the atomic service, and a reverse business chain opposite to the forward business chain execution sequence is established according to the compensation service.
The bidirectional responsibility mechanism is a mechanism which consists of a forward service chain and a reverse service chain and can repeatedly execute the micro-service sub-service, but the micro-service sub-service is repeatedly processed only when the micro-service sub-service fails to execute, and the micro-service sub-service is atomic service.
Illustratively, the atomic service s1 of the forward service chain of a certain micro service is executed, if the atomic service s1 in the forward service chain successfully processes the corresponding micro service data, the atomic service s1 subsequent to the atomic service s1 in the forward service chain is continuously executed.
S12, executing the processing operation of the original service S2 to the corresponding micro-service data in the forward service chain. Specifically, the original service s2 in the forward service chain successfully processes the corresponding micro service data.
S13, executing the operation of processing the corresponding micro-service data by the original service S3 in the forward service chain.
Specifically, the corresponding microservice data is not successfully processed by the atomic service s3 in the forward traffic chain.
And S14, if the execution of the atomic service S3 in the forward service chain fails, executing the compensation service c3 with the corresponding relation with the atomic service S3 in the reverse service chain, and if the execution of the compensation service c3 succeeds, turning to executing the subsequent atomic service of the atomic service S3 in the forward service chain.
Specifically, the execution times are preset for all the compensation services in the reverse service chain, when the execution of the atomic service s3 in the forward service chain fails, the compensation service c3 with a corresponding relation with the atomic service s3 in the reverse service chain is executed, the execution process of the micro service bidirectional responsibility chain is judged according to the execution result of the compensation service c3, if the execution times of the compensation service c3 are within the preset execution times range, the corresponding micro service data is successfully executed by the compensation service c3, the atomic services s4 to sn after the atomic service s3 are continuously executed according to the execution sequence of the forward service chain until the micro service data is successfully processed by the micro service as a whole, and the data for executing the micro service is generated.
And S15, if the times of executing the compensation service c3 reach the preset execution times, the compensation service c3 does not successfully execute the corresponding micro service data, and the compensation service c2 and/or c1 after the compensation service c3 are continuously executed according to the reverse service chain execution sequence.
Specifically, if the number of times of executing the compensation service c3 reaches the preset number of times, the compensation service c3 does not successfully execute the corresponding micro service data, the compensation services c2 to c1 after the compensation service c3 are continuously executed according to the reverse service chain execution sequence, and if the c2 or c1 compensation service successfully executes the corresponding micro service data, the atomic service of the forward service chain is executed with the atomic service corresponding to the successfully executed compensation service as a starting point until the micro service data is successfully processed by the micro service as a whole, and the data for executing the micro service is generated.
Illustratively, the micro service execution modes may include two modes, including: the bidirectional responsibility mechanism corresponding to the micro service successfully executes the micro service data by starting the forward service chain and the reverse service chain, or the bidirectional responsibility mechanism only enables the micro service to successfully execute the micro service data by starting the forward service chain, and the micro service execution results generated by the two micro service execution modes have consistency.
Example IV
Fig. 4 is a schematic structural diagram of a micro service data processing device according to a third embodiment of the present invention, where the device may execute the micro service data processing method according to any embodiment of the present invention, and the micro service data processing device has functional modules and beneficial effects corresponding to the execution method. As shown in fig. 4, the apparatus may include:
The correspondence modeling module 410 is configured to split the micro service into a predetermined number of atomic services, and establish correspondence between each atomic service and the compensation service;
the service chain construction module 420 is configured to construct a forward service chain according to the atomic service execution sequence for the atomic service, and construct a reverse service chain according to the reverse sequence of the atomic service execution sequence for the compensation service corresponding to the atomic service;
and the microservice subsequent processing module 430 is configured to process the microservice data according to a reverse service chain from the compensation service corresponding to the target atomic service if there is a failure in execution of the target atomic service in the forward service chain, and determine a subsequent processing procedure for the microservice data according to a processing result.
Further, the correspondence modeling module 410 includes:
the compensation service determining unit is used for backing up the atomic service for each atomic service, and taking the backed up atomic service as the compensation service of the atomic service;
and the corresponding relation establishing unit is used for establishing the corresponding relation between the atomic service and the compensation service.
Further, the micro service post-processing module 430 includes:
The forward processing data unit is used for processing the micro service data according to a forward service chain from the atomic service corresponding to the compensation service if the compensation service is successful in processing the micro service data;
and the reverse processing data unit is used for processing the micro service data through the compensation service positioned after the compensation service in the reverse service chain if the compensation service fails to process the micro service data.
Further, the reverse processing data unit is specifically configured to:
and processing the micro service data through the compensation service positioned behind the compensation service in the reverse service chain until the micro service data is successfully processed by the compensation service, or the last compensation service in the reverse service chain finishes processing the micro service data and fails to process.
Further, the reverse processing data unit is specifically configured to:
and if the micro service data is processed through the compensation service positioned behind the compensation service in the reverse service chain and the last compensation service in the reverse service chain finishes processing the micro service data and fails to process, determining that the micro service has a problem, and generating problem prompt information.
Further, the micro service post-processing module 430 further includes:
the data continuing processing unit is used for continuing to process the micro-service data through the compensation service if the compensation service fails to execute the micro-service data;
and the processing failure determining unit is used for determining that the compensation service fails to process the micro service data if the times of processing the micro service data by the compensation service reach the preset times and the processing fails.
Further, the micro service data processing device further includes:
and the forward success processing module is used for processing the micro service data through the atomic service after the atomic service which is successfully processed in the forward service chain if the atomic service in the forward service chain is successful in processing the micro service data.
The micro service data processing device provided in the embodiment of the present invention can execute the micro service data processing method provided in any embodiment of the present invention, and has the corresponding functions and beneficial effects of executing the micro service data processing method, and the detailed process refers to the related operations of the micro service data processing method in the foregoing embodiment.
Example five
Fig. 5 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 5, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the respective methods and processes described above, for example, the processing method of the micro service data.
In some embodiments, the method of processing microservice data may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the above-described processing method of micro service data may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the processing method of the micro-service data in any other suitable way (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for processing micro service data, comprising:
splitting the micro-service business into a preset number of atomic services, and establishing the corresponding relation between each atomic service and the compensation service;
constructing a forward service chain according to the atomic service execution sequence aiming at the atomic service, and constructing a reverse service chain according to the reverse sequence of the atomic service execution sequence aiming at the compensation service corresponding to the atomic service;
If the target atomic service fails to be executed in the forward service chain, processing the micro service data according to the reverse service chain from the compensation service corresponding to the target atomic service, and determining a subsequent processing process of the micro service data according to a processing result.
2. The method of claim 1, wherein splitting the micro-service business into a predetermined number of atomic services and establishing a correspondence between each of the atomic services and the compensation service comprises:
for each atomic service, backing up the atomic service, and taking the backed up atomic service as a compensation service of the atomic service;
and establishing the corresponding relation between each atomic service and the compensation service.
3. The method of claim 1, wherein processing the micro service data in a reverse traffic chain from a compensation service corresponding to the target atomic service, and determining a subsequent process for the micro service data according to the processing result comprises:
if the compensation service is successful in processing the micro-service data, starting from an atomic service corresponding to the compensation service, and processing the micro-service data according to a forward service chain;
And if the compensation service fails to process the micro service data, processing the micro service data through the compensation service positioned after the compensation service in the reverse service chain.
4. A method according to claim 3, wherein processing the microservice data by a compensation service located after the compensation service in the reverse traffic chain comprises:
and processing the micro service data through the compensation service positioned behind the compensation service in the reverse service chain until the micro service data is successfully processed by the compensation service, or the last compensation service in the reverse service chain finishes processing the micro service data and fails to process.
5. The method according to claim 4, wherein the method further comprises:
and if the micro service data is processed through the compensation service positioned behind the compensation service in the reverse service chain and the last compensation service in the reverse service chain finishes processing the micro service data and fails to process, determining that the micro service has a problem, and generating problem prompt information.
6. The method according to any of claims 3-5, wherein the process of determining whether a compensation service is successful in processing the microservice data comprises:
If the compensation service fails to execute the micro service data, continuing to process the micro service data through the compensation service;
and if the times of processing the micro service data by the compensation service reach the preset times and the processing fails, determining that the processing of the micro service data by the compensation service fails.
7. The method according to claim 1, wherein the method further comprises:
and if the atomic service in the forward service chain processes the micro service data successfully, processing the micro service data through the atomic service after the atomic service which is processed successfully in the forward service chain.
8. A micro service data processing apparatus, comprising:
the corresponding relation modeling module is used for splitting the micro-service business into a preset number of atomic services and establishing corresponding relation between each atomic service and the compensation service;
the service chain construction module is used for constructing a forward service chain according to the atomic service execution sequence aiming at the atomic service, and constructing a reverse service chain according to the reverse sequence of the atomic service execution sequence aiming at the compensation service corresponding to the atomic service;
And the micro service subsequent processing module is used for processing the micro service data according to the reverse service chain from the compensation service corresponding to the target atomic service if the target atomic service fails to be executed in the forward service chain, and determining the subsequent processing process of the micro service data according to the processing result.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of processing micro service data according to any one of claims 1-7.
10. A computer readable storage medium, characterized in that the computer readable storage medium stores computer instructions for causing a processor to execute the method of processing micro service data according to any one of claims 1-7.
CN202310481460.XA 2023-04-27 2023-04-27 Micro-service data processing method and device, electronic equipment and medium Pending CN116405544A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310481460.XA CN116405544A (en) 2023-04-27 2023-04-27 Micro-service data processing method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310481460.XA CN116405544A (en) 2023-04-27 2023-04-27 Micro-service data processing method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN116405544A true CN116405544A (en) 2023-07-07

Family

ID=87007576

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310481460.XA Pending CN116405544A (en) 2023-04-27 2023-04-27 Micro-service data processing method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN116405544A (en)

Similar Documents

Publication Publication Date Title
CN106168915A (en) Distributed system architecture data process consistency ensuring method
CN112817660B (en) Method, device, equipment and storage medium for expanding applet capability
CN116248689A (en) Capacity expansion method, device, equipment and medium for cloud native application
CN116405544A (en) Micro-service data processing method and device, electronic equipment and medium
CN115437709A (en) Method and device for loading application home page splash screen resources
CN112559547B (en) Method and device for determining consistency among multiple storage object copies
CN117234779A (en) Exception recovery method, device, equipment and medium for distributed database
CN114924806B (en) Dynamic synchronization method, device, equipment and medium for configuration information
CN116244324B (en) Task data relation mining method and device, electronic equipment and storage medium
CN117742899A (en) Distributed transaction processing method, device and medium in distributed database
CN117632384A (en) Distributed transaction processing method, device, equipment and storage medium
CN116974825A (en) Backup method, device, equipment and storage medium
CN116302371A (en) Transaction visibility judging method, device, equipment and storage medium
CN117829755A (en) Data processing method, device, equipment and storage medium
CN117609194A (en) Cloud database processing method and device, electronic equipment and storage medium
CN117707643A (en) Plug-in building method and device and plug-in running method and device
CN113592655A (en) Transaction processing method and device, electronic equipment and computer readable medium
CN117271667A (en) Data reading method and device, electronic equipment and storage medium
CN115578200A (en) Data processing method and device, electronic equipment and storage medium
CN114637738A (en) Data visibility judgment method and device, database node and medium
CN117873787A (en) Data backup and recovery method, device, equipment and storage medium
CN117762694A (en) Data backup method and device, electronic equipment and storage medium
CN116775171A (en) Architecture switching method and device, electronic equipment and storage medium
CN117573267A (en) Application program data display method, system, electronic equipment and storage medium
CN117294597A (en) Network card binding configuration method, device, 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