A high-efficiency query and intelligent scheduling global load balancing method
By using a DB storage module and packet processing technology, global load balancing with efficient querying and intelligent scheduling is achieved, solving the problems of cross-carrier latency and resource redundancy in existing technologies, and realizing an efficient and low-cost load balancing solution.
Patent Information
- Application Number
- CN202410802167.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2023-12-12
- Filing Date
- 2024-06-20
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2044-06-20
AI Technical Summary
Existing global load balancing technologies suffer from problems such as network latency when accessing networks across different carriers, low query efficiency, hardware resource redundancy, and high operation and maintenance costs. In particular, they are difficult to effectively distribute access pressure during peak periods, and deployment is difficult and costly.
By acquiring access policy configurations and DNS request messages, and combining open-source IPv4 address library files and custom files, IP query data packets are generated. The DB storage module is used for efficient querying, enabling a single lookup to obtain the operator ID, country ID, province ID, and city ID, and intelligent scheduling based on regional operator information.
It enables location-based access, avoids cross-carrier network latency, improves query efficiency, reduces system resource consumption, lowers hardware costs, and can meet high access demands with lightweight deployment, reducing maintenance workload.
Smart Images

Figure CN119011534B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer domain name resolution technology, and more specifically, to a global load balancing method for efficient querying and intelligent scheduling. Background Technology
[0002] Global load balancing technology uses DNS to enable application services to access the nearest service, achieving geographically based access and ISP-based access acceleration. Traditional global load balancing technology has two main intelligent scheduling strategies.
[0003] For example, CN100456690C discloses a global load balancing method based on global network positioning, characterized in that: the DNS server calculates the IP addresses of multiple servers closest to the Web client based on the GNP coordinates of the Web client in the DNS query message and the GNP coordinates of each mirror Web server corresponding to different IP addresses of the domain name to be resolved, and selects one IP address as the DNS query result to return.
[0004] Although it achieves location-based access through GNP coordinates, it may suffer from network latency when accessing across carriers and performance bottlenecks in concurrent queries. In particular, query timeouts are likely to occur during peak business periods. While horizontal scaling can be used to deploy more GSLB nodes to distribute the access pressure, it consumes more system resources and causes hardware redundancy during off-peak periods. In addition, it has negative impacts such as difficult deployment and high operation and maintenance costs.
[0005] Publication No. CN103905534A discloses a global load balancing method based on operator city information, which specifically includes: creating an address list, including operator, city and IP address; secondly, matching the address list with the source address to obtain the matched city and operator information; finally, matching the obtained city and operator information with the city and operator information pre-configured for each data center to obtain the matching result, and returning the matching result.
[0006] While it solves the network latency issue for cross-carrier access and also features location-based proximity access, its query efficiency is low. For IP address ranges with contained IP address lists, maintaining multiple records is not only redundant but also reduces query efficiency. For example, in the following three records: 1.0.0.0-1.255.255.255 China; 1.1.1.0-1.1.1.255 China-Beijing-Chaoyang District; 1.1.2.0-1.1.2.255 China-Beijing-Tongzhou District, the first record is redundant.
[0007] Even after obtaining the IP address of the geographic location, it is still necessary to query the carrier's affiliation information separately. At least three queries are required to obtain the final accurate result, which greatly slows down the query speed and affects the performance indicators of the network element node. However, if more GSLB nodes are deployed horizontally to distribute the access pressure during peak periods, it will also lead to more system resources being consumed and hardware redundancy during off-peak periods. There are also negative impacts such as deployment difficulties and high operation and maintenance costs. Summary of the Invention
[0008] To overcome the aforementioned deficiencies of existing technologies, this invention provides a highly efficient global load balancing method for querying and intelligent scheduling, comprising: obtaining access policy configuration and distributing it to the global load balancing network element device; obtaining DNS request packets and transmitting them to the GSLB network element node for processing; generating business data and parsing it to obtain the request source IP and request domain name; matching the request source IP and request domain name according to the access policy to determine whether a match is found; if a match is not found, directly returning nxdomain; if a match is found, returning the corresponding request source IP according to the access policy configuration associated with the request domain name; obtaining an open-source IPv4 address library file, marked as ip.txt, and... The system obtains a custom file from ip.txt and marks it as global.txt. It then retrieves carrier data packets and generates an IP query data packet, marked as ip.cov, based on the open-source IPv4 address library file, the custom file, and carrier data format conversion. It then queries ip.cov to obtain regional carrier information. Based on this information, it parses the carrier ID, country ID, province ID, and city ID. It then matches these information against the associated access policy configuration to determine success. If a match is found, it schedules access based on the nearest available carrier ID, country ID, province ID, and city ID. If no match is found, access is denied.
[0009] Preferably, the access policy configuration includes policy priority, parsing request source, address pool, and health detection information.
[0010] Preferably, the open-source address library format stored in the open-source IPv4 address library file is: start IP|end IP|country|useless field|province|city|operator.
[0011] Preferably, the processing method for obtaining the custom file based on ip.txt is as follows: processing is performed based on the open-source address library in the open-source IPv4 address library file, and the improved address library format stored in the custom file is: city ID, parent city ID, country or city name.
[0012] Preferably, the carrier data packets support the following labels: 0, 1, 2, ... 8 in sequence, where 0 indicates that no carrier is supported; 1 indicates the default value, representing all carriers, i.e., no distinction between carriers; and 2, 3, 4, ... 8 in sequence represent different carriers.
[0013] Preferably, the final address database stored in the IP query data packet is in the format of: starting IP | ending IP | regional operator information.
[0014] A global load balancing system with efficient querying and intelligent scheduling is provided to implement the aforementioned global load balancing method with efficient querying and intelligent scheduling. The system includes a DB storage module for storing ip.cov files and supporting efficient queries. The DB storage module is divided into four segments based on the file pointer size, from smallest to largest:
[0015] The header information segment occupies a fixed space of 256 bytes and is used to store header information;
[0016] The vector index segment is a second-level index of the binary index segment, occupying the following space:
[0017] 256×256×8=524288Bytes=512KiB;
[0018] The regional data segment is used to write to ip.cov. It corresponds to the regional operator information corresponding to the start IP and end IP of each line of data. The string uses UTF-8 encoding (before writing, the file pointer at that time will be recorded and stored in the data pointer space of the binary index segment below. The regional operator information is divided into 16 characters, corresponding to 8 bytes of hexadecimal format. Four characters are taken in turn and converted into unsigned short type, corresponding to operator ID, country ID, province ID and city ID respectively).
[0019] The binary index segment stores pointers to regional operator information and is used for split lookups. Each binary index entry occupies 14 bytes.
[0020] Preferably, the first 16 bytes of the header information segment are used to record header information including version number, caching strategy, file generation time, index start address and index end address.
[0021] Preferably, the detailed fields and spatial distribution of the binary index segment are: start IP 4 bytes, end IP 4 bytes, data length 2 bytes, and data pointer 4 bytes.
[0022] Preferably, the efficient query method based on the DB storage module includes the following steps:
[0023] S1, resolve the corresponding option subnet in the DNS protocol to obtain the request source IP;
[0024] S2, obtain the binary index segment from the vector index segment, and obtain the start IP and end IP of the region binary index through the binary index segment;
[0025] S3, perform a binary search in the binary index, obtain the start IP and end IP based on S2, and use a binary search between the indexes in this region to obtain the specific dataLen and dataPtr;
[0026] S4, based on dataLen and dataPtr obtained in S3, reads dataLen bytes from the dataPtr position to obtain the regional operator information.
[0027] The technical effects and advantages of the efficient query and intelligent scheduling global load balancing method of this invention are as follows:
[0028] 1. It satisfies the need for location-based access and avoids network latency across different carriers. At the same time, it utilizes the DB storage module to enable efficient queries, allowing users to obtain the required carrier ID, country ID, province ID, and city ID in a single search, greatly improving query efficiency.
[0029] 2. At the same time, it does not occupy system resources, saving hardware costs. Only 4 GSLB network element devices need to be deployed in a single resource pool to meet the access demand of tens of millions, reducing hardware resource costs, reducing deployment workload, and reducing operation and maintenance costs. Attached Figure Description
[0030] Figure 1 This is a schematic diagram of the invention process of this invention;
[0031] Figure 2 This is a public network query traffic topology diagram of the global load balancing product of this invention;
[0032] Figure 3 This is a traffic topology diagram within the resource pool of the global load balancing product of this invention;
[0033] Figure 4 This is a diagram illustrating the complete traffic access and deployment model of the global load balancing product of this invention.
[0034] Figure 5 This is a diagram showing the overall system architecture of the global load balancing product of this invention.
[0035] Figure 6 This is a diagram of the DB space storage structure for efficient querying of the global load balancing product of this invention;
[0036] Figure 7 This is a graph showing the efficient querying of measured data for the global load balancing product of this invention.
[0037] Figure 8This is a schematic logic diagram illustrating how the request source IP is obtained in this invention.
[0038] Figure 9 This is a schematic logic diagram illustrating the acquisition of the start and end IPs of the region binary index in this invention.
[0039] Figure 10 This is a schematic logic diagram illustrating the split-search method of the present invention;
[0040] Figure 11 This is a schematic logic diagram illustrating the acquisition of regional operator information in this invention. Detailed Implementation
[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0042] Example 1:
[0043] Please see Figure 6 As shown in the figure, the global load balancing system for efficient querying and intelligent scheduling described in this embodiment includes a DB storage module, which serves efficient querying. The DB storage module is divided into four layers according to the file pointer from smallest to largest: header information segment, vector index segment, regional data segment, and binary index segment.
[0044] Specifically, the header information segment mainly records some header information. This segment occupies a fixed space of 256 bytes. The specific space usage of the first 16 bytes is as follows: version number, caching strategy, file generation time, index start address and index end address;
[0045] The vector index segment, also known as the vector index segment, is a secondary index of the binary index segment. Essentially, it is a 256×256 two-dimensional array, which is equivalent to splitting the entire IP data segment into 256×256 partitions according to the first two bytes of the IP. In this way, the number of subsequent binary search I / O operations can be greatly reduced by using a single fixed I / O operation.
[0046] Essentially, it's a 256×256 two-dimensional array. The structure of each Vector index item, which is the structure of each cell in the 256×256 array above, starts at the beginning of the binary index and ends at the end of the secondary index. In other words, the vector index divides the entire binary index into 256×256 partitions, which helps to reduce the search range of the binary index more quickly, thereby speeding up the query. The space of each cell is fixed, so the space occupied by the entire vector index segment is: 256×256×8=524288Bytes=512KiB. This space is fixed and is independent of the number of rows of the original IP data.
[0047] The region information segment contains the converted file "ip.cov", which corresponds to the region operator information after the starting and ending IP addresses of each line of the original data. The original data is the data recorded in the open-source IPv4 address library file. The region operator information is written exactly as it appears in the original file. The strings are encoded in UTF-8, and the generation program automatically removes duplicates. Only one copy of the same region operator information is written. Before writing, the file pointer is recorded and stored in the data pointer space of the binary index below. The currently designed region information is as follows: 0002000104d0052f is 16 strings; the meaning of the fields is as follows: 0002 is the operator (China Telecom), 0001 is the country ID (China), 04d0 is the province ID (Anhui Province), and 052f is the city ID (Lu'an City).
[0048] The binary index segment is the core of the query. The core of the search process is to perform a halving search in the binary index. Each binary index entry occupies 14 bytes, with detailed fields and space distribution: start IP 4 bytes, end IP 4 bytes, data length 2 bytes, and data pointer 4 bytes.
[0049] Furthermore, the efficient query method based on the DB storage module includes the following steps:
[0050] S1 resolves the corresponding option subnet in the DNS protocol to obtain the request source IP. See the schematic code for details. Figure 8 The following code converts the source IP address of a network request to host address: client_subnet = ntohl(request->client_subnet.in.sin_addr.s_addr);
[0051] S2, obtain the binary index segment from the vector index segment, and obtain the start IP and end IP of the region binary index through the binary index segment. See the schematic logic. Figure 9Each searcher binding has an API to load vectorIndex, which is essentially a one-dimensional byte array. Then, the first two bytes of the IP address are used to quickly obtain the start and end addresses of the binary index of this partition from the vectorIndex. This is the core of vector indexing. By using a single search, the binary index is divided into 256×256 partitions, which drastically reduces the scanning range of subsequent binary searches, thereby reducing the number of runtime I / O operations and accelerating the query process.
[0052] S3 involves performing a binary search within the binary index. Based on the start and end IPs obtained in S2, a binary search can then be used within this region index to retrieve specific locational data. See the schematic diagram of the binary search logic. Figure 10 After the above search process, the specific dataLen and dataPtr are obtained, that is, the data block is located and the data in it is read, which includes the regional operator information.
[0053] S4, based on the dataLen and dataPtr obtained in S3, reads dataLen bytes from the dataPtr position to obtain the regional operator information. See the schematic diagram for details. Figure 11 .
[0054] Example 2:
[0055] Please see Figures 1-6 As shown in Example 1, the global load balancing method of efficient query and intelligent scheduling described in this example is implemented based on a global load balancing system of efficient query and intelligent scheduling. The specific steps of the efficient query and intelligent scheduling method include access policy, address translation, efficient query and intelligent scheduling in sequence. The subsequent steps depend on the preceding steps, and the preceding steps serve the subsequent steps.
[0056] Specifically, regarding access policies, cloud platform users purchase global load balancing products and services, and configure access policies through the cloud management control plane's north-south operations. This includes policy priority, request source resolution, address pool, and health probe information, which are then distributed to the global load balancing network element devices. When public network users access the global load balancing service via DNS request packets, the requests are routed through the public network to the cloud environment, ultimately reaching the GSLB network element node, i.e., the global load balancing network element node. The application layer parses the DNS packets, obtains the request source IP and request domain name, and searches for the user-configured CNAME domain name. If the match is not found, the nxdomain is returned directly. If the domain name is found, the request source and primary / backup address pool information are found based on the access policy associated with the domain name, and the IP is intelligently returned.
[0057] Address translation involves obtaining an open-source IPv4 address database file, labeled ip.txt. This file can be purchased and is in txt format. It contains the open-source address database, formatted as (starting IP | ending IP | country | useless field | province | city | carrier). It covers all global IPv4 network segments and provides a precise list of addresses for China, containing a total of 683,591 rows of data. See Table 1 for details.
[0058] Start IP | End IP | Country | Unused Field | Province | City | Carrier
[0059] 1.0.0.0|1.0.0.255|Australia|0|0|0|0
[0060] 1.0.1.0|1.0.3.255|China|0|Fujian Province|Fuzhou City|China Telecom
[0061] 1.0.4.0|1.0.7.255|Australia|0|Victoria|Melbourne|0
[0062] 1.0.8.0|1.0.15.255|China|0|Guangdong Province|Guangzhou City|China Telecom
[0063] 1.0.16.0|1.0.31.255|Japan|0|0|0|0
[0064] 1.0.32.0|1.0.63.255|China|0|Guangdong Province|Guangzhou City|China Telecom
[0065] 1.0.64.0|1.0.79.255|Japan|0|Hiroshima Prefecture|0|0
[0066] ...
[0067] 223.242.0.0|223.242.31.255|China|0|Anhui Province|Lu'an City|China Telecom
[0068] 223.242.32.0|223.242.47.255|China|0|Anhui Province|Wuhu City|China Telecom
[0069] 223.242.48.0|223.242.63.255|China|0|Anhui Province|Anqing City|China Telecom
[0070] 223.242.64.0|223.242.159.255|China|0|Anhui Province|Bengbu City|China Telecom
[0071] 223.242.160.0|223.242.191.255|China|0|Anhui Province|Fuyang City|China Telecom
[0072] 223.242.192.0|223.242.223.255|China|0|Anhui Province|Huaibei City|China Telecom
[0073] 223.242.224.0|223.242.255.255|China|0|Anhui Province|Huainan City|China Telecom
[0074] Table 1
[0075] More specifically, in order to achieve high-performance QPS through efficient queries, the open-source address database must be processed. To facilitate more efficient queries of country ID, province ID, city ID, and carrier ID, a custom file, named global.txt, is obtained by processing the open-source IPv4 address database file. The file format is (city ID, parent city ID, country or city name, depth, useless fields), covering all countries in the world as well as all provinces and cities in China, containing a total of 3462 rows of data. See Table 2 for details.
[0076] City ID, Parent City ID, Country or City Name, Depth, Unused Fields
[0077] 1,0,China,1,0
[0078] 2,0, Mongolia, 1,0
[0079] 3,0, North Korea, 1,0
[0080] 4,0, South Korea, 1,0
[0081] 5,0,Japan,1,0
[0082] 6,0, Philippines, 1,0
[0083] 7,0, Vietnam, 1,0
[0084] 8,0, Laos, 1,0
[0085] 9,0, Cambodia, 1,0
[0086] 10, 0, Myanmar, 1, 0
[0087] 2469, 1, Sichuan Province, 2, 0
[0088] 2470, 2469, Chengdu, 3, 610000
[0089] 2471, 2470, Jinjiang District, 4, 0
[0090] 2472, 2470, Qingyang District, 4, 0
[0091] 2473, 2470, Jinniu District, 4, 0
[0092] 2474, 2470, Wuhou District, 4, 0
[0093] 2475, 2470, Chenghua District, 4, 0
[0094] 2476, 2470, Longquanyi District, 4, 0
[0095] Table 2
[0096] Furthermore, the operator data packets are obtained. In this embodiment, the operator data packets are based on the digital processing of some global operators. The operator data packets are labeled as follows: 0, 1, 2, ... 8 in sequence, where 0 indicates that no operator is supported; 1 indicates the default value, representing all operators, i.e., no operator distinction; 2, 3, 4, ... 8 in sequence represent different operators, specifically such as 0 (no operator supported), 1 (all) is the default value, representing all operators, i.e., no operator distinction, 2 (cu) and China Telecom, 3 (ct) and China Unicom, 4 (cmcc) and China Mobile, 5 (pbs) and Dr. Peng Telecom & Media Group, 6 (gdw) and China Broadcasting Network, 7 (edu) and China Education and Research Network, 8 (tt) and China Railcom.
[0097] It should be noted that when an unsupported operator is used, 0 is used by default. In addition, the storage design allocates 2 bytes for each operator, with a maximum value of 2 to the power of 16. The space is large enough to meet the digital storage needs of a sufficient number of operators.
[0098] Furthermore, based on the information recorded in ip.txt, global.txt, and carrier data packets, a format conversion is performed to obtain the IP query data packet, marked as ip.cov. The converted file format is (starting IP|ending IP|regional carrier information). The regional carrier information corresponding to the memory mapping is divided into 16 characters, which corresponds to 8 bytes of hexadecimal format. Four characters are taken in sequence and converted into unsigned short type, corresponding to carrier ID, country ID, province ID, and city ID respectively, so as to facilitate efficient querying after storage and achieve ultra-high performance QPS. Each dimension is 2 bytes, with a maximum value of 2 to the power of 16 for easy subsequent expansion to support more carriers and refine the geographical location to precise positioning such as city, county, and town. See Table 3 for details.
[0099] Start IP | End IP | Regional Carrier Information
[0100] 1.0.0.0|1.0.0.255|0000008d00000000
[0101] 1.0.1.0|1.0.3.255|000200010549054a
[0102] 1.0.4.0|1.0.7.255|0000008d00000000
[0103] 1.0.8.0|1.0.15.255|00020001085b085c
[0104] 1.0.16.0|1.0.31.255|0000000500000000
[0105] 1.0.32.0|1.0.63.255|00020001085b085c
[0106] 1.0.64.0|1.0.79.255|0000000500000000
[0107] ……
[0108] 223.242.0.0|223.242.31.255|0002000104d0052f
[0109] 223.242.32.0|223.242.47.255|0002000104d004d9
[0110] 223.242.48.0|223.242.63.255|0002000104d004fe
[0111] 223.242.64.0|223.242.159.255|0002000104d004e1
[0112] 223.242.160.0|223.242.191.255|0002000104d0051a
[0113] 223.242.192.0|223.242.223.255|0002000104d004f5
[0114] 223.242.224.0|223.242.255.255|0002000104d004e9
[0115] 223.243.0.0|223.243.31.255|0002000104d00537
[0116] 223.243.32.0|223.243.63.255|0002000104d00541
[0117] 223.243.64.0|223.243.127.255|0002000104d0052f
[0118] Table 3
[0119] Efficient querying: Based on the DB storage module and the internally stored ip.ocv file, it can efficiently retrieve regional operator information.
[0120] Intelligent scheduling, based on the regional operator information obtained through efficient query, parses it according to the format of the address translation section to obtain operator ID, country ID, province ID and city ID. Then, it matches the resolution request source associated with the access policy configured by the customer. If the match is successful, it is considered to have hit the resolution request source, and healthy IP information of the address pool associated with the same access policy is returned to achieve intelligent scheduling for access to the nearest one. If the match is unsuccessful, access is denied.
[0121] It is worth mentioning that the command executed when a match fails depends on the user's actual configuration. This embodiment provides access denial, but depending on the access policy configuration, a default access policy can also be returned. That is, if a specific access policy is not successfully matched, a default access policy can be returned. This policy can be the default processing logic for the case of no match. For example, it can return a default request source IP, redirect it to a specific server, or forward the request. If a specific access policy is not successfully matched, but it is still desired to continue processing the request, the request can be forwarded to other servers or services for processing. Logs can also be recorded and analyzed. In the case of no match, relevant log information can be recorded for subsequent analysis and adjustment of the access policy configuration. The specific details are determined by those skilled in the art based on actual needs.
[0122] Example 3
[0123] Please see Figures 2-7 As shown, based on Examples 1 and 2, this example achieves microsecond-level performance for a single query, with a standard physical machine single-node limit of 8 million QPS and a virtual machine deployment limit of 100,000 QPS for 2 cores and 8GB of memory. A single resource pool only needs to deploy 4 GSLB network element devices to meet the access demands of tens of millions, reducing hardware resource costs, deployment workload, and maintenance costs.
[0124] like Figure 2As shown, the user obtains the CNAME domain app123.gslb.ctyun.cn by accessing the business domain through localDNS; the user obtains the NS record and the IP address of the A record of gslb.ctyun.cn by accessing ctyun.cn through localDNS; the user accesses the authoritative node Region1 or Region2 of GSLB based on the returned IP address; within the Region, the optimal A record is returned based on GSLB's efficient query and intelligent resolution strategy.
[0125] like Figure 3 As shown, users access traffic through the blue line to enter the resource pool. Inside the resource pool, ECMP equivalent routes are established through BGP to further access GSLB network element nodes to obtain healthy A record IPs. Then, healthy IP addresses use red line traffic to probe the health status of real servers in real time to achieve the effect of intelligent resolution.
[0126] like Figure 4 As shown, the user accesses the business domain name www.myappname.com; LocalDNS queries the business authoritative DNS; the business authoritative DNS returns the CNAME domain app12345678.gslb.ctyun.cn; accesses the GSLB network element node to efficiently query regional operator information; GSLB returns the optimal record set based on intelligent resolution and health detection information; LocalDNS returns the result to the end user; the end user initiates access to the target business address based on the returned resolution address.
[0127] like Figure 5 As shown, this embodiment uses DPDK to send and receive packets at the underlying level to ensure performance. Before being sent to the protocol stack, the traffic is split into east-west and north-south traffic based on the port information. That is, DNS is sent to the FreeBSD protocol stack, while BGP and HTTP are sent to the Linux protocol stack. The FreeBSD protocol stack processes the network layer and transport layer information of the DNS packets. The Agent process directly modifies the configuration information for adding, deleting, and modifying data and saves it to the disk. Then, it notifies the DNS process of the changed configuration to achieve configuration loading.
[0128] like Figure 6As shown, the spatial structure and hierarchical relationship of the DB storage module, from low to high memory address, are as follows: header information segment, vector index segment, regional data segment, and binary index segment. The header information segment has a fixed length and mainly stores the version number, index start address, and index end address. The vector index segment maps the first two bytes of the IP address to a two-dimensional array, allowing a single query to locate the address of the binary index segment, i.e., the range of the last two bytes of the IP address, thus improving query efficiency and providing ultra-high performance QPS. The regional data segment mainly stores the converted regional operator information segment, each with a length of 16. Each character is mapped to 8 bytes of hexadecimal; the equal-length design is for memory alignment and efficient movement of read offsets, while reserving enough space for expansion. For example, 2 bytes of operator data support 2 to the power of 16 operators, currently only 7 operators are used, facilitating future expansion; sufficient space is also reserved for country ID, province ID, and city ID for future expansion; the binary index segment mainly stores the last two bytes of the IP address, and the corresponding memory and byte integer sizes are sorted sequentially by size, with smaller values first and larger values last, to facilitate binary search and improve query efficiency. Each data block is 14 bytes in size, with the data length occupying 2 bytes and a value of 16; the data pointer executes the regional information, providing a many-to-one mapping, meaning that the same regional information can have multiple IP address ranges, which greatly saves memory space and improves query efficiency.
[0129] like Figure 7 As shown, this embodiment provides actual test data, which is as follows: a single query takes 13 microseconds, 3,417,955 queries take 4.231 seconds, and the average time per query is 1.238 microseconds; standard deployment of GSLB network elements: a single node has a stable value of 5 million QPS, and with cluster deployment, it can easily reach 30 million QPS. This meets the high-pressure access requirements of public clouds and also greatly saves hardware costs; lightweight deployment of GSLB network elements: 2 cores and 8GB of memory, 50,000 QPS; normal specification devices have 16 cores and 64GB of memory, easily reaching 400,000 QPS, which meets the deployment scenarios of private clouds and saves hardware costs.
[0130] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0131] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A global load balancing method with efficient querying and intelligent scheduling, characterized in that, include: The system obtains the access policy configuration and sends it to the global load balancer network element device. It also obtains the DNS request message and transmits it to the GSLB network element node for processing. The system generates business data and parses it to obtain the request source IP and request domain name. It matches the request source IP and request domain name according to the access policy to determine whether they match. If they do not match, it directly returns nxdomain. If they match, it returns the corresponding request source IP according to the access policy configuration associated with the request domain name. Obtain the open-source IPv4 address library file, labeled as ip.txt; process ip.txt to obtain a custom file, labeled as global.txt; obtain the carrier data packet; and generate an IP query data packet, labeled as ip.cov, based on the open-source IPv4 address library file, the custom file, and carrier data format conversion. Obtain regional carrier information by querying ip.cov; Based on the parsing of regional operator information, the operator ID, country ID, province ID, and city ID are obtained. The matching is performed according to the associated access policy configuration to determine whether the match is successful. If the match is successful, access is scheduled based on the nearest operator ID, country ID, province ID, and city ID. If the match is unsuccessful, access is denied. The ip.cov file is stored in a DB storage module for efficient querying. The DB storage module is divided into four segments according to the file pointer size, from smallest to largest: The header information segment occupies a fixed space of 256 bytes and is used to store header information; The vector index segment is a second-level index of the binary index segment, occupying the following space: 256×256×8=524288Bytes=512KiB; The regional data segment is used to write to ip.cov. It corresponds to the regional operator information of the start and end IPs of each line of data. The string uses UTF-8 encoding. Before writing to ip.cov, the file pointer is recorded and stored in the data pointer space of the binary index segment below. The regional operator information is divided into 16 characters, corresponding to 8 bytes of hexadecimal format. Four characters are taken in sequence and converted into unsigned short type, which correspond to operator ID, country ID, province ID and city ID respectively. The binary index segment stores pointers to regional operator information and is used for halving lookups. Each binary index entry occupies 14 bytes. The efficient query method based on the DB storage module includes the following steps: S1, resolve the corresponding option subnet in the DNS protocol to obtain the request source IP; S2, obtain the binary index segment from the vector index segment, and obtain the start IP and end IP of the region binary index through the binary index segment; S3, perform a binary search in the binary index, obtain the start IP and end IP based on S2, and use a binary search between the indexes in this region to obtain the specific dataLen and dataPtr; S4, based on dataLen and dataPtr obtained in S3, reads dataLen bytes from the dataPtr position to obtain the regional operator information.
2. The global load balancing method for efficient querying and intelligent scheduling according to claim 1, characterized in that, The access policy configuration includes policy priority, parsing request source, address pool, and health detection information.
3. The global load balancing method for efficient querying and intelligent scheduling according to claim 1, characterized in that, The open-source IPv4 address library file stores the following open-source address library format: Start IP|End IP|Country|Unused Fields|Province|City|Operator.
4. The global load balancing method for efficient querying and intelligent scheduling according to claim 3, characterized in that, The method for obtaining custom files based on ip.txt is as follows: The processing is based on the open-source address library in the open-source IPv4 address library file. The improved address library format stored in the custom file is: city ID, parent city ID, country or city name.
5. The global load balancing method for efficient querying and intelligent scheduling according to claim 4, characterized in that, The carrier data packets are supported by the following numbers: 0, 1, 2, ... 8, where 0 indicates that no carrier is supported; 1 is the default value, representing all carriers, i.e., no carrier distinction; and 2, 3, 4, ... 8 represent different carriers.
6. The global load balancing method for efficient querying and intelligent scheduling according to claim 5, characterized in that, The final address database stored in the IP query data packet is in the format of: starting IP | ending IP | regional operator information.
7. A global load balancing system with efficient querying and intelligent scheduling, used to implement the global load balancing method with efficient querying and intelligent scheduling as described in any one of claims 1-6, characterized in that, The first 16 bytes of the header information segment are used to record header information including version number, caching strategy, file generation time, index start address, and index end address.
8. A global load balancing system for efficient querying and intelligent scheduling according to claim 7, characterized in that, The detailed fields and spatial distribution of the binary index segment are as follows: start IP 4 bytes, end IP 4 bytes, data length 2 bytes, and data pointer 4 bytes.
Citation Information
Patent Citations
Whole load equalizing method based on global network positioning
CN100456690C
Global load balancing method and device based on operator city information
CN103905534A
File-based regional information query method and file generation method
CN112307138A