Traffic forwarding method and device, computer equipment, storage medium and program product
By matching the access domain name in the traffic request with multiple traffic forwarding policies, determining the target policy and forwarding traffic data, the problem of unbalanced traffic forwarding in traditional technology is solved, and the load balancing of traffic forwarding is achieved.
Patent Information
- Application Number
- CN202411683472.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-22
AI Technical Summary
In traditional technology, there is a problem of load imbalance during traffic forwarding, resulting in improper resource allocation and unbalanced load.
By receiving the access domain name in the traffic request and matching it with multiple preset traffic forwarding policies, the target traffic forwarding policy is determined, so that traffic data is forwarded to the corresponding destination device according to the policy.
Load balancing is realized during traffic forwarding, avoiding the problem of forwarding multiple traffic requested data to the same destination device, and ensuring that data requested by different traffic can be forwarded to different destination devices.
Smart Images

Figure CN119520407A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of traffic data distribution, and in particular to a traffic forwarding method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] When processing traffic requests sent by clients, by deploying a load balancer on the network element, the user's traffic requests can be evenly distributed to multiple host groups corresponding to the network element, thereby achieving balanced traffic processing. Usually, a single or multiple listeners can be configured on the elastic load balancer, and a traffic forwarding policy can be configured in the listener to send the traffic data corresponding to the traffic request to the corresponding host group according to the traffic forwarding policy.
[0003] In traditional technology, the domain name certificate corresponding to the domain name in the traffic request is matched with the traffic forwarding strategy. When the match is successful, the traffic data corresponding to the traffic request is forwarded to the host group corresponding to the traffic forwarding strategy to achieve balanced traffic processing.
[0004] However, traditional technologies suffer from load imbalance during traffic forwarding. Summary of the invention
[0005] Based on this, it is necessary to provide a traffic forwarding method, device, computer equipment, computer-readable storage medium and computer program product that can achieve load balancing during traffic forwarding in response to the above technical problems.
[0006] In a first aspect, the present application provides a traffic forwarding method. The method comprises:
[0007] Receiving a first traffic request, wherein the first traffic request includes a first access domain name;
[0008] Matching the first access domain name with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy;
[0009] According to the target traffic forwarding strategy, the traffic data corresponding to the first traffic request is forwarded to the destination device corresponding to the first traffic request.
[0010] In one embodiment, the traffic forwarding strategy includes a legitimate domain name, and the first access domain name is matched with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy:
[0011] Detecting whether there is a target legitimate domain name that is the same as the first access domain name in each of the traffic forwarding strategies, and obtaining a detection result;
[0012] The target traffic forwarding strategy is determined according to the detection result.
[0013] In one embodiment, determining the target traffic forwarding strategy according to the detection result includes:
[0014] If the detection result is that the target legal domain name exists in each of the traffic forwarding strategies, the traffic forwarding strategy corresponding to the target legal domain name is determined as the target traffic forwarding strategy;
[0015] If the detection result is that the target legal domain name does not exist in each of the traffic forwarding strategies, the default traffic forwarding strategy is determined as the target traffic forwarding strategy.
[0016] In one embodiment, the traffic forwarding strategy also includes a device certificate; and forwarding the traffic data corresponding to the first traffic request to a destination device corresponding to the first traffic request according to the target traffic forwarding strategy includes:
[0017] The corresponding server cluster is determined according to the device certificate in the target traffic forwarding strategy, and the traffic data corresponding to the first traffic request is forwarded to the server cluster so that the destination device in the server cluster processes the traffic data corresponding to the first traffic request.
[0018] In one embodiment, the method further comprises:
[0019] The uniform resource locator path corresponding to the target traffic forwarding strategy is associated with the first access domain name and stored.
[0020] In one embodiment, the method further comprises:
[0021] receiving a second traffic request, wherein the second traffic request includes a second access domain name;
[0022] In the case that the second access domain name is the same as the first access domain name, the traffic data corresponding to the second traffic request is forwarded to the destination device corresponding to the first traffic request according to the uniform resource locator path.
[0023] In a second aspect, the present application also provides a traffic forwarding device. The device includes:
[0024] A first receiving module, configured to receive a first traffic request, wherein the first traffic request includes a first access domain name;
[0025] A matching module, used to match the first access domain name with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy;
[0026] The first forwarding module is used to forward the traffic data corresponding to the first traffic request to the destination device corresponding to the first traffic request according to the target traffic forwarding strategy.
[0027] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method described in the first aspect are implemented.
[0028] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0029] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0030] In the above-mentioned traffic forwarding method, apparatus, computer equipment, storage medium and computer program product, a network element first receives a first traffic request, which includes a first access domain name. Then, the first access domain name is matched with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy. Then, according to the target traffic forwarding strategy, the traffic data corresponding to the first traffic request is forwarded to a destination device corresponding to the first traffic request. Since the first access domain name is unique in the network and there will be no duplicate access domain names, a unique target traffic forwarding strategy can be determined by matching the first access domain name with a plurality of traffic forwarding strategies. Thus, when the network element receives a plurality of traffic requests, it can avoid matching the access domain names of a plurality of traffic requests with the same traffic forwarding strategy, which results in the problem of forwarding the traffic data corresponding to the plurality of traffic requests to the same destination device. In addition, the traffic data corresponding to different traffic requests can be forwarded to different destination devices, thereby achieving load balancing during traffic forwarding. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] 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.
[0032] FIG1 is an application environment diagram of a traffic forwarding method according to an embodiment;
[0033] FIG2 is a schematic diagram of a flow chart of a traffic forwarding method in an embodiment;
[0034] FIG3 is a schematic diagram of a flow chart of step 202 in one embodiment;
[0035] FIG4 is a schematic diagram of a flow chart of a traffic forwarding method in another embodiment;
[0036] FIG5 is a structural block diagram of a traffic forwarding device in one embodiment;
[0037] FIG. 6 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0038] 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.
[0039] In the scenario of traffic balancing, a load balancer can be deployed on the network element, and a traffic forwarding policy can be added to the load balancer to forward traffic requests from different domain names or different Uniform Resource Locators (URLs) to different server groups for processing according to the traffic forwarding policy, thereby diverting traffic requests and achieving reasonable allocation of resources.
[0040] On this basis, elastic load balancers have emerged. By configuring a single or multiple listeners on the elastic load balancer, each listener can correspond to a traffic forwarding strategy. The listener forwards the traffic request to the server group according to the protocol corresponding to the traffic request received by the network element and the device certificate corresponding to each backend server group, so that the server in the target server group can process the traffic data corresponding to the traffic request. Usually, a single or multiple servers can be configured in the target server group. Within the server group, the traffic data can be allocated to the corresponding server for processing according to the port number corresponding to the traffic request. Among them, the traffic forwarding strategy can include forwarding rules and forwarding actions. For example, the forwarding rule can be a domain name or URL, and the forwarding action can be to forward the traffic request to the server group, or to redirect the traffic request to the listener.
[0041] When the traffic forwarding strategy is to forward based on the domain name, the listener can match the domain name of the traffic request with the device certificate corresponding to the traffic forwarding strategy, and determine the corresponding server group based on the matching result. However, if traffic requests from different domain names correspond to the same domain name certificate, there may be a problem of forwarding multiple traffic requests to the same server group, resulting in improper resource allocation and load imbalance.
[0042] In view of this, the present application proposes a traffic forwarding method, in which a network element first receives a first traffic request, which includes a first access domain name. Then, the first access domain name is matched with multiple preset traffic forwarding strategies to determine the target traffic forwarding strategy. Then, according to the target traffic forwarding strategy, the traffic data corresponding to the first traffic request is forwarded to the destination device corresponding to the first traffic request. Since the first access domain name is unique in the network, there will be no repeated access domain names. By matching the first access domain name with multiple traffic forwarding strategies, a unique target traffic forwarding strategy can be determined. Therefore, when the network element receives multiple traffic requests, it can avoid matching the access domain names of multiple traffic requests with the same traffic forwarding strategy, resulting in the problem of forwarding the traffic data corresponding to multiple traffic requests to the same destination device. In addition, the traffic data corresponding to different traffic requests can be forwarded to different destination devices, thereby achieving load balancing during traffic forwarding.
[0043] The traffic forwarding method provided in the embodiment of the present application can be applied in the application environment shown in FIG. 1. The network element 102 communicates with the terminal 104 and the server 106 respectively through the network. The data storage system can store the data that the server 106 needs to process. The data storage system can be integrated on the server 106, or it can be placed on the cloud or other network servers. The network element 102 first receives a first traffic request, and the first traffic request includes a first access domain name. Then, the first access domain name is matched with a plurality of preset traffic forwarding strategies to determine the target traffic forwarding strategy, and then, according to the target traffic forwarding strategy, the traffic data corresponding to the first traffic request is forwarded to the destination device corresponding to the first traffic request. In the embodiment, the terminal 104 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-mounted devices, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server 106 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0044] In an exemplary embodiment, as shown in FIG2 , a traffic forwarding method is provided, which is described by taking the method applied to the network element in FIG1 as an example, and includes the following steps:
[0045] Step 201: Receive a first traffic request, where the first traffic request includes a first access domain name.
[0046] It should be noted that the client installed on the terminal can send an http request to the server through a TCP connection. After the server parses the http request, it can generate an http response according to the content of the request and return it to the terminal where the client is located. It can be understood that in order to achieve reasonable allocation of resources, in this embodiment, the first flow request can be forwarded to the network element through the gateway, and the network element forwards the first flow request to the corresponding server for processing according to the load balancing mechanism.
[0047] The first traffic request refers to a request initiated by a user to a network element through a mobile phone, computer device, etc. The first traffic request is used to request a specific service or resource from a server. For example, the first traffic request may be an HTTP request, which is used to obtain resources such as web pages, files, pictures, videos, audio, and database information from a server. The access domain name refers to the domain name corresponding to the client sending the first traffic request. For example, the access domain name is a string of names separated by dots, which is the name of a computer or computer group on the Internet, and is used to identify the electronic location of the computer during data transmission. The network element can determine the device corresponding to the client sending the first traffic request based on the access domain name.
[0048] In this embodiment, the network element may receive a first traffic request sent by a gateway, and may obtain an access domain name corresponding to the first traffic request by parsing the first traffic request.
[0049] Step 202: Match the first access domain name with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy.
[0050] The traffic forwarding strategy refers to a rule for sending traffic requests to devices corresponding to the traffic forwarding strategy so that the devices process the traffic data corresponding to the traffic requests. In this embodiment, the traffic forwarding strategy matching the first access domain name is determined as the target traffic forwarding strategy. In the network element, multiple traffic forwarding strategies can be pre-set, and the forwarding rules of each traffic forwarding strategy are different.
[0051] In this embodiment, the network element can match the first access domain name with the forwarding rules corresponding to each traffic forwarding policy respectively. If the first access domain name meets the forwarding rules corresponding to the traffic forwarding policy, the traffic forwarding policy corresponding to the compliant forwarding rules is determined as the target traffic forwarding policy.
[0052] Step 203: forward the traffic data corresponding to the first traffic request to the destination device corresponding to the first traffic request according to the target traffic forwarding strategy.
[0053] The traffic data refers to the request method, the header information of the request, the URL of the request, and the content of the request corresponding to the first traffic request. The destination device refers to the device that processes the traffic data corresponding to the first traffic request. In this embodiment, after determining the target traffic forwarding strategy, the device corresponding to the target traffic forwarding strategy can be determined as the destination device. Optionally, the destination device can be a server.
[0054] In this embodiment, the network element can determine the corresponding destination device according to the target traffic forwarding strategy, and then parse the first traffic request, obtain the traffic data corresponding to the first traffic request from the parsing result, and forward the traffic data corresponding to the first traffic request to the destination device.
[0055] As a possible implementation method, the network element in Figure 1 can also be a network element in a network element cluster. When the network element is not working, the load balancing deployed on the network element can also switch the traffic data of the first traffic request to other network elements to reduce the problem of being unable to respond to the first traffic request due to network element failure and improve the reliability of load balancing.
[0056] In the above-mentioned traffic forwarding method, the network element first receives a first traffic request, which includes a first access domain name. Then, the first access domain name is matched with multiple preset traffic forwarding strategies to determine the target traffic forwarding strategy. Then, according to the target traffic forwarding strategy, the traffic data corresponding to the first traffic request is forwarded to the destination device corresponding to the first traffic request. Since the first access domain name is unique in the network, there will be no repeated access domain names. By matching the first access domain name with multiple traffic forwarding strategies, a unique target traffic forwarding strategy can be determined. Therefore, when the network element receives multiple traffic requests, it can avoid matching the access domain names of multiple traffic requests with the same traffic forwarding strategy, resulting in the problem of forwarding the traffic data corresponding to multiple traffic requests to the same destination device. In addition, the traffic data corresponding to different traffic requests can be forwarded to different destination devices, thereby achieving load balancing during traffic forwarding.
[0057] In the above scenario where the first access domain name is matched with a plurality of preset traffic forwarding strategies to determine the target traffic forwarding strategy, the network element may determine the target traffic forwarding strategy based on the legal domain name in the traffic forwarding strategy and the first access domain name. In an exemplary embodiment, the traffic forwarding strategy includes the legal domain name, as shown in FIG3 , the above step 202 includes:
[0058] Step 301: Detect whether there is a target legal domain name that is the same as the first access domain name in each traffic forwarding strategy, and obtain a detection result.
[0059] The legal domain name refers to the domain name information included in the traffic forwarding strategy, which is used to indicate that the destination device corresponding to the traffic forwarding strategy can process the traffic data of the traffic request from the domain name. The target legal domain name refers to the legal domain name that is the same as the first access domain name.
[0060] In this embodiment, the network element can detect the legal domain name in each traffic forwarding strategy respectively to determine whether each legal domain name is the same as the first access domain name, thereby determining the detection result. Optionally, if the legal domain name of a traffic forwarding strategy is the same as the first access domain name, it can be determined that the detection result is that the target legal domain name exists in each traffic forwarding strategy, and if the legal domain names of multiple traffic forwarding strategies are not the same as the first access domain name, it can be determined that the detection result is that the target legal domain name does not exist in each traffic forwarding strategy.
[0061] Step 302: Determine the target traffic forwarding strategy based on the detection result.
[0062] It is understandable that different detection results correspond to different traffic forwarding strategies. For example, if the detection result indicates that the target legal domain name exists in each traffic forwarding strategy, then the detection result can be used to determine a traffic forwarding strategy as the target traffic forwarding strategy; if the detection result indicates that the target legal domain name does not exist in each traffic forwarding strategy, then the detection result can be used to determine another traffic forwarding strategy as the target traffic forwarding strategy.
[0063] In this embodiment, the network element may determine, based on the detection result, the traffic forwarding policy corresponding to the detection result as the target traffic forwarding policy.
[0064] The following describes the process of determining the corresponding target traffic forwarding strategy based on different detection results:
[0065] First, if the detection result is that the target legal domain name exists in each traffic forwarding strategy, the traffic forwarding strategy corresponding to the target legal domain name is determined as the target traffic forwarding strategy.
[0066] It should be noted that each traffic forwarding strategy corresponds to a unique legal domain name, and therefore, the traffic forwarding strategy corresponding to the target legal domain name can be determined as the target traffic forwarding strategy.
[0067] In this embodiment, when the detection result shows that the target legal domain name exists in each traffic forwarding policy, the network element can associate the first access domain name with the target legal domain name and determine the traffic forwarding policy corresponding to the target legal domain name as the target traffic forwarding policy.
[0068] Second, if the detection result is that the target legal domain name does not exist in each traffic forwarding strategy, the default traffic forwarding strategy is determined as the target traffic forwarding strategy.
[0069] Among them, the default traffic forwarding policy refers to the traffic forwarding policy that forwards the traffic request to the specified device, and the default traffic forwarding policy includes the default allowed domain name and device certificate. It should be noted that if the target legal domain name does not exist in each traffic forwarding policy, it means that the devices corresponding to multiple traffic forwarding policies do not have the traffic data that can process the traffic request corresponding to the first access domain name. Therefore, the default traffic forwarding policy can be determined as the target traffic forwarding policy, so that the traffic data of the traffic request corresponding to the first access domain name can be forwarded to the device corresponding to the default traffic forwarding policy.
[0070] In this embodiment, when the detection result is that the target legal domain name does not exist in each traffic forwarding policy, the network element can associate the first access domain name with the default allowed domain name in the default traffic forwarding policy, and determine the default traffic forwarding policy as the target traffic forwarding policy.
[0071] It can be understood that by setting the default traffic forwarding strategy, the problem that there is no legitimate domain name identical to the first access domain name in multiple traffic forwarding strategies, resulting in the inability to process the traffic data corresponding to the first traffic request, can be avoided, thereby improving the reliability of responding to the first traffic request.
[0072] In this embodiment, the network element obtains a detection result by detecting whether there is a target legitimate domain name that is the same as the first access domain name in each traffic forwarding strategy, and can determine the target traffic forwarding strategy based on the detection result, thereby being able to determine the corresponding target traffic forwarding strategy based on different detection results, thereby being able to improve the accuracy of determining the target traffic forwarding strategy.
[0073] In the above scenario where the traffic data corresponding to the first traffic request is forwarded to the destination device corresponding to the first traffic request according to the target traffic forwarding policy, the network element can forward the traffic data corresponding to the first traffic request to the server cluster corresponding to the device certificate according to the device certificate corresponding to the target traffic forwarding policy, thereby forwarding the traffic data corresponding to the first traffic request to the destination device in the server cluster. In an exemplary embodiment, the traffic forwarding policy also includes a device certificate; the above step 203 includes:
[0074] The corresponding server cluster is determined according to the device certificate in the target traffic forwarding strategy, and the traffic data corresponding to the first traffic request is forwarded to the server cluster so that the destination device in the server cluster processes the traffic data corresponding to the first traffic request.
[0075] Among them, the device certificate is issued by a trusted digital certificate authority CA after verifying the identity of the device. The device certificate has the functions of device identity authentication and data transmission encryption. Optionally, the device cluster can be a server cluster, and the device certificate can be a server certificate. The server cluster can include multiple servers that work together using a shared IP address. The server cluster can provide high availability and load balancing. A server cluster can correspond to a device certificate, and the device certificate corresponding to each server cluster is bound to each traffic forwarding policy respectively, so that the network element can forward the traffic data of the traffic request to the corresponding server cluster according to the device certificate in the target traffic forwarding policy.
[0076] In this embodiment, the network element may obtain a device certificate from the target traffic forwarding policy, then determine a corresponding server cluster according to the device certificate, and forward the traffic data corresponding to the first traffic request to the server cluster.
[0077] It should be noted that a management device may be set up in the server cluster, and a port number may be assigned to each device, so that the traffic data from the same port number may be assigned to the corresponding device. In this embodiment, after the server cluster receives the traffic data corresponding to the first traffic request, the management device may send the traffic data corresponding to the first traffic request to the device with the same port number, i.e., the destination device, according to the port number corresponding to the first traffic request, so that the destination device processes the traffic data corresponding to the first traffic request.
[0078] In this embodiment, the network element determines the corresponding server cluster according to the device certificate in the target traffic forwarding strategy, and forwards the traffic data corresponding to the first traffic request to the server cluster, so that the destination device in the server cluster can process the traffic data corresponding to the first traffic request. Since the device certificate corresponds to the server cluster, the server cluster can be quickly determined according to the device certificate, thereby improving the efficiency of forwarding the traffic data corresponding to the first traffic request to the server cluster, and further improving the efficiency of the destination device in processing the traffic data corresponding to the first traffic request.
[0079] After forwarding the traffic data of the first traffic request to the destination device according to the target traffic forwarding policy, the network element may also associate the target traffic forwarding policy with the first access domain name corresponding to the first traffic request. In an exemplary embodiment, the method further includes: storing the uniform resource locator path corresponding to the target traffic forwarding policy in association with the first access domain name.
[0080] Among them, the Uniform Resource Locator (URL) is a string used to identify and locate resources on the Internet. Only one resource can be found through a URL, that is, each resource on the Internet corresponds to a unique URL.
[0081] After determining the target traffic forwarding policy corresponding to the first traffic request, the target traffic forwarding policy can be marked to characterize the correspondence between the traffic forwarding policy and the first access domain name. In this embodiment, one target traffic forwarding policy corresponds to one URL. Therefore, the uniform resource locator path corresponding to the target traffic forwarding policy can be associated with the first access domain name.
[0082] In this embodiment, the network element may establish an association relationship between the uniform resource locator path corresponding to the target traffic forwarding policy and the first access domain name, and then store the association relationship.
[0083] In this embodiment, the network element stores the uniform resource locator path corresponding to the target traffic forwarding policy in association with the first access domain name, and can reduce the matching process with the target traffic forwarding policy when receiving other traffic requests and matching the access domain names in the other traffic requests with multiple traffic forwarding policies, thereby reducing the computing resources consumed in the matching process and improving the efficiency of determining the target traffic forwarding policy, thereby improving the efficiency of forwarding the traffic data corresponding to the traffic request to the corresponding destination device for processing.
[0084] On the basis of associating and storing the uniform resource locator path corresponding to the target traffic forwarding strategy with the first access domain name, when receiving a traffic request from the first access domain name again, the network element can directly forward the traffic data corresponding to the traffic request to the destination device corresponding to the first access domain name. In an exemplary embodiment, as shown in FIG4 , the method further includes:
[0085] Step 401: Receive a second traffic request, where the second traffic request includes a second access domain name.
[0086] Among them, the second traffic request refers to other traffic requests other than the first traffic request. For example, after receiving the first traffic request, the network element can use the other received traffic requests as the second traffic request, and use the access domain name in the second traffic request as the second access domain name.
[0087] In this embodiment, the network element may receive the second traffic request through the network, and obtain the second access domain name by parsing the second traffic request.
[0088] Step 402, when the second access domain name is the same as the first access domain name, forward the traffic data corresponding to the second traffic request to the destination device corresponding to the first traffic request according to the uniform resource locator path.
[0089] It can be understood that since the network element associates and stores the uniform resource locator path corresponding to the target traffic forwarding policy with the first access domain name, there is also an association between the first access domain name and the device cluster corresponding to the target traffic forwarding policy, that is, the device cluster corresponding to the target traffic forwarding policy can only process traffic data from the first access domain name.
[0090] In this embodiment, the network element may compare the second access domain name with the first access domain name, and then, when the second access domain name is the same as the first access domain name, determine that the destination device corresponding to the first traffic request can allow processing of traffic data from the second access domain name, and then, according to the uniform resource locator path, forward the traffic data corresponding to the second traffic request to the destination device corresponding to the first traffic request.
[0091] In this embodiment, the network element receives a second traffic request, which includes a second access domain name. When the second access domain name is the same as the first access domain name, the network element can forward the traffic data corresponding to the second traffic request to the destination device corresponding to the first traffic request according to the uniform resource locator path. Since the network element only needs to compare the second access domain name with the first access domain name, it can determine the destination device for processing the traffic data corresponding to the second traffic request when the second access domain name is the same as the first access domain name, thereby reducing the process of matching the second access domain name with multiple traffic forwarding strategies and determining the target traffic forwarding strategy, thereby saving computing resources consumed in the matching process and improving the efficiency of traffic forwarding.
[0092] To facilitate understanding by those skilled in the art, the traffic forwarding method provided by the present application is described in detail below. The method may include:
[0093] S1, receiving a first traffic request, where the first traffic request includes a first access domain name.
[0094] S2, detecting whether there is a target legal domain name that is the same as the first access domain name in each traffic forwarding strategy, and obtaining a detection result.
[0095] S3, if the detection result is that the target legal domain name exists in each traffic forwarding strategy, the traffic forwarding strategy corresponding to the target legal domain name is determined as the target traffic forwarding strategy.
[0096] S4, if the detection result is that the target legal domain name does not exist in each traffic forwarding strategy, the default traffic forwarding strategy is determined as the target traffic forwarding strategy.
[0097] S5, determining a corresponding server cluster according to the device certificate in the target traffic forwarding policy.
[0098] S6: Forward the traffic data corresponding to the first traffic request to the server cluster.
[0099] S7: Store the uniform resource locator path corresponding to the target traffic forwarding policy in association with the first access domain name.
[0100] S8. Receive a second traffic request, where the second traffic request includes a second access domain name.
[0101] S9, when the second access domain name is the same as the first access domain name, forward the traffic data corresponding to the second traffic request to the destination device corresponding to the first traffic request according to the uniform resource locator path.
[0102] It should be noted that for the descriptions in the above S1-S9, reference may be made to the relevant descriptions in the above embodiments, and the effects are similar, so this embodiment will not be repeated here.
[0103] 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.
[0104] Based on the same inventive concept, the embodiment of the present application also provides a traffic forwarding device for implementing the above-mentioned traffic forwarding method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more traffic forwarding device embodiments provided below can refer to the limitations on the traffic forwarding method above, and will not be repeated here.
[0105] In one embodiment, as shown in FIG5 , a traffic forwarding device is provided, including: a first receiving module 501, a matching module 502 and a first forwarding module 503, wherein:
[0106] A first receiving module 501 is used to receive a first traffic request, where the first traffic request includes a first access domain name;
[0107] A matching module 502, used to match the first access domain name with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy;
[0108] The first forwarding module 503 is used to forward the traffic data corresponding to the first traffic request to the destination device corresponding to the first traffic request according to the target traffic forwarding strategy.
[0109] The traffic forwarding device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be repeated here.
[0110] In one embodiment, the traffic forwarding strategy includes a legitimate domain name, and the matching module 502 includes:
[0111] A detection unit, used to detect whether there is a target legal domain name that is the same as the first access domain name in each traffic forwarding strategy, and obtain a detection result;
[0112] The determination unit is used to determine a target traffic forwarding strategy according to the detection result.
[0113] The traffic forwarding device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be repeated here.
[0114] In one embodiment, the determination unit is specifically configured to:
[0115] If the detection result shows that the target legal domain name exists in each traffic forwarding strategy, the traffic forwarding strategy corresponding to the target legal domain name is determined as the target traffic forwarding strategy;
[0116] If the detection result is that the target legal domain name does not exist in each traffic forwarding strategy, the default traffic forwarding strategy is determined as the target traffic forwarding strategy.
[0117] The traffic forwarding device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be repeated here.
[0118] In one embodiment, the traffic forwarding strategy also includes a device certificate, and the first forwarding module 503 includes:
[0119] A forwarding unit is used to determine the corresponding server cluster according to the device certificate in the target traffic forwarding strategy, and forward the traffic data corresponding to the first traffic request to the server cluster so that the destination device in the server cluster can process the traffic data corresponding to the first traffic request.
[0120] The traffic forwarding device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be repeated here.
[0121] In one embodiment, the above device further comprises:
[0122] The storage module is used to associate and store the uniform resource locator path corresponding to the target traffic forwarding strategy with the first access domain name.
[0123] The traffic forwarding device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be repeated here.
[0124] In one embodiment, the above device further comprises:
[0125] A second receiving module is used to receive a second traffic request, where the second traffic request includes a second access domain name;
[0126] The second forwarding module is used to forward the traffic data corresponding to the second traffic request to the destination device corresponding to the first traffic request according to the uniform resource locator path when the second access domain name is the same as the first access domain name.
[0127] The traffic forwarding device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be repeated here.
[0128] Each module in the above-mentioned traffic forwarding device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0129] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG6. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. 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 traffic data of traffic requests. 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 traffic forwarding method is implemented.
[0130] Those skilled in the art will understand that the structure shown in FIG. 6 is merely a block diagram of a partial 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 shown in the figure, or combine certain components, or have a different arrangement of components.
[0131] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0132] receiving a first traffic request, wherein the first traffic request includes a first access domain name;
[0133] Matching the first access domain name with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy;
[0134] According to the target traffic forwarding strategy, the traffic data corresponding to the first traffic request is forwarded to the destination device corresponding to the first traffic request.
[0135] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0136] Detect whether there is a target legitimate domain name that is the same as the first access domain name in each traffic forwarding strategy, and obtain a detection result;
[0137] Determine the target traffic forwarding strategy based on the detection results.
[0138] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0139] If the detection result shows that the target legal domain name exists in each traffic forwarding strategy, the traffic forwarding strategy corresponding to the target legal domain name is determined as the target traffic forwarding strategy;
[0140] If the detection result is that the target legal domain name does not exist in each traffic forwarding strategy, the default traffic forwarding strategy is determined as the target traffic forwarding strategy.
[0141] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0142] The corresponding server cluster is determined according to the device certificate in the target traffic forwarding strategy, and the traffic data corresponding to the first traffic request is forwarded to the server cluster so that the destination device in the server cluster processes the traffic data corresponding to the first traffic request.
[0143] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0144] The uniform resource locator path corresponding to the target traffic forwarding strategy is associated with the first access domain name and stored.
[0145] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0146] receiving a second traffic request, wherein the second traffic request includes a second access domain name;
[0147] In the case that the second access domain name is the same as the first access domain name, the traffic data corresponding to the second traffic request is forwarded to the destination device corresponding to the first traffic request according to the uniform resource locator path.
[0148] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0149] Receiving a first traffic request, where the first traffic request includes a first access domain name;
[0150] Matching the first access domain name with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy;
[0151] According to the target traffic forwarding strategy, the traffic data corresponding to the first traffic request is forwarded to the destination device corresponding to the first traffic request.
[0152] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0153] Detect whether there is a target legitimate domain name that is the same as the first access domain name in each traffic forwarding strategy, and obtain a detection result;
[0154] Determine the target traffic forwarding strategy based on the detection results.
[0155] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0156] If the detection result shows that the target legal domain name exists in each traffic forwarding strategy, the traffic forwarding strategy corresponding to the target legal domain name is determined as the target traffic forwarding strategy;
[0157] If the detection result is that the target legal domain name does not exist in each traffic forwarding strategy, the default traffic forwarding strategy is determined as the target traffic forwarding strategy.
[0158] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0159] The corresponding server cluster is determined according to the device certificate in the target traffic forwarding strategy, and the traffic data corresponding to the first traffic request is forwarded to the server cluster so that the destination device in the server cluster processes the traffic data corresponding to the first traffic request.
[0160] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0161] The uniform resource locator path corresponding to the target traffic forwarding strategy is associated with the first access domain name and stored.
[0162] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0163] receiving a second traffic request, wherein the second traffic request includes a second access domain name;
[0164] In the case that the second access domain name is the same as the first access domain name, the traffic data corresponding to the second traffic request is forwarded to the destination device corresponding to the first traffic request according to the uniform resource locator path.
[0165] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0166] receiving a first traffic request, wherein the first traffic request includes a first access domain name;
[0167] Matching the first access domain name with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy;
[0168] According to the target traffic forwarding strategy, the traffic data corresponding to the first traffic request is forwarded to the destination device corresponding to the first traffic request.
[0169] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0170] Detect whether there is a target legitimate domain name that is the same as the first access domain name in each traffic forwarding strategy, and obtain a detection result;
[0171] Determine the target traffic forwarding strategy based on the detection results.
[0172] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0173] If the detection result shows that the target legal domain name exists in each traffic forwarding strategy, the traffic forwarding strategy corresponding to the target legal domain name is determined as the target traffic forwarding strategy;
[0174] If the detection result is that the target legal domain name does not exist in each traffic forwarding strategy, the default traffic forwarding strategy is determined as the target traffic forwarding strategy.
[0175] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0176] The corresponding server cluster is determined according to the device certificate in the target traffic forwarding strategy, and the traffic data corresponding to the first traffic request is forwarded to the server cluster so that the destination device in the server cluster processes the traffic data corresponding to the first traffic request.
[0177] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0178] The uniform resource locator path corresponding to the target traffic forwarding strategy is associated with the first access domain name and stored.
[0179] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0180] receiving a second traffic request, wherein the second traffic request includes a second access domain name;
[0181] In the case that the second access domain name is the same as the first access domain name, the traffic data corresponding to the second traffic request is forwarded to the destination device corresponding to the first traffic request according to the uniform resource locator path.
[0182] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments 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 this application can include at least one of non-volatile 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), magnetoresistive 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, etc., but are not limited to this.
[0183] 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 specification.
[0184] The above 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 traffic forwarding method, characterized in that: The method comprises: Receiving a first traffic request, wherein the first traffic request includes a first access domain name; Matching the first access domain name with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy; According to the target traffic forwarding strategy, the traffic data corresponding to the first traffic request is forwarded to the destination device corresponding to the first traffic request.
2. The method according to claim 1, characterized in that The traffic forwarding strategy includes a legal domain name, and the first access domain name is matched with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy: Detecting whether there is a target legitimate domain name that is the same as the first access domain name in each of the traffic forwarding strategies, and obtaining a detection result; The target traffic forwarding strategy is determined according to the detection result.
3. The method according to claim 2, characterized in that Determining the target traffic forwarding strategy according to the detection result includes: If the detection result is that the target legal domain name exists in each of the traffic forwarding strategies, the traffic forwarding strategy corresponding to the target legal domain name is determined as the target traffic forwarding strategy; If the detection result is that the target legal domain name does not exist in each of the traffic forwarding strategies, the default traffic forwarding strategy is determined as the target traffic forwarding strategy.
4. The method according to any one of claims 1 to 3, characterized in that: The traffic forwarding strategy also includes a device certificate; and forwarding the traffic data corresponding to the first traffic request to the destination device corresponding to the first traffic request according to the target traffic forwarding strategy includes: The corresponding server cluster is determined according to the device certificate in the target traffic forwarding strategy, and the traffic data corresponding to the first traffic request is forwarded to the server cluster so that the destination device in the server cluster processes the traffic data corresponding to the first traffic request.
5. The method according to claim 1, characterized in that The method further comprises: The uniform resource locator path corresponding to the target traffic forwarding strategy is associated with the first access domain name and stored.
6. The method according to claim 5, characterized in that The method further comprises: receiving a second traffic request, wherein the second traffic request includes a second access domain name; In the case that the second access domain name is the same as the first access domain name, the traffic data corresponding to the second traffic request is forwarded to the destination device corresponding to the first traffic request according to the uniform resource locator path.
7. A traffic forwarding device, characterized in that: The device comprises: A first receiving module, configured to receive a first traffic request, wherein the first traffic request includes a first access domain name; A matching module, used to match the first access domain name with a plurality of preset traffic forwarding strategies to determine a target traffic forwarding strategy; The first forwarding module is used to forward the traffic data corresponding to the first traffic request to the destination device corresponding to the first traffic request according to the target traffic forwarding strategy.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, 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 6 are implemented.
10. A computer program product, comprising a computer program, 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 6 are implemented.
Citation Information
Patent Citations
Nginx-based load balancing implementation method and apparatus, computer device, and storage medium
CN108965381A
Load balancing method, device and storage medium
CN108989430A
Service access method and device based on load balancer
CN111857974A
Static resource request response method and device, computer equipment and storage medium
CN115665249A
Request distribution method and device, electronic equipment and storage medium
CN116781628A