CDN caching method and device, computer equipment and storage medium
By introducing a multi-process architecture and file size allocation strategy into the CDN caching system, optimizing SSD and HDD disk management, the problem of low cache hit rate was solved, cross-process cache sharing and origin-fetching strategies were implemented, and the quality of CDN services was improved.
Patent Information
- Application Number
- CN202511798116.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-02
- Publication Date
- 2026-02-13
AI Technical Summary
Traditional CDN caching methods have low cache hit rates, leading to frequent cache loss and origin server callbacks, which affects the quality of CDN services.
By introducing a multi-process architecture into the CDN caching system through a scheduling management process, cache query requests are allocated using hash values, and different storage engines are selected for writing cached content based on file size. This includes optimized management of SSD and HDD disks, enabling cross-process cache sharing and content origin-based strategies.
It improved cache hit rate, reduced cache loss, and enhanced the overall performance and response speed of CDN services.
Smart Images

Figure CN121531031A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of CDN network technology, and in particular to a CDN caching method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] In a CDN network, on-demand videos and website images need to be cached on cache servers. Caching refers to copying the required static resource files and storing them on the CDN's cache server. Since the number of storage disks on a single cache server is actually limited, the I / O read / write throughput that a single machine can provide is also limited. Therefore, to improve the quality of CDN services, it is necessary to ensure the cache hit rate and reduce the large number of origin server requests caused by cache misses.
[0003] However, traditional CDN caching methods have low cache hit rates. Summary of the Invention
[0004] Therefore, it is necessary to provide a CDN caching method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the cache hit rate in order to address the above-mentioned technical problems.
[0005] In a first aspect, this application provides a CDN caching method applied to the scheduling management process of a CDN caching system. The scheduling management process communicates with child processes of the CDN caching system, and the child processes include at least one first process and one second process. The method includes:
[0006] Receive a cache query request sent by the client; send the cache query request to the target first process; if the target first process does not find the target cache content, send the cache query request to the second process; the target first process is one of at least one first process; the target cache content is the cache content corresponding to the cache query request;
[0007] If the target cached content is not found in the second process, the target cached content is obtained from the origin server corresponding to the domain name in the cache query request;
[0008] Get the file size of the target cached content; write the target cached content to the target process based on the file size; the target process is used to return the target cached content to the client; the target process is one of at least one first process and one second process.
[0009] In one embodiment, sending a cached query request to the target first process includes:
[0010] Hash the cached query request to obtain a hash value;
[0011] Based on the hash value and the preset mapping relationship between the hash value and the first process identifier, obtain the target first process identifier corresponding to the hash value;
[0012] Based on the target first process identifier, the cache query request is sent to the target first process.
[0013] In one embodiment, writing the target cache content to the target process based on the file size includes:
[0014] If the file size is greater than or equal to the first preset threshold, the target cache content is written to the first process;
[0015] If the file size is less than the first preset threshold, the target cache content is written to the second process.
[0016] In one embodiment, writing the target cache content into the first process includes:
[0017] Write the target cache content to the SSD disk of the first process;
[0018] If the memory space of the SSD disk in the first process is less than the second preset threshold, the target cache content in the SSD disk will be migrated to the HDD disk of the first process.
[0019] In one embodiment, migrating the target cache content from the SSD disk to the HDD disk of the first process includes:
[0020] According to the preset disk write strategy, the target HDD disk is determined from the multiple HDD disks of the first process; the preset disk write strategy is generated based on the file size of the target cache content, the length of the IO queue that each HDD disk is currently reading and writing, and the writable space of each HDD disk.
[0021] Migrate the target cache content from the SSD to the target HDD.
[0022] In one embodiment, writing the target cache content into a second process includes:
[0023] The target cache content is written to the SSD disk of the second process in a sequential write and a loop write manner, and the metadata of the target cache content is recorded through the Slot array; the metadata includes, but is not limited to, the offset of the target cache content in the SSD disk of the second process and the file size.
[0024] Secondly, this application also provides a CDN caching device, applied to the scheduling management process of a CDN caching system. The scheduling management process is communicatively connected to a sub-process of the CDN caching system, the sub-process including at least one first process and one second process. The device includes:
[0025] The cache request receiving module is used to receive cache query requests sent by the client; send the cache query request to the target first process; if the target first process does not find the target cache content, send the cache query request to the second process; the target first process is one of at least one first process; the target cache content is the cache content corresponding to the cache query request;
[0026] The cache content retrieval module is used to retrieve the target cache content from the origin server corresponding to the domain name in the cache query request when the second process fails to find the target cache content.
[0027] The cached content return module is used to obtain the file size of the target cached content; based on the file size, the target cached content is written to the target process; the target process is used to return the target cached content to the client; the target process is one of at least one first process and one second process.
[0028] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method steps of the first aspect.
[0029] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method steps of the first aspect.
[0030] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the method steps of the first aspect.
[0031] The aforementioned CDN caching method, apparatus, computer equipment, computer-readable storage medium, and computer program product receive a cache query request sent by a client; send the cache query request to a target first process; if the target first process does not find the target cache content, send the cache query request to a second process; the target first process is one of at least one first process; the target cache content is the cache content corresponding to the cache query request; if the second process does not find the target cache content, obtain the target cache content from the origin server corresponding to the domain name in the cache query request; obtain the file size of the target cache content; write the target cache content to a target process according to the file size; the target process is used to return the target cache content to the client; the target process is one of at least one first process and one second process. As can be seen from the above, this application achieves cross-process cache sharing and improves the cache hit rate by scheduling and managing processes to query the cache content corresponding to the cache query request from both the first and second processes. Furthermore, if neither the first process nor the second process finds the cached content corresponding to the cache query request, the cached content is retrieved from the origin server, written to either the first or second process, and then the cached content corresponding to the cache query request is retrieved from the first or second process, thereby improving the cache hit rate. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a diagram illustrating the application environment of a CDN caching method in one embodiment.
[0034] Figure 2 This is a flowchart illustrating a CDN caching method in one embodiment;
[0035] Figure 3 This is a schematic diagram illustrating the interaction between the scheduling management process and its child processes in one embodiment;
[0036] Figure 4 This is a request-response flowchart of a CDN caching method in one embodiment;
[0037] Figure 5 This is a structural block diagram of a CDN caching device in one embodiment;
[0038] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0040] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0041] CDN (Content Delivery Network): Utilizes global load balancing technology to direct user access to the nearest working streaming media server, which then directly responds to the user's request. If the server does not have the content the user requests, it will automatically fetch the corresponding content from the original server and provide it to the user, based on its configuration.
[0042] The CDN caching method provided in this application embodiment can be applied to, for example... Figure 1 The application environment shown includes a CDN caching system scheduling management process 102, at least one first process 104, and a second process 106. The scheduling management process 102 is communicatively connected to at least one first process 104 and the second process 106. Specifically, the scheduling management process 102 receives a cache query request from a client; sends the cache query request to a target first process; if the target first process does not find the target cache content, it sends the cache query request to the second process 106; the target first process is one of at least one first process 104; if the second process 106 does not find the target cache content, it retrieves the target cache content from the origin server corresponding to the domain name in the cache query request; the target cache content is the cache content corresponding to the cache query request; it obtains the file size of the target cache content; and writes the target cache content to the target process according to the file size; the target process is used to return the target cache content to the client; the target process is one of at least one first process 104 and the second process 106.
[0043] In one embodiment, such as Figure 2 As shown, a CDN caching method is provided. This embodiment applies this method to... Figure 1Taking the scheduling management process 102 in the example, the method includes the following steps:
[0044] Step S210: Receive a cache query request sent by the client; send the cache query request to the target first process; if the target first process does not find the target cached content, send the cache query request to the second process; the target first process is one of at least one first process.
[0045] The CDN caching system is a multi-process, multi-storage-engine caching system, consisting of a scheduling management process and child processes. Each child process is further divided into a first process and a second process. Each child process registers itself with the scheduling management process, and the child processes interact with the scheduling management process via Unix sockets. The scheduling management process acts as a communication hub between child processes.
[0046] Specifically, the scheduling management process listens on the source port to receive external requests. It creates a socket and a child process identifier (fd) for each child process, and passes the fd to the corresponding child process to initialize it. The scheduling management process forwards external requests to the child processes, which then process the requests and return responses. The source port is a port randomly selected by the client (such as a browser) when initiating a request, used to distinguish multiple concurrent requests from the same client.
[0047] The first process is configured with a file storage engine for storing large files. The second process is configured with a cached shared storage engine for storing small files. The cached shared storage engine includes, but is not limited to, the COSS (Cyclic Object Storage System) storage engine and the ATS (Apache Traffic Server) storage engine. Large files are defined as files whose size is greater than or equal to a preset threshold, and small files are defined as files whose size is less than the preset threshold.
[0048] The cache query request is used to retrieve the content of files cached on the CDN cache server. It can be triggered by a user playing a video or clicking on a website image on the client side.
[0049] In this embodiment, a user initiates a cache query request on the client. This cache query request is monitored by the scheduling management process, which then sends the cache query request to the target first process. The target first process checks if the target cache content exists in its own cache. If it exists, it directly returns the target cache content to the client. If it does not exist, it sends a message indicating that the cache does not exist to the scheduling management process, which then sends the cache query request to the second process.
[0050] Optionally, the business subprocess can listen for cache query requests and forward them to the scheduling management process. The business subprocess is specifically designed to receive external requests and only receives and forwards them.
[0051] Step S220: If the second process does not find the target cached content, obtain the target cached content from the origin server corresponding to the domain name in the cache query request; the target cached content is the cached content corresponding to the cache query request.
[0052] The cache query request includes a domain name, which is used to identify and access the website. Specifically, the cache query request is a URL request, which includes information such as the protocol, domain name, and path. For example, if the URL request is "http: / / mail.163.com / index.html", then "mail.163.com" is the domain name.
[0053] In this embodiment, the second process checks if the target cache content exists in its own cache. If it exists, the target cache content is directly returned to the client. If it does not exist, an instruction indicating that the cache does not exist is sent to the scheduling management process, which then retrieves the target cache content from the origin server corresponding to the domain name in the cache query request.
[0054] Step S230: Obtain the file size of the target cache content; write the target cache content to the target process according to the file size; the target process is used to return the target cache content to the client; the target process is one of at least one first process and one second process.
[0055] In this embodiment, the file size of the target cached content is compared with a preset threshold to obtain a comparison result. Based on the comparison result, the target cached content is written to a first process or a second process, and the first process or the second process returns the target cached content to the client.
[0056] The aforementioned CDN caching method involves receiving a cache query request from a client; sending the cache query request to a target first process; if the target first process does not find the target cached content, sending the cache query request to a second process; the target first process can be one of at least one first process; the target cached content is the cached content corresponding to the cache query request; if the second process does not find the target cached content, retrieving the target cached content from the origin server corresponding to the domain name in the cache query request; obtaining the file size of the target cached content; writing the target cached content to the target process according to the file size; and the target process being used to return the target cached content to the client; the target process can be one of at least one first process and one second process. As can be seen from the above, this application achieves cross-process cache sharing and improves the cache hit rate by scheduling and managing processes to query the cached content corresponding to the cache query request from both the first and second processes. Furthermore, if neither the first nor the second process finds the cached content corresponding to the cache query request, the cache hit rate is improved by fetching the cached content from the origin server, writing the cached content to either the first or second process, and then querying the cached content corresponding to the cache query request from both the first and second processes.
[0057] In one embodiment, sending a cached query request to the target first process includes:
[0058] Step S310: Hash the cached query request to obtain a hash value.
[0059] The cached query request includes the source port and the Uniform Resource Locator (URL).
[0060] In this embodiment of the application, the source port and the Uniform Resource Locator URL are hashed to obtain a hash value.
[0061] Step S320: Obtain the target first process identifier corresponding to the hash value based on the hash value and the preset mapping relationship between the hash value and the first process identifier.
[0062] In the preset mapping relationship between hash values and first process identifiers, each hash value corresponds to a unique first process identifier. The first process identifier is used to identify the first process. Specifically, the first process identifier can be a number, letter, or digit.
[0063] In this embodiment of the application, after obtaining the hash value, the target first process identifier is found from the mapping relationship.
[0064] Step S330: Send the cache query request to the target first process according to the target first process identifier.
[0065] In this embodiment of the application, after obtaining the target first process identifier, the scheduling management process can determine the target first process from multiple first processes and send the cache query request to the target first process.
[0066] This application embodiment generates a hash value by hashing the cache query request and determining the target first process based on the hash value. This ensures that the same cache query request is directed to the child process that has already cached the corresponding cached content, improving the response speed of cached content. It also avoids contention or duplicate calculations caused by multiple child processes processing the same cache query request simultaneously.
[0067] In one embodiment, writing the target cache content to the target process based on the file size includes:
[0068] Step S410: If the file size is greater than or equal to the first preset threshold, write the target cache content into the first process;
[0069] Step S420: If the file size is less than the first preset threshold, write the target cache content into the second process.
[0070] The first preset threshold can be set according to actual needs.
[0071] In the embodiments of this application, such as Figure 3 As shown, when the target cache content is a large file, the target cache content is written to the first process. When the target cache content is a small file, the target cache content is written to the second process.
[0072] In this application embodiment, different storage engines are used to write the target cached content of different file sizes into different sub-processes, which can reduce disk fragmentation and improve I / O read and write performance.
[0073] In one embodiment, writing the target cached content to the first process includes:
[0074] Step S510: Write the target cache content to the SSD disk of the first process;
[0075] Step S520: If the memory space of the SSD disk of the first process is less than the second preset threshold, the target cache content in the SSD disk is migrated to the HDD disk of the first process.
[0076] SSDs are storage devices based on flash memory technology, using flash memory chips to store data. HDDs are traditional hard disk storage devices, mainly composed of platters, read / write heads, spindle motors, and control circuitry. They perform data read / write operations by moving the read / write heads across the high-speed rotating platters.
[0077] In this embodiment, the first process prioritizes storing the target cache content on the SSD disk. When the SSD disk is insufficient or full, the target cache content is cold-migrated to the HDD disk, thereby improving the overall cache I / O capability.
[0078] In one embodiment, migrating the target cache content from the SSD to the HDD of the first process includes:
[0079] Step S610: According to the preset disk writing strategy, the target HDD disk is determined from the multiple HDD disks of the first process; the preset disk writing strategy is generated based on the file size of the target cache content, the length of the IO queue that each HDD disk is currently reading and writing, and the writable space of each HDD disk.
[0080] The preset disk write strategies include, but are not limited to, disk write strategies based on file size, disk write strategies based on the length of the currently read / write I / O queue, and disk write strategies based on the writable space of the disk.
[0081] File size-based disk write strategies mean that different disks, based on their own disk space, will write a certain range of disk files. Policies based on the length of the currently active I / O queue mean that different disks, based on their I / O read / write activity, will determine whether to write to a disk file. For example, disks with shorter queue lengths will be prioritized to avoid cumulative write latency. Policies based on the writable space of the disk mean that disks with a higher percentage of remaining space will be written first.
[0082] In this embodiment of the application, multiple HDD disks are pre-configured for the first process, and the scheduling management process determines the target HDD disk from the multiple HDD disks of the first process according to the preset disk writing strategy.
[0083] Step S620: Migrate the target cache content from the SSD disk to the target HDD disk.
[0084] In this embodiment of the application, after determining the target HDD disk, the scheduling management process migrates the target cache content in the SSD disk to the target HDD disk.
[0085] In one embodiment, writing the target cached content to a second process includes:
[0086] In step S710, the target cache content is written to the SSD disk of the second process in a sequential write and a nested write manner, and the metadata of the target cache content is recorded through the Slot array; the metadata includes, but is not limited to, the offset of the target cache content in the SSD disk of the second process and the file size.
[0087] Sequential write refers to writing files sequentially to a pre-defined contiguous disk space. Round-robin write refers to overwriting the earliest written data in a loop when the storage pool is full (ensuring the data has been persisted or is no longer needed before overwriting).
[0088] The Slot array is an array that records the logical order of data entries, where each slot stores an index or an offset pointing to the actual data entry.
[0089] In this embodiment, by writing the target cache content to the SSD disk of the second process through sequential write and nested write, disk fragmentation can be reduced, and old caches cannot be overwritten by the disk being full, thus avoiding cache loss.
[0090] For ease of understanding of the above embodiments, as follows Figure 4 As shown in the diagram, when a client initiates a URL request, the business subprocess receives the request and forwards it to the scheduling management process. The scheduling management process performs a hash and selects the specific business subprocess to handle the cache. The business process first checks if the local cache exists. If it does, it directly responds to the client with the requested cached content. If the cache misses, it initiates a cache query with the COSS storage engine process to determine if the cache exists. If it exists, it responds directly; otherwise, it retrieves the cached data from the origin server. Upon receiving the response from the origin server, it first obtains the response headers and determines whether to write the cached file to the business subsystem's own cache engine or to the COSS storage engine process based on the cache file size. If it's a small file, it's written to the COSS storage engine process using sequential write and nested write methods to the SSD disk and then responded to the client. If it's a large file, it's directly written to the business process's SSD disk and then responded to the client. If the SSD disk is full, the cache from the SSD disk needs to be migrated to the HDD disk. During the migration process, disk selection is required to store the migration cache files. Disk selection can be achieved through disk persistence strategies configured in the configuration file, such as based on file size, the length of the disk's currently read / write I / O queue, and the available disk space. Once the disk is selected, the migration proceeds to the corresponding disk.
[0091] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0092] In one exemplary embodiment, such as Figure 5 As shown, a CDN caching device is provided, applied to the scheduling management process of a CDN caching system. The scheduling management process communicates with the sub-processes of the CDN caching system, and the sub-processes include at least one first process and one second process. The device includes:
[0093] The cache request receiving module 510 is used to receive cache query requests sent by the client; send the cache query request to the target first process; if the target first process does not find the target cache content, send the cache query request to the second process; the target first process is one of at least one first process; the target cache content is the cache content corresponding to the cache query request;
[0094] The cache content retrieval module 520 is used to retrieve the target cache content from the origin server corresponding to the domain name in the cache query request when the second process fails to find the target cache content.
[0095] The cached content return module 530 is used to obtain the file size of the target cached content; write the target cached content to the target process according to the file size; the target process is used to return the target cached content to the client; the target process is one of at least one first process and one second process.
[0096] In one embodiment, sending a cached query request to the target first process includes:
[0097] Hash the cached query request to obtain a hash value;
[0098] Based on the hash value and the preset mapping relationship between the hash value and the first process identifier, obtain the target first process identifier corresponding to the hash value;
[0099] Based on the target first process identifier, the cache query request is sent to the target first process.
[0100] In one embodiment, writing the target cache content to the target process based on the file size includes:
[0101] If the file size is greater than or equal to the first preset threshold, the target cache content is written to the first process;
[0102] If the file size is less than the first preset threshold, the target cache content is written to the second process.
[0103] In one embodiment, writing the target cached content to the first process includes:
[0104] Write the target cache content to the SSD disk of the first process;
[0105] If the memory space of the SSD disk in the first process is less than the second preset threshold, the target cache content in the SSD disk will be migrated to the HDD disk of the first process.
[0106] In one embodiment, migrating the target cache content from the SSD to the HDD of the first process includes:
[0107] According to the preset disk write strategy, the target HDD disk is determined from the multiple HDD disks of the first process; the preset disk write strategy is generated based on the file size of the target cache content, the length of the IO queue that each HDD disk is currently reading and writing, and the writable space of each HDD disk.
[0108] Migrate the target cache content from the SSD to the target HDD.
[0109] In one embodiment, writing the target cached content to a second process includes:
[0110] The target cache content is written to the SSD disk of the second process in a sequential write and a loop write manner, and the metadata of the target cache content is recorded through the Slot array; the metadata includes, but is not limited to, the offset of the target cache content in the SSD disk of the second process and the file size.
[0111] Each module in the aforementioned CDN caching device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can invoke and execute the operations corresponding to each module.
[0112] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows. Figure 6 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores CDN cached data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a CDN caching method.
[0113] Those skilled in the art will understand that Figure 6 The structures shown are merely block diagrams of some structures related to the present application and do not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements. In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the aforementioned CDN caching method. The steps of the CDN caching method described here may be steps from one of the CDN caching methods in the various embodiments described above.
[0114] In one embodiment, a computer-readable storage medium is provided, storing a computer program that, when executed by a processor, causes the processor to perform the steps of the CDN caching method described above. The steps of the CDN caching method described here may be steps from one of the CDN caching methods in the various embodiments described above.
[0115] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, causes the processor to perform the steps of the CDN caching method described above. The steps of the CDN caching method described here may be steps from one of the CDN caching methods in the various embodiments described above.
[0116] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0117] Those skilled in the art will understand that all or part of the processes in the methods of 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 of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory 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, artificial intelligence (AI) processors, etc., and are not limited to these.
[0118] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0119] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A CDN caching method, characterized in that, A scheduling management process applied to a CDN caching system, wherein the scheduling management process is communicatively connected to a sub-process of the CDN caching system, the sub-process including at least one first process and one second process, the method comprising: The system receives a cache query request from a client; sends the cache query request to a target first process; if the target first process does not find the target cache content, it sends the cache query request to a second process; the target first process is one of the at least one first process; the target cache content is the cache content corresponding to the cache query request. If the second process fails to find the target cache content, the target cache content is obtained from the origin server corresponding to the domain name in the cache query request; Obtain the file size of the target cached content; write the target cached content to the target process according to the file size; the target process is used to return the target cached content to the client; the target process is at least one of the first process and the second process.
2. The method according to claim 1, characterized in that, Sending the cache query request to the target first process includes: The cache query request is hashed to obtain a hash value; Based on the hash value and the preset mapping relationship between the hash value and the first process identifier, the target first process identifier corresponding to the hash value is obtained; The cache query request is sent to the target first process based on the target first process identifier.
3. The method according to claim 1, characterized in that, The step of writing the target cache content into the target process according to the file size includes: If the file size is greater than or equal to a first preset threshold, the target cache content is written to the first process; If the file size is less than the first preset threshold, the target cache content is written to the second process.
4. The method according to claim 3, characterized in that, The step of writing the target cache content into the first process includes: Write the target cache content to the SSD disk of the first process; If the memory space of the SSD disk of the first process is less than the second preset threshold, the target cache content in the SSD disk is migrated to the HDD disk of the first process.
5. The method according to claim 4, characterized in that, The step of migrating the target cache content from the SSD disk to the HDD disk of the first process includes: According to a preset disk write strategy, a target HDD disk is determined from multiple HDD disks of the first process; the preset disk write strategy is generated based on the file size of the target cache content, the length of the I / O queue being read and written by each HDD disk, and the writable space of each HDD disk. Migrate the target cache content from the SSD to the target HDD.
6. The method according to claim 3, characterized in that, The step of writing the target cache content into the second process includes: The target cache content is written to the SSD disk of the second process in a sequential write and a loop write manner, and the metadata of the target cache content is recorded through a slot array; the metadata includes, but is not limited to, the offset of the target cache content in the SSD disk of the second process and the file size.
7. A CDN caching device, characterized in that, A scheduling and management process applied to a CDN caching system, the scheduling and management process communicating with sub-processes of the CDN caching system, the sub-processes including at least one first process and one second process, the device comprising: A cache request receiving module is used to receive a cache query request sent by a client; send the cache query request to a target first process; if the target first process does not find the target cache content, send the cache query request to a second process; the target first process is one of the at least one first process; the target cache content is the cache content corresponding to the cache query request; The cache content acquisition module is used to acquire the target cache content from the origin server corresponding to the domain name in the cache query request when the second process fails to find the target cache content. A cached content return module is used to obtain the file size of the target cached content; write the target cached content into a target process according to the file size; the target process is used to return the target cached content to the client; the target process is at least one of the first process and the second process.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Cache sharing method and device for content delivery network
CN102143212A
Data caching method and device
CN105608159A
Cache read-write system and method of content distribution network
CN111930316A