Intelligent cache management system and synchronization method based on set
Patent Information
- Application Number
- CN202410484697.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-22
- Publication Date
- 2024-10-01
AI Technical Summary
缓存服务需要兼容各个服务的缓存数据格式,可能会导致服务负载较大
[0011] Beneficial effects: The collection-based intelligent cache management system and synchronization method of this application match different cache operation plans based on the cache type of the target cache data, can satisfy the use of different cache plans in different scenarios, and improve cache read and write performance. Save unnecessary process interactions, reduce the operating pressure of cache services, improve cache service performance, and reduce access time and resource overhead. Compared with traditional methods, the system response speed and storage utilization are improved.
Smart Images

Figure CN118733291A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a set-based intelligent cache management system and synchronization method. Background Art
[0002] As the complexity of modern software systems increases, a large number of applications need to process massive amounts of data and high-concurrency requests. In this context, the cache system has become a key component to improve application performance and response speed. However, traditional cache systems often face a variety of challenges, including but not limited to: performance pressure under high-concurrency read and write operations, data consistency problems caused by different data access modes, insufficient cache warm-up and elimination strategies, and the matching of cache data structures with underlying data sources. Specifically, when there are multiple service deployments in a project or product, another process is usually used as their common cache service to ensure that the cache read by each service is consistent. The cache service needs to be compatible with the cache data format of each service, which may cause a large service load. In addition, since the cache service and the service that calls it do not belong to the same process, there will be a certain delay in sending and receiving cache read and write instructions, and there is a great possibility that it will be affected by network factors. Therefore, when the data volume is large or the read and write frequency is high, the performance is often lower than expected. Therefore, in some cases where the data reading speed requirement is very high, the cache service will have insufficient performance in the solution of the prior art. Summary of the invention
[0003] The purpose of this application is to provide a set-based intelligent cache management system and synchronization method to solve the technical problems raised in the above background.
[0004] To achieve the above objectives, the present application discloses the following technical solutions: a set-based intelligent cache management system and synchronization method, the method comprising the following steps:
[0005] The user requests service A, wherein service A needs to operate cache data when processing the request, and defines the cache data as target cache data;
[0006] Parse the target cache data to obtain the corresponding cache type; the cache type includes a common data type, a state data type and a configuration data type, wherein the state data type is cache data that only needs to be used in local services, changes frequently and needs to be updated in real time, and the configuration data type is cache data that needs to be used by multiple services, changes less but is read frequently;
[0007] When the cache type of the target cache data is a common data type, service A reads and writes cache service C to perform operations on the target cache data;
[0008] When the cache type of the target cache data is a status data type, service A stores the target cache data in an internal cache to read and write the target cache data;
[0009] When the cache type of the target cache data is a configuration data type, service A stores the target cache data in an internal cache for reading and writing, and uses an internal http request to notify service B for synchronizing the cache between service A and service B.
[0010] Preferably, the cache synchronization specifically includes: service B stores the target cache data into an internal cache for reading and writing.
[0011] Beneficial effects: The set-based intelligent cache management system and synchronization method of the present application matches different cache operation schemes based on the cache type of the target cache data, can meet the use of different cache schemes in different scenarios, improve cache read and write performance, save unnecessary process interactions, reduce the operating pressure of cache services, improve cache service performance, and reduce access time and resource overhead. Compared with traditional methods, the system response speed and storage utilization rate are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 A flowchart of a set-based intelligent cache management system and synchronization method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0014] The technical solutions in the embodiments of the present application are described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0015] In this article, the term "comprising" is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, the elements defined by the sentence "comprising..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0016] In a first aspect, this embodiment discloses Figure 1 The working method of a set-based intelligent cache management system and synchronization method shown in the figure comprises the following steps:
[0017] The user requests service A, wherein service A needs to operate cache data when processing the request, and defines the cache data as target cache data;
[0018] Parse the target cache data to obtain the corresponding cache type; the cache type includes common data types, state data types and configuration data types. It should be noted that common data types refer to commonly used caches, such as temporary data used for marking that is frequently read and written. In this case, you only need to be consistent with the existing solution and directly read and write "cache service C". The state data type is cache data that only needs to be used in local services, changes frequently and needs to be updated in real time. The configuration data type is cache data that needs to be used by multiple services, changes less but is read frequently.
[0019] When the cache type of the target cache data is a common data type, service A reads and writes cache service C to perform operations on the target cache data.
[0020] When the cache type of the target cache data is a status data type, service A stores the target cache data in an internal cache to perform read and write operations to complete the target cache data.
[0021] When the cache type of the target cache data is a configuration data type, service A stores the target cache data in an internal cache for reading and writing, and uses an internal http request to notify service B for cache synchronization between service A and service B. During cache synchronization, service B stores the target cache data in an internal cache for reading and writing.
[0022] Furthermore, it is feasible that the business scenarios in different services may vary greatly, and the cache structures required to be used are also very different. In the internal cache, the structure of the collection can be customized without being restricted by the fixed structure storage of the cache service C.
[0023] Through the above, the set-based intelligent cache management system and synchronization method of this embodiment have achieved significant technical progress in managing and optimizing cache storage. The core is to determine the access mode through different business scenarios, adjust the cache strategy in real time, and adopt an efficient synchronization method, thereby greatly improving the cache performance and reducing the access time and resource overhead. In such a diverse cache mode, it has efficient query, insertion and deletion operations, which greatly improves the system's response speed and storage utilization compared to traditional methods. The design and application of these collection modules are important innovations of this patent. At the same time, the cache management system has good scalability and flexibility. Different strategies can be adjusted according to different scenarios and needs, allowing the system to flexibly adapt to different applications and environments, providing users with a more optimized cache management solution.
[0024] Next, the set-based intelligent cache management system and synchronization method of this embodiment and the prior art solutions are further described and compared with specific examples.
[0025] 1. Example
[0026] Assume that a positioning system has related functions such as real-time positioning of personnel and warning of entry into an area.
[0027] 2. Realistic scenarios
[0028] Assume that the system needs to record the real-time location of personnel, with a recording frequency of 3 times per second. At the same time, some restricted areas are configured in the system. The background configuration prohibits "Zhang San" and "Li Si" from entering the "warehouse". If they enter the warehouse, a warning needs to be issued. At this time, the background needs to detect in real time whether Zhang San and Li Si are in the warehouse area.
[0029] Background cache storage:
[0030] (1) Cache a (cache data of common data types): The backend needs to update the last location of Zhang San and Li Si to the cache so that it can be retrieved when determining whether the two are in the warehouse.
[0031] (2) Cache b (cached data of the configuration data type): Since the regional range data of the warehouse is read very frequently and modified very rarely, we will load it into the cache.
[0032] (3) Cache c (cache data of status data type): The identification of whether Zhang San and Li Si have entered the warehouse belongs to a temporary status data type and needs to be updated and judged in real time. When this identification shows that two people have entered the warehouse, a warning will be issued.
[0033] 3. Solution 1 (i.e. solution based on existing technology)
[0034] According to the existing technology, cache a, cache b, and cache c will all exist in "cache service C". Since cache b has an extremely high reading frequency and cache c has an extremely high update speed, when the number of people reaches a certain level, the interaction between processes will become very frequent, the required network bandwidth will increase dramatically, and the network latency will also be higher. High latency will also lead to a sharp accumulation of unprocessed data, forming a vicious circle.
[0035] 4. Solution 2 (Solution based on this application)
[0036] In the optimization scheme, since the update frequency of cache a is 3 times / second, which is equivalent to an update every 333 milliseconds, this update speed is not very high, so it can be stored in "cache service C" and shared with other services.
[0037] Cache B stores warehouse area data. Generally, area data is rarely updated, but in this business scenario, its reading frequency is extremely high, because each time the location information of a configured person is updated, the warehouse area cache needs to be queried once, so its access volume will increase exponentially with the increase in the number of configured personnel. At this time, we store the cache in the internal cache of each service. When the warehouse area changes, we use the http protocol to notify other services to update the warehouse area information.
[0038] Cache c stores temporary status data. Every time the background completes the logical judgment of "whether Zhang San and Li Si are in the warehouse", the status of cache c needs to be updated. Such temporary status data type is often only used for the current service, so we store it in the internal cache of our own service. Since other services will not use such data, there is no need to notify other services to update.
[0039] Based on the above, the solution based on the present application has the following characteristics compared with the solution based on the prior art:
[0040] 1.Excellent performance optimization
[0041] The solution of this application introduces a collection-based intelligent cache management system, whose biggest advantage is the significant improvement in performance. By applying efficient cache strategies to access patterns in different scenarios, the system can significantly reduce data access time and effectively reduce the system's response latency. Compared with traditional cache systems, this system performs better when processing large-scale data and high-concurrency access.
[0042] 2. Efficient cache utilization
[0043] Compared with the solutions of the prior art, the set data structure adopted by the solution of the present application has obvious advantages in storage utilization. These data structures allow more efficient data management and storage organization, reduce the waste of storage space, and maximize the cache hit rate and reduce unnecessary data access operations through intelligent adjustment.
[0044] 3. Flexible dynamic optimization
[0045] The dynamic optimization strategy introduced in the solution of this application gives the system a high degree of flexibility. It can dynamically adjust the cache management strategy according to real-time conditions and needs, allowing the system to adapt to different workloads and data access modes, and provide more personalized and optimized services.
[0046] In summary, the set-based intelligent cache management system and synchronization method disclosed in this embodiment match different cache operation schemes based on the cache type of the target cache data, which can meet the use of different cache schemes in different scenarios, improve cache read and write performance, save unnecessary process interactions, reduce the operating pressure of cache services, improve cache service performance, and reduce access time and resource overhead.
[0047] In the embodiments provided in the present application, it should be understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, code or any appropriate combination thereof. For hardware implementation, the processor can be implemented in one or more of the following units: application specific integrated circuit (ASIC), digital signal processor (DSP), digital signal processing device (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), processor, controller, microcontroller, microprocessor, other electronic units designed to implement the functions described herein or their combination. For software implementation, part or all of the flow of the embodiment can be completed by instructing the relevant hardware through a computer program. When implemented, the above program can be stored in a computer-readable storage medium or transmitted as one or more instructions or codes on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein the communication medium includes any medium that is convenient for transmitting a computer program from one place to another. The storage medium can be any available medium that a computer can access. The computer-readable storage medium can include but is not limited to RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer.
[0048] Finally, it should be noted that the above is only a preferred embodiment of the present application and is not intended to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A set-based intelligent cache management system and synchronization method, characterized in that: The method comprises the following steps: The user requests service A, wherein service A needs to operate cache data when processing the request, and defines the cache data as target cache data; Parse the target cache data to obtain the corresponding cache type; the cache type includes a common data type, a state data type and a configuration data type, wherein the state data type is cache data that only needs to be used in local services, changes frequently and needs to be updated in real time, and the configuration data type is cache data that needs to be used by multiple services, changes less but is read frequently; When the cache type of the target cache data is a common data type, service A reads and writes cache service C to perform operations on the target cache data; When the cache type of the target cache data is a status data type, service A stores the target cache data in an internal cache to read and write the target cache data; When the cache type of the target cache data is a configuration data type, service A stores the target cache data in an internal cache for reading and writing, and service A uses an internal http request to notify service B for synchronizing the cache between service A and service B.
2. The set-based intelligent cache management system and synchronization method according to claim 1, characterized in that: The cache synchronization specifically includes: service B stores the target cache data into an internal cache for reading and writing.
Citation Information
Cited By
Data transmission method and device, equipment and storage medium
CN119946704A
