Communication exception construction method, computer device, storage medium and program product

By obtaining the calling and called service information in the exception declaration information, constructing the proxy service port number and policy, and forwarding the service call request to realize the application layer communication exception, the problem of poor scalability in the existing technology is solved, and the reliability of the construction method is improved. Scalability and flexibility.

CN118573544APending Publication Date: 2024-08-30TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410590157.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-13
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

The existing chaos platform has poor scalability when constructing application layer communication anomalies and cannot effectively support multiple application layer protocols. With the increase of new protocols, the construction method is difficult to expand.

Method used

By obtaining the calling service information and the called service information in the exception declaration information, obtain the proxy service port number associated with it, build a communication exception construction strategy in the proxy service, and forward it to the corresponding service call request when receiving it. The target port of the port number executes an exception response through the proxy service, and implements proxy ports corresponding to different port numbers to construct application layer communication exceptions.

Benefits of technology

It improves the scalability of application layer communication exception construction, avoids encoding and decoding each application layer protocol, supports communication exception construction of multiple protocols, and realizes exception construction without parsing application layer protocols.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118573544A
    Figure CN118573544A
Patent Text Reader

Abstract

The invention relates to a communication anomaly construction method and device and a readable storage medium. The method comprises the following steps: in response to a communication exception construction request, acquiring exception declaration information matched with the communication exception construction request; the abnormal declaration information carries calling service information and called service information; obtaining a port number of an agency service associated with the calling service information and the called service information, and constructing a communication abnormity construction strategy matched with the port number in the agency service; under the condition that a service calling request initiated by the main calling service matched with the main calling service information is received, if a called service corresponding to the service calling request is a called service matched with the called service information, forwarding the service calling request to a target port, matched with the port number, of the proxy service; and executing a communication exception response corresponding to the service calling request through the proxy service according to the communication exception construction strategy. By adopting the method, the expandability of the method for constructing the communication abnormity of the application layer can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a communication anomaly construction method, a computer device, a computer-readable storage medium, and a computer program product. Background Art

[0002] With the development of computer technology, a technology that uses chaos engineering to ensure system stability has emerged. This technology mainly introduces abnormal conditions into the system, that is, actively creates failure scenarios, and then determines the optimization strategy according to the performance of the system under various pressures. It is a means of ensuring system stability.

[0003] In traditional technology, chaos engineering is usually implemented through a chaos platform, and the chaos platform can support the construction of application layer communication anomalies. By encoding and decoding the application layer protocol, it can implement the parsing of various application layer protocols. After that, the rule engine can be used to construct rules according to the protocol parsing results. If the rule matches, a fault action can be injected, such as sleeping for a period of time to construct a delay fault.

[0004] However, the current method of constructing application layer communication anomalies requires encoding and decoding of each application layer protocol. The number of protocols that the current chaos platform can support is far smaller than the protocols involved in actual business scenarios, and with the iteration of technology, new application layer protocols will continue to increase. Therefore, the existing method of constructing application layer communication anomalies on chaos platforms has poor scalability. Summary of the invention

[0005] Based on this, it is necessary to provide a communication anomaly construction method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve the scalability of application layer communication anomaly construction in response to the above technical problems.

[0006] In a first aspect, the present application provides a communication anomaly construction method, comprising:

[0007] In response to a communication exception construction request, obtaining exception declaration information matching the communication exception construction request; the exception declaration information carries the calling service information and the called service information;

[0008] Acquire the port number of the proxy service associated with the calling service information and the called service information, and construct a communication anomaly construction strategy matching the port number in the proxy service;

[0009] Upon receiving a service call request initiated by a calling service matching the calling service information, if the called service corresponding to the service call request is the called service matching the called service information, forwarding the service call request to a target port of the proxy service matching the port number;

[0010] The proxy service executes a communication exception response corresponding to the service call request according to the communication exception construction strategy.

[0011] In one of the embodiments, before forwarding the service call request to the target port of the proxy service that matches the port number, it also includes: obtaining the port number and the called service address that matches the called service information, and constructing a service discovery protocol based on the data source according to the port number and the called service address; sending the service discovery protocol to the proxy service, and constructing a communication connection between the target port and the called service that matches the called service information through the proxy service.

[0012] In one of the embodiments, constructing a service discovery protocol based on a data source according to the port number and the called service address includes: converting the port number into a listener of the service discovery protocol, and converting the called service address into a cluster of the service discovery protocol; constructing a communication connection between the target port and the called service that matches the called service information through the proxy service includes: starting the target port that matches the port number through the proxy service, and constructing a communication connection between the target port and the called service that matches the called service information according to the called service address.

[0013] In one of the embodiments, constructing a communication exception construction strategy that matches the port number in the proxy service includes: obtaining a target exception policy that matches the exception declaration information, and a service identifier of the proxy service; and adding a filtering policy that carries the service identifier, the port number, and the target exception policy to the packet filtering policy of the proxy service as the communication exception construction strategy.

[0014] In one embodiment, the target exception policy includes a delayed response policy, which is implemented by a delay queue; obtaining the target exception policy that matches the exception declaration information includes: obtaining delay duration information from the exception declaration information; obtaining a target delay queue that matches the delay duration information from a plurality of pre-set candidate delay queues, and using the target delay queue as the target exception policy; wherein each of the candidate delay queues corresponds to a different delay duration; adding a filtering policy carrying the service identifier, the port number and the target exception policy as the communication exception construction strategy to the packet filtering policy of the proxy service includes: adding a filtering policy carrying the service identifier, the port number and the queue identifier of the target delay queue as the communication exception construction strategy to the packet filtering policy.

[0015] In one of the embodiments, the service call request includes a service addressing request; if the called service corresponding to the service call request is a called service that matches the called service information, the service call request is forwarded to a target port of the proxy service that matches the port number, including: in response to the service addressing request, obtaining the called service corresponding to the service call request; if the called service corresponding to the service call request is a called service that matches the called service information, obtaining the port number of the proxy service from the communication exception construction strategy; returning the proxy service address of the proxy service and the port number to the calling service as the response address corresponding to the service addressing request, so as to instruct the calling service to send the service call request to the target port according to the proxy service address and the port number.

[0016] In one of the embodiments, the communication exception construction strategy includes a delayed response strategy, and the delayed response strategy is implemented by a delay queue corresponding to a delay queue identifier included in the communication exception construction strategy; the communication exception response corresponding to the service call request is executed by the proxy service in accordance with the communication exception construction strategy, including: sending the service call request from the target port to the called service corresponding to the service call request through the proxy service, and receiving, by the proxy service, a service request response corresponding to the service call request returned by the called service corresponding to the service call request; inputting the service request response into the delay queue corresponding to the delay queue identifier included in the communication exception construction strategy through the proxy service, and returning the service request response to the calling service through the delay queue to achieve a delayed response to the service call request.

[0017] In a second aspect, the present application also provides a communication anomaly construction device, including:

[0018] The abnormal declaration acquisition module is used to respond to the communication abnormal construction request and obtain abnormal declaration information matching the communication abnormal construction request; the abnormal declaration information carries the main calling service information and the called service information;

[0019] An abnormal strategy construction module, used to obtain the port number of the proxy service associated with the calling service information and the called service information, and construct a communication abnormality construction strategy matching the port number in the proxy service;

[0020] a service call forwarding module, configured to, upon receiving a service call request initiated by a calling service matching the calling service information, forward the service call request to a target port of the proxy service matching the port number if the called service corresponding to the service call request is a called service matching the called service information;

[0021] The communication exception response module is used to execute a communication exception response corresponding to the service call request through the proxy service according to the communication exception construction strategy.

[0022] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in any one of the embodiments of the first aspect when executing the computer program.

[0023] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of the embodiments of the first aspect.

[0024] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method described in any one of the embodiments of the first aspect.

[0025] The above-mentioned communication exception construction method, device, computer equipment, computer-readable storage medium and computer program product obtain exception declaration information matching the communication exception construction request by responding to the communication exception construction request; the exception declaration information carries the main calling service information and the called service information; obtains the port number of the proxy service associated with the main calling service information and the called service information, and constructs a communication exception construction strategy matching the port number in the proxy service; when receiving a service call request initiated by the main calling service matching the main calling service information, if the called service corresponding to the service call request is the called service matching the called service information, then the service call request is forwarded to the target port matching the port number of the proxy service; and executes the communication exception response corresponding to the service call request according to the communication exception construction strategy through the proxy service. When constructing a communication exception, the present application can obtain the calling service information and the called service information from the exception declaration, and can also obtain the proxy service port number associated with the calling service information and the called service information, so as to construct a communication exception construction strategy that matches the port number in the proxy service. Afterwards, when a service call request initiated by the calling service is received, if the called service requested matches the called service in the exception declaration information, the service call request can be forwarded to the target port that matches the port number in the proxy service, and the proxy service executes the exception response according to the communication exception construction strategy. In this way, the application layer communication exception construction is realized by using proxy ports corresponding to different port numbers, and because each port number is bound to the called service, the communication exception construction can be realized without parsing the application layer protocol. In this way, the scalability of the method for constructing application layer communication exceptions can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 An application environment diagram of a communication anomaly construction method in one embodiment;

[0028] Figure 2 It is a flowchart of a communication anomaly construction method in one embodiment;

[0029] Figure 3 A schematic diagram of a flow chart of constructing a communication connection between a target port and a called service in one embodiment;

[0030] Figure 4A schematic diagram of a flow chart of obtaining a communication anomaly construction strategy in one embodiment;

[0031] Figure 5 A schematic diagram of a process of forwarding a service call request to a target port in one embodiment;

[0032] Figure 6 A schematic diagram of a flow chart of executing a communication abnormality response in one embodiment;

[0033] Figure 7 A schematic diagram of the architecture of a chaos platform in one embodiment;

[0034] Figure 8 A schematic diagram of specific steps for constructing an abnormal communication at the application layer in one embodiment;

[0035] Fig. 9 A schematic diagram of a chaos platform deployment topology structure in one embodiment;

[0036] Fig.10 A schematic diagram of the construction principle of application layer communication anomaly in one embodiment;

[0037] Fig.11 A schematic diagram of specific steps for constructing an abnormal application layer communication in another embodiment;

[0038] Fig.12 It is a structural block diagram of a communication anomaly construction device in one embodiment;

[0039] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0041] The communication anomaly construction method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 101 communicates with the server 102 through the network. The data storage system can store the data that the server 102 needs to process. The data storage system can be integrated on the server 102, or it can be placed on the cloud or other network servers. Specifically, the user can initiate a communication anomaly construction request for constructing an application layer communication anomaly through its terminal 101, and carry anomaly declaration information in the communication anomaly construction request, and the anomaly declaration information includes the main calling service information and the called service information. When the server 102 responds to the communication anomaly construction request, it can obtain a matching proxy service port number according to the main calling service information and the called service information, and construct a communication anomaly construction strategy matching the port number in the proxy service. Afterwards, if a service call request is received from the main calling service, and the called service of the call request happens to be the called service in the anomaly declaration information, the server 102 can forward the service call request to the target port matching the port number in the proxy service, and the proxy service executes the communication anomaly response according to the communication anomaly construction strategy corresponding to the port. Among them, the terminal 101 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 102 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.

[0042] In one embodiment, Figure 2 As shown, a communication exception construction method is provided, which is applied to Figure 1 Taking the server 102 in the example as an example, the following steps are included:

[0043] Step S201, in response to a communication exception construction request, obtaining exception declaration information matching the communication exception construction request; the exception declaration information carries the calling service information and the called service information.

[0044] Among them, the communication anomaly construction request can be a request for constructing an application layer communication anomaly in the server 102, that is, a certain chaos platform. The request can be initiated by the user through his terminal 101, for example, the user can log in to the server 102 through his terminal 101. At this time, the relevant setting information of the chaos engineering experiment can be displayed in the terminal 101, such as selecting the application layer fault type, fault behavior parameters, such as timeout, called service or method, fault percentage, and other necessary information such as the main calling service information and the called service information, etc. The above setting information can be used as the abnormal declaration information matching the communication anomaly construction request, and the information can be used to declare the user's communication anomaly construction request and send it to the server 102.

[0045] Specifically, the user can initiate a communication exception construction request carrying exception declaration information to the server 102 through the terminal 101, and the server 102 can respond to the request to obtain the exception declaration information set by the user, and obtain the corresponding calling service information and called service information therefrom, such as the name of the calling service and the name of the called service.

[0046] Step S202: obtaining the port number of the proxy service associated with the calling service information and the called service information, and constructing a communication exception construction strategy matching the port number in the proxy service.

[0047] The communication anomaly construction strategy refers to the strategy used to construct communication anomalies. The strategy can be a packet filtering system strategy, i.e., an IPTABLES strategy. The proxy service can be used to execute the communication anomaly construction, which can be an Envoy four-layer proxy. The proxy service can receive request packets that match the calling service information and the called service information to construct an anomaly response to the request packet. The port number is a port identifier used to characterize different proxy service ports. In this embodiment, the proxy service can correspond to multiple ports. By setting different port numbers, multiple communication anomaly response constructions can be executed simultaneously.

[0048] Specifically, after obtaining the exception declaration information, the server 102 can obtain the port number of the proxy service that matches it based on the calling service information and the called service information in the exception declaration information. The port number can be bound to the above exception declaration information, and then a communication exception construction strategy matching the port number can be constructed in the proxy service to realize the binding of the communication exception construction strategy and the exception declaration information.

[0049] Step S203, when receiving a service call request initiated by a calling service matching the calling service information, if the called service corresponding to the service call request is the called service matching the called service information, forwarding the service call request to the target port matching the port number of the proxy service;

[0050] Step S204: executing a communication exception response corresponding to the service call request through the proxy service according to the communication exception construction strategy.

[0051] A service call request refers to a request initiated by the calling service for calling the called service. The service call request may carry the calling service information and the called service information. If the called service in the service call request initiated by the calling service is the same as the called service that matches the called service information in the exception declaration information, then it indicates that the service call request meets the conditions for constructing a communication exception. In this case, compared to the normal situation where the server 102 sends the above service call request directly to the called service, in order to construct a communication exception, the server 102 may forward the service call request to the target port that matches the port number of the proxy service, and the proxy service executes the communication exception response corresponding to the service call request according to the communication exception construction strategy.

[0052] For example, a certain exception declaration information carries the main calling service information corresponding to the main calling service A, and the called service information corresponding to the called service 1, so the server 102 can be set with a port number A1, which is associated with the main calling service information and the called service information to realize the binding of the port A1 of the proxy service and the exception declaration information, and at the same time, a communication exception construction strategy matching the port number A1 can be constructed in the proxy service. If the main calling service A then initiates a service call request for the called service 1, under normal circumstances, the service call request will be sent directly by the server 102 to the called service 1 for response. However, in order to construct a communication exception at this time, the server 102 can send the request to the A1 port of the proxy service, so that the proxy service executes the communication exception response according to the communication exception construction strategy to realize the communication exception construction for the service call request.

[0053] In the above-mentioned communication exception construction method, by responding to the communication exception construction request, exception declaration information matching the communication exception construction request is obtained; the exception declaration information carries the calling service information and the called service information; the port number of the proxy service associated with the calling service information and the called service information is obtained, and a communication exception construction strategy matching the port number is constructed in the proxy service; in the case of receiving a service call request initiated by the calling service matching the calling service information, if the called service corresponding to the service call request is the called service matching the called service information, the service call request is forwarded to the target port matching the port number of the proxy service; and the communication exception response corresponding to the service call request is executed according to the communication exception construction strategy through the proxy service. When constructing a communication exception, the present application can obtain the calling service information and the called service information from the exception declaration, and can also obtain the proxy service port number associated with the calling service information and the called service information, so as to construct a communication exception construction strategy that matches the port number in the proxy service. Afterwards, when a service call request initiated by the calling service is received, if the called service requested matches the called service in the exception declaration information, the service call request can be forwarded to the target port that matches the port number in the proxy service, and the proxy service executes the exception response according to the communication exception construction strategy. In this way, the application layer communication exception construction is realized by using proxy ports corresponding to different port numbers, and because each port number is bound to the called service, the communication exception construction can be realized without parsing the application layer protocol. In this way, the scalability of the method for constructing application layer communication exceptions can be improved.

[0054] In one embodiment, Figure 3 As shown, before step S203, the following may also be included:

[0055] Step S301, obtaining a port number and a called service address that matches the called service information, and constructing a service discovery protocol based on a data source according to the port number and the called service address.

[0056] Among them, the called service address refers to the IP address of the called service corresponding to the called service information, and the service discovery protocol based on the data source can be the xDS protocol, and the types of the protocol can include multiple types, for example, it can include the LDS protocol, the RDS protocol, the EDS protocol and the CDS protocol, etc. In this embodiment, before the server 102 forwards the service call request to the target port that matches the proxy service and the port number, in order to ensure that the proxy service can communicate with the called service through the target port, it is also necessary to establish a communication connection between the above-mentioned target port and the called service, and the establishment of the communication connection depends on the service discovery protocol. The server 102 can construct a service discovery protocol by combining the obtained port number with the called service address, so that the proxy service can build a communication connection between the called service whose target port matches the called service information.

[0057] Step S302: Send the service discovery protocol to the proxy service, and construct a communication connection between the called service whose target port matches the called service information through the proxy service.

[0058] After server 102 completes the construction of the service discovery protocol, it can send the service discovery protocol to the proxy service. For example, it can send the service discovery protocol to the Envoy four-layer proxy through the gRPC channel, so that the proxy service can construct a communication connection between the target port and the called service.

[0059] In this embodiment, the server 102 can also construct a service discovery protocol based on the port number and the called service address, thereby using the service discovery protocol to enable the proxy service to construct a communication connection between the target port and the called service. In this way, the smoothness of communication between the proxy service and the called service can be ensured.

[0060] Furthermore, step S301 may further include: converting the port number into a listener of the service discovery protocol, and converting the called service address into a cluster of the service discovery protocol; step S302 may further include: starting the target port matching the port number through the proxy service, and establishing a communication connection between the called service whose target port matches the called service information according to the called service address.

[0061] In this embodiment, the listener may refer to the service discovery protocol, i.e., the Listener of the xDS protocol, and the cluster of the service discovery protocol may refer to the Cluster of the xDS protocol. In this embodiment, the server may convert the port number into the Listener of the xDS protocol, and convert the called service address, i.e., the called IP:Port into the Cluster of the xDS protocol, to realize the construction of the service discovery protocol.

[0062] Afterwards, the proxy service can start the target port that matches the port number. After the target port is started, the calling service can be allowed to send the service call request to the target port, and the communication connection between the target port and the called service can be constructed according to the called service address. In this way, the service call request initiated by the calling service can be forwarded to the called service through the proxy service, so that the proxy service can construct a communication exception response to the service call request.

[0063] In this embodiment, the server 102 can also convert the port number into a listener of the service discovery protocol and convert the called service address into a cluster of the service discovery protocol to construct a service discovery protocol, and start the target port matching the port number through the proxy service, and build a communication connection between the target port and the called service. The service call request initiated by the calling service can be realized through the proxy service. This embodiment can ensure the stability of the execution of communication exception response.

[0064] In one embodiment, Figure 4 As shown, step S202 may further include:

[0065] Step S401, obtaining a target exception policy that matches the exception declaration information and a service identifier of the proxy service.

[0066] The target exception policy refers to the exception policy that needs to be constructed by the communication exception construction request, and the target exception policy can be determined based on the type of exception and the exception parameters, and the service identifier can be used to identify the proxy service, for example, it can be the service terminal number of the proxy service, etc. Specifically, after receiving the communication exception construction request, the server 102 can determine the matching target exception policy based on the exception declaration information, and can also obtain the service terminal number of the proxy service used to construct the communication exception as the service identifier of the proxy service.

[0067] Step S402: Add a filtering policy carrying a service identifier, a port number and a target abnormality policy to the information packet filtering policy of the proxy service as a communication abnormality construction policy.

[0068] The packet filtering policy may refer to an iptables rule policy. In this embodiment, the communication anomaly construction policy may be implemented by constructing an iptables rule policy by adding an iptables rule policy carrying a service identifier of a proxy service, a port number, and a target anomaly policy to the iptables rule policy as a communication anomaly construction policy.

[0069] For example, a filtering policy carrying the proxy service identifier A, port number B and target exception policy C can be set in proxy service A. Since port number B is associated with the calling service information and the called service information, when a service call request between the calling service and the called service associated with port number B is received, the filtering policy can be used to allow proxy service A to execute the target exception policy C through port B corresponding to port number B to perform a communication exception response.

[0070] In this embodiment, the server 102 can implement the communication anomaly policy by adding a filtering policy carrying the service identifier, port number and target anomaly policy to the packet filtering policy of the proxy service, that is, the iptables rule policy. This method can improve the accuracy of the communication anomaly policy construction.

[0071] Furthermore, the target exception strategy includes a delayed response strategy, and the delayed response strategy is implemented through a delay queue; step S401 may further include: obtaining delay duration information from the exception declaration information; obtaining a target delay queue that matches the delay duration information from a plurality of pre-set candidate delay queues, and using the target delay queue as the target exception strategy; wherein each candidate delay queue corresponds to a different delay duration; step S402 may further include: in the packet filtering strategy, adding a filtering policy carrying a service identifier, a port number, and a queue identifier of the target delay queue as a communication exception construction strategy.

[0072] In this embodiment, the target exception strategy can be a delayed response strategy. For example, after receiving a service call request, the response to the request is returned after a delay of a period of time to simulate the response of the service call during communication abnormalities. The delayed response strategy can be implemented through a delay queue, such as a tc queue, i.e., a Traffic Control queue, which can be used to provide traffic speed limiting, shaping and policy control mechanisms.

[0073] The delay duration information refers to the delay duration required to execute a delayed response. The setting of the delay duration can be set by the user in the abnormal declaration information. The candidate delay queue is a queue pre-set for executing a delayed response. The number of the candidate delay queues can be multiple, corresponding to different delay durations, and the target delay queue refers to the candidate delay queue that matches the delay duration information among the above multiple candidate delay queues. For example, the candidate delay queues may include delay queue 1, delay queue 2, and delay queue 3, wherein the delay duration corresponding to delay queue 1 is 800ms, the delay duration corresponding to delay queue 2 is 200ms, and the delay duration corresponding to delay queue 3 is 6s. If the delay duration set by the user in the abnormal declaration information is 6s, then the server 102 can use delay queue 3 as the target delay queue, and since the target abnormal strategy is implemented through delay queue 3, the delay queue 3 is also used as the target abnormal strategy.

[0074] Therefore, when adding a packet filtering policy, server 102 can also use a queue identifier that carries a service identifier, a port number, and a target delay queue, which can be used to identify the target delay queue, for example, a filtering policy with the queue number of the target delay queue, as a communication anomaly construction strategy.

[0075] In this embodiment, the target exception strategy can be implemented through a delayed response strategy, and the delayed response strategy is implemented through a delay queue. Therefore, a plurality of candidate delay queues can be pre-set, and then the target delay queue can be screened out as the target exception strategy based on the delay duration declared by the user. When constructing the communication packet filtering strategy, a filtering policy carrying the queue identifier of the target delay queue is added. In this way, the efficiency of constructing the communication exception construction strategy can be improved.

[0076] In one embodiment, the service invocation request includes a service addressing request; Figure 5 As shown, step S203 may further include:

[0077] Step S501, in response to a service addressing request, obtaining a called service corresponding to the service calling request.

[0078] In this embodiment, the service call request may also carry a service addressing request for addressing the called service. Generally speaking, when the calling service initiates a service call request for the called service, it needs to first initiate a service addressing request for the called service, and only after obtaining the service address of the called service can the service call request be sent to the called service. In order to obtain the service address of the called service, it is necessary to carry information related to the called service, such as the service name of the called service, in the service addressing request. Therefore, after the server 102 monitors the service addressing request, it can determine the called service corresponding to the service call request.

[0079] Step S502: If the called service corresponding to the service call request is a called service that matches the called service information, the port number of the proxy service is obtained from the communication exception construction strategy.

[0080] If the called service corresponding to the service call request is the same as the called service corresponding to the called service information declared in the communication exception construction request, it means that the service call request initiated by the main calling service hits the communication exception construction strategy. In this case, the server 102 can obtain the port number of the proxy service from the constructed communication exception construction strategy.

[0081] Step S503, returning the proxy service address and port number of the proxy service as the response address corresponding to the service addressing request to the main calling service, so as to instruct the main calling service to send the service call request to the target port according to the proxy service address and port number.

[0082] After obtaining the port number of the proxy service, the server 102 can further obtain the proxy service address of the proxy service, such as the IP address of the proxy service, and return it to the calling service as the response address corresponding to the service addressing request, thereby instructing the calling service to send the service call request to the target port according to the proxy service address and port number, rather than sending the service call request directly to the called service.

[0083] For example, the communication exception construction strategy is set with a communication exception construction strategy for the calling service A and the called service 1, and the proxy service port number associated with the calling service A and the called service 1 is port number A1. When the calling service A initiates a service call request for the called service 1, it is necessary to first obtain the service address of the called service 1 through an addressing request. Under normal circumstances, the server 102 will directly return the service address of the called service 1 to the calling service A. However, at this time, since the calling service A and the called service 1 hit the communication exception construction strategy, the server 102 will obtain the port number of the proxy service A and the IP address of the proxy service A based on the communication exception construction strategy, and then return the port number and the IP address of the proxy service A to the calling service A, so that the calling service A sends the service call request to the port corresponding to the proxy service A and the port number, thereby executing the corresponding communication exception response.

[0084] In this embodiment, the server 102 can also return the port number and address of the proxy service in the hit communication exception construction strategy to the main calling service through the service addressing request initiated by the main calling service, so that the main calling service sends the service call request to the corresponding target port of the proxy service. In this way, the communication exception response can be simulated more accurately.

[0085] In one embodiment, the communication anomaly construction strategy includes a delayed response strategy, and the delayed response strategy is implemented by a delay queue corresponding to a delay queue identifier included in the communication anomaly construction strategy; Figure 6 As shown, step S204 may further include:

[0086] Step S601: Send a service call request from a target port to a called service corresponding to the service call request through a proxy service, and receive a service request response corresponding to the service call request returned by the called service corresponding to the service call request through the proxy service.

[0087] Specifically, after the proxy service receives the service call request, it can send the service call request to the called service through the target port, and the called service will execute the service request response corresponding to the service call request. Since the service call request is sent by the proxy service to the called service through the target port at this time, the called service can return the corresponding service request response to the proxy service.

[0088] Step S602: input the service request response into the delay queue corresponding to the delay queue identifier included in the communication exception construction strategy through the proxy service, and return the service request response to the main calling service through the delay queue to achieve a delayed response to the service call request.

[0089] In this embodiment, the communication exception construction strategy can be a delayed response strategy, and the delayed response strategy can be implemented through the delay queue corresponding to the delay queue identifier contained in the communication exception construction strategy. Therefore, after receiving the returned service request response, the proxy service can also input the service request response into the delay queue corresponding to the delay queue identifier contained in the communication exception construction strategy, and return the service request response to the main calling service through the delay queue, thereby realizing a delayed response to the service call request.

[0090] In this embodiment, the service call request can be sent to the called service through the proxy service, so that the service call response returned by the called service can be received, and the service call response can be further input into the delay queue to return the service request response to the calling service through the delay queue. In this way, a delayed response to the service call request can be achieved, and the response accuracy of the delayed response can be improved.

[0091] In one embodiment, a method for constructing application layer communication anomalies through tc / iptables rules is also provided, which can solve the problem of low scalability of application layer communication anomaly construction in traditional technologies.

[0092] In traditional technologies, the construction of application layer communication anomalies is usually implemented by a chaos platform, for example, it can be implemented by a proxy called App-Injector. The platform architecture is as follows: Figure 7 As shown, the transmission channel manages the connection from APPInjector to the client and the server respectively; the codec is responsible for the encoding and decoding of the protocol, which can be extended to support different protocols, and the specific protocol is parsed specifically. The rule engine matches the request according to the rule, and if it matches, it executes the specific fault injection action, such as Sleeping for a period of time to construct a delay.

[0093] The specific steps can be as follows Figure 8 As shown, the following process is included:

[0094] 1. Send a fault request to the Chaos Executor;

[0095] 2. After receiving the fault injection request, the Chaos Executor generates startup parameters and creates the APP-Injector process;

[0096] 3. The Chaos Executor sets iptables rules to hijack all requests to APP-Injector;

[0097] 4. After the client request reaches APP-Injector, if there is no matching rule, it will directly forward the request response as a transparent proxy. If there is a matching rule, it will execute the corresponding fault action and sleep for a while before responding to the client. The phenomenon seen by the client during the sleep time is timeout or delay.

[0098] It can be seen that in the traditional technology, the construction of application layer communication exceptions needs to implement its encoding and decoding for each application layer protocol. Therefore, if a large range of real business scenarios are to be covered, the implementation cost of the traditional technology is high and the actual implementation is difficult. Therefore, this embodiment provides a general, protocol-independent, zero-cost backward-compatible application layer communication exception construction solution, which specifically includes the following steps:

[0099] This embodiment can apply the chaos platform fault drills, including the following types:

[0100] (1) RPC-related, HTTP / SRF / tRPC / gRPC timeout / delay failures;

[0101] (2) Storage-related, MySQL / MongoDB / CKV+ / CKV timeout / delay failures;

[0102] (3) Message queue related, Kafka / Pulsar timeout / delay failure.

[0103] The specific steps for users are as follows:

[0104] 1. Open the Chaos platform and select Create a New Experiment;

[0105] 2. Select the application layer fault type, such as SRF fault;

[0106] 3. Set fault behavior parameters, such as timeout, called service / method, and percentage of faults;

[0107] 4. Set other necessary parameters, such as main tuning information, and finally submit the experiment.

[0108] This embodiment can be deployed on the K8s container platform, and the deployment topology can be as follows Fig. 9 As shown, the core principle is to distinguish different application protocols or different instances of the same protocol through different proxy ports.

[0109] like Fig.10 As shown, the calling service is music.chaos.SayServer, and the three called services are:

[0110] (1) music.chaos.EchoServer.Echo (SRF interface)

[0111] (2) music.chaos.EchoServer.EchoV2 (SRF interface)

[0112] (3) music.storage.ckvplus.chaos (CKV+ storage)

[0113] By assigning three ports 9000, 9001, and 9002 to the proxy Envoy and configuring the four-layer proxy rules, TCP traffic coming from port 9000 is forwarded to the server corresponding to music.chaos.Echo server.Echo, and so on.

[0114] Then, through service discovery, traffic is hijacked, and the traffic of the main server, music.chaos.Say, and the server, music.chaos.Echo, is hijacked to port 9000, and so on.

[0115] Set tc rules on the Envoy side, build a delay queue, set iptables rules, and send traffic matching the rules to the tc delay queue.

[0116] Take the operation of the chaos platform to construct the application layer timeout failure experiment as an example. Fig.11 The detailed steps are as follows:

[0117] 1. The front end sends the fault statement to the backend Controller through HTTP request.

[0118] 2. The controller randomly assigns a port number and converts it into a Listener of the xDS protocol, converts the called IP:Port in the fault statement into a Cluster of the xDS protocol, and sends both to Envoy through the gRPC channel.

[0119] 3. After receiving the xDS configuration, Envoy starts a listening port and establishes a TCP connection with the called cluster.

[0120] 4. The Controller requests Netem-server through HTTP to set an iptables rule in the Pod where Envoy is located. This rule can indicate that if the source IP and source port of the TCP packet are matched and the flag bit is not set to SYN, the ordinary data packet will enter the tc queue. In the tc queue set by the initialization container, the corresponding delay is very large, which has exceeded the normal service timeout, which means that all tcp packets entering this queue will time out.

[0121] 5. The Controller performs traffic hijacking based on service discovery through custom routing. Specifically, a normal service discovery request name service will directly return the IP:Port of the called service, but through custom routing, rules can be set, and service discovery requests that match the rules return the port assigned in step 3 and the Envoy IP.

[0122] 6. At this time, the main caller initiates a request and wants to obtain the address of the called party through service discovery addressing. At this time, the rule set in step 5 is matched, and the name service returns the Envoy proxy address.

[0123] 7. The Envoy layer 4 proxy directly forwards the TCP packet to the called service and gets the return packet. Then, when forwarding the return packet to the main caller, it hits the iptables rule set in step 4. The TCP packet enters the tc queue and generates a preset delay, resulting in a timeout.

[0124] Through this embodiment, it is possible to construct application layer communication anomalies for fault drills without implementing the encoding and decoding of various application layer protocols one by one. If new application layer protocols appear in the future, it can also be supported, thereby improving the scalability of the application layer communication anomaly construction.

[0125] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0126] Based on the same inventive concept, the embodiment of the present application also provides a communication anomaly construction device for implementing the communication anomaly construction method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more communication anomaly construction device embodiments provided below can refer to the limitations on the communication anomaly construction method above, and will not be repeated here.

[0127] In one embodiment, Fig.12 As shown, a communication anomaly construction device is provided, including: an anomaly declaration acquisition module 1201, an anomaly strategy construction module 1202, a service call forwarding module 1203 and a communication anomaly response module 1204, wherein:

[0128] The abnormal declaration acquisition module 1201 is used to respond to the communication abnormal construction request and obtain abnormal declaration information matching the communication abnormal construction request; the abnormal declaration information carries the main calling service information and the called service information;

[0129] The abnormal strategy construction module 1202 is used to obtain the port number of the proxy service associated with the calling service information and the called service information, and construct a communication abnormality construction strategy matching the port number in the proxy service;

[0130] The service call forwarding module 1203 is used to forward the service call request to the target port that matches the port number of the proxy service when receiving a service call request initiated by the main calling service matching the main calling service information and if the called service corresponding to the service call request is the called service matching the called service information;

[0131] The communication exception response module 1204 is used to execute a communication exception response corresponding to the service call request according to the communication exception construction strategy through the proxy service.

[0132] Each module in the above communication anomaly construction device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0133] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.13 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store abnormal declaration information data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a communication abnormality construction method is implemented.

[0134] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0135] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0136] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0137] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0138] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0139] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0140] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0141] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A communication anomaly construction method, It is characterized in that The method comprises: In response to a communication exception construction request, obtaining exception declaration information matching the communication exception construction request; the exception declaration information carries the calling service information and the called service information; Acquire the port number of the proxy service associated with the calling service information and the called service information, and construct a communication anomaly construction strategy matching the port number in the proxy service; Upon receiving a service call request initiated by a calling service matching the calling service information, if the called service corresponding to the service call request is the called service matching the called service information, forwarding the service call request to a target port of the proxy service matching the port number; The proxy service executes a communication exception response corresponding to the service call request according to the communication exception construction strategy.

2. The method according to claim 1, It is characterized in that Before forwarding the service call request to the target port of the proxy service that matches the port number, the method further includes: Acquire the port number and the called service address that matches the called service information, and construct a service discovery protocol based on the data source according to the port number and the called service address; The service discovery protocol is sent to the proxy service, and a communication connection between the target port and the called service matching the called service information is constructed through the proxy service.

3. The method according to claim 2, It is characterized in that The constructing a service discovery protocol based on a data source according to the port number and the called service address includes: Convert the port number into a listener of the service discovery protocol, and convert the called service address into a cluster of the service discovery protocol; The step of constructing a communication connection between the target port and the called service matching the called service information through the proxy service includes: The target port matching the port number is started through the proxy service, and a communication connection between the target port and the called service matching the called service information is established according to the called service address.

4. The method according to claim 1, It is characterized in that The constructing of a communication anomaly construction strategy matching the port number in the proxy service includes: Acquire a target exception policy that matches the exception declaration information and a service identifier of the proxy service; In the packet filtering policy of the proxy service, a filtering policy carrying the service identifier, the port number and the target abnormality policy is added as the communication abnormality construction policy.

5. The method according to claim 4, It is characterized in that The target exception strategy includes a delayed response strategy, and the delayed response strategy is implemented by a delayed queue; The acquiring of a target exception strategy matching the exception declaration information includes: Obtaining delay duration information from the abnormal declaration information; Obtaining a target delay queue that matches the delay duration information from a plurality of pre-set candidate delay queues, and using the target delay queue as the target exception strategy; wherein each of the candidate delay queues corresponds to a different delay duration; The step of adding a filtering policy carrying the service identifier, the port number and the target abnormality policy to the information packet filtering policy of the proxy service as the communication abnormality construction policy includes: In the information packet filtering policy, a filtering policy carrying the service identifier, the port number and the queue identifier of the target delay queue is added as the communication anomaly construction strategy.

6. The method according to claim 1, It is characterized in that The service call request includes a service addressing request; If the called service corresponding to the service call request is a called service that matches the called service information, forwarding the service call request to a target port of the proxy service that matches the port number includes: In response to the service addressing request, obtaining a called service corresponding to the service calling request; If the called service corresponding to the service call request is a called service that matches the called service information, obtaining the port number of the proxy service from the communication exception construction strategy; The proxy service address of the proxy service and the port number are returned to the calling service as the response address corresponding to the service addressing request, so as to instruct the calling service to send the service call request to the target port according to the proxy service address and the port number.

7. The method according to any one of claims 1 to 6, It is characterized in that The communication anomaly construction strategy includes a delayed response strategy, and the delayed response strategy is implemented by a delay queue corresponding to a delay queue identifier included in the communication anomaly construction strategy; The executing, by the proxy service according to the communication exception construction strategy, a communication exception response corresponding to the service call request comprises: The service call request is sent from the target port to the called service corresponding to the service call request through the proxy service, and the proxy service receives the service request response corresponding to the service call request returned by the called service corresponding to the service call request; The service request response is input into the delay queue corresponding to the delay queue identifier contained in the communication exception construction strategy through the proxy service, and the service request response is returned to the main calling service through the delay queue to achieve a delayed response to the service call request.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.