A method and system for denial of cache request flooding suppression for block device storage

CN122909225APending Publication Date: 2026-10-13BEIJING MERCURIA TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611263563.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-19
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

[0004]本申请提供一种块设备存储的否定缓存请求洪泛抑制方法及系统,用以解决现有技术中对象缺失场景下重复查询导致后端存储访问压力大、资源浪费、性能低下的缺陷,实现对缺失对象的否定缓存及请求短路抑制,降低后端存储访问压力,提升系统资源利用效率和响应性能

Benefits of technology

[0018]本申请提供的一种块设备存储的否定缓存请求洪泛抑制方法及系统,在本地缓存中引入具有预设有效期的否定缓存条目,对已确认缺失的对象在有效期内直接返回未找到错误消息,不再向后端对象存储发起查询请求,从而在缺失对象场景下有效短路块设备驱动产生的重复读取请求,显著降低后端对象存储的访问压力、网络带宽消耗和接口调用配额占用,提升系统资源利用效率和响应性能。同时,通过将瞬时错误排除在否定缓存写入范围之外,保证瞬时错误恢复后能够正常重新查询,避免因网络抖动或服务端错误导致对象被误屏蔽。通过区分对象永久缺失与瞬时错误的日志级别,降低监控告警噪音,提升运维告警的精确性。通过多路合并机制和互斥锁保护下的二次检查,保证并发场景下否定缓存条目写入的一致性和原子性,进一步提升系统在并发访问情况下的稳定性和可靠性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122909225A_ABST
    Figure CN122909225A_ABST
Patent Text Reader

Abstract

The application provides a negative cache request flooding suppression method and system for block device storage, relates to the technical field of computer storage, and can solve the problems of large access pressure of a back-end storage, resource waste and low performance caused by repeated queries in an object missing scenario in the prior art, and comprises the following steps: in response to a read request for a target object in a block device, searching for a cache entry corresponding to the target object in a local cache; when a negative cache entry is found and the negative cache entry does not exceed a preset validity period, returning a not found error message; when no cache entry is found, or when a negative cache entry is found and the negative cache entry has exceeded the preset validity period, initiating a back-end query request to a back-end object storage; and in the case where the result of the back-end query request indicates that the target object does not exist in the back-end object storage, writing a negative cache entry corresponding to the target object into the local cache. The application is used for missing object request flooding suppression in block device storage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer storage technology, and in particular to a method and system for suppressing negative cache request flooding in block device storage. Background Technology

[0002] Network Block Device (NBD) technology is widely used in cloud environments for scenarios such as reading and writing virtual machine disk images and snapshot migration. In an NBD-based cloud sandbox system, virtual machine read requests for block devices are issued by the kernel driver and forwarded to the backend object storage or local caching system via a user-space daemon. The local caching system typically employs an on-demand build strategy, initiating a query to the backend storage when a cache miss occurs and filling the cache based on the query result to improve subsequent read efficiency.

[0003] In existing caching systems, when the requested object does not exist in the backend object storage, the backend returns a "object not found" response. Because block device drivers have an automatic retry mechanism for read failures, failed read requests are repeatedly initiated. However, existing caching mechanisms primarily cache successfully retrieved objects and lack effective means to suppress missing objects, resulting in repeated queries to the backend storage for the same missing object. Summary of the Invention

[0004] This application provides a method and system for suppressing negative cache request flooding in block device storage, which solves the defects of existing technologies in which repeated queries in the case of missing objects cause high backend storage access pressure, resource waste and low performance. It realizes negative caching of missing objects and short-circuit suppression of requests, reduces backend storage access pressure, and improves system resource utilization efficiency and response performance.

[0005] In a first aspect, this application provides a method for suppressing negative cache request flooding in block device storage, comprising the following steps: In response to a read request for a target object in the block device, the cache entry corresponding to the target object is searched in the local cache; wherein, the local cache includes a negative cache entry, which is used to indicate that the corresponding object does not exist in the backend object storage, and the negative cache entry has a corresponding preset validity period; If a negative cache entry corresponding to the target object is found and the negative cache entry has not exceeded the preset validity period, a "not found" error message is returned, and no backend query request is sent to the backend object storage; the "not found" error message indicates that the target object does not exist in the backend object storage. If no cache entry corresponding to the target object is found, or if a negative cache entry corresponding to the target object is found but the negative cache entry has expired, a backend query request for the target object is sent to the backend object storage. If the result of the backend query request indicates that the target object does not exist in the backend object storage, write the corresponding negative cache entry for the target object into the local cache and return a not found error message.

[0006] In one possible implementation, the method further includes: If a negative cache entry corresponding to the target object is found, and the negative cache entry has exceeded its preset expiration date, the negative cache entry is deleted from the local cache.

[0007] In another possible implementation, the method also includes: After deleting the negative cache entry from the local cache, in response to the next read request for the target object, a backend query request is sent to the backend object storage. If the result of the re-initiated backend query request indicates that the target object exists in the backend object storage, return the data of the target object.

[0008] In another possible implementation, the negative cache entry carries a special flag value and a write timestamp; the special flag value is used to identify the negative cache entry. The method also includes: If a negative cache entry corresponding to the target object is found, determine whether the negative cache entry has exceeded the preset validity period based on the current time and the write timestamp.

[0009] In another possible implementation, the method also includes: The system receives configuration information, which includes a validity period parameter. This validity period parameter is determined based on the network transmission speed of the network environment and is negatively correlated with the network transmission speed. The validity period parameter carried in the configuration information is used as the preset validity period for the negative cache entry.

[0010] In another possible implementation, after initiating a backend query request for the target object to the backend object storage, the method further includes: In the event that a transient error occurs as indicated by the result of a backend query request, the negative cache entry corresponding to the target object will not be written to the local cache. Returns the error message corresponding to the transient error; wherein, the transient error is used to characterize the query failure where the existence status of the target object in the backend object storage has not been confirmed, and the transient error includes at least one of the network timeout error and the server-side error returned by the backend object storage; After returning the error message corresponding to the transient error, a new backend query request is sent to the backend object storage for subsequent read requests of the target object.

[0011] In another possible implementation, a backend query request for the target object is initiated to the backend object storage, including: A multi-way merging mechanism is used to initiate a backend query request to the backend object storage. The multi-way merging mechanism is used when there are multiple concurrent query requests for the same target object. Only one of the concurrent query requests executes the shared callback, and the shared callback initiates a backend query request to the backend object storage. The other concurrent query requests wait for the shared callback to finish executing. The results of the backend query requests obtained from the shared callback are used as the query results for each of the multiple concurrent queries; Write the negative cache entry for the target object to the local cache and return a not found error message, including: Within the shared callback, the negative cache entry corresponding to the target object is written to the local cache. Among multiple concurrent query requests for the same target object, only the concurrent query request that executes the shared callback performs the writing of the negative cache entry. Returns a Not Found error message to each concurrent query waiting for the result of the target object.

[0012] In another possible implementation, the method also includes: For writes of negative cache entries triggered by independent concurrent access requests that have not undergone multiple-way merging, check whether a cache entry corresponding to the target object already exists in the local cache before writing; If a cache entry for the target object already exists in the local cache, cancel the writing of this negative cache entry; If there is no cache entry for the target object in the local cache, write the negative cache entry for the target object into the local cache; Both read and write operations on the local cache are performed under the protection of a mutex lock.

[0013] In another possible implementation, the result of the backend query request indicates that the target object does not exist in the backend object storage, including: the backend object storage returns a status code indicating that the object does not exist, or the backend object storage returns an error identifier indicating that the object does not exist; The method also includes: If the result of the backend query request indicates that the target object does not exist in the backend object storage, the first log is logged at the warning level; the first log carries descriptive information to indicate that the object is permanently missing, the object identifier of the target object, and the block offset corresponding to the read request; If the result of a backend query request indicates a transient error, a second log is recorded at the error level; where the alarm priority of the error level is higher than that of the warning level.

[0014] Secondly, this application also provides a negative cache request flooding suppression system for block device storage, including the following modules: a cache lookup module, used to look up a cache entry corresponding to the target object in the local cache in response to a read request for a target object in the block device; the negative cache entry in the local cache is a cache entry used to indicate that the corresponding object does not exist in the backend object storage, and the negative cache entry corresponds to a preset validity period; The negative cache short-circuit module is used to return a not found error and not initiate a backend query request to the backend object storage when a negative cache entry corresponding to the target object is found and the negative cache entry has not exceeded the preset validity period; the not found error is used to indicate that the target object does not exist in the backend object storage; The backend query module is used to initiate a backend query request for the target object to the backend object storage when no cache entry corresponding to the target object is found, or when a negative cache entry corresponding to the target object is found and the negative cache entry has exceeded the preset validity period. The negative write module is used to write a negative cache entry corresponding to the target object into the local cache and return the not found error when the result of the backend query request indicates that the target object does not exist in the backend object storage.

[0015] Thirdly, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements a negative cache request flooding suppression method as described above for storage in the block device.

[0016] Fourthly, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the negative cache request flooding suppression method as described above for any of the block devices.

[0017] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements a negative cache request flooding suppression method as described above for storage in a block device.

[0018] This application provides a method and system for suppressing negative cache request flooding in block device storage. It introduces negative cache entries with preset expiration dates into the local cache. For confirmed missing objects, a "not found" error message is returned directly within the expiration date, without initiating a query request to the backend object storage. This effectively short-circuits duplicate read requests generated by the block device driver in missing object scenarios, significantly reducing access pressure on the backend object storage, network bandwidth consumption, and interface call quota usage, thus improving system resource utilization efficiency and response performance. Simultaneously, by excluding transient errors from the negative cache write scope, it ensures that normal re-queries can be performed after transient errors are resolved, avoiding the accidental blocking of objects due to network jitter or server-side errors. By differentiating the log levels of permanent object loss and transient errors, monitoring alarm noise is reduced, improving the accuracy of operational alarms. Through a multi-path merging mechanism and secondary checks protected by mutex locks, the consistency and atomicity of negative cache entry writes in concurrent scenarios are guaranteed, further improving the stability and reliability of the system under concurrent access conditions. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a schematic diagram of the architecture of the negative cache request flooding suppression system for block device storage provided in this application.

[0021] Figure 2 This is one of the flowcharts illustrating the negative cache request flooding suppression method for block device storage provided in this application.

[0022] Figure 3 This is the second flowchart of the negative cache request flooding suppression method for block device storage provided in this application.

[0023] Figure 4 This is the third flowchart of the negative cache request flooding suppression method for block device storage provided in this application.

[0024] Figure 5 This is a schematic diagram of the negative cache request flooding suppression device for block device storage provided in this application.

[0025] Figure 6 This is a schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0027] The following is combined with Figures 1 to 6 This application describes a method and system for suppressing negative cache request flooding in block device storage.

[0028] In cloud sandbox systems based on Network Block Devices (NBDs), virtual machine read requests to block devices are initiated by the kernel driver and forwarded to the backend object storage and local cache layer via user-space daemons. The local cache layer employs an on-demand build strategy. When a cache miss occurs, concurrent queries for the same key are merged using a multiplexing mechanism (such as singleflight), sending only one query request to the backend object storage. Other concurrent requests wait for the query result and return it together. When the backend query result indicates that the object exists, a positive cache entry is written to the local cache, allowing subsequent reads to directly hit the cache, improving access efficiency. This mechanism is widely used in scenarios such as hot migration of cloud virtual machine disk images and snapshot read / write operations.

[0029] However, when the requested object does not exist in the backend object storage (i.e., it is permanently missing, such as when the corresponding build artifact has been deleted), the backend returns a non-existent object response (e.g., HTTP 404). Because block device drivers have an automatic retry policy for block read failures, failed read requests are frequently re-initiated by the kernel driver in a tight loop, and a single missing object can generate hundreds of repeated query requests per second.

[0030] The existing caching mechanism only caches successfully retrieved objects, neglecting to cache results for non-existent objects. This causes each retry to trigger a new round of backend queries, failing to short-circuit known missing objects. Furthermore, permanent missing objects and transient errors such as network jitter and server-side errors are all output with the same error level in the logs, resulting in high noise in monitoring alerts and making it difficult to distinguish between genuine errors requiring intervention and expected states that do not require action.

[0031] The aforementioned issues significantly increase the access pressure on the backend storage, consume a large amount of network bandwidth and interface call quotas, reduce the overall resource utilization efficiency and response performance of the system, and also increase the burden of operation and maintenance monitoring.

[0032] To address the shortcomings of the existing technology, this application provides a method and apparatus for suppressing negative cache request flooding in block device storage. The method includes: introducing negative cache entries in the local cache to indicate that the corresponding object does not exist in the backend object storage, and configuring a preset expiration time for the negative cache entries. When a read request for a target object is received, the method searches the local cache for the cache entry corresponding to the target object; if the negative cache entry is hit and the preset expiration time has not expired, a "not found" error message is returned, and no backend query request is initiated to the backend object storage, thus short-circuiting duplicate queries for known missing objects; if the cache entry is not hit or the negative cache entry has expired, a backend query request is initiated to the backend object storage; if the result of the backend query request indicates that the target object does not exist, the negative cache entry corresponding to the target object is written to the local cache, and a "not found" error message is returned. Therefore, by using negative caching to short-circuit read requests for missing objects, duplicate backend queries for the same missing object are reduced, backend storage access pressure is lowered, and system resource utilization efficiency and response performance are improved.

[0033] For example, Figure 1 This is a schematic diagram of the architecture of a negative cache request flooding suppression system for block device storage provided in this application. Figure 1 As shown, the system includes: a cache lookup module 101, a negative cache short-circuit module 102, a backend query module 103, and a negative write module 104.

[0034] The cache lookup module 101 is used to search for the cache entry corresponding to the target object in the local cache in response to a read request for the target object in the block device. The cache entries in the local cache include negative cache entries, which indicate that the corresponding object does not exist in the backend object storage. Negative cache entries have a corresponding preset validity period.

[0035] For example, the cache lookup module 101 can maintain cache entries using data structures such as hash tables, red-black trees, or in-memory key-value databases, and perform lookup operations based on the key-value pairs of the target objects. Negative cache entries can include a special flag value and a write timestamp. The special flag value is used to identify the entry as a negative cache entry, thus distinguishing it from positive cache entries; the write timestamp is used to record the write time of the negative cache entry, so that it can be used to determine whether the negative cache entry has exceeded its preset validity period in conjunction with the current time.

[0036] Optionally, the cache lookup module 101 is further configured to delete the negative cache entry from the local cache and treat the negative cache entry as a miss if a negative cache entry corresponding to the target object is found and the negative cache entry has exceeded a preset validity period. After deletion, the next read request for the target object can re-initiate a backend query request to the backend object storage.

[0037] Optionally, the cache lookup module 101 is also used to receive the sent configuration information, which carries an expiration parameter. The expiration parameter carried in the configuration information is determined based on the network transmission speed of the network environment, and is negatively correlated with the network transmission speed. The cache lookup module 101 uses the expiration parameter carried in the configuration information as the preset expiration time for the negative cache entry. For example, when the network transmission speed is fast, the preset expiration time can be set to be shorter; when the network transmission speed is slow, the preset expiration time can be set to be longer.

[0038] The negative cache short-circuit module 102 is used to return a "not found" error message and not initiate a backend query request to the backend object storage when the cache lookup module 101 finds a negative cache entry corresponding to the target object and the negative cache entry has not exceeded a preset validity period. The "not found" error message indicates that the target object does not exist in the backend object storage.

[0039] For example, the negative cache short-circuiting module 102 can achieve short-circuiting by directly generating an error message and returning it to the initiator of the read request, thereby avoiding triggering a backend query. Since negative cache entries are considered trustworthy during their validity period, there is no need to confirm with the backend.

[0040] Optionally, the negation cache short-circuiting module 102 is further configured to log a first log at a warning level when a not found error message is returned. The first log carries descriptive information indicating that the object is permanently missing, the object identifier of the target object, and the block offset corresponding to the read request. By logging the first log at a warning level, it can be distinguished from the error-level log of transient errors, reducing alarm noise.

[0041] The backend query module 103 is used to initiate a backend query request for the target object to the backend object storage when the cache lookup module 101 fails to find a cache entry corresponding to the target object, or finds a negative cache entry corresponding to the target object and the negative cache entry has exceeded the preset validity period.

[0042] For example, the backend query module 103 can communicate with the backend object storage via a network protocol, send an object retrieval request, and receive the returned response. The backend object storage can be an object storage service, such as GCS or S3.

[0043] Optionally, the backend query module 103 is also used to initiate a backend query request to the backend object storage through a multiplexing mechanism.

[0044] The multi-way merging mechanism is used when multiple concurrent query requests exist for the same target object. Only one of these concurrent query requests executes a shared callback, which then initiates a backend query request to the backend object storage. The remaining concurrent query requests wait for the shared callback to complete. The multi-way merging mechanism uses the result of the backend query request obtained from the shared callback as the result of each of the multiple concurrent queries.

[0045] It should be understood that by using a multi-path merging mechanism, duplicate requests to the backend can be avoided by concurrent queries targeting the same object, thereby further reducing the pressure on the backend.

[0046] For example, the multiplexing mechanism can be specifically implemented as the singleflight mechanism. Singleflight is a mechanism used to suppress duplicate function calls. For multiple concurrent execution requests corresponding to the same key value, only one request is allowed to actually execute the processing function, while the other requests enter a waiting state; when the actually executed request is completed, its result is shared with all waiting requests.

[0047] In this embodiment, backend query requests targeting the same object can be used as processing functions, with the target object's key value serving as the key value for `singleflight`. Thus, when multiple concurrent read requests target the same object and none hit the cache, the `singleflight` mechanism ensures that only one concurrent request initiates a backend query request to the backend object storage. The remaining concurrent requests wait for the result of this backend query request and share it after the result is returned. The `singleflight` mechanism effectively avoids duplicate requests to the backend storage caused by concurrent queries targeting the same object, further reducing backend access pressure.

[0048] Optionally, the backend query module 103 is also configured to not write the negative cache entry to the local cache and return the error message corresponding to the transient error if the result of the backend query request indicates that a transient error has occurred.

[0049] Transient errors are used to characterize query failures where the existence of the target object in the backend object storage has not been confirmed. Transient errors include at least one of network timeout errors and server-side errors returned by the backend object storage. After returning the error message corresponding to the transient error, subsequent read requests for the target object can re-initiate a backend query request to the backend object storage.

[0050] Optionally, the backend query module 103 is further configured to initiate a backend query request to the backend object storage in response to the next read request for the target object after the negative cache entry is deleted from the local cache; and return the data of the target object if the result of the re-initiated backend query request indicates that the target object exists in the backend object storage.

[0051] Optionally, the backend query module 103 is also used to record a second log at the error level when the result of the backend query request indicates a transient error; the alarm priority of the error level is higher than the alarm priority of the warning level. Thus, by distinguishing between permanent missing data and transient errors through log levels, it is easier to configure monitoring alarms accurately.

[0052] The negative write module 104 is used to write the negative cache entry corresponding to the target object in the local cache and return a not found error message when the result of the backend query request indicates that the target object does not exist in the backend object storage.

[0053] For example, the negative write module 104 can insert or update negative cache entries in the cache by updating the data structure of the local cache. During writing, the negative cache entry can carry a special flag value and a write timestamp, and be configured with a preset expiration period.

[0054] Optionally, the negative write module 104 is further configured to, when executing a backend query via a multiplexing mechanism, write the negative cache entry corresponding to the target object to the local cache within a shared callback. Among multiple concurrent query requests for the same target object, only the concurrent query request executing the shared callback performs the writing of the negative cache entry; and return a "not found" error message to each concurrent query waiting for the query result of the target object. Writing within the shared callback avoids multiple concurrent queries repeatedly writing negative cache entries.

[0055] Optionally, the negative write module 104 is also used to write negative cache entries triggered by independent concurrent access requests that have not undergone multiple-way merging. Before writing, it checks whether a cache entry corresponding to the target object already exists in the local cache. If a cache entry corresponding to the target object already exists in the local cache, the writing of the negative cache entry is canceled. If a cache entry corresponding to the target object does not exist in the local cache, the negative cache entry corresponding to the target object is written to the local cache.

[0056] It should be noted that both read and write operations on the local cache are performed under the protection of a mutex lock to ensure concurrency safety.

[0057] In this application, the block device can be a network block device. Read requests are initiated by the kernel driver of the network block device and forwarded to the cache layer where the local cache resides via a user-space daemon. If a block read fails, the kernel driver re-initiates the read request. If the re-initiated read request returns a "not found" error message from the local cache within a preset validity period for the negative cache entry, thus avoiding repeated access to the backend object storage.

[0058] It should be understood that the executing entity of the negative cache request flooding suppression method for block device storage provided in this application can be a negative cache request flooding suppression device for block device storage (hereinafter referred to as the flooding suppression device), which may include a cache lookup module, a negative cache short-circuiting module, a back-end query module, and a negative write module. Alternatively, the flooding suppression device can be an electronic device or a server, which has the functions of a cache lookup module, a negative cache short-circuiting module, a back-end query module, and a negative write module. Furthermore, the device can also be the central processing unit (CPU) of the electronic device, or a module within the electronic device used to execute the negative cache request flooding suppression method for block device storage. This application uses the execution of the negative cache request flooding suppression method for block device storage by a flooding suppression device as an example to illustrate the negative cache request flooding suppression method for block device storage provided in this application.

[0059] Figure 2 This is one of the flowcharts illustrating the negative cache request flooding suppression method for block device storage provided in this application, such as... Figure 2 As shown, the method includes the following: Step 201: In response to a read request for a target object in the block device, look up the cache entry corresponding to the target object in the local cache.

[0060] It should be noted that the block device can be a Network Block Device (NBD). Read requests are initiated by the NBD's kernel driver and forwarded to the cache layer where the local cache is located via the user-space daemon.

[0061] Among them, the cache entries in the local cache include negative cache entries. Negative cache entries are used to indicate that the corresponding object does not exist in the backend object storage (such as GCS / S3). Negative cache entries have a corresponding preset validity period.

[0062] In one possible implementation, the local cache can reside in the user-space daemon of the network block device, receiving block read requests forwarded by the kernel driver. Cache entries can be stored as key-value pairs, where the key can be the identifier of the target object, and the value can be object data or a negation flag.

[0063] It should be understood that a negative cache entry is a special type of cache entry used to record the state that "the object has been confirmed not to exist in the backend object storage". This allows subsequent read requests for the same object to be directly short-circuited based on this state, without having to reach the backend object storage again.

[0064] For example, a negative cache entry can carry a special flag value and a write timestamp.

[0065] A special flag value is used to identify the entry as a negative cache entry, thus distinguishing it from a positive cache entry; the write timestamp is used to record the time when the negative cache entry is written to the local cache.

[0066] Furthermore, based on the current time and the write timestamp, it can be determined whether the negative cache entry has exceeded the preset validity period.

[0067] The preset expiration time can be understood as the time to live (TTL) of the negative cache entry. In one implementation, the preset expiration time can be a fixed value, such as sixty seconds.

[0068] In another implementation, the preset validity period can be dynamically determined based on the issued configuration information: 1) The flood suppression device receives the configuration information sent out, which carries the validity period parameter.

[0069] The validity period parameter carried in the configuration information is determined based on the network transmission speed of the network environment, and the validity period parameter carried in the configuration information is negatively correlated with the network transmission speed. 2) The flood suppression device uses the validity period parameter carried in the configuration information as the preset validity period corresponding to the negative cache entry.

[0070] For example, when the network transmission speed is fast, the preset validity period can be set to be relatively short to allow for timely re-probing of the backend object storage; when the network transmission speed is slow, the preset validity period can be set to be relatively long to reduce the number of backend queries.

[0071] Optionally, upon receiving a read request for the target object, it can first be determined whether the target object corresponds to a positive cache entry; if a positive cache entry exists, the data of the target object is returned directly without proceeding to the subsequent negative cache determination process. This part belongs to conventional cache hit processing and can be implemented in conjunction with this embodiment.

[0072] Step 202: If a negative cache entry corresponding to the target object is found and the negative cache entry has not exceeded the preset validity period, return a not found error message and do not send a backend query request to the backend object storage.

[0073] The Not Found error message is used to indicate that the target object does not exist in the backend object storage. For example, it can be an ErrNotFound error or an object non-existent status code (such as HTTP 404).

[0074] In other words, if a negative cache entry corresponding to the target object exists in the local cache, and the negative cache entry has not exceeded its TTL since it was written, the negative result can be considered still valid, and there is no need to confirm with the backend object storage again.

[0075] At this point, simply returning a "not found" error message to the initiator of the read request completes the processing of this read request, while avoiding sending duplicate query requests to the backend object storage. For retry requests from the NBD kernel driver, within the validity period of the negative cache entry, these retry requests can be short-circuited within the user-space daemon process, preventing them from reaching the backend object storage, thus effectively suppressing request flooding.

[0076] In one possible implementation, determining whether a negative cache entry exceeds the TTL can be based on whether the difference between the write timestamp recorded in the negative cache entry and the current time is greater than the TTL: If the difference is less than or equal to the TTL, the cached entry is considered valid. If the difference is greater than TTL, the negative cache entry is considered to have expired.

[0077] Optionally, the lookup and expiration determination of the negative cache entry can be completed during the cache lookup process, or they can be performed separately after the negative cache entry is found.

[0078] Step 203: If no cache entry corresponding to the target object is found, or if a negative cache entry corresponding to the target object is found but the negative cache entry has exceeded the preset validity period, initiate a backend query request for the target object to the backend object storage.

[0079] Among them, no cache entry corresponding to the target object was found, including cases where there is neither a positive cache entry nor a negative cache entry in the local cache.

[0080] If a negative cache entry has exceeded its TTL, it means that the negative cache entry has expired and can no longer be used as a basis for short-circuiting. It is necessary to reconfirm the true state of the target object from the backend object store.

[0081] In one possible implementation, expired negative cache entries can be deleted from the local cache before the backend query request is initiated to maintain the timeliness of cached data; alternatively, they can be deleted after the query results are returned. This embodiment does not limit this approach.

[0082] For example, backend query requests can be sent to the backend object storage via network protocols, such as sending a request to the object storage service via HTTP to retrieve object metadata or object content. The response returned by the object storage service may include object content, an object non-existent status code (such as HTTP 404), a network timeout error (such as context deadlineexceeded), a server error (such as 5xx), etc. Backend query requests can be initiated based on the key-value pairs of a target object to obtain the latest status of that target object in the backend object storage.

[0083] Optionally, to avoid multiple concurrent read requests for the same target object triggering multiple backend queries simultaneously, backend query requests sent to the backend object storage can be executed using a multiplexing mechanism. The multiplexing mechanism can merge multiple concurrent backend queries for the same target object into a single backend request, thereby reducing backend load.

[0084] For example, the multi-way merging mechanism can be specifically implemented as a singleflight mechanism, as explained above and will not be repeated here.

[0085] Step 204: If the result of the backend query request indicates that the target object does not exist in the backend object storage, write the negative cache entry corresponding to the target object into the local cache and return a not found error message.

[0086] The result of the backend query request indicates that the target object does not exist. For example, the backend object storage returns an HTTP 404 status code or an error flag (ErrNotFound) to indicate that the object does not exist.

[0087] At this point, it indicates that the target object is indeed missing in the backend object storage. To prevent subsequent duplicate read requests for the target object from reaching the backend storage again, a negative cache entry for the target object is written to the local cache, allowing subsequent requests to be bypassed directly within the validity period of the negative cache entry. After writing the negative cache entry, a "not found" error message is returned to the initiator of this read request.

[0088] It should be noted that if the result of the backend query request indicates that the target object exists in the backend object storage, this step does not involve writing a negative cache entry. In this case, the target object's data can be written to the local cache as a positive cache entry, and the target object's data can be returned to the initiator of the read request, following the conventional caching process. This positive caching process is a conventional technique in this field and will not be elaborated upon here.

[0089] In one possible implementation, after a negative cache entry has exceeded its preset expiration date and been deleted from the local cache, this application can also automatically resume detection after the negative cache entry expires. Specifically, the flood suppression device performs the following steps: (1) After deleting the negative cache entry from the local cache, in response to the next read request for the target object, a backend query request is sent to the backend object storage; Since the negative cache entry has been deleted, there is no valid negative cache entry for the target object in the local cache. Therefore, the next read request will not be short-circuited due to hitting the negative cache entry, but will instead enter the backend query process normally and reconfirm the current state of the target object with the backend object store.

[0090] (2) If the result of the re-initiated backend query request indicates that the target object exists in the backend object storage, return the data of the target object. If the target object has reappeared in the backend object storage due to reasons such as re-uploading, the re-initiated backend query request can obtain the data of the target object and return the data of the target object to the initiator of the read request, realizing automatic recovery detection without manual intervention or cache clearing operations.

[0091] Therefore, this application achieves system self-healing by negating the automatic deletion of expired cache entries and subsequent re-queries, enabling automatic resumption of normal reading after object recovery, while balancing request flood suppression and business recovery capabilities. Optionally, if the result of a backend query request indicates that the target object does not exist in the backend object storage, a first log can be recorded at the warning level (WARN). The first log carries descriptive information indicating the permanent absence of the object, the object identifier of the target object, and the block offset corresponding to the read request. By recording at the warning level, it can be distinguished from the error-level logs of transient errors in subsequent embodiments, reducing alarm noise.

[0092] Based on the above technical solution, this application embodiment implements negative caching of missing objects and request short-circuit suppression. For the same target object, after the initial backend query confirms that it does not exist, subsequent read requests received within the validity period of the negative cache entry will no longer reach the backend object storage, thereby effectively reducing duplicate queries, reducing backend storage access pressure, and improving system resource utilization efficiency and response performance.

[0093] For example, Figure 3 This is the second flowchart illustrating the negative cache request flooding suppression method for block device storage provided in this application. Figure 3 As shown, this method further includes the following steps when the backend query request returns different types of results: Step 301: If the result of the backend query request indicates a transient error, do not write the negative cache entry corresponding to the target object into the local cache.

[0094] A transient error refers to a query failure where the existence of the target object in the backend object storage is not confirmed. In other words, the backend query request failed to confirm whether the target object exists in the backend object storage, rather than explicitly confirming that the target object does not exist.

[0095] It should be noted that transient errors and object non-existence are fundamentally different: object non-existence is a result in the backend object storage explicitly returning a status code (such as HTTP 404) or error identifier (such as ErrNotFound) to indicate that the object does not exist; while transient errors only indicate that the query could not be completed due to network or server-side exceptions, and the target object may still exist in the backend object storage.

[0096] For example, transient errors may include at least one of a network timeout error and a server-side error returned by the backend object storage. A network timeout error is, for example, "context deadline exceeded," and a server-side error is, for example, a 5xx status code.

[0097] For the aforementioned transient errors, since the actual existence of the target object in the backend object storage cannot be confirmed, a negative cache entry is not written to the local cache. If a transient error is mistakenly judged as the target object not existing and written to a negative cache entry, then during the validity period of the negative cache entry, read requests for that target object will be continuously short-circuited and return a "not found" error message. Even if the target object actually still exists, this will lead to data read errors and affect system correctness.

[0098] Step 302: Return the error message corresponding to the transient error.

[0099] Transient errors are used to characterize query failures where the existence status of the target object in the backend object storage is not confirmed. Transient errors include at least one of network timeout errors and server-side errors returned by the backend object storage.

[0100] Optionally, the flood suppression device returns an error message corresponding to the transient error to the initiator of the read request without writing a negative cache entry. This error message indicates that the read request failed due to a transient error in the backend query, but this failure does not mean that the target object does not exist in the backend object storage. The error message may carry a type identifier for the transient error, such as a network timeout error or a server-side error, so that upper-layer applications can handle it accordingly.

[0101] In one possible implementation, the returned error message can follow the error return path of existing cache misses and failed queries, for example, by directly propagating the error message returned by the backend query request to the initiator of the read request. For the NBD kernel driver, receiving the error message may trigger a retry mechanism, re-initiating a read request for the same target object.

[0102] Step 303: After returning the error message corresponding to the transient error, re-initiate a backend query request to the backend object storage for subsequent read requests of the target object.

[0103] Because the transient error was not written to the negative cache entry, there is no valid negative cache entry for the target object in the local cache. Therefore, when a subsequent read request arrives, the cache lookup process will enter the backend query step due to the failure to find a valid negative cache entry, and will re-send a backend query request to the backend object storage.

[0104] It's important to note that this step aims to ensure the system can automatically recover from transient errors. Once the network or backend object storage service recovers, re-initiated backend query requests can correctly retrieve the existence status of the target object, preventing the target object from being incorrectly blocked due to transient errors. For retry requests from the NBD kernel driver, since there are no negative cache entries in the local cache, retry requests will not be short-circuited but will instead re-reach the backend object storage, ensuring the availability of the read path.

[0105] Step 304: If the result of the backend query request indicates that the target object does not exist in the backend object storage, log the first log at the warning level.

[0106] The first log contains descriptive information indicating the permanent loss of an object, the object identifier of the target object, and the block offset corresponding to the read request.

[0107] For example, if the result of a backend query request indicates that the target object does not exist in the backend object storage, it may include a status code returned by the backend object storage indicating that the object does not exist, or an error flag returned by the backend object storage indicating that the object does not exist. In this case, it means that the target object is permanently missing from the backend object storage, which is an expected state and not a system failure. Therefore, a warning (WARN) level log is logged first.

[0108] The first log can carry descriptive information indicating that an object is permanently missing, the object identifier of the target object, and the block offset corresponding to the read request. For example, the message template of the first log can include descriptive fields such as "object permanently absent (not-found), block will fail", along with observable fields such as the object identifier of the target object and the block offset, to facilitate subsequent auditing and problem tracking.

[0109] Step 305: If the result of the backend query request indicates that a transient error has occurred, log a second log at the error level.

[0110] Among them, alarms at the error level have a higher priority than alarms at the warning level.

[0111] Understandably, if a backend query request indicates a transient error, it means the query failed to complete due to a network or server-side anomaly, potentially affecting system operation and requiring attention from maintenance personnel. Therefore, a second log is recorded with the error level (ERROR). This second log can carry the error type of the transient error and the context information corresponding to the query request, facilitating rapid problem localization.

[0112] Thus, the flood suppression device differentiates the log levels for permanent object loss and transient errors by recording the first log at the warning level and the second log at the error level.

[0113] The flood suppression device can be configured with alarm rules according to different log levels. For example, it can lower the alarm threshold or prevent alarms from being triggered for the first log at the warning level, while maintaining high-priority alarms for the second log at the error level. This can eliminate alarm noise caused by permanent object loss while retaining the high-priority notification capability for transient errors, improving the accuracy of operation and maintenance alarms and reducing the mean time to failure.

[0114] Based on the above technical solution, this application embodiment does not write a negative cache entry when the result of the backend query request indicates a transient error, and returns an error message corresponding to the transient error. This allows subsequent read requests to re-initiate a backend query request to the backend object storage, avoiding the erroneous blocking of the target object due to a transient error. At the same time, by recording a first log of permanent object loss at the warning level and a second log of transient error at the error level, and by utilizing the alarm priority of the error level being higher than the warning level, the log levels of permanent object loss and transient error are differentiated, thereby improving the accuracy of monitoring alarms and reducing the operational burden.

[0115] For example, Figure 4 This is the third flowchart illustrating the negative cache request flooding suppression method for block device storage provided in this application. Figure 4 As shown, the method also includes the following steps: Step 401: Initiate a backend query request to the backend object storage through a multi-way merging mechanism.

[0116] The multi-path merging mechanism is used when there are multiple concurrent query requests for the same target object. Only one of the concurrent query requests executes the shared callback, which then initiates a backend query request to the backend object storage. The remaining concurrent query requests wait for the shared callback to finish executing.

[0117] For an introduction to the multi-path merging mechanism, please refer to the previous text; it will not be repeated here.

[0118] In this step, when multiple concurrent read requests target the same object and none hit a valid cache entry, the flooding suppression mechanism can use the backend query request for that target object as the processing function, using the target object's key as the key for `singleflight`. In this way, only one concurrent query request will execute the shared callback, which will then initiate a backend query request to the backend object storage. The remaining concurrent query requests do not directly query the backend object storage but instead enter a waiting state, sharing their results after the shared callback has finished executing. Through this method, multiple concurrent backend queries for the same target object are merged into a single backend request, effectively reducing the query pressure on the backend object storage.

[0119] Step 402: Use the results of the backend query requests obtained from the shared callback as the query results for each of the multiple concurrent queries.

[0120] Optionally, after the shared callback is executed, the result of the backend query request will be obtained. This result may include types such as object existence, object non-existence, and transient error.

[0121] For the remaining concurrent query requests waiting for the shared callback to complete, the multiplexing mechanism uses the result of the backend query request obtained from the shared callback as the query result of each of the multiple concurrent queries.

[0122] In other words, multiple concurrent query requests all use the result of the same backend query request as their own query result, without each request needing to independently query the backend object storage. This ensures the consistency of results from multiple concurrent query requests while avoiding duplicate queries.

[0123] In one possible implementation, the multiplexing mechanism can pass the results of the backend query request to all waiting concurrent query requests after the shared callback has been executed, through message notification, shared variables, or callback functions.

[0124] Step 403: Write the negative cache entry corresponding to the target object to the local cache within the shared callback.

[0125] Among multiple concurrent query requests for the same target object, only the concurrent query request that executes the shared callback performs the writing of the negative cache entry.

[0126] Optionally, when the result of the backend query request obtained from the shared callback indicates that the target object does not exist in the backend object storage, a negative cache entry corresponding to the target object needs to be written to the local cache.

[0127] Since only one of the multiple concurrent query requests executes the shared callback, the write operation for this negative cache entry is also performed only by the concurrent query request that executed the shared callback. The remaining concurrent query requests, not having executed the shared callback, will not repeat the write operation.

[0128] Therefore, the flood suppression device, by performing writes within a shared callback, ensures that multiple concurrent query requests for the same target object will only generate one negative cache entry write, avoiding duplicate writes and data races. During the write operation, the negative cache entry can carry a special flag value and a write timestamp, and be configured with a corresponding preset expiration period. The specific implementation of the write operation can be consistent with step 204 above, and will not be repeated here.

[0129] Step 404: Return a Not Found error message to each concurrent query waiting for the query result of the target object.

[0130] Optionally, after writing the negative cache entry within the shared callback, a "not found" error message needs to be returned to each concurrent query waiting for the result of the target object. This "not found" error message indicates that the target object does not exist in the backend object storage.

[0131] Since multiple concurrent query requests share the execution result of the shared callback, they will all receive a not found error message instead of each initiating a query to the backend object storage.

[0132] In one possible implementation, the multiplexing mechanism can return the "not found" error message as a shared result to all waiting concurrent query requests after the shared callback has finished executing. This way, multiple concurrent read requests for the same target object will all receive the same "not found" error message after a single backend query confirms the object does not exist, and subsequent requests can be directly short-circuited within the validity period of the negative cache entry.

[0133] Step 405: For writes to negative cache entries triggered by independent concurrent access requests that have not undergone multiple-way merging, check whether a cache entry corresponding to the target object already exists in the local cache before writing. Both read and write operations to the local cache are performed under the protection of a mutex lock.

[0134] Among them, independent concurrent access requests that have not undergone multiple merging mechanisms refer to concurrent access requests that execute backend queries independently without being merged through mechanisms such as singleflight.

[0135] For example, in some implementations, different code paths or different callers may not have multiplexing enabled, or the multiplexing mechanism may not cover all concurrent access scenarios. For such independent concurrent access requests, there may still be multiple requests for the same target object that each initiate a backend query and attempt to write a negative cache entry.

[0136] Optionally, to avoid multiple independent concurrent access requests repeatedly writing to or overwriting each other's negative cache entries, a secondary check is performed before writing.

[0137] Specifically, the system first checks whether a cache entry for the target object already exists in the local cache, including negative or positive cache entries. Furthermore, during the above check and subsequent write operations, both read and write operations on the local cache are performed under the protection of a mutex lock to ensure the atomicity of the check and write.

[0138] Step 406: If a cache entry for the target object already exists in the local cache, cancel the writing of this negative cache entry.

[0139] If the check result in step 405 shows that a cache entry corresponding to the target object already exists in the local cache, it means that other concurrent access requests have already written to the cache entry of the target object.

[0140] At this point, continuing to write negative cache entries may overwrite existing entries or cause duplicate writes. Therefore, the writing of this negative cache entry is cancelled to maintain the consistency of cached data.

[0141] It should be noted that after the flood suppression device cancels the write, subsequent read requests for the target object can directly use the existing cache entries in the local cache to respond, without needing to write again.

[0142] Step 407: If there is no cache entry for the target object in the local cache, write the negative cache entry for the target object into the local cache; both read and write operations on the local cache are performed under the protection of a mutex lock.

[0143] If the check result in step 405 shows that there is no cache entry for the target object in the local cache, it indicates that this is the first write operation, and the negative cache entry for the target object can be written to the local cache normally. During the write operation, the negative cache entry can carry a special flag value and a write timestamp, and be configured with a corresponding preset expiration period.

[0144] Meanwhile, the aforementioned write operation, as well as the check operation in step 405 and the write cancellation operation in step 406, are all executed under the premise of applying a mutex lock to the read and write operations of the local cache. Mutex lock protection ensures the atomicity of the check and write processes in concurrent scenarios, avoiding data races and overwrite writes.

[0145] Based on the above technical solutions, this application embodiment merges multiple concurrent query requests for the same target object into a single backend request through a multi-way merging mechanism. Within a shared callback, the concurrent query request that uniquely executes the shared callback writes the negative cache entry, reducing duplicate queries to the backend object storage and duplicate writing of negative cache entries. Simultaneously, by performing a secondary check on independent concurrent access requests that have not undergone multi-way merging before writing the negative cache entry, and by performing local cache read and write operations under the protection of a mutex lock, data contention and overwriting caused by concurrent writes are avoided, thus improving the correctness and system stability of the negative cache mechanism in concurrent scenarios.

[0146] The flood suppression device provided in this application is described below. The flood suppression device described below can be referred to in correspondence with the negative cache request flood suppression method for block device storage described above.

[0147] For example, Figure 5 This is a schematic diagram of a flood suppression device provided in this application. Figure 5 As shown, the flood suppression device includes: a processing unit 501, a transmitting unit 502, and a receiving unit 503.

[0148] Processing unit 501 is configured to, in response to a read request for a target object in the block device, search for a cache entry corresponding to the target object in the local cache. The local cache includes negative cache entries, which indicate that the corresponding object does not exist in the backend object storage. Negative cache entries have a preset expiration time.

[0149] The processing unit 501 is further configured to return a "not found" error message and not initiate a backend query request to the backend object storage if a negative cache entry corresponding to the target object is found and the negative cache entry has not exceeded a preset validity period. The "not found" error message indicates that the target object does not exist in the backend object storage.

[0150] The processing unit 501 is also used to initiate a backend query request for the target object to the backend object storage when no cache entry corresponding to the target object is found, or when a negative cache entry corresponding to the target object is found and the negative cache entry has exceeded the preset validity period.

[0151] The processing unit 501 is also used to write a negative cache entry corresponding to the target object into the local cache when the result of the backend query request indicates that the target object does not exist in the backend object storage.

[0152] Sending unit 502 is used to return a not found error message.

[0153] Optionally, the processing unit 501 is further configured to delete the negative cache entry from the local cache when a negative cache entry corresponding to the target object is found and the negative cache entry has exceeded a preset validity period.

[0154] Optionally, the processing unit 501 is further configured to, after deleting the negative cache entry from the local cache, initiate a backend query request to the backend object storage in response to the next read request for the target object. Optionally, the sending unit 502 is configured to return the data of the target object if the result of the re-initiated backend query request indicates that the target object exists in the backend object storage.

[0155] Optionally, the processing unit 501 is further configured to determine, based on the current time and the write timestamp, whether the negative cache entry has exceeded a preset validity period when a negative cache entry corresponding to the target object is found.

[0156] Optionally, the receiving unit 503 is used to receive the sent configuration information, which carries a validity period parameter. The validity period parameter carried in the configuration information is determined based on the network transmission speed of the current network environment, and is negatively correlated with the network transmission speed.

[0157] Optionally, the processing unit 501 is further configured to use the validity period parameter carried in the configuration information as the preset validity period corresponding to the negative cache entry.

[0158] Optionally, the processing unit 501 is also configured to not write the negative cache entry corresponding to the target object into the local cache if the result of the backend query request indicates a transient error.

[0159] Optionally, the sending unit 502 is further configured to return an error message corresponding to a transient error. The transient error is used to characterize a query failure where the existence status of the target object in the backend object storage has not been confirmed. The transient error includes at least one of a network timeout error and a server-side error returned by the backend object storage.

[0160] Optionally, the processing unit 501 is also configured to, after returning the error message corresponding to the transient error, re-initiate a backend query request to the backend object storage for subsequent read requests of the target object.

[0161] Optionally, the sending unit 502 is further configured to initiate a backend query request to the backend object storage via a multiplexing mechanism. The multiplexing mechanism is used when multiple concurrent query requests exist for the same target object, so that only one of the concurrent query requests executes a shared callback, which then initiates a single backend query request to the backend object storage. The remaining concurrent query requests wait for the shared callback to complete.

[0162] Optionally, the processing unit 501 is also used to use the result of the backend query request obtained from the shared callback as the query result of each of the multiple concurrent queries.

[0163] Optionally, the processing unit 501 is also used to write the negative cache entry corresponding to the target object into the local cache within the shared callback, wherein only the concurrent query request executing the shared callback performs the writing of the negative cache entry among multiple concurrent query requests for the same target object.

[0164] Optionally, the sending unit 502 is also configured to return a not found error message to each concurrent query waiting for the query result of the target object.

[0165] Optionally, the processing unit 501 is also used to check whether a cache entry corresponding to the target object already exists in the local cache before writing a negative cache entry triggered by an independent concurrent access request that has not undergone multiple-way merging mechanism.

[0166] Optionally, the processing unit 501 is also used to cancel the writing of the current negative cache entry if a cache entry corresponding to the target object already exists in the local cache.

[0167] Optionally, the processing unit 501 is further configured to write the negative cache entry corresponding to the target object into the local cache when there is no cache entry corresponding to the target object in the local cache; wherein, both read and write operations on the local cache are performed under the protection of a mutex lock.

[0168] Optionally, processing unit 501 is further configured to record a first log at a warning level if the result of a backend query request indicates that the target object does not exist in the backend object storage. The first log carries descriptive information indicating that the object is permanently missing, the object identifier of the target object, and the block offset corresponding to the read request.

[0169] Optionally, the processing unit 501 is further configured to record a second log at an error level if the result of the backend query request indicates a transient error. The alarm priority at the error level is higher than that at the warning level.

[0170] For example, Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communications interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute any of the aforementioned negative cache request flooding suppression methods stored in the block device.

[0171] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0172] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute any of the above-mentioned negative cache request flooding suppression methods for block device storage.

[0173] In another aspect, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform any of the aforementioned negative cache request flooding suppression methods for block device storage.

[0174] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0175] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0176] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for suppressing negative cache request flooding in block device storage, characterized in that, The method includes: In response to a read request for a target object in a block device, the cache entry corresponding to the target object is searched in the local cache; wherein, the local cache includes a negative cache entry, which is used to indicate that the corresponding object does not exist in the backend object storage, and the negative cache entry has a corresponding preset validity period; If a negative cache entry corresponding to the target object is found and the negative cache entry has not exceeded the preset validity period, a "not found" error message is returned, and no backend query request is initiated to the backend object storage; wherein, the "not found" error message is used to indicate that the target object does not exist in the backend object storage; If no cache entry corresponding to the target object is found, or if a negative cache entry corresponding to the target object is found and the negative cache entry has exceeded the preset validity period, a backend query request for the target object is initiated to the backend object storage. If the result of the backend query request indicates that the target object does not exist in the backend object storage, write the negative cache entry corresponding to the target object into the local cache and return the not found error message.

2. The method according to claim 1, characterized in that, The method further includes: If a negative cache entry corresponding to the target object is found, and the negative cache entry has exceeded the preset validity period, the negative cache entry is deleted from the local cache.

3. The method according to claim 2, characterized in that, The method further includes: After deleting the negative cache entry from the local cache, in response to the next read request for the target object, a backend query request is initiated to the backend object storage; If the result of the re-initiated backend query request indicates that the target object exists in the backend object storage, the data of the target object shall be returned.

4. The method according to claim 1, characterized in that, The negative cache entry carries a special flag value and a write timestamp; wherein, the special flag value is used to identify the negative cache entry; The method further includes: If a negative cache entry corresponding to the target object is found, it is determined whether the negative cache entry has exceeded the preset validity period based on the current time and the write timestamp.

5. The method according to claim 1, characterized in that, The method further includes: The system receives configuration information, which carries a validity period parameter. The validity period parameter is determined based on the network transmission speed of the network environment, and is negatively correlated with the network transmission speed. The validity period parameter carried in the configuration information is used as the preset validity period corresponding to the negative cache entry.

6. The method according to claim 1, characterized in that, After initiating a backend query request for the target object to the backend object storage, the method further includes: If the result of the backend query request indicates a transient error, the negative cache entry corresponding to the target object will not be written to the local cache. Return the error message corresponding to the transient error; wherein, the transient error is used to characterize the query failure in which the existence status of the target object in the backend object storage is not confirmed, and the transient error includes at least one of network timeout error and server error returned by the backend object storage; After returning the error message corresponding to the transient error, a backend query request is re-initiated to the backend object storage for subsequent read requests of the target object.

7. The method according to claim 1, characterized in that, The step of initiating a backend query request for the target object to the backend object storage includes: A backend query request is initiated to the backend object storage through a multi-way merging mechanism; wherein, the multi-way merging mechanism is used to ensure that when there are multiple concurrent query requests for the same target object, only one of the multiple concurrent query requests executes a shared callback, and the shared callback initiates a backend query request to the backend object storage once, while the other concurrent query requests wait for the shared callback to complete. The result of the backend query request obtained from the shared callback is used as the query result of each of the multiple concurrent queries; The step of writing the negative cache entry corresponding to the target object into the local cache and returning the not found error message includes: Within the shared callback, the negative cache entry corresponding to the target object is written to the local cache. Among multiple concurrent query requests for the same target object, only the concurrent query request executing the shared callback performs the writing of the negative cache entry. Return the not found error message to each concurrent query that is waiting for the query result of the target object.

8. The method according to claim 7, characterized in that, The method further includes: For negative cache entry writes triggered by independent concurrent access requests that have not undergone the multi-way merging mechanism, check whether a cache entry corresponding to the target object already exists in the local cache before writing; If a cache entry corresponding to the target object already exists in the local cache, cancel the writing of this negative cache entry; If no cache entry for the target object exists in the local cache, a negative cache entry for the target object is written into the local cache. Both read and write operations on the local cache are performed under the protection of a mutex lock.

9. The method according to claim 6, characterized in that, The result of the backend query request indicating that the target object does not exist in the backend object storage includes: the backend object storage returning a status code indicating that the object does not exist, or the backend object storage returning an error identifier indicating that the object does not exist; The method further includes: If the result of the backend query request indicates that the target object does not exist in the backend object storage, a first log is recorded at the warning level; the first log carries descriptive information to characterize the permanent absence of the object, the object identifier of the target object, and the block offset corresponding to the read request; If the result of the backend query request indicates that the transient error has occurred, a second log is recorded at the error level; wherein the alarm priority of the error level is higher than the alarm priority of the warning level.

10. A negative cache request flooding suppression system for block device storage, characterized in that, The system includes: The cache lookup module is used to respond to a read request for a target object in the block device by looking up the cache entry corresponding to the target object in the local cache; the negative cache entry in the local cache is a cache entry used to indicate that the corresponding object does not exist in the backend object storage, and the negative cache entry corresponds to a preset validity period; The negative cache short-circuit module is used to return a "not found" error message and not initiate a backend query request to the backend object storage when a negative cache entry corresponding to the target object is found and the negative cache entry has not exceeded the preset validity period; the "not found" error message is used to indicate that the target object does not exist in the backend object storage; The backend query module is used to initiate a backend query request for the target object to the backend object storage when no cache entry corresponding to the target object is found, or when a negative cache entry corresponding to the target object is found and the negative cache entry has exceeded the preset validity period. The negative write module is used to write a negative cache entry corresponding to the target object in the local cache and return the not found error message when the result of the backend query request indicates that the target object does not exist in the backend object storage.