A method and system for cache hot backwriting in a CDN system

By adopting the hot writeback method in the CDN network, the lru cache table and hot evacuation bucket are used to optimize the cache write order and location, which solves the problem of unbalanced occupation of hot cache and cold cache, and improves the cache hit rate and system performance.

CN116320029BActive Publication Date: 2025-06-27CHINA TELECOM CLOUD TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310030661.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-10
Publication Date
2025-06-27
Estimated Expiration
2043-01-10

AI Technical Summary

Technical Problem

CDN网络中,由于热缓存与冷缓存对磁盘资源的占用不均衡,导致热请求miss回源,增加了磁盘io操作,影响系统性能。

Method used

Using the hot writeback method, by establishing the lru cache table and hot evacuation bucket, controlling the write order and location of the cache, reducing disk io operations, ensuring that the hot cache is not eliminated, and achieving efficient cache coverage.

Benefits of technology

It effectively reduces disk io operations, improves cache hit rate, optimizes disk space utilization, reduces source return frequency, and improves system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116320029B_ABST
    Figure CN116320029B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for hot backwriting of a CDN system cache. When a node writes a new cache, by sequentially writing the cache to overwrite the old cache, disk I / O operations are reduced; a hot backwriting LRU table is established, and each time a cache hit occurs, it is placed at the head of the LRU, and the cache at the tail will be eliminated; a hot evacuation bucket is established based on the disk position of the cache, and the hot cache to be overwritten can be reversely queried, the hot cache is rewritten, and then the new cache is written, so as to prevent the hot cache from being eliminated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method and system for storing cached files in a CDN network, and particularly to a method for hot backwriting unevenly heated caches. Background Art

[0002] A CDN network, that is, a content delivery network, is used to accelerate the resources obtained by users and reduce the load on the content source site. Edge nodes often receive a large number of various requests. By hitting the cache of the edge nodes, the amount of backhaul is reduced, and the load on the source site is reduced. However, due to the limited disk space of the nodes and the excessive space required for requesting resources, cache misses occur at the nodes, resulting in backhaul. Considering that the number of caches on a single node is tens of millions or even hundreds of millions, the cache needs to be cleared at all times to store new caches, which may cause the I / O to be too high to hit the cache and directly backhaul.

[0003] The requests received by the node machines are of different heat levels. The caches under certain domain names are cached multiple times, that is, hot caches, and the caches under certain domain names are accessed less frequently or even only once, that is, cold caches. The occupation of disk resources by hot caches and cold caches causes cold caches to squeeze the disk resources of hot caches, resulting in hot request misses and backhaul. The disk space is occupied by cold caches, resulting in a large number of cache misses at the nodes. Summary of the Invention

[0004] Based on the above technical problems, the present application proposes a method for hot backwriting of CDN system caches, which includes:

[0005] Step 1: The cache system receives a URL request initiated by a user and determines whether the corresponding cache exists;

[0006] Step 2: If the cache exists, respond; otherwise, backhaul to the source site, request the cache object, write it into the cache in a cyclic order, and perform hot backwriting in the hot cache according to the relevant information of the cache.

[0007] Further, step 2 further includes that when the cache system backhauls to the source site, an LRU cache entry is established to save the cache index information, and the index information is inserted into the head of the LRU list. When the memory is insufficient, the cache entry at the end of the LRU list is deleted. If the cache is already on the LRU list, that is, the cache is a hot cache, continue to insert the cache into the head of the LRU list.

[0008] Further, when writing the cache in step 2, according to the current disk write position, the corresponding hot cache hash ID value is obtained and inserted into the hot evacuation bucket, and the hot cache with the same hash ID is queried in reverse to perform a hot backwriting operation on the hot cache.

[0009] Further, step 2 further includes adding a new configuration item for the write-back, controlling its concurrency, and avoiding an excessive number of caches corresponding to the hash ID of the hot evacuation bucket.

[0010] Meanwhile, the present invention also requests to protect a CDN system cache hot write-back system, including users, a cache system, and an origin server, which executes the method described in any one of the above.

[0011] The invention provides a method and system for CDN system cache hot write-back. When a node writes a new cache, there is no need to delete the old cache to free up disk space. Instead, the new cache is directly written to overwrite the old cache, reducing disk I / O operations. An LRU table for hot write-back is established. Each time a cache is hit, it is placed at the head of the LRU, and the cache at the tail will be eliminated, controlling the space of the hot cache and preventing excessive memory occupation. A hot evacuation bucket is established based on the disk position offset of the cache, and the hot cache to be overwritten can be reversely queried, rewritten, and then the new cache is written, ensuring that the hot cache is not eliminated. The concurrency of hot write-back is controlled to reduce excessive read / write I / O operations that affect the normal I / O read / write of requests, and different concurrency levels can be targeted for early morning and peak periods. Brief Description of the Drawings

[0012] To more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0013] Figure 1 A time series similarity matching method based on local spatial position provided for the embodiments of the present application;

[0014] Figure 2 A cache physical structure diagram used in the embodiments of the present application;

[0015] Figure 3 A logical structure diagram of the hot evacuation bucket for the embodiments of the present application. Detailed Embodiments

[0016] In order to make the objectives, technical solutions, and advantages of the present application clearer, the following further details the present application in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0017] The following is a specific embodiment of the present invention. User A initiates various URL requests. The cache system receives and responds to the user requests, and the origin server receives the requests initiated by the cache system. The specific process is as shown in the timing diagram in the drawings, and the steps are as follows:

[0018] Step 1: The cache system receives the URL request initiated by the user and determines whether the cache corresponding to the request exists;

[0019] Specifically: S1: The user initiates a normal URL request, and the cache system determines whether the cache exists.

[0020] Step 2: If the cache exists, respond; otherwise, return to the origin site, request the cache object, write it to the cache in a circular order, and write it back to the hot cache based on the relevant information of the cache.

[0021] Specifically: S2: If the cache exists, respond directly without going back to the source; otherwise, go back to the source to pull cache object A and trigger cache write;

[0022] In the cache system, if the disk space is not full, cache A can be written normally, waiting for the user to trigger the request, that is, the operation of S1 is repeated, that is, cache miss, and new cache is written;

[0023] In the above step 2, when the cache system returns to the source station, it creates an LRU cache item, saves the cache index information, and inserts the index information into the LRU table header. When the memory is insufficient, the cache item at the end of the LRU table is deleted. If the cache is already on the LRU table, that is, the cache is a hot cache, the cache continues to be inserted into the LRU table header.

[0024] Specifically, S3:cache will create an LRU table for URLs, and for each URL request received, it will construct the cache metadata information of the URL and put it into the LRU table and hot evacuation bucket, until the memory on the LRU is too large, and the oldest cache metadata and the corresponding hot evacuation bucket data will be eliminated;

[0025] S4: When the disk space is full, the cache is written again after the disk is fully enclosed.

[0026] In the above step 2, when writing to the cache, the corresponding hot cache hash ID value is obtained according to the current disk write position, and inserted into the hot evacuation bucket, and the hot cache with the same hash ID is reversely queried to write back to the hot cache.

[0027] Specifically, the following steps are included:

[0028] S5: When the user initiates a request again, the cache system will write cache A to the write location of the current disk and trigger the hot write-back operation of the cache block that will be overwritten later;

[0029] S6: The cache system writes the cache object obtained from the origin server into the cache and responds to user A.

[0030] S7: The cache block to be overwritten is aligned according to the block size of thermal evacuation to obtain the block area B that needs to be thermally written back.

[0031] S8: Calculate the size of the block area B and the disk space to obtain the hash ID value of the thermal evacuation bucket of the disk.

[0032] S9: Obtain the corresponding thermal cache linked list according to the hash ID value, and perform a write-back operation on the cache on the linked list, that is, read the disk cache data, rewrite it into the cache, and update the metadata information of the cache, indicating that the cache is not the cache written in the previous round of circular writing.

[0033] The above step 2 further includes adding a configuration item for the write-back to control its concurrency and avoid too many caches corresponding to the hash ID of the thermal evacuation bucket.

[0034] Specifically, S10: Thermal write-back will control the number of write-back times to avoid too many thermal caches in the block area B, resulting in too high IO.

[0035] In the present invention, the nodes cache in the way of writing to the disk in a circular order, so that when there are high-concurrency requests, the old cache can be efficiently eliminated without deleting the old cache, avoiding the consumption of disk io. And the disk write position offset will be maintained and updated in real time in the system. When restarting, the disk write position will also be serialized in the metadata at the head of the disk.

[0036] Although the present invention has been described in detail with general descriptions and specific embodiments above, based on the present invention, some parameter modifications or improvements can be made, which are obvious to those skilled in the art. Therefore, these modifications or improvements made without departing from the idea of the present invention all fall within the scope of protection required by the present invention.

Claims

1. A method for cache warm write-back in a CDN system, the method comprising: Step 1: The cache system receives a URL request initiated by a user and determines whether the corresponding cache exists. Step 2: If the cache exists, it responds; otherwise, it makes a backhaul to the origin server to request a cache object, writes it into the cache in a cyclic order, and performs a warm write-back in the warm cache according to the relevant information of the cache. Specifically, it includes the following steps. When the request is initiated again, the cache system writes cache A to the current write position on the disk and triggers a warm write-back operation for the cache block to be overwritten subsequently. The cache system writes the cache object obtained from the origin server into the cache while responding to user A. The cache block to be overwritten is aligned according to the warm evacuation block size to obtain the block area B to be warm written back. Calculate the size of the block area B and the disk space to obtain the hash ID value of the warm evacuation bucket of the disk. Obtain the corresponding linked list of the warm cache according to the hash ID value, and perform a write-back operation on the cache on the linked list, that is, read the disk cache data, rewrite it into the cache, and update the metadata information of the cache.

2. The method according to claim 1, wherein Step 2 further includes that when the cache system makes a backhaul to the origin server, it creates an LRU cache entry, saves the cache index information, and inserts the index information into the head of the LRU list. When the memory is insufficient, it deletes the cache entry at the end of the LRU list. If the cache is already on the LRU list, that is, the cache is a warm cache, it continues to insert the cache into the head of the LRU list.

3. The method according to claim 2, wherein When writing into the cache in Step 2, obtain the corresponding warm cache hash ID value according to the current write position on the disk, insert it into the warm evacuation bucket, and perform a write-back operation on the warm cache by reverse querying the warm cache with the same hash ID.

4. The method according to claim 3, characterized in that, Step 2 further includes adding a new configuration item for the write-back to control its concurrency and avoid an excessive number of caches corresponding to the hash ID of the warm evacuation bucket.

5. A CDN system cache warm write-back system, including a user, a cache system, and an origin server, which executes the method according to any one of claims 1-4.

Citation Information

Patent Citations

  • Permutation and write-back adaptive buffer region management method

    CN108845957A