Traffic diversion method, device, storage medium and electronic device
By monitoring and diversion of forwarding failures of target traffic, intelligently allocating traffic to multiple computer rooms, solving the problem of low traffic shunt efficiency in multi-computer room scenarios, and achieving efficient utilization of resources.
Patent Information
- Application Number
- CN202210635798.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-07
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-06-07
AI Technical Summary
In multi-computer room scenarios, the diversion efficiency of business traffic in the prior art is low, resulting in a sharp expansion of traffic pressure in some computer rooms and idle resources in other computer rooms, resulting in waste of resources.
By monitoring the number of times the target traffic failed to forward by the proxy container, if the preset threshold is exceeded, it will be diverted based on the total number of forwarding times of the target traffic, and some traffic will be forwarded to servers in non-target servers or other computer rooms to realize intelligent traffic diversion .
It improves the efficiency of diversion of business traffic in multiple computer rooms, realizes efficient and balanced utilization of resources, and avoids traffic pressure concentration and resource waste.
Smart Images

Figure CN114827160B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a traffic diversion method, device, storage medium and electronic device. Background Art
[0002] In the current multi-cluster and multi-computer room scenarios, load balancing often requires service consumers to subscribe to multiple clusters at the same time, and implement park-priority load through the park ID configured by the consumer. Taking the dubbo framework as an example, the dubbo consumer can subscribe to multiple registration centers at the same time, but needs to configure the park ID of each registration center at the same time. The consumer will prioritize the load of its own requests to the provider on the registration center in the same park as itself.
[0003] However, for a single consumer, the campus ID is fixed, which means that only when the registration center of the current computer room is completely down and disconnected will it reload the traffic to the providers of other computer rooms. Therefore, most of the time, the provider data subscribed from other computer rooms is useless, but it takes up a lot of memory on the consumer side. At the same time, maintaining a large number of connections and heartbeats also requires a lot of additional IO overhead. In the actual production and operation environment, the geographical distribution of service consumers is often very unbalanced: a large number of consumer requests will be concentrated on one (or a few) computer rooms, causing the traffic pressure of these computer rooms to expand sharply. In this case, they can only be temporarily physically expanded; at the same time, other computer rooms may not have any traffic load at all, and a large number of resources are idle, resulting in a huge waste of resources.
[0004] With regard to the problem of low efficiency in diverting business traffic when there are multiple computer rooms in related technologies, no effective solution has been proposed so far. Summary of the invention
[0005] The main purpose of the present application is to provide a traffic diversion method, device, storage medium and electronic device to solve the problem of low efficiency in diverting business traffic when there are multiple computer rooms in the related art.
[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a traffic diversion method is provided. The method includes: monitoring the target traffic flowing through the target server in the first computer room to obtain the monitoring result, wherein the monitoring result at least includes: the number of times the target traffic fails to be forwarded by the proxy container, wherein the proxy container is used to forward the target traffic to the target server in the first computer room; if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, obtaining the total number of forwardings of the target traffic by the proxy container; and diverting the target traffic according to the total number of forwardings of the target traffic.
[0007] Furthermore, before monitoring the target traffic flowing through the target server in the first computer room and obtaining the monitoring result, the method also includes: creating a proxy container through the target console; receiving the target traffic through the proxy container; and forwarding the target traffic to the target server in the first computer room using the proxy container.
[0008] Further, using a proxy container to forward the target traffic to a target server in the first computer room includes: receiving a traffic forwarding identifier sent by a target console, wherein the traffic forwarding identifier includes at least one of the following: the number of times the target traffic fails to be forwarded by the proxy container, and the maximum number of forwardings of the target traffic in the first computer room; and using the proxy container to forward the target traffic to the target server in the first computer room according to the traffic forwarding identifier.
[0009] Furthermore, the target traffic flowing through the target server in the first computer room is monitored to obtain the monitoring result, including: setting a preset time; within the preset time, monitoring the number of times the target traffic flowing through the target server fails to be forwarded by the proxy container; and taking the number of times the target traffic fails to be forwarded by the proxy container as the monitoring result.
[0010] Further, diverting the target traffic according to the target total number of target traffic includes: if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, determining whether the target total number of target traffic is greater than a second preset threshold, wherein the target total number is the sum of the number of times the target traffic is successfully forwarded by the proxy container and the number of times the target traffic fails to be forwarded by the proxy container; if the target total number of target traffic is not greater than the second preset threshold, forwarding a preset portion of the target traffic to a non-target server in the first computer room, so that the non-target server diverts the target traffic; if the target total number of target traffic is greater than the second preset threshold, forwarding a preset portion of the target traffic to a server in the second computer room, so that the server in the second computer room diverts the target traffic.
[0011] Furthermore, forwarding a preset part of the target traffic to the server in the second computer room includes: if the target total number of target traffic is greater than a second preset threshold, sending the preset part of the traffic to the target gateway device; redirecting and forwarding the preset part of the traffic to the server in the second computer room through the target gateway device.
[0012] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a traffic diversion device is provided. The device includes: a monitoring unit, which is used to monitor the target traffic flowing through the target server in the first computer room to obtain the monitoring result, wherein the monitoring result at least includes: the number of times the target traffic fails to be forwarded by the proxy container, wherein the proxy container is used to forward the target traffic to the target server in the first computer room; an acquisition unit, which is used to obtain the total number of times the proxy container forwards the target traffic if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold; and a diversion unit, which is used to divert the target traffic according to the total number of times the target traffic is forwarded.
[0013] Furthermore, the device also includes: a creation unit, which is used to monitor the target traffic flowing through the target server in the first computer room and create a proxy container through the target console before obtaining the monitoring result; a receiving unit, which is used to receive the target traffic through the proxy container; and a forwarding unit, which is used to use the proxy container to forward the target traffic to the target server in the first computer room.
[0014] Furthermore, the forwarding unit includes: a receiving module, used to receive a traffic forwarding identifier sent by a target console, wherein the traffic forwarding identifier includes at least one of the following: the number of times the target traffic fails to be forwarded by the proxy container, and the maximum number of forwardings of the target traffic in the first computer room; a first forwarding module, used to use the proxy container to forward the target traffic to the target server in the first computer room according to the traffic forwarding identifier.
[0015] Furthermore, the monitoring unit includes: a setting module for setting a preset time; a monitoring module for monitoring the number of times that the target traffic flowing through the target server fails to be forwarded by the proxy container within the preset time; and a determination module for taking the number of times that the proxy container fails to forward as a monitoring result.
[0016] Further, the diversion unit includes: a judgment module, which is used to judge whether the target total number of target traffic is greater than a second preset threshold if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, wherein the target total number is the sum of the number of times the target traffic is successfully forwarded by the proxy container and the number of times the target traffic fails to be forwarded by the proxy container; a second forwarding module, which is used to forward a preset part of the target traffic to a non-target server in the first computer room if the target total number of the target traffic is not greater than the second preset threshold, so that the non-target server diverts the target traffic; a third forwarding module, which is used to forward a preset part of the target traffic to a server in the second computer room if the target total number of the target traffic is greater than the second preset threshold, so that the server in the second computer room diverts the target traffic.
[0017] Furthermore, the third forwarding module includes: a sending sub-module, used to send a preset part of the traffic to the target gateway device if the target total number of target traffic is greater than a second preset threshold; a forwarding sub-module, used to redirect and forward the preset part of the traffic to the server in the second computer room through the target gateway device.
[0018] Through this application, the following steps are adopted: monitor the target traffic flowing through the target server in the first computer room to obtain the monitoring results, wherein the monitoring results at least include: the number of times the target traffic fails to be forwarded by the proxy container, wherein the proxy container is used to forward the target traffic to the target server in the first computer room; if the monitoring result indicates that the number of forwarding failures is greater than the first preset threshold, obtain the total number of forwarding times of the target traffic by the proxy container; and divert the target traffic according to the total number of forwarding times of the target traffic. Through this application, the problem of low efficiency in diverting business traffic in multiple computer rooms in the related art is solved. By diverting the target traffic according to the total number of forwarding times of the target traffic, the effect of improving the diversion efficiency of business traffic in multiple computer rooms is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0020] Figure 1 is a flow chart of a traffic diversion method provided according to an embodiment of the present application;
[0021] Figure 2 This is a schematic diagram of the overall operation of the flow diversion method provided in the embodiment of the present application.
[0022] Figure 3 is a schematic diagram of a flow diversion device provided according to an embodiment of the present application;
[0023] Figure 4 It is a schematic diagram of the network architecture of the traffic diversion electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0025] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] 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 for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0028] The present invention is described below in conjunction with preferred implementation steps. Figure 1 is a flow chart of a flow diversion method provided according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0029] Step S101, monitor the target traffic flowing through the target server in the first computer room to obtain a monitoring result, wherein the monitoring result at least includes: the number of times the target traffic fails to be forwarded by the proxy container, wherein the proxy container is used to forward the target traffic to the target server in the first computer room.
[0030] For example, if the first computer room includes multiple servers, a proxy container is required to receive the target traffic before the target traffic flows through the target server.
[0031] Optionally, in the traffic diversion method provided in an embodiment of the present application, before monitoring the target traffic flowing through the target server in the first computer room and obtaining the monitoring result, the method also includes: creating a proxy container through the target console; receiving the target traffic through the proxy container; and using the proxy container to forward the target traffic to the target server in the first computer room.
[0032] Specifically, Figure 2 As shown, when the business pod is initialized, the service mesh control plane (Mesh Controller) (corresponding to the target console in this application) creates a sidecar container (Sidecar) (corresponding to the proxy container in this application) in its pod to proxy the business container traffic, and forwards the target traffic to the target server in the first computer room to implement resource allocation for the business traffic.
[0033] In order to improve the efficiency of allocating business traffic, the present application uses a proxy container to forward the target traffic to the target server in the first computer room, including: receiving a traffic forwarding identifier sent by the target console, wherein the traffic forwarding identifier includes at least one of the following: the number of times the target traffic fails to be forwarded by the proxy container, and the maximum number of forwardings of the target traffic in the first computer room; using the proxy container to forward the target traffic to the target server in the first computer room according to the traffic forwarding identifier.
[0034] Specifically, the service grid control surface sends the provider node (which may correspond to the target server in this application) traffic diversion forwarding rules (corresponding to the traffic forwarding identifier in this application) to the proxy container. Each identifier contains a 4-tuple (failure-rate, flow-rate, TTL, time-slice), which can represent the current business container failure rate, the maximum number of forwarding hops in the computer room, and can also include the traffic forwarding ratio and the maximum number of forwarding hops in the computer room. According to the traffic diversion forwarding rules, the target traffic is forwarded to the target server in the first computer room, so that the target traffic flowing through the target server can be effectively monitored.
[0035] In order to improve the monitoring efficiency of the target traffic, in the traffic diversion method provided in the embodiment of the present application, the target traffic flowing through the target server in the first computer room is monitored, and obtaining the monitoring result includes: setting a preset time; within the preset time, monitoring the number of times the target traffic flowing through the target server fails to be forwarded by the proxy container; and taking the number of times the proxy container fails to forward as the monitoring result.
[0036] For example, a certain moment within the preset time is used as the monitoring time of the proxy container for the target server, and during the monitoring time, the request failure rate of the target traffic flowing through the target server is monitored (corresponding to the number of proxy container forwarding failures in this application), and the request failure rate is used as the monitoring result in this application. By monitoring the request failure rate, the diversion of the target traffic in this application is more reasonable.
[0037] Step S102: If the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, the total number of forwarding times of the proxy container for the target traffic is obtained.
[0038] Step S103, diverting the target traffic according to the total number of forwarding times of the target traffic.
[0039] Specifically, if the monitoring result indicates that the number of forwarding failures is greater than the failure rate threshold (corresponding to the first preset threshold in this application), it is determined whether to split the traffic across the computer room according to the total number of forwarding of the target traffic, where Figure 2 As shown in the figure, DC represents the server cluster and computer room; RPC represents remote procedure call; Provider represents the service provider that exposes distributed services; Consumer represents the service consumer that calls remote services; Registry represents the registration center; Router represents the cross-computer room service gateway; Sidecar represents the sidecar container; Mesh Controller represents the service mesh control plane; TTL represents the maximum forwarding hops.
[0040] Optionally, in the traffic diversion method provided in an embodiment of the present application, diverting the target traffic according to the target total number of the target traffic includes: if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, determining whether the target total number of the target traffic is greater than a second preset threshold, wherein the target total number is the sum of the number of times the target traffic is successfully forwarded by the proxy container and the number of times the target traffic fails to be forwarded by the proxy container; if the target total number of the target traffic is not greater than the second preset threshold, forwarding a preset portion of the target traffic to a non-target server in the first computer room, so that the non-target server diverts the target traffic; if the target total number of the target traffic is greater than the second preset threshold, forwarding a preset portion of the target traffic to a server in the second computer room, so that the server in the second computer room diverts the target traffic.
[0041] For example, when the number of forwarding failures exceeds the failure rate threshold, a portion of the traffic originally loaded to the current business container will be randomly forwarded to another provider in the current computer room (corresponding to the non-target server in this application), and the t++ operation will be performed, where t represents the total number of forwarding hops of the current target traffic (corresponding to the total number of forwarding times in this application), and the initial value is 0. Specifically, if a Sidecar receives a portion of the forwarded traffic and finds that the failure rate of the current business container also exceeds the failure rate threshold and the current number of forwarding hops of this traffic t>TTL (corresponding to the second preset threshold in this application), part of the current target traffic will be forwarded to the server in the second computer room, so that the server in the second computer room can divert the target traffic. This application determines the total number of jumps of the target traffic to achieve efficient decoupling of traffic management and business.
[0042] In order to enable the server in the second computer room to divert the target traffic, in the traffic diversion method provided in the embodiment of the present application, forwarding a preset part of the target traffic to the server in the second computer room includes: if the target total number of target traffic is greater than a second preset threshold, sending the preset part of the traffic to the target gateway device; redirecting and forwarding the preset part of the traffic to the server in the second computer room through the target gateway device.
[0043] Specifically, Figure 2 As shown, Sidecar forwards part of the target traffic to Router (corresponding to the target gateway device in this application), and sends relevant information to Mesh Controller. Specifically, after Mesh Controller obtains Sidecar push and senses that the current computer room (that is, the first computer room in this application) may reach a traffic bottleneck, it broadcasts this situation to all provider Sidecars in the current computer room. After a period of time (time-slice), Sidecar directly forwards the traffic that originally needs to be forwarded to other providers in the current computer room to Router. After receiving the traffic, Router redirects the traffic to divert the load to providers (corresponding to the servers in the second computer room in this application) in other computer rooms (corresponding to the second computer room in this application). This overcomes the shortcomings of the current mainstream campus priority load balancing through consumer multi-computer room subscription method, and achieves the effect of efficient and balanced utilization of multi-computer room resources.
[0044] In summary, the traffic diversion method provided in the embodiment of the present application monitors the target traffic flowing through the target server in the first computer room to obtain the monitoring result, wherein the monitoring result includes at least: the number of times the target traffic fails to be forwarded by the proxy container, wherein the proxy container is used to forward the target traffic to the target server in the first computer room; if the monitoring result indicates that the number of forwarding failures is greater than the first preset threshold, the total number of forwardings of the target traffic by the proxy container is obtained; and the target traffic is diverted according to the total number of forwardings of the target traffic. Through this application, the problem of low efficiency in diverting business traffic in multiple computer rooms in the related art is solved. By diverting the target traffic according to the total number of forwardings of the target traffic, the effect of improving the efficiency of diverting business traffic in multiple computer rooms is achieved.
[0045] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0046] The embodiment of the present application also provides a flow diversion device. It should be noted that the flow diversion device of the embodiment of the present application can be used to execute the flow diversion method provided in the embodiment of the present application. The flow diversion device provided in the embodiment of the present application is introduced below.
[0047] Figure 3 Schematic diagram of a flow diversion device according to an embodiment of the present application. Figure 3 As shown, the device includes: a monitoring unit 301, an acquisition unit 302, and a diversion unit 303.
[0048] Specifically, the monitoring unit 301 is used to monitor the target traffic flowing through the target server in the first computer room to obtain a monitoring result, wherein the monitoring result at least includes: the number of times the target traffic fails to be forwarded by the proxy container, wherein the proxy container is used to forward the target traffic to the target server in the first computer room;
[0049] An acquiring unit 302 is configured to acquire a total number of forwarding times of the target traffic by the proxy container if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold;
[0050] The traffic diversion unit 303 is used to divert the target traffic according to the total forwarding times of the target traffic.
[0051] In summary, the traffic diversion device provided in the embodiment of the present application monitors the target traffic flowing through the target server in the first computer room through the monitoring unit 301 to obtain the monitoring result, wherein the monitoring result at least includes: the number of times the target traffic fails to be forwarded by the proxy container, wherein the proxy container is used to forward the target traffic to the target server in the first computer room; if the monitoring result indicates that the number of forwarding failures is greater than the first preset threshold, the acquisition unit 302 obtains the total number of forwardings of the target traffic by the proxy container; the diversion unit 303 diverts the target traffic according to the total number of forwardings of the target traffic, thereby solving the problem of low diversion efficiency of business traffic in multiple computer rooms in the related art. By diverting the target traffic according to the total number of forwardings of the target traffic, the effect of improving the diversion efficiency of business traffic in multiple computer rooms is achieved.
[0052] Optionally, in the traffic diversion device provided in the embodiment of the present application, the device also includes: a creation unit, used to monitor the target traffic flowing through the target server in the first computer room and create a proxy container through the target console before obtaining the monitoring result; a receiving unit, used to receive the target traffic through the proxy container; and a forwarding unit, used to use the proxy container to forward the target traffic to the target server in the first computer room.
[0053] Optionally, in the traffic diversion device provided in an embodiment of the present application, the forwarding unit includes: a receiving module, used to receive a traffic forwarding identifier sent by a target console, wherein the traffic forwarding identifier includes at least one of the following: the number of times the target traffic fails to be forwarded by the proxy container, and the maximum number of forwardings of the target traffic in the first computer room; a first forwarding module, used to use the proxy container to forward the target traffic to the target server in the first computer room according to the traffic forwarding identifier.
[0054] Optionally, in the traffic diversion device provided in an embodiment of the present application, the monitoring unit includes: a setting module, used to set a preset time; a monitoring module, used to monitor the number of times that the target traffic flowing through the target server fails to be forwarded by the proxy container within the preset time; and a determination module, used to use the number of times that the proxy container fails to forward as the monitoring result.
[0055] Optionally, in the traffic diversion device provided in the embodiment of the present application, the diversion unit includes: a judgment module, which is used to judge whether the target total number of target traffic is greater than a second preset threshold if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, wherein the target total number is the sum of the number of times the target traffic is successfully forwarded by the proxy container and the number of times the target traffic fails to be forwarded by the proxy container; a second forwarding module, which is used to forward a preset part of the target traffic to a non-target server in the first computer room if the target total number of the target traffic is not greater than the second preset threshold, so that the non-target server diverts the target traffic; a third forwarding module, which is used to forward a preset part of the target traffic to a server in the second computer room if the target total number of the target traffic is greater than the second preset threshold, so that the server in the second computer room diverts the target traffic.
[0056] Optionally, in the traffic diversion device provided in the embodiment of the present application, the third forwarding module includes: a sending sub-module, used to send a preset part of the traffic to the target gateway device if the target total number of target traffic is greater than a second preset threshold; a forwarding sub-module, used to redirect and forward the preset part of the traffic to the server in the second computer room through the target gateway device.
[0057] The traffic diversion device includes a processor and a memory. The above-mentioned monitoring unit 301, acquisition unit 302, diversion unit 303, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0058] The processor contains a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and traffic can be diverted by adjusting kernel parameters.
[0059] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0060] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, a traffic diversion method is implemented.
[0061] An embodiment of the present invention provides a processor, which is used to run a program, wherein a traffic diversion method is executed when the program is running.
[0062] like Figure 4 As shown, an embodiment of the present invention provides an electronic device, the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the following steps when executing the program: monitoring the target traffic flowing through the target server in the first computer room to obtain a monitoring result, wherein the monitoring result at least includes: the number of times the target traffic fails to be forwarded by the proxy container, wherein the proxy container is used to forward the target traffic to the target server in the first computer room; if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, obtaining the total number of forwardings of the target traffic by the proxy container; and diverting the target traffic according to the total number of forwardings of the target traffic.
[0063] When the processor executes the program, the following steps are also implemented: before monitoring the target traffic flowing through the target server in the first computer room and obtaining the monitoring result, a proxy container is created through the target console; the target traffic is received through the proxy container; and the target traffic is forwarded to the target server in the first computer room using the proxy container.
[0064] When the processor executes the program, the following steps are also implemented: receiving a traffic forwarding identifier sent by a target console, wherein the traffic forwarding identifier includes at least one of the following: the number of times the target traffic fails to be forwarded by the proxy container, and the maximum number of forwardings of the target traffic in the first computer room; and using the proxy container to forward the target traffic to the target server in the first computer room according to the traffic forwarding identifier.
[0065] When executing the program, the processor also implements the following steps: setting a preset time; within the preset time, monitoring the number of times that the target traffic flowing through the target server fails to be forwarded by the proxy container; and taking the number of times that the target traffic fails to be forwarded by the proxy container as the monitoring result.
[0066] When the processor executes the program, the following steps are also implemented: if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, determine whether the target total number of target traffic is greater than a second preset threshold, wherein the target total number is the sum of the number of times the target traffic is successfully forwarded by the proxy container and the number of times the target traffic is failed to be forwarded by the proxy container; if the target total number of target traffic is not greater than the second preset threshold, forward a preset portion of the target traffic to a non-target server in the first computer room, so that the non-target server diverts the target traffic; if the target total number of target traffic is greater than the second preset threshold, forward a preset portion of the target traffic to a server in the second computer room, so that the server in the second computer room diverts the target traffic.
[0067] When the processor executes the program, the following steps are also implemented: if the target total number of target traffic is greater than a second preset threshold, a preset portion of traffic is sent to a target gateway device; and the preset portion of traffic is redirected and forwarded to a server in the second computer room through the target gateway device.
[0068] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0069] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that is initialized with the following method steps: monitoring the target traffic flowing through the target server in the first computer room to obtain a monitoring result, wherein the monitoring result at least includes: the number of times the target traffic fails to be forwarded by the proxy container, wherein the proxy container is used to forward the target traffic to the target server in the first computer room; if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, obtaining the total number of forwardings of the target traffic by the proxy container; and diverting the target traffic according to the total number of forwardings of the target traffic.
[0070] When executed on a data processing device, it is also suitable for executing a program that is initialized with the following method steps: before monitoring the target traffic flowing through the target server in the first computer room and obtaining the monitoring result, creating a proxy container through the target console; receiving the target traffic through the proxy container; and forwarding the target traffic to the target server in the first computer room using the proxy container.
[0071] When executed on a data processing device, the method is also suitable for executing a program that is initialized with the following method steps: receiving a traffic forwarding identifier sent by a target console, wherein the traffic forwarding identifier includes at least one of the following: the number of times the target traffic fails to be forwarded by the proxy container, and the maximum number of forwardings of the target traffic in the first computer room; and using the proxy container to forward the target traffic to the target server in the first computer room according to the traffic forwarding identifier.
[0072] When executed on a data processing device, the method is also suitable for executing an initialization program having the following method steps: setting a preset time; within the preset time, monitoring the number of times that the target traffic flowing through the target server fails to be forwarded by the proxy container; and using the number of times that the target traffic fails to be forwarded by the proxy container as the monitoring result.
[0073] When executed on a data processing device, it is also suitable for executing a program that is initialized with the following method steps: if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, determine whether the target total number of target traffic is greater than a second preset threshold, wherein the target total number is the sum of the number of times the target traffic is successfully forwarded by the proxy container and the number of times the target traffic is failed to be forwarded by the proxy container; if the target total number of target traffic is not greater than the second preset threshold, forward a preset part of the target traffic to a non-target server in the first computer room, so that the non-target server diverts the target traffic; if the target total number of target traffic is greater than the second preset threshold, forward a preset part of the target traffic to a server in the second computer room, so that the server in the second computer room diverts the target traffic.
[0074] When executed on a data processing device, it is also suitable for executing an initialization program having the following method steps: if the target total number of target traffic is greater than a second preset threshold, sending a preset part of the traffic to a target gateway device; redirecting and forwarding the preset part of the traffic to a server in a second computer room through the target gateway device.
[0075] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0076] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0077] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0078] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0079] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0080] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0081] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0082] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0083] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0084] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A flow diversion method, characterized in that: include: Monitoring target traffic flowing through a target server in the first computer room to obtain monitoring results, wherein the monitoring results at least include: the number of times the target traffic fails to be forwarded by a proxy container, wherein the proxy container is used to forward the target traffic to the target server in the first computer room; If the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, obtaining a total number of forwarding times of the target traffic by the proxy container; The target traffic is diverted according to the total number of forwardings of the target traffic, wherein the target traffic is diverted according to the target total number of the target traffic, including: if the monitoring result indicates that the number of forwarding failures is greater than the first preset threshold, judging whether the target total number of the target traffic is greater than the second preset threshold, wherein the target total number is the sum of the number of times the target traffic is successfully forwarded by the proxy container and the number of times the target traffic is failed to be forwarded by the proxy container; if the target total number of the target traffic is not greater than the second preset threshold, forwarding a preset part of the target traffic to a non-target server in the first computer room, so that the non-target server diverts the target traffic; if the target total number of the target traffic is greater than the second preset threshold, forwarding a preset part of the target traffic to a server in the second computer room, so that the server in the second computer room diverts the target traffic; the second preset threshold is the maximum forwarding hop number; Forwarding a preset portion of the target traffic to the server in the second computer room includes: if the target total number of the target traffic is greater than a second preset threshold, sending the preset portion of the traffic to a target gateway device; and redirecting and forwarding the preset portion of the traffic to the server in the second computer room through the target gateway device.
2. The method according to claim 1, characterized in that: Before monitoring the target traffic flowing through the target server in the first computer room and obtaining the monitoring result, the method further includes: Creating the proxy container via the target console; Receiving the target traffic through the proxy container; The proxy container is used to forward the target traffic to the target server in the first computer room.
3. The method according to claim 2, characterized in that Using the proxy container to forward the target traffic to the target server in the first computer room includes: Receive a traffic forwarding identifier sent by a target console, wherein the traffic forwarding identifier includes at least one of the following: the number of times the target traffic fails to be forwarded by the proxy container, and the maximum forwarding number of the target traffic being forwarded in the first computer room; The proxy container is used to forward the target traffic to a target server in the first computer room according to the traffic forwarding identifier.
4. The method according to claim 1, characterized in that: The target traffic flowing through the target server in the first computer room is monitored, and the monitoring results include: Set a preset time; Within the preset time, monitoring the number of times that the target traffic flowing through the target server fails to be forwarded by the proxy container; The number of times that the proxy container fails to forward is used as the monitoring result.
5. A flow diversion device, characterized in that: include: A monitoring unit, configured to monitor target traffic flowing through a target server in the first computer room, and obtain a monitoring result, wherein the monitoring result at least includes: the number of times the target traffic fails to be forwarded by a proxy container, wherein the proxy container is configured to forward the target traffic to the target server in the first computer room; an acquiring unit, configured to acquire a total number of forwarding times of the target traffic by the proxy container if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold; A traffic diversion unit, configured to divert the target traffic according to the total number of forwarding times of the target traffic; The diversion unit includes: a judgment module, which is used to judge whether the target total number of target traffic is greater than a second preset threshold if the monitoring result indicates that the number of forwarding failures is greater than a first preset threshold, wherein the target total number is the sum of the number of times the target traffic is successfully forwarded by the proxy container and the number of times the target traffic is failed to be forwarded by the proxy container; a second forwarding module, which is used to forward a preset part of the target traffic to a non-target server in the first computer room if the target total number of the target traffic is not greater than the second preset threshold, so that the non-target server diverts the target traffic; a third forwarding module, which is used to forward a preset part of the target traffic to a server in the second computer room if the target total number of the target traffic is greater than the second preset threshold, so that the server in the second computer room diverts the target traffic; the second preset threshold is the maximum forwarding hop count; Forwarding a preset portion of the target traffic to the server in the second computer room includes: if the target total number of the target traffic is greater than a second preset threshold, sending the preset portion of the traffic to a target gateway device; and redirecting and forwarding the preset portion of the traffic to the server in the second computer room through the target gateway device.
6. The device according to claim 5, characterized in that The device also includes: A creation unit, configured to monitor the target traffic flowing through the target server in the first computer room and create the proxy container through the target console before obtaining the monitoring result; A receiving unit, configured to receive the target traffic through the proxy container; A forwarding unit is used to use the proxy container to forward the target traffic to a target server in the first computer room.
7. A computer-readable storage medium, characterized in that: The storage medium stores a program, wherein the program executes the method according to any one of claims 1 to 4.
8. An electronic device, characterized in that: The invention comprises one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of claims 1 to 4.
