A content distribution method and a content distribution network

By performing obfuscation value calculation and redirection ratio comparison in CDN services, the problem of unstable redirection ratio in CDN services has been solved, connection reuse rate and cache hit rate have been improved, and bandwidth utilization and service quality have been optimized.

CN122457789APending Publication Date: 2026-07-24HANGZHOU YOUYUN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HANGZHOU YOUYUN TECH CO LTD
Filing Date
2026-06-29
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

In existing CDN services, the redirection ratio of user requests cannot be stably controlled, leading to increased access latency and decreased service quality. Furthermore, multiple requests from the same user are arbitrarily redirected, affecting connection reuse rate and cache hit rate.

Method used

By calculating obfuscation values ​​and comparing redirection ratios at edge nodes, it is determined whether to trigger a redirect, ensuring that requests from the same batch of clients are consistently directed to other edge nodes. Combined with DNS traction and dynamic proportional 302 scheduling based on client IP, connection reuse rate and cache hit rate are optimized.

Benefits of technology

It enables precise control over the redirection ratio, improves connection reuse and cache hit rate, reduces access latency, optimizes bandwidth utilization, and avoids additional costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122457789A_ABST
    Figure CN122457789A_ABST
Patent Text Reader

Abstract

The application discloses a content distribution method and a content distribution network. The method comprises the following steps: a first edge node receives an access request of a target resource from a client, and the access request of the target resource comprises a client IP; a current redirection ratio is determined based on a planned bandwidth and a real-time used bandwidth of the first edge node, and a current first threshold is determined according to the current redirection ratio; it is judged whether the tail number of a preset number of bits of a first confusion value of the client IP is less than the current first threshold, if not, the target resource is sent to the client, and the preset number of bits is equal to the number of bits of the first threshold; if yes, a target edge node is determined, and redirection information is returned to the client. The application compares the tail number of the preset number of bits of the first confusion value with the first threshold determined based on the redirection ratio to judge whether the redirection is triggered, so that the accurate control of the redirection ratio is realized, and meanwhile, the connection multiplexing rate can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of mobile communication technology, and more particularly to a content distribution method and a content distribution network. Background Technology

[0002] To make fuller use of planned bandwidth, data centers typically operate CDN (Content Delivery Network) services. The core function of a CDN is to pre-cache files such as videos on edge nodes located in various locations, with each edge node consisting of multiple servers.

[0003] In CDN services, when 302 redirection is required, a simple round-robin or random method is usually used to determine whether to redirect user requests to other edge nodes via 302 redirection.

[0004] However, this scheduling method lacks a precise selection mechanism, making it impossible to stably control the proportion of requests selected. Furthermore, multiple requests from the same user may be randomly selected and skipped at different times. This instability and inconsistency in the selection process makes it difficult for users to maintain a persistent connection with a particular edge node, thereby increasing the frequency with which clients establish connections with edge nodes, ultimately leading to increased access latency and decreased service quality. Summary of the Invention

[0005] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a content distribution method and content distribution network that can determine whether to trigger a redirection by comparing the tail of a preset number of bits in a first obfuscation value with a first threshold determined based on a redirection ratio, thereby achieving precise control over the redirection ratio; at the same time, it can also ensure that requests from the same batch of clients can be consistently filtered and guided to other edge nodes, effectively improving the connection reuse rate.

[0006] In a first aspect, this application provides a content distribution method applied to a content distribution network, the network including multiple edge nodes, the method comprising: The first edge node receives the client's access request for the target resource, and the access request for the target resource includes the client's IP address; The current redirection ratio is determined based on the planned bandwidth and real-time usage bandwidth of the first edge node, and the current first threshold is determined based on the current redirection ratio. The redirection ratio is used to characterize the proportion of access requests that need to be redirected among the multiple access requests currently received. The first obfuscation value of the client IP is determined, and it is determined whether the last digit of the preset number of bits of the first obfuscation value is less than the current first threshold. If not, the first edge node sends the target resource to the client, and the preset number of bits is equal to the number of bits of the first threshold. If so, the first edge node determines the target edge node and returns redirection information to the client. The redirection information is used to instruct the client to send an access request for the target resource to the target edge node.

[0007] Secondly, this application also provides a content delivery network, the network comprising: The receiving module is used to receive access requests from clients to the target resource, and the access requests to the target resource include the client's IP address; The redirection module is used to determine the current redirection ratio based on the planned bandwidth and real-time usage bandwidth of the first edge node, and to determine the current first threshold based on the current redirection ratio. The redirection ratio is used to characterize the proportion of access requests that need to be redirected among the multiple access requests currently received. The comparison module is used to determine the first obfuscation value of the client IP and to determine whether the last digit of the preset number of bits of the first obfuscation value is less than the current first threshold. If not, the target resource is sent to the client, and the preset number of bits is equal to the number of bits of the first threshold. If so, the target edge node is determined, and redirection information is returned to the client. The redirection information is used to instruct the client to send an access request to the target resource to the target edge node. Attached Figure Description

[0008] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a diagram illustrating the data center traffic fluctuations under the 95% monthly bandwidth billing model. Figure 2 A diagram illustrating data center traffic fluctuations under a monthly bandwidth billing model combined with DNS scheduling; Figure 3 A diagram illustrating data center traffic fluctuations under the 95% monthly bandwidth billing model, combined with DNS and 302 joint scheduling. Figure 4 This is a schematic diagram of the content delivery network structure for this application; Figure 5 This is a flowchart illustrating the method of this application in one embodiment; Figure 6 This is a block diagram of the content delivery network of this application in one embodiment. Detailed Implementation

[0009] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0010] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The present application will now be described in detail with reference to the accompanying drawings and embodiments. Furthermore, the term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The terms "first" and "second," etc., in the specification and claims of the embodiments of this application are used to distinguish different objects, not to describe a specific order of objects.

[0011] The following is an explanation of the terms used in this application: Content delivery services: This usually refers to Content Delivery Network (CDN) services. It is a business model that caches digital content such as websites, videos, and software closer to users by deploying edge node servers globally, thereby accelerating content delivery, reducing pressure on origin servers, and improving the user access experience.

[0012] DNS (Domain Name System): A distributed database system used to translate human-readable domain names (such as www.example.com) into machine-readable IP addresses (such as 192.0.2.1). DNS is an infrastructure of the Internet, enabling users to access network resources without having to remember complex IP addresses.

[0013] Redirection: A standard mechanism in network communication where, upon receiving a client request, the server does not directly return the requested resource content but instead sends a command instructing the client to automatically redirect to a different network address (URL, Uniform Resource Locator) to re-initiate the request. According to the HTTP protocol, this command is typically conveyed through 3xx status codes (such as 301 permanent redirect, 302 temporary redirect) and the Location field in the response header. In content distribution and traffic scheduling scenarios, redirection technology is often used to guide user requests to more suitable servers (such as edge nodes with underutilized bandwidth) in real time and with precision, achieving load balancing, resource optimization, or improved access speed. The entire process is automatically completed by the client and is transparent to the user.

[0014] 302 Redirection: 302 redirection is a temporary redirection technique based on the HTTP protocol, where the HTTP 302 status code indicates "Found" (temporary move). The process involves the user first accessing the redirection system. The system then generates a redirection response (Location header) containing the new URL based on information such as the client's IP address and returns it to the client with a 302 status code. The client then automatically sends a request to that new URL, thus achieving real-time and precise traffic scheduling.

[0015] Monthly 95 billing: A common bandwidth billing model. Specifically, bandwidth usage within a month is calculated in 5-minute intervals (e.g., 00:00~04:59, 05:00~09:59). The bandwidth value (traffic divided by 300 seconds) for each interval is used as a billing point; there are a total of 30 minutes per month. twenty four 60 / 5 = 8640 billing points (based on 30 days). The highest 5% of billing points (i.e., 432 points) are removed, and the highest value among the remaining billing points is taken as the final billing bandwidth. This is to balance burst traffic and encourage stable bandwidth utilization.

[0016] Cache hit rate: In a caching system (such as CDN edge nodes), the percentage of times a user's requested resource is successfully retrieved directly from the local cache. A high cache hit rate means that more requests do not need to retrieve the resource from the origin server, thereby reducing latency, saving bandwidth, and improving service efficiency; it is one of the key indicators for measuring the performance of a caching system.

[0017] Connection reuse rate: In network communication, the proportion of times the same TCP connection is used to transmit requests and responses multiple times. By reusing connections (such as persistent connections in HTTP / 1.1 or multiplexing in HTTP / 2), the overhead of establishing and closing connections can be reduced, server load can be lowered, and client access speed can be improved. This ratio reflects the efficiency of connection utilization.

[0018] In the industry where internet data centers provide network bandwidth resources to other companies, a bandwidth billing model based on a monthly settlement of 95 is commonly used. For example... Figure 1 As shown, in this model, if the actual bandwidth utilization rate remains below the billing threshold (i.e., 95 lines), a large amount of underutilized bandwidth resources will be generated. In order to improve resource utilization, the industry generally tries to use this underutilized bandwidth to carry content delivery network (CDN) services, in order to generate revenue without increasing costs.

[0019] Existing CDN traffic scheduling technologies primarily rely on Domain Name System (DNS) resolution. This method achieves initial traffic distribution by directing user requests to different edge data centers. However, due to the existence of DNS caching at various levels, scheduling updates suffer from significant delays and limited accuracy. Figure 2 As shown, this often leads to the actual traffic in the data center being difficult to accurately match the 95 lines: either there is still unused bandwidth, or the billing cost increases due to short-term overages.

[0020] In pursuit of more precise scheduling, such as Figure 3 As shown, existing technologies use 302 redirection as a supplement to DNS redirection, but usually it simply redirects a portion of requests to other edge nodes. However, this process requires different clients to frequently establish connections with different edge nodes, resulting in increased client access latency, increased server performance loss, low resource hit rate leading to bandwidth waste (if the edge node's cache misses, it will retrieve the cache from the parent node, wasting the parent node's bandwidth) and client lag.

[0021] Based on this, embodiments of this application provide a content distribution method and a content distribution network that can determine whether to trigger a redirection by comparing the last digit of a preset number of bits in a first obfuscation value with a first threshold determined based on a redirection ratio, thereby achieving precise control over the redirection ratio. At the same time, it can also ensure that requests from the same batch of clients can be consistently filtered and guided to certain specific edge nodes as much as possible, thereby improving connection reuse rate and cache hit rate.

[0022] The method provided in this application embodiment can be applied to, for example... Figure 4 The content delivery network shown includes a scheduling center configured with a central scheduler and multiple edge nodes that are respectively connected to the scheduling center. Each edge node includes a cluster scheduler and multiple servers. Each server is equipped with a gateway. The execution subject of the method in this application is the first edge node.

[0023] The central scheduler is used to obtain the following information for each edge node: real-time bandwidth usage, average bandwidth of each accessed domain name within a preset time window up to the current time, and cache hit rate of each domain name within a preset time window up to the current time.

[0024] Each server's memory array stores various resource access events for each edge node. Each resource access event includes: the edge node used, the requested resource, and a timestamp.

[0025] The cluster scheduler is used to collect the real-time bandwidth usage and traffic composition of each server in the server cluster of this edge node, and send the data to the scheduling center after aggregation. Furthermore, each cluster scheduler is also used to determine the redirection ratio of real-time access requests of the corresponding server cluster based on the planned bandwidth or real-time bandwidth usage of the first edge node.

[0026] It is worth mentioning that edge nodes will regularly and frequently update the real-time bandwidth usage of the edge node to the scheduling center to avoid being mistakenly identified as target edge nodes.

[0027] In one possible implementation, to improve the cache hit rate for each domain name, each edge node is configured to handle only access requests for a subset of specific domain names (achieved by redirecting specific domain name requests to specific edge nodes via DNS). Correspondingly, this edge node does not cache resources for other domain names. Based on this design, each edge node needs to periodically report the cache hit rate of the domain names it is responsible for to the scheduling center.

[0028] The cluster scheduler is also configured to determine whether the total bandwidth occupied by all currently received access requests is greater than the local planned bandwidth; if it is greater, a 302 scheduling instruction is issued, which includes the proportion of the access request that needs to be redirected; the gateway will schedule the request to a suitable target edge node according to the redirection proportion in the instruction and return the redirection information to the client; otherwise, the gateway will directly respond to the client's access request and send the target resource.

[0029] Firstly, such as Figure 5 As shown, this application provides a content distribution method applied to a content distribution network, the network including multiple edge nodes, the method including: S1. The first edge node receives the client's access request for the target resource, and the access request for the target resource includes the client's IP address; Specifically, the client sends an access request to the first edge node based on the DNS resolution of the domain name address; S2. Determine the current redirection ratio based on the planned bandwidth and real-time usage bandwidth of the first edge node, and determine the current first threshold based on the current redirection ratio. The redirection ratio is used to characterize the proportion of access requests that need to be redirected among the multiple access requests currently received. The planned bandwidth for each edge node refers to the bandwidth pre-configured for that edge node, which is usually a fixed value; In one possible implementation, S2.1 determines the current redirection ratio based on the planned bandwidth and real-time usage bandwidth of the first edge node, specifically as follows: S2.1.1 Determine the real-time bandwidth used by the first edge node; Specifically, the real-time bandwidth usage is obtained by summing the response body sizes of all new access requests from the gateway within a very short time window (e.g., the current 1 second) and then dividing by that time window.

[0030] S2.1.2 When the real-time bandwidth usage is less than the planned bandwidth, the redirection ratio is 0, and the first edge node sends the target resource to the client; S2.1.3 When the real-time bandwidth used is greater than the planned bandwidth, determine the difference between the real-time bandwidth used and the planned bandwidth, and determine the first ratio between the difference and the real-time bandwidth used. The first ratio is the current redirection ratio. The redirection ratio is used to quantify the real-time bandwidth load pressure of the first edge node. The higher the value, the larger the scale of traffic that this node needs to redirect.

[0031] The following is an example of the redirection ratio process: If the planned bandwidth is 1Gb and the real-time bandwidth is 2Gb, then the redirection ratio is: (2-1) / 2=50%.

[0032] In other embodiments, when the first ratio reaches the second preset value, the calculation of the redirection ratio can be triggered, and the redirection ratio can be set to the preset ratio of the planned bandwidth.

[0033] S3. Determine the first obfuscation value of the client IP, and check whether the last digit of the preset number of bits in the first obfuscation value is less than the current first threshold. In one possible implementation, S2.2, the current first threshold is determined based on the current redirection ratio, specifically as follows: Multiply the current redirection ratio by a preset factor to obtain the current first threshold.

[0034] Specifically, the preset multiple and preset number of bits can be determined based on the value of the redirection ratio, so that the preset number of bits is equal to the number of bits of the first threshold, thereby enabling the subsequent step S3.2 to control the redirection ratio more precisely; For example, if the preset number of digits is set to two, and the current redirection ratio is 20%, and the preset multiplier is set to 100, then the first threshold is 20% × 100 = 20; if the current redirection ratio is 20.3%, then 20.3% is rounded to 20%, and the corresponding first threshold is 20. Another possible implementation is to set the preset number of bits to three. If the current redirection ratio is 20.3%, and the preset multiple is set to 1000 times, then the first threshold is 20.3% × 1000 = 203.

[0035] If not, then jump to S3.1, and S3.1 and the first edge node send the target resource to the client; If so, proceed to S3.2. S3.2 The first edge node then determines the target edge node and returns redirection information to the client. The redirection information is used to instruct the client to send an access request for the target resource to the target edge node.

[0036] For example, when the preset number of digits is two and the preset multiplier is 100, the gateway of the first edge node determines whether each request needs to be redirected using a 302 redirect based on the redirection ratio calculated by the local cluster scheduler and the client's IP address. Specifically: for example, if the gateway of the first edge node needs to respond to the client with a redirection ratio of 20%, it performs obfuscation calculations based on the client's IP address to obtain a data value, and then distinguishes the data based on the last two digits of the obtained obfuscated value. If the last two digits are in the range of 00 to 19, the request is redirected using 302 redirection technology.

[0037] This application obfuscates or performs obfuscation calculations on the client IP at the gateway of the first edge node, and returns redirection information to some access requests based on the obtained first obfuscation value. This makes it more likely that some specific clients will reuse the established TCP connection with the redirection target node, reducing the number of connection reconstructions, thereby reducing access latency and improving server processing performance.

[0038] In this application, in order to improve the connection reuse rate, the gateway of the first edge node will try to schedule the requests of a batch of clients with specific IPs to the target edge node that has recently processed the relevant requests of the client with that IP. This is because when a specific client has accessed a specific edge node, it will maintain a TCP connection with the host of that edge node for a short period of time. When it makes another request, it does not need to establish a TCP connection, thereby reducing the performance consumption of the edge node and improving the access speed of the client.

[0039] Furthermore, this application combines DNS shunting with dynamic proportional 302 scheduling based on client IP to make the bandwidth utilization of each edge node more uniform. This not only makes full use of the planned bandwidth but also avoids traffic exceeding the planned bandwidth, thus avoiding additional costs. This optimizes resource usage while controlling costs.

[0040] In one possible implementation, the access request for the target resource also includes: the requested byte range of the target resource, the resource locator of the target resource, and the domain name where the target resource is located. In one possible implementation, the target resource is a video resource, and the corresponding client is a video-based client. Access requests initiated by video-based clients typically carry a specific requested byte range, such as 512KB. This design is intended to accommodate users who might interrupt their viewing to save bandwidth. To be compatible with various services (such as downloading large game files), the basic unit of the content delivery network's cache is typically set to 1MB. When a client initially requests the first 512KB of a 1MB data block, based on the expectation that the video client will soon request the remaining 512KB, the content delivery network pre-fetches the entire 1MB data block from disk into memory.

[0041] Accordingly, S3.2 specifically refers to: S3.2.1 The first edge node performs boundary alignment processing on the requested byte range based on the preset data block size to obtain an aligned data block, which is divided into a first half and a second half. In one possible implementation, during redirection, the requested byte range is aligned to an integer boundary of 1MB to obtain an aligned data block.

[0042] S3.2.2 Determine if the requested byte range is in the latter half. If so, jump to S3.2.2.1. S3.2.2.1 Determine the target edge node based on the resource locator and return redirection information to the client; If not, proceed to S3.2.2.2. S3.2.2.2 Determine the target edge node based on the domain name and return redirection information to the client.

[0043] In one possible implementation, the network also includes a scheduling center that communicates with each edge node individually; S3.2.2.1 specifically refers to: S3.2.2.1.1 Concatenate the resource locator and the alignment data block to obtain a string, and determine the second obfuscation value of the string; S3.2.2.1.2. Based on the second obfuscation value, the preset width of each memory array is calculated by taking the modulo to obtain the corresponding index value. Each memory array is stored in the corresponding edge node to store various resource access events. Specifically, a second obfuscation value is calculated based on the string obtained by "resource locator (URL) + aligned byte range", and then a fixed modulus is taken as the index value for the second obfuscation value.

[0044] S3.2.2.1.3. Based on each index value, query the corresponding memory array to obtain the latest access time of the first half and the second edge node used at the latest access time; Specifically, the content delivery network uses index values ​​to query the memory array to find out if a second edge node has recently (e.g., within a very short time window) processed the first half of the aligned data block.

[0045] Since it is impossible to save all accessed resources (including their URLs and aligned byte ranges) at the edge nodes of the last redirection, and there is insufficient memory space to store a data structure matching the maximum size of the complete obfuscation value, this application uses obfuscation calculation combined with modulo operation to map the target resources into a fixed-size array. Furthermore, since different resources may obtain the same index value after obfuscation and modulo operation, there is a certain probability of misjudgment. To reduce this probability of misjudgment, this application additionally records the last access time in the memory array as an auxiliary judgment criterion.

[0046] It is worth mentioning that when querying the memory array based on the index value, even if there is a judgment error, at most only the edge nodes in the memory cache that do not store the corresponding resources will be accessed to obtain the data; and CDN itself has a certain probability of cache miss scenarios, which is within the acceptable normal range.

[0047] S3.2.2.1.4 Determine the target edge node based on the latest access time and the second edge node.

[0048] In one possible implementation, S3.2.2.1.4 specifically refers to: S3.2.2.1.4.1 Compare the latest access time with the current time and determine whether the difference between the two is less than the first preset value; If so, then proceed to S3.2.2.1.4.1.1. S3.2.2.1.4.1.1, Determine the second edge node as the target edge node; If not, proceed to S3.2.2.1.4.1.2. S3.2.2.1.4.1.2, The first edge node determines the target edge node based on the domain name.

[0049] In other words, in this application, by querying the latest accessed records of the first half of the video resource that meet the time requirements, closely related access requests for the first and second halves of the same data block are directed to the same target edge node. This not only improves the cache hit rate of the target edge node and reduces disk I / O overhead, but also further enhances TCP connection reuse, enabling the cluster to achieve optimal performance.

[0050] Furthermore, the advantage of the method for processing video resources in this application lies in the fact that when a video client accesses the first 512KB of a 1MB data block, if a target edge node is identified for it, then when the video client subsequently accesses the remaining 512KB of the same data block, even if the real-time bandwidth used by that edge node is greater than the planned bandwidth, it can still be reused preferentially because it has recently processed the first half. This is because the scheduling decision is calculated only based on "URL + aligned byte range," and its impact is limited to subsequent requests within that 1MB data block, without affecting the scheduling selection of other subsequent data blocks of the entire video resource. Therefore, when processing the latter half of the video resource access request, this application is not limited by the real-time bandwidth used, thereby ensuring connection reuse, reducing latency, and maintaining the flexibility and granularity of the distribution strategy.

[0051] When accessing the first half of the aligned data block, jump to S3.2.2.2, which determines the target edge node based on the domain name. In one possible implementation, S3.2.2.2 specifically is as follows: S3.2.2.2.1 Determine the third edge node used when the domain name was last accessed, and determine the real-time bandwidth used by the third edge node and the first cache hit rate of the domain name by the third edge node; S3.2.2.2.2 Determine whether the real-time bandwidth used by the third edge node is less than the planned bandwidth and whether the first cache hit rate is greater than the second threshold. If so, proceed to S3.2.2.2.2.1. S3.2.2.2.2.1. Determine the third edge node as the target edge node; It should be noted that the first preset value, the second preset value, the preset ratio, the first threshold, and the second threshold are all set by those skilled in the art as needed. This application prioritizes edge nodes that have been recently used, have a high caching hit rate for the domain name, and meet the requirements for real-time bandwidth usage, when historical records are available. This is beneficial for increasing the probability of TCP connection reuse.

[0052] If not, proceed to S3.2.2.2.2.2. S3.2.2.2.2. The target edge node is determined based on the real-time bandwidth used by each candidate edge node other than the third edge node and the first edge node, and the second cache hit rate of each candidate edge node for the domain name.

[0053] In one possible implementation, S3.2.2.2.2.2 specifically refers to: S3.2.2.2.2.2.1 Determine whether there is at least one candidate edge node that meets the preset conditions. The preset conditions are that the real-time bandwidth used is less than the planned bandwidth and the second cache hit rate is greater than the second threshold. If so, determine the target edge node from the candidate edge nodes that meet the preset conditions. If not, then proceed to S3.2.2.2.2.2.1.1. S3.2.2.2.2.2.1.1. Determine the first edge node as the target edge node.

[0054] It is worth mentioning that if none of the candidate edge nodes meet the preset conditions, the gateway of the first edge node will respond to the client request through local caching and send the target resource to the client. At this time, it may exceed the planned bandwidth value.

[0055] If so, then proceed to S3.2.2.2.2.2.1.2. S3.2.2.2.2.2.1.2 Determine the target edge node from the candidate edge nodes that meet the preset conditions. In one possible implementation, S3.2.2.2.2.2.1.2 specifically refers to: S3.2.2.2.2.1.2.1. Number each edge node and record the candidate edge node that meets the preset conditions as the fourth edge node; S3.2.2.2.2.1.2.2, The fourth edge node whose number is greater than that of the first edge node and whose number difference with that of the first edge node is the smallest is determined as the target edge node.

[0056] In one possible implementation, following S3.2.2.2.2.2.1.2.2, it also includes: Record the target edge node, domain name, and current timestamp, and store them in memory so that the target edge node can be directly indexed based on the domain name next time.

[0057] It's worth noting that if the first half of the aligned data block is accessed, the target edge node, domain name, and current timestamp need to be recorded in a memory array. Regardless of whether the first or second half of the aligned data block is accessed, it's necessary to record in other memory structures which target edge node the domain name was most recently scheduled to using a 302 redirect, so that the target edge node can be determined based on the domain name in subsequent 302 redirects.

[0058] This application assigns a number to each edge node, selects the edge node whose number is greater than that of the first edge node and is closest to that of the first edge node, and considers the edge node with the smallest number as the target edge node when the first edge node has the largest number, in order to improve resource hit rate, improve TCP connection reuse rate and achieve load balancing of each edge node.

[0059] Example of step S3.2.2.2.2.2.1.2: All edge nodes are sequentially numbered using numbers from NODE_1 to NODE_100. It is worth noting that this application does not require numbering edge nodes with each request. Instead, when the content delivery network starts, each edge node is numbered by the central scheduler, and the numbering process is random, with no overlap between edge nodes. The edge node numbered NODE_1 is designated as the first edge node; for ease of description, NODE_1 will be used to refer to the first edge node thereafter. When NODE_1 receives an access request for a target resource existing in domain A, if NODE_1 determines, based on the aforementioned steps, that the fourth edge node meeting the preset conditions is NODE_3, NODE_10, NODE_14, or NODE_15, then NODE_3 is selected as the target edge node, and the selected target edge node and its corresponding domain name are cached in memory.

[0060] Furthermore, if there is at least one first edge node, this application selects the target node whose number is closest to and greater than the first edge node's number from the candidate node set that meets preset conditions. Since the numbering is unique and globally ordered, this rule ensures that in a distributed scheduling scenario, the selected targets of different first edge nodes will naturally disperse along the numbering sequence. This systematically avoids the situation where multiple first edge nodes simultaneously redirect traffic to the same target edge node, effectively preventing overload of the target edge node due to concentrated requests, and achieving stable and balanced traffic distribution within the joint scheduling pool.

[0061] The following is an embodiment of this application: Suppose that the cluster scheduler of the first edge node calculates a redirection ratio of 9%, and then sends it to each gateway of the first edge node.

[0062] When a client request is received, the gateway first obtains the client's IP address: 183.131.107.111. Then, it performs an obfuscation function (such as fmix32) on the client's IP address to calculate the obfuscation value, or performs an obfuscation function on the client's IP address to calculate the obfuscation result, which is recorded as the first obfuscation value: 441,565,506.

[0063] Specifically, in this embodiment, the last two digits of the first obfuscation value will be selected. The last two digits "06" will be compared with 100 times the redirection ratio "9". If "06" is less than "9", then it is considered that this request should be redirected to other nodes by 302.

[0064] The gateway then needs to decide which node to redirect the 302 request to. Assume the URL being accessed is http: / / XXX.com / a.pm4, and the requested byte range is 524288~1048575. The preset data block size is 1MB, and the whole MB is aligned to the requested byte range range, resulting in an aligned data block of 0~1048575. It is determined that the current access request is for the latter half of the video resource. The folder path and the aligned data block are then concatenated to obtain the string "http: / / XXX.com / a.pm4range0~1048575". The second obfuscation value is obtained by performing obfuscation calculation on the string: E633F9C10FC1B5D4; The default width of the memory array is 1024. 1024 = 1048576. Using the second obfuscation value, we calculate the modulo of the preset width: 0xE633F9C10FC1B5D4%1048576 = 112084, thus obtaining the index value 112084. Retrieve the address and latest access time of the second edge node stored in the 112084th element of the memory array. If the latest access time is within 10 seconds of the current time, it means that the first 512KB of the target resource was likely recently requested, and the second edge node is directly used as the target edge node. Since this request is for the latter half of a whole MB, there is no need to update the access time.

[0065] In another embodiment, if the current access request is determined to be for the first half of the target resource which is an integer MB based on the aligned data block, then the target edge node is determined based on the domain name, and the target edge node and access time are updated in the memory array so that when the access request for the second half is received, the cached content of the target resource can be used directly.

[0066] The specific process of determining the target edge node based on the domain name is as follows: Based on the domain name of this access request, find the third edge node used in the most recent access to this domain name, and then determine whether the real-time bandwidth used by the third edge node reaches the planned bandwidth of 1Gb, and whether the second cache hit rate of the domain name is greater than the second threshold of 60%. If so, the third edge node is directly selected as the target edge node, and the redirection information is returned to the client in the form of 302.

[0067] If not, among the multiple candidate edge nodes other than the first and third edge nodes, first select the candidate edge node that meets the preset conditions and denot it as the fourth edge node. The preset conditions are: real-time bandwidth usage is less than 1Gb and the second cache hit rate for the domain name is greater than 60%. Then, find the node with a number greater than the first edge node and closest to the first edge node number from at least one fourth edge node. Return the redirection information to the client in the form of a 302, and record the target edge node in a hash table in memory (the key of the hash table is the domain name and the value is the node number).

[0068] It should be noted that although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all of the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flowchart may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0069] On the other hand, such as Figure 6 As shown, this application also provides a content delivery network 10, the network including: The receiving module 11 is used to receive the client's access request for the target resource, and the access request for the target resource includes the client's IP address; The redirection module 12 is used to determine the current redirection ratio based on the planned bandwidth and real-time usage bandwidth of the first edge node, and to determine the current first threshold based on the current redirection ratio. The redirection ratio is used to characterize the proportion of access requests that need to be redirected among the multiple access requests currently received. The comparison module 13 is used to determine the first obfuscation value of the client IP and to determine whether the last digit of the preset number of bits of the first obfuscation value is less than the current first threshold. If not, the target resource is sent to the client, and the preset number of bits is equal to the number of bits of the first threshold. If so, the target edge node is determined, and redirection information is returned to the client. The redirection information is used to instruct the client to send an access request to the target resource to the target edge node.

[0070] This application constructs a larger idle bandwidth resource pool with less bandwidth fluctuation by jointly scheduling numerous edge nodes. It also performs real-time and precise 302 redirection scheduling between the first edge node and the other edge nodes, enabling traffic to flow dynamically according to the real-time bandwidth usage of each node. This fully utilizes planned bandwidth resources, effectively raising the overall bandwidth utilization rate to near the billing threshold, while avoiding additional costs caused by local traffic surges exceeding the billing line. Ultimately, this achieves low-cost and high-efficiency content distribution.

[0071] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media 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), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0072] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. A content distribution method, characterized in that, Applied to a content delivery network, the network comprising multiple edge nodes, the method includes: The first edge node receives a client's access request for a target resource, and the access request for the target resource includes the client's IP address; The current redirection ratio is determined based on the planned bandwidth and real-time usage bandwidth of the first edge node, and the current first threshold is determined based on the current redirection ratio. The redirection ratio is used to characterize the proportion of access requests that need to be redirected among the multiple access requests currently received. A first obfuscation value for the client IP is determined, and it is determined whether the last digit of the preset number of bits in the first obfuscation value is less than the current first threshold. If not, the first edge node sends the target resource to the client, where the preset number of bits is equal to the number of bits in the first threshold. If so, the first edge node determines the target edge node and returns redirection information to the client, the redirection information being used to instruct the client to send an access request for the target resource to the target edge node.

2. The method according to claim 1, characterized in that, The current first threshold is determined based on the current redirection ratio, specifically as follows: Multiply the current redirection ratio by a preset factor to obtain the current first threshold.

3. The method according to claim 1, characterized in that, The access request for the target resource also includes: the requested byte range of the target resource, the resource locator of the target resource, and the domain name where the target resource is located. Accordingly, the first edge node determines the target edge node, specifically as follows: The first edge node performs boundary alignment processing on the requested byte range based on a preset data block size to obtain an aligned data block, which is divided into a first half and a second half. Determine whether the requested byte range is located in the latter half; if so, determine the target edge node based on the resource locator. If not, the target edge node is determined based on the domain name.

4. The method according to claim 3, characterized in that, The target edge node is determined based on the resource locator, specifically as follows: The resource locator and the alignment data block are concatenated to obtain a string, and a second obfuscation value of the string is determined. Based on the second obfuscation value, the preset width of each memory array is sequentially moduloed to obtain the corresponding index value. Each memory array is stored in the corresponding edge node to store various resource access events. Based on each index value, query the corresponding memory array to obtain the latest access time of the first half and the second edge node used at the latest access time; The target edge node is determined based on the latest access time and the second edge node.

5. The method according to claim 4, characterized in that, The target edge node is determined based on the latest access time and the second edge node, specifically as follows: Compare the latest access time with the current time to determine whether the difference between the two is less than a first preset value; If so, the second edge node is determined as the target edge node; If not, the first edge node determines the target edge node based on the domain name.

6. The method according to claim 5, characterized in that, The first edge node determines the target edge node based on the domain name, specifically as follows: Determine the third edge node used when the domain name was last accessed, and determine the real-time bandwidth used by the third edge node and the first cache hit rate of the third edge node for the domain name; Determine whether the real-time bandwidth used by the third edge node is less than the planned bandwidth and whether the first cache hit rate is greater than the second threshold. If so, then the third edge node is determined as the target edge node. If not, the target edge node is determined based on the real-time bandwidth usage of each candidate edge node other than the third edge node and the first edge node, and the second cache hit rate of each candidate edge node for the domain name.

7. The method according to claim 6, characterized in that, The target edge node is determined based on the real-time bandwidth usage of each candidate edge node other than the third edge node and the first edge node, and the second cache hit rate of each candidate edge node for the domain name. Specifically: Determine whether at least one of the candidate edge nodes meets a preset condition, wherein the preset condition is that the real-time bandwidth used is less than the planned bandwidth and the second cache hit rate is greater than a second threshold. If so, determine the target edge node from the candidate edge nodes that meet the preset condition. If not, then the first edge node is determined as the target edge node.

8. The method according to claim 7, characterized in that, The target edge node is determined from the candidate edge nodes that meet the preset conditions, specifically as follows: Each edge node is numbered, and the candidate edge node that meets the preset conditions is recorded as the fourth edge node; When the number of the first edge node is not the largest, the fourth edge node whose number is greater than that of the first edge node and whose number difference with that of the first edge node is the smallest is determined as the target edge node. When the number of the first edge node is the largest, the fourth edge node with the smallest number is determined as the target edge node.

9. The method according to any one of claims 6 to 8, characterized in that, After returning redirection information to the client, the process also includes: The target edge node, the domain name, and the current timestamp are stored.

10. A content delivery network, characterized in that, The network includes: A receiving module is used to receive a client's access request for a target resource, wherein the access request for the target resource includes the client's IP address; The redirection module is used to determine the current redirection ratio based on the planned bandwidth and real-time usage bandwidth of the first edge node, and to determine the current first threshold according to the current redirection ratio. The redirection ratio is used to characterize the proportion of access requests that need to be redirected among the multiple access requests currently received. The comparison module is used to determine the first obfuscation value of the client IP and to determine whether the last digit of the preset number of bits of the first obfuscation value is less than the current first threshold. If not, the target resource is sent to the client, and the preset number of bits is equal to the number of bits of the first threshold. If so, the target edge node is determined, and redirection information is returned to the client, which instructs the client to send an access request for the target resource to the target edge node.