CDN multi-party drainage scheduling algorithm based on DNS
Through the CDN multi-party traffic diversion scheduling algorithm based on DNS, probability compensation is used to adjust IP allocation, which solves the problem of poor multi-party traffic diversion caused by the limited IP of the DNS protocol and long cache time, achieves close to the specified ratio, and supports accurate traffic diversion with unlimited multi-party proportions. .
Patent Information
- Application Number
- CN202410861677.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-10-15
AI Technical Summary
Due to the limited number of DNS protocol IPs and the long local DNS cache time, multi-party CDN traffic diversion is not effective and cannot accurately divert traffic according to the specified ratio.
A DNS-based multi-party traffic diversion scheduling algorithm for CDN is proposed. By obtaining the total number of responding IPs and the IP sets of each party in real time, the specified ratio is calculated, and the IP allocation is adjusted through the probability compensation method to ensure that the number of responding IPs is as close as possible to the specified ratio.
When DNS responds, it reaches or approaches the specified ratio through probability compensation, supports unlimited multi-party ratios, and improves the accuracy and efficiency of multi-party traffic diversion.
Smart Images

Figure CN118784567A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of IT and software development technology, and in particular to a CDN multi-party traffic diversion scheduling algorithm based on DNS. Background Art
[0002] Domain Name System (DNS): It is a service of the Internet. As a distributed database that maps domain names and IP addresses to each other, it enables people to access the Internet more conveniently.
[0003] Content Delivery Network (CDN): is a new type of network content service system, which is built on IP network and provides content distribution and services based on the efficiency requirements, quality requirements and content order of content access and application. CDN has been widely used in scenarios such as website acceleration, live streaming, and game acceleration because it can significantly relieve the pressure on the source station and increase the speed of content distribution and services.
[0004] CDN has been widely used in website acceleration, point live broadcast, game acceleration and other scenarios because it can significantly relieve the pressure of the source station and improve the speed of content distribution and service. However, with the development of the company's business, traditional CDN has also exposed many problems. For example, when many enterprises use CDN products, they often use the products of a cloud vendor for multiple divisions or projects at the same time. When the cloud vendor has a network failure, they can only wait for the cloud vendor to solve the problem; in the face of sudden large traffic, they cannot quickly and effectively provide high-quality network resources; there are too many enterprise projects and divisions, and it is impossible to segment cloud products, and the cost cannot be shared in the end, etc., which will affect the business of the enterprise. In order to solve these problems, the integrated CDN solution was born. The purpose of the integrated CDN is to integrate the current high-quality cloud vendor resources and realize the integrated management of data network acceleration through integrated technology. Not only does it perfectly solve the problems of multi-CDN disaster preparedness and bandwidth usage, but it also provides enterprises with high-quality acceleration experience when using CDN services. At the same time, if enterprises are using integrated solutions, it will force cloud vendors to continuously improve their service quality. In the core algorithm of the integrated CDN, how to make multiple CDN vendors accurately divert traffic according to the specified ratio becomes the key.
[0005] However, at present, most applications and businesses use domain names as service entrances, so it is very common to use DNS for load balancing and regional scheduling. However, due to the limited number of DNS protocol IPs, local DNS cache and long cache time, the effect of multi-party traffic diversion is poor and it is impossible to accurately divert traffic according to the specified ratio. Therefore, in order to optimize the traffic diversion bandwidth of multiple vendors to be as close to the specified ratio as possible, the present invention proposes a DNS-based CDN multi-party traffic diversion scheduling algorithm to improve the above situation. Summary of the invention
[0006] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0007] In view of the above-mentioned problems of a DNS-based CDN multi-party traffic diversion scheduling algorithm, the present invention is proposed.
[0008] Therefore, the purpose of the present invention is to provide a CDN multi-party diversion scheduling algorithm based on DNS, which is used to solve the problem that most applications and businesses currently use domain names as service entrances. Therefore, it is a very common practice to use DNS for load balancing and regional scheduling. However, due to the limited number of DNS protocol IPs, local DNS cache and long cache time, the multi-party diversion effect is poor and it is impossible to accurately divert traffic according to the specified ratio.
[0009] In order to solve the above technical problems, the present invention provides the following technical solutions: a DNS-based CDN multi-party traffic diversion scheduling algorithm, comprising the following steps:
[0010] Step S1: Real-time acquisition of the total number of currently configured response IPs, recorded as M; the total number of parties, recorded as m; the IP set of each party, whose number of IPs is recorded as N1, N2, N3, ..., Nm; the specified ratio, recorded as P1:P2:P3:...:Pm; calculate the sum of the specified ratios;
[0011] Step S2: If Ni≥Pi, it indicates that the IPs of all parties are sufficient, and the ratio can be accurately enlarged to a maximum number where the total number of IPs does not exceed M, and the algorithm ends; otherwise, continue with the following steps;
[0012] Step S3: Allocate the maximum number of responding IPs M according to the ratio P1:P2:P3:...:Pm, and take the smaller value of each IP number Ni to obtain Q1, Q2, Q3,..., Qm;
[0013] Step S4: Taking the number of IPs Ni that meet the condition Qi=Ni as the benchmark, calculate the benchmark total number of IPs, and take the minimum value of Bi to obtain the final benchmark IP response number B=MIN(Bi);
[0014] Step S5: If B is not an integer, the decimal part is probability compensated to obtain the total number of IPs responding this time, T;
[0015] Step S6: Calculate the number of IPs of each party according to the ratio P1:P2:P3:...:Pm based on the benchmark response IP number B, and take the smaller value of the number of IPs of the corresponding party Ni to obtain the number of response IPs of each party R1, R2, R3,...Rm;
[0016] Step S7: Probabilistically compensate the decimal part of the number of IPs R1, R2, R3, ...Rm of responses from each party.
[0017] As a preferred solution of the DNS-based CDN multi-party traffic diversion scheduling algorithm described in the present invention, wherein: in step S1, P1, P2, P3, ..., Pm are mutually prime.
[0018] As a preferred solution of the DNS-based CDN multi-party traffic scheduling algorithm described in the present invention, in which: in step S1, the formula for calculating the sum of the specified ratios is:
[0019]
[0020] As a preferred solution of the DNS-based CDN multi-party traffic diversion scheduling algorithm described in the present invention, wherein: in the calculation formula Ni≥Pi in step S2, i=1, 2, 3, ..., m.
[0021] As a preferred solution of the DNS-based CDN multi-party traffic scheduling algorithm described in the present invention, in which: in step 3, the maximum number of response IPs M is rounded down when being allocated proportionally.
[0022] As a preferred solution of the DNS-based CDN multi-party traffic diversion scheduling algorithm described in the present invention, in step S4, the formula for calculating the total number of benchmark IPs is:
[0023] Bi=Ni*S / Pi.
[0024] As a preferred solution of the DNS-based CDN multi-party traffic diversion scheduling algorithm described in the present invention, in which: in step S6, the number of IPs of each party is calculated according to the ratio P1:P2:P3:...:Pm with decimal points.
[0025] As a preferred solution of the DNS-based CDN multi-party traffic diversion scheduling algorithm described in the present invention, in which: in step S6, the smaller value of the corresponding party IP number Ni is taken to obtain the number of response IPs of each party R1, R2, R3, ... Rm with a decimal point.
[0026] As a preferred solution of the DNS-based CDN multi-party traffic scheduling algorithm described in the present invention, in which: in step S7, the number of compensation times of probability compensation is the total number of responding IPs T minus the integer part of the number of responding IPs of each party.
[0027] As a preferred solution of the DNS-based CDN multi-party traffic scheduling algorithm described in the present invention, in which: in step S7, a random number generation method is used to generate a random number between 0 and 1 during probability compensation. If the random number falls within the proportion of a certain party, it means that the party compensates one IP.
[0028] Beneficial effects of the present invention:
[0029] 1. When responding to DNS, the probability compensation method is used to respond to as many IP responses as possible while reaching or approaching the specified ratio.
[0030] 2. Not limited to the number of squares, theoretically it can support infinite ratios. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0032] Figure 1 The present invention is a flow chart of a DNS-based CDN multi-party traffic scheduling algorithm. DETAILED DESCRIPTION
[0033] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0034] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0035] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0036] Secondly, the present invention is described in detail with reference to the schematic diagram. When describing the embodiments of the present invention in detail, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0037] Reference Figure 1 , as an embodiment of the present invention, provides a DNS-based CDN multi-party traffic diversion scheduling algorithm, including the following steps:
[0038] Step S1: Get the total number of responding IPs of the current configuration in real time, recorded as M; the total number of parties is recorded as m; the IP set of each party, the number of IPs is recorded as N1, N2, N3, ..., Nm; the specified ratio is recorded as P1:P2:P3:...:Pm (where P1, P2, P3, ..., Pm are mutually prime); record the sum of the ratios
[0039] Step S2: If Ni≥Pi (where i=1,2,3,...,m), it indicates that the IPs of all parties are sufficient, and the ratio can be accurately enlarged to a maximum number where the total number of IPs does not exceed M, and the algorithm ends; otherwise, continue with the following steps;
[0040] Step S3: Allocate the maximum number of responding IPs M in proportion to P1:P2:P3:...:Pm (round down), and take the smaller value of each IP number Ni to obtain Q1, Q2, Q3,..., Qm;
[0041] Step S4: Taking the number of IPs Ni that meet the condition Qi==Ni as the benchmark, calculate the benchmark total IP number: Bi=Ni*S / Pi, and take the minimum value of Bi to obtain the final benchmark IP response number B=MIN(Bi);
[0042] Step S5: If B is not an integer, the decimal part is probability compensated to obtain the total number of IPs responding this time, T;
[0043] Step S6: Calculate the number of IPs of each party (including decimal points) according to the ratio P1:P2:P3:...:Pm based on the benchmark response IP number B, and take the smaller value of the number of IPs of the corresponding party Ni to obtain the number of response IPs of each party R1, R2, R3,...Rm (including decimal points);
[0044] Step S7: Probabilistically compensate the decimal part of the number of responding IPs R1, R2, R3, ... Rm of each party, and the number of compensations is the total number of responding IPs T minus the integer part of the number of responding IPs of each party.
[0045] In step S7, for the probability compensation method, a random number between 0 and 1 is generated using the random number generation method. If the random number falls within the proportion of a certain party, it means that party compensates one IP.
[0046] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will illustrate the embodiments of each step of the present invention with examples.
[0047] Step S1: Obtain the total number of response IPs currently configured in real time, which is 13; the total number of parties is 3; the IP sets of each party, with the number of IPs being 2, 3, and 4 respectively; the specified ratio is 1:3:5; denote the sum of the ratios S = 1 + 3 + 5 = 9;
[0048] Step S2: If Ni ≥ Pi (where i = 1, 2, 3,..., m), it indicates that the IPs of each party are sufficient, and the ratio can be accurately amplified to the maximum number not exceeding M for the total number of IPs, and the algorithm ends; otherwise, continue with the following steps. Since N3(4) < P3(5), the following steps are required;
[0049] Step S3: Allocate the maximum number of response IPs, 13, according to the ratio 1:3:5 (rounding down), and take the smaller value with the respective number of IPs Ni of each party to obtain 1, 3, and 4;
[0050] Step S4: Based on the number of IPs Ni that meet the condition Qi == Ni, calculate the benchmark total number of IPs: Bi = Ni * S / Pi, and take the minimum value of Bi to obtain the final benchmark IP response number B = 7.2;
[0051] Step S5: Since 7.2 is not an integer, perform probability compensation on the decimal part (0.2) to obtain the total number of response IPs T for this time. There is a 20% probability of responding with 8 IPs and an 80% probability of responding with 7 IPs. Assume the result after probability compensation is 8 IPs.
[0052] Step S6: According to the benchmark response IP number 7.2, calculate the number of IPs of each party (including decimals) according to the ratio 1:3:5, and take the smaller value with the corresponding number of IPs Ni of each party to obtain the number of response IPs of each party as 0.8, 2.4, and 4;
[0053] Step S7: Perform probability compensation on the decimal parts of the number of response IPs of each party, 0.8, 2.4, and 4. The number of compensation times is the total number of response IPs 8 minus the integer parts of the number of response IPs of each party (0, 2, 4), and the number of compensation times is 2;
[0054] Note: For the probability compensation method, a random number between 0 and 1 is generated using the random number generation method. If the random number is less than 0.6667 (0.8 / (0.8 + 0.4)), it means that the first party compensates 1 IP, otherwise the second party is compensated.
[0055] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A DNS-based CDN multi-party traffic scheduling algorithm, characterized in that: The following steps are involved: Step S1: Real-time acquisition of the total number of currently configured response IPs, recorded as M; the total number of parties, recorded as m; the IP set of each party, whose number of IPs is recorded as N1, N2, N3, ..., Nm; the specified ratio, recorded as P1:P2:P3:...:Pm; calculate the sum of the specified ratios; Step S2: If Ni≥Pi, it indicates that the IPs of all parties are sufficient, and the ratio can be accurately enlarged to a maximum number where the total number of IPs does not exceed M, and the algorithm ends; otherwise, continue with the following steps; Step S3: Allocate the maximum number of responding IPs M according to the ratio P1:P2:P3:...:Pm, and take the smaller value of each IP number Ni to obtain Q1, Q2, Q3,..., Qm; Step S4: Taking the number of IPs Ni that meet the condition Qi=Ni as the benchmark, calculate the benchmark total number of IPs, and take the minimum value of Bi to obtain the final benchmark IP response number B=MIN(Bi); Step S5: If B is not an integer, the decimal part is probability compensated to obtain the total number of IPs responding this time, T; Step S6: Calculate the number of IPs of each party according to the ratio P1:P2:P3:...:Pm based on the benchmark response IP number B, and take the smaller value of the number of IPs of the corresponding party Ni to obtain the number of response IPs of each party R1, R2, R3,...Rm; Step S7: Probabilistically compensate the decimal part of the number of IPs R1, R2, R3, ...Rm of responses from each party.
2. According to the DNS-based CDN multi-party traffic scheduling algorithm of claim 1, it is characterized by: In step S1, P1, P2, P3, ..., Pm are relatively prime.
3. According to the DNS-based CDN multi-party traffic scheduling algorithm of claim 1, it is characterized by: In step S1, the formula for calculating the sum of the specified ratios is:
4. According to the DNS-based CDN multi-party traffic diversion scheduling algorithm of claim 1, it is characterized by: In the calculation formula Ni≥Pi in step S2, i=1, 2, 3, ..., m.
5. According to the DNS-based CDN multi-party traffic scheduling algorithm of claim 1, it is characterized by: In step 3, the maximum number of responding IPs M is rounded down when being allocated proportionally.
6. The DNS-based CDN multi-party traffic diversion scheduling algorithm according to claim 1 is characterized in that: In step S4, the formula for calculating the benchmark total IP number is: Bi=Ni*S / Pi.
7. The DNS-based CDN multi-party traffic diversion scheduling algorithm according to claim 1 is characterized by: In step S6, the number of IPs of each party is calculated according to the ratio P1:P2:P3:...:Pm with decimal points.
8. The DNS-based CDN multi-party traffic diversion scheduling algorithm according to claim 1 is characterized by: In step S6, the smaller value is taken from the number of corresponding IPs Ni to obtain the number of responding IPs of each party R1, R2, R3, ... Rm with a decimal point.
9. The DNS-based CDN multi-party traffic diversion scheduling algorithm according to claim 1, characterized in that: In step S7, the number of times of probability compensation is equal to the total number of responding IPs T minus the integer part of the number of responding IPs of each party.
10. The DNS-based CDN multi-party traffic diversion scheduling algorithm according to claim 1, characterized in that: In step S7, a random number generation method is used to generate a random number between 0 and 1 during probability compensation. If the random number falls within the proportion of a certain party, it means that the party compensates one IP.
