A cache management method and device, a storage medium and an electronic device
By monitoring cache fluctuations and user distribution information, and dynamically adjusting the cache space, the cache pressure problem of the service platform when a large number of users flood in is solved, and the efficiency and response speed of cache management are improved.
Patent Information
- Application Number
- CN202210907778.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-29
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2042-07-29
AI Technical Summary
When faced with a large influx of users, existing technologies struggle to effectively alleviate the caching pressure on service platforms, leading to increased database load and response delays. Traditional caching strategies are also difficult to optimize flexibly.
By monitoring the cache fluctuations of hot and cold data, we can obtain access user distribution information, dynamically adjust the first and second data cache spaces, and adopt different cache eviction strategies to improve cache hit rate and reduce cache management overhead.
It improved the cache hit rate, reduced the processing pressure on the service platform, reduced the burden on the backend database, and improved the utilization efficiency and robustness of the cache space.
Smart Images

Figure CN115334158B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a cache management method, apparatus, storage medium and electronic device. Background Technology
[0002] With the widespread adoption of the internet, the influx of users to service platforms has led to a geometrical increase in the amount of data accessed, presenting both challenges and opportunities for service platform management. To ensure smooth transactions between the service platform and clients, data caching and update technology will be adopted to enable the service platform to achieve a higher external processing speed. Summary of the Invention
[0003] This specification provides a cache management method, apparatus, storage medium, and electronic device, the technical solution of which is as follows:
[0004] Firstly, this specification provides a cache management method, the method comprising:
[0005] Monitor cache fluctuations for hot and cold data, and obtain access user distribution information based on the cache fluctuation status.
[0006] Based on the access user distribution information, the cache space of the first data cache space and / or the second data cache space is adjusted. The first data cache space is a data storage space for caching the hot data, and the second data cache space is a data cache space for caching the cold data.
[0007] Secondly, this specification provides a cache management device, the device comprising:
[0008] The information acquisition module is used to monitor the cache fluctuation status of hot data and cold data, and to acquire access user distribution information based on the cache fluctuation status.
[0009] The data processing module is used to adjust the cache space of the first data cache space and / or the second data cache space based on the access user distribution information. The first data cache space is a data storage space for caching the hot data, and the second data cache space is a data cache space for caching the cold data.
[0010] Thirdly, this specification provides a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.
[0011] Fourthly, this specification provides an electronic device that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.
[0012] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following:
[0013] In one or more embodiments of this specification, the service platform monitors the cache fluctuation status of hot and cold data to obtain current access user distribution information, and dynamically adjusts the cache space of the first data cache space and / or the second data cache space based on the access user distribution information. Based on the access user distribution information, the fluctuation of the cache amount of hot and cold data can be predicted to a certain extent, and the corresponding cache space can be adjusted in advance, improving the cache hit rate when requesting data and reducing the cache processing pressure on the service platform. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in this specification 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 only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 This is a schematic diagram of a cache management system provided in this manual;
[0016] Figure 2 This is a flowchart illustrating a cache management method provided in this manual;
[0017] Figure 3 This is a flowchart illustrating another cache management method provided in this manual;
[0018] Figure 4 This is a flowchart illustrating another cache management method provided in this manual;
[0019] Figure 5 This is a schematic diagram of a cache management device provided in this specification;
[0020] Figure 6 This is a structural diagram of an information acquisition module provided in this specification;
[0021] Figure 7 This is a schematic diagram of the structure of a data processing module provided in this specification;
[0022] Figure 8 This is a schematic diagram of another cache management device provided in this specification;
[0023] Figure 9 This is a schematic diagram of the structure of an electronic device provided in this specification;
[0024] Figure 10 This is a schematic diagram of the operating system and user space provided in this manual;
[0025] Figure 11 yes Figure 10 Architecture diagram of the Android operating system in China;
[0026] Figure 12 yes Figure 10 Architecture diagram of the iOS operating system. Detailed Implementation
[0027] The technical solutions in this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0028] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. In the description of this application, it should be noted that, unless otherwise expressly specified and limited, "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances. Furthermore, in the description of this application, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist; for example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0029] In related technologies, cache management is an important means to improve the response speed of service platforms and reduce service pressure. However, due to cost factors, the cache space that service platforms can provide is usually limited. Due to the limitation of cache space, service platforms generally allocate cache space for several types of cached data and then optimize the cache based on the set cache eviction policy. However, this method cannot effectively alleviate cache pressure when faced with cache pressure caused by a large influx of users.
[0030] The present application will now be described in detail with reference to specific embodiments.
[0031] Please see Figure 1 This is a schematic diagram illustrating a scenario for a cache management system provided in this specification. Figure 1 As shown, the cache management system may include at least a client cluster and a service platform 100.
[0032] The client cluster may include at least one client, such as Figure 1 As shown, it specifically includes client 1 corresponding to user 1, client 2 corresponding to user 2, ..., client n corresponding to user n, where n is an integer greater than 0.
[0033] Each client in a client cluster can be an electronic device with communication capabilities, including but not limited to: wearable devices, handheld devices, personal computers, tablets, in-vehicle devices, smartphones, computing devices, or other processing devices connected to a wireless modem. Electronic devices may have different names in different networks, such as: user equipment, access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent or user device, cellular phone, cordless phone, personal digital assistant (PDA), and electronic devices in 5G networks or future evolved networks.
[0034] The service platform 100 can be a standalone server device, such as a rack-mount, blade, tower, or cabinet-type server device, or a workstation, mainframe, or other hardware device with strong computing power; or it can be a server cluster composed of multiple servers. The servers in the service cluster can be composed in a symmetrical manner, wherein each server is functionally and hierarchically equivalent in the transaction chain, and each server can provide services independently. The independent provision of services can be understood as not requiring the assistance of other servers.
[0035] In one or more embodiments of this specification, the service platform 100 can establish a communication connection with at least one client in the client cluster, and complete the interaction of service data based on the communication connection. The service platform 100 can provide corresponding transaction services to at least one client in the client cluster. Transaction services include, but are not limited to, consumption services, shopping services, financial services, credit services, etc., and the specific type of transaction service is determined based on the actual application.
[0036] In the process of providing transaction services to multiple clients by service platform 100, a large number of users will access service platform 100 through their clients in scenarios such as the release of relevant transaction activities and platform hot events. In order to better provide transaction services to the outside world, service platform 100 may pre-introduce distributed service deployment and platform cache construction. However, in some scenarios, under sudden surges in customer access traffic, the access of new and old users is significantly different, making it difficult for conventional caching strategies to flexibly optimize the cache. Based on this, service platform 100 can optimize the first cache space used by service platform 100 for storing hot data and the second cache space used by users to store cold data by executing the cache management method of one or more embodiments of this specification.
[0037] In one or more embodiments of this specification, the service platform 100 stores various types of service data. Clients access or query the corresponding service data from the service platform 100 based on actual scenarios. To avoid significant impacts such as increased burden on the database maintained by the service platform 100, degraded database response, and website display delays in scenarios with increased data volume and concentrated access, the service platform 100 may employ a caching mechanism to optimize data access.
[0038] As an illustration, one caching mechanism works by checking whether the requested data exists in the cache space maintained by the service platform when the client requests data. If it does, the data is returned directly without querying the database.
[0039] If the requested data cannot be found in the cache, the service platform queries the database, returns the data, and simultaneously stores a copy of the data in the cache.
[0040] As an illustration, the service platform 100 can maintain the "freshness" of the cache. Whenever the data changes, the service platform 100 synchronously updates the cache information in the cache space to ensure that users do not retrieve old data from the cache space.
[0041] It should be noted that the service platform 100 establishes a communication connection with at least one client in the client cluster via a network for interactive communication. This network can be a wireless network or a wired network. Wireless networks include, but are not limited to, cellular networks, wireless LANs, infrared networks, or Bluetooth networks. Wired networks include, but are not limited to, Ethernet, universal serial bus (USB), or controller area networks. In one or more embodiments of the specification, technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc., are used to represent data exchanged over the network (such as target compressed packets). Furthermore, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), and Internet Protocol Security (IPsec) can be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can be used to replace or supplement the aforementioned data communication technologies.
[0042] The cache management system embodiments provided in this specification and the cache management methods described in one or more embodiments belong to the same concept. The execution entity corresponding to the cache management method involved in one or more embodiments of this specification can be the aforementioned service platform 100; the execution entity corresponding to the cache management method involved in one or more embodiments of this specification can also be other electronic devices, specifically determined based on the actual application environment. The implementation process of the cache management system embodiments can be detailed in the following method embodiments, and will not be repeated here.
[0043] based on Figure 1 The following is a detailed description of the model processing methods provided in one or more embodiments of this specification, as illustrated in the scene diagram.
[0044] Please see Figure 2 This document provides a flowchart illustrating a cache management method according to one or more embodiments. This method can be implemented using a computer program and can run on a cache management device based on the von Neumann architecture. The computer program can be integrated into an application or run as a standalone utility application. The cache management device can be a service platform.
[0045] Specifically, the cache management method includes:
[0046] S102: Monitor the cache fluctuation status for hot and cold data, and obtain access user distribution information based on the cache fluctuation status;
[0047] In practical application scenarios based on service platforms, service data such as operation logs and service information are usually collected based on access frequency or user access operations. The service data is divided into cold data and hot data according to the data access popularity, and then the data is stored or migrated to the corresponding storage space (such as a database) according to the cold and hot data types.
[0048] In some embodiments, the service platform typically employs a caching mechanism to optimize data access. The service platform maintains a cache space and a database for storing service data. One caching mechanism works as follows: when a client initiates a user request for corresponding data, the service platform checks the client's request data. First, the service platform checks if the requested data exists in the maintained cache space. If it does, it directly returns the requested data to the client without querying the database. If the requested data cannot be found in the cache space, the service platform queries the database, returns the requested data, and simultaneously stores a copy of the requested data in the cache space.
[0049] Understandably, the service platform can maintain the "freshness" of the cache during data processing. Whenever the service data changes, the service platform can synchronously update the cache information in the cache space to ensure that users do not retrieve old service data from the cache space.
[0050] Understandably, in the actual application scenarios of service platforms, service platforms usually divide service data into cold data and hot data based on data popularity. Cold data and hot data can be stored in the cache space and in the database.
[0051] The cache fluctuation state is used to characterize the cache fluctuation of user access to cold and / or hot data in the cache. The cache fluctuation state can be characterized based on the access fluctuation of cold and / or hot data.
[0052] Understandably, the service platform can monitor the cache fluctuation of cold data and / or hot data in real time or periodically to determine the cache fluctuation status. When the ratio of cold and hot data fluctuation is relatively large or stable, the service platform can automatically detect it and process it by executing the cache management methods involved in this manual.
[0053] Specifically, the service platform can monitor the cache fluctuation of cold data and / or hot data in real time or periodically to determine the cache fluctuation status, and obtain access user distribution information based on the cache fluctuation status.
[0054] The access user distribution information is used to provide feedback on the distribution of users of different access user types on the platform. The access user distribution information can be a fit of one or more of the following: the number of users of several access user types, the distribution status of user types, and the fluctuation data of new and old users.
[0055] Optionally, the service platform can obtain access user distribution information by acquiring user access data for each user type within a monitoring window period based on the user types that access the service platform, and then determining the corresponding user fluctuation data based on the user access data for each user type, and using it as access user distribution information.
[0056] For illustrative purposes, user distribution information can be data on fluctuations between new and returning users, such as the ratio of new to returning users, the number of new to returning users, etc. The service platform can (within the monitoring window) acquire first-level user access data for new user types and second-level user access data for returning user types.
[0057] The first user access data may be user access data such as the number of user accesses corresponding to new user types and the number of user accesses increasing (within the monitoring window time); the second user access data may be user access data such as the number of user accesses corresponding to old user types and the number of user accesses increasing (within the monitoring window time).
[0058] Among them, new user type and old user type are user types classified for users accessing the service platform. For example, users who access the platform less than a threshold number (e.g., 1 time) are classified as new users, and users who access the platform more than a threshold number are classified as old users. The classification criteria for new user type and old user type can be customized based on actual application scenarios, and no specific limitation is made here.
[0059] Then, based on the first user access data and the second user access data, the fluctuation data of new and old users is determined. The fluctuation data of new and old users can be a parameter of the fluctuation ratio between new and old users, such as the fluctuation ratio of new users (growth / decrease) and the fluctuation ratio of old users (growth / decrease). Then, the fluctuation data of new and old users is used as the distribution information of accessing users;
[0060] The monitoring window time can be understood as the window time set by the service platform to monitor user access traffic. Usually, for stable traffic, the service platform dynamically sets the adjustment window time at the hour or minute level. For sudden surges in traffic (such as access traffic exceeding a threshold), the service platform dynamically sets a smaller adjustment window time, for example, at the second level.
[0061] S104: Based on the access user distribution information, adjust the cache space of the first data cache space and / or the second data cache space. The first data cache space is a data storage space for caching the hot data, and the second data cache space is a data cache space for caching the cold data.
[0062] It is understood that, in one or more embodiments of this specification, the first data storage space for caching hot data or the second data storage space for caching cold data can be dynamically adjusted based on the actual situation. This can improve the utilization efficiency of the cache space maintained by the service platform, alleviate the cache load, and improve the robustness of cache processing. By adjusting the cache space, the cache hit rate when users request to access data can be improved, and the pressure on the backend database can be reduced.
[0063] In one or more embodiments of this specification, the service platform monitors the cache fluctuation status of hot and cold data, dynamically obtains current user distribution information based on the cache fluctuation status, and dynamically adjusts the cache space of the first data cache space and / or the second data cache space in advance based on the predicted changes in hot and cold caches based on the user distribution information. It is understood that, on the one hand, the user distribution information can predict the fluctuation of the cached amount of hot or cold data to a certain extent. In practical applications, the user distribution information can indicate that in the case of a surge in access from existing user types, hot data cache management typically requires more computation and more hot data needs to be stored; conversely, in the case of a surge in access from new user types, cold data cache management typically requires more computation and more cold data needs to be stored. Therefore, the demand for subsequent hot or cold data can be predicted in advance based on the user distribution information, thereby allowing for advance adjustment of the corresponding data cache space. On the other hand, by adjusting the data cache space for the corresponding data, the frequent migration of cold / hot data cache locations can be avoided in scenarios with large access fluctuations, thereby avoiding increasing the time complexity of cache management and the load on the cache system. Adjusting the cache space accordingly can significantly reduce the cost of cache management to a certain extent.
[0064] In one feasible implementation, the service platform analyzes and processes access user distribution information to determine a target adjustment cache space to be adjusted within a first data cache space and / or a second data cache space, and then adjusts the target adjustment cache space. For example, if the analysis of access user distribution information indicates that subsequent hot data management typically involves a large amount of computation and more hot data needs to be stored, then the target adjustment cache space is the first data cache space; if the analysis of access user distribution information indicates that subsequent cold data management typically involves a large amount of computation and more cold data needs to be stored, then the target adjustment cache space is the second data cache space.
[0065] Optionally, the analysis and processing based on the access user distribution information can be carried out by determining whether the demand for subsequent cold data cache management is high or low based on the access user distribution information, and then determining the target adjustment cache space to be adjusted in the first data cache space and the second data cache space.
[0066] To illustrate, based on the user distribution information, we can determine the proportion of new user types / old user types or the large fluctuations in user distribution. If the proportion of new user types or the large fluctuations in user distribution indicate a high demand for subsequent cold data cache management, then a second data cache space for storing cold data can be added. If the proportion of old user types or the large fluctuations in user distribution indicate a high demand for subsequent hot data cache management, then a first data cache space for storing hot data can be added.
[0067] In one feasible implementation, a least recently used caching mechanism is employed to perform cache eviction processing on the first data cache space, and a least frequently used caching mechanism is employed to perform cache eviction processing on the second data cache space. It is understood that, based on the monitored cache fluctuations of hot and cold data, different eviction strategies are used for the first data cache space used to cache hot data and the second data cache space used to cache cold data to improve cache hit rate.
[0068] In one or more embodiments of this specification, the service platform monitors the cache fluctuation status of hot and cold data to obtain current access user distribution information, and dynamically adjusts the cache space of the first data cache space and / or the second data cache space based on the access user distribution information. Based on the access user distribution information, the fluctuation of the cache amount of hot and cold data can be predicted to a certain extent, allowing for pre-adjustment of the corresponding cache space, improving the cache hit rate when requesting data, reducing the processing pressure on the service platform; and avoiding the need for cache space migration of cached data, which can reduce the time complexity of cache management and the load on the cache system, as well as save on cache management costs.
[0069] Please see Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of a cache management method proposed in one or more embodiments of this specification. Specifically:
[0070] S202: Monitor the buffer fluctuation ratio for hot and cold data;
[0071] The cache fluctuation ratio can be a fit of one or more types of data, such as the hot data cache fluctuation (growth / decrease) ratio, the cold data cache fluctuation (growth / decrease) ratio, and the fluctuation ratio of hot data cache and cold data cache within the monitoring period.
[0072] Understandably, the service platform can monitor the cache fluctuation of cold data and / or hot data in real time or periodically to determine the cache fluctuation ratio. When the cache fluctuation ratio is relatively large or stable, the service platform can automatically detect it and process it by executing the cache management methods involved in this manual.
[0073] S204: If the cache fluctuation ratio is greater than or equal to the fluctuation ratio threshold, then obtain the access user distribution information;
[0074] The fluctuation ratio threshold can be understood as a threshold or critical value set for the cache fluctuation ratio. Different types of cache fluctuation ratios can be set with corresponding fluctuation ratio thresholds. The fluctuation ratio threshold is used to monitor the current distribution of accessing users on the service platform to predict or evaluate the trend of cold and hot data cache changes when the cache fluctuation ratio indicator reaches the critical point.
[0075] The access user distribution information can be a fit of one or more of the following: the number of users of several access user types, the distribution of user types, and the fluctuation data of new and old users.
[0076] In one or more embodiments of this specification, the access user distribution information can be new and old user fluctuation data, such as the new and old user fluctuation ratio, the new and old user fluctuation number, etc. The service platform can (within the monitoring window time) obtain the first user access data for the new user type and the second user access data for the old user type, and then determine the new and old user fluctuation data based on the first user access data and the second user access data. This new and old user fluctuation data is also the access user distribution information, which can reflect the distribution changes of user access volume on the new user type and the old user type.
[0077] Optionally, if the cache fluctuation ratio is greater than or equal to the fluctuation ratio threshold, the service platform may ignore the processing.
[0078] S206: Based on the access user distribution information, determine the target cache adjustment method;
[0079] The target cache adjustment method, based on actual application conditions, includes at least dynamic cache adjustment and cache periodic adjustment.
[0080] In one or more embodiments of this specification, the dynamic cache adjustment method is generally applicable to the method of adjusting the cache space under drastic fluctuation conditions. Under the dynamic cache adjustment method, the cache space of the first data cache space and / or the second data cache space is dynamically adjusted in real time within the monitoring window based on access user distribution information such as fluctuation data of new and old users.
[0081] In one or more embodiments of this specification, the cache period adjustment method is generally applicable to adjusting the cache space under stable fluctuation conditions. The cache period adjustment method is triggered at fixed intervals based on user distribution information such as fluctuation data of new and old users, to adjust the cache space of the first data cache space and / or the second data cache space.
[0082] In one feasible implementation, taking the access user distribution information as an example of fluctuation data between new and old users, the service platform determines the target cache adjustment method based on the access user distribution information, which may specifically be:
[0083] The service platform can determine the user traffic fluctuation status for the service platform based on the fluctuation data of new and old users; the user traffic fluctuation status can be set to at least a highly volatile state and a stable state based on the actual application situation.
[0084] As an example, a fluctuation threshold can be set for fluctuation data of new and old users. When the fluctuation data of new and old users meets the fluctuation threshold, the user traffic fluctuation state is considered to be a stable fluctuation state; when the fluctuation data of new and old users does not meet the fluctuation threshold, the user traffic fluctuation state is considered to be a drastic fluctuation state.
[0085] For example, the fluctuation data for new and returning users can be a parameter representing the ratio of new to returning users, such as the fluctuation ratio of new users (growth / decrease) and the fluctuation ratio of returning users (growth / decrease). The fluctuation threshold data can be a fluctuation threshold set for the fluctuation ratio of new users (growth / decrease) and a fluctuation threshold set for the fluctuation ratio of returning users (growth / decrease).
[0086] If the user traffic fluctuation is drastic, the service platform determines the target cache adjustment method to be dynamic cache adjustment.
[0087] If the user traffic fluctuation status is stable, the service platform determines the target cache adjustment method to be the cache cycle adjustment method.
[0088] In one feasible implementation, the new and old user fluctuation data includes user growth and the ratio of new to old users; user growth can be understood as the increase in new or old user types within the monitoring window; the ratio of new to old users can be understood as the ratio of new or old user types to the total number of users. The service platform can combine user growth and the ratio of new to old users to determine the user traffic fluctuation status.
[0089] As an illustration, the service platform can compare the user growth rate with the incremental threshold, and the ratio of new to returning users with the user ratio threshold. The incremental threshold is a limit set for the user growth rate, and the user ratio threshold is a limit set for the ratio of new to returning users.
[0090] If the user growth exceeds the incremental threshold and the ratio of new to existing users is greater than the user proportion threshold, then the user traffic fluctuation state for the service platform is determined to be a highly volatile state. Conversely, if the user growth exceeds the incremental threshold and the ratio of new to existing users is greater than the user proportion threshold, then the user traffic fluctuation state for the service platform is determined to be a stable state.
[0091] S208: Adjust the cache space of the first data cache space and / or the second data cache space using the target cache adjustment method.
[0092] In one feasible implementation, taking the target cache adjustment method as an example of cache cycle adjustment, the cache cycle adjustment method is typically suitable for adjusting the cache space under stable fluctuation conditions. Under the cache cycle adjustment method, based on a certain periodic trigger, at fixed intervals, the cache space of the first data cache space and / or the second data cache space is fine-tuned according to access user distribution information such as fluctuation data of new and old users. Furthermore, under stable fluctuation conditions, the first and second data cache spaces typically have a high probability of meeting the current hot and cold data caching needs. The service platform only needs to adaptively fine-tune the first and second data cache spaces by combining access user distribution information or current hot and cold data fluctuation parameters (such as the amplitude and amount of hot and cold data fluctuations), where the spatial adjustment range is less than a set fine-tuning threshold.
[0093] As an illustration, under the cache lifecycle adjustment method, the space adjustment range of the service platform is usually smaller than that of the cache dynamic adjustment method.
[0094] In one feasible implementation, taking the target cache adjustment method as an example of a dynamic cache adjustment method, the dynamic cache adjustment method is generally suitable for adjusting the cache space under conditions of drastic fluctuations. The service platform executes the cache space adjustment of the first data cache space and / or the second data cache space using the target cache adjustment method, which can be:
[0095] 1. The service platform can use the aforementioned dynamic cache adjustment method to determine the sliding window adjustment area and the target adjustment cache space;
[0096] The sliding window adjustment area is a cache area allocated to the cache space that needs to be adjusted (either the first data cache space or the second data cache space). It can be understood as allocating the sliding window adjustment area to the cache space that needs to be adjusted.
[0097] The target adjustment cache space can be understood as the cache space that needs to be adjusted. The target adjustment cache space is one of the first data cache space and the second data cache space. For example, if the cold data cache demand is higher than the hot data cache demand, the target adjustment cache space is usually the second data cache space, that is, the determined sliding window adjustment area is allocated to the second data cache space; or if the hot data cache demand is higher than the cold data cache demand, the target adjustment cache space is usually the first data cache space, that is, the determined sliding window adjustment area is allocated to the first data cache space.
[0098] Optionally, the cache adjustment ratio for each dynamic cache adjustment can be set. Under the dynamic cache adjustment mode, the sliding window adjustment area is determined according to the cache adjustment ratio. For example, if the cache adjustment ratio can be 10%, then 10% of the available cache space (such as idle cache space) is determined as the sliding window adjustment area. The sliding window adjustment area is allocated to the target adjustment cache space in a similar sliding window manner. In practical applications, the sliding window adjustment area is usually associated with the target adjustment cache space.
[0099] As an example, a baseline cache adjustment ratio can be set, and the cache can be adjusted according to the baseline cache adjustment ratio each time it is dynamically adjusted.
[0100] Indicatively, dynamic cache adjustment typically involves multiple rounds of adjustments during the monitoring process. After determining the sliding window adjustment area according to the baseline cache adjustment ratio and allocating it to the target adjustment cache space in the first round, fluctuation parameters of new and old user data or hot and cold data can be monitored to measure the degree of drastic fluctuation. For example, a fluctuation factor can be evaluated based on the fluctuation parameters of new and old user data or hot and cold data. The baseline cache adjustment ratio can be adjusted based on this fluctuation factor. Based on the adjusted cache adjustment ratio, the sliding window adjustment area for the next round is determined in the next round of cache space adjustment, and then the target adjustment cache space for the next round is adjusted.
[0101] In one feasible implementation, the cache adjustment ratio can be dynamic. The service platform can dynamically determine the cache adjustment ratio based on the real-time monitored user distribution information, and determine the sliding window adjustment area based on the cache adjustment ratio, such as determining the sliding window adjustment area from the available cache space (such as idle cache space) based on the cache adjustment ratio.
[0102] As an illustration, the service platform can monitor at least one monitoring parameter in the user access distribution information in real time. For example, the monitoring parameter can be one or more of the following: the fluctuation ratio of new and old users, the fluctuation number of new and old users, the number of users of several access user types, the distribution status of user types, etc. The cache adjustment ratio can be determined by weighting each type of monitoring parameter and based on the weighted evaluation value, such as directly using the evaluation value as the cache adjustment ratio.
[0103] As an illustration, several reference evaluation ranges can be set, and each reference evaluation range corresponds to a reference cache adjustment ratio. By determining the reference evaluation range into which the evaluation value falls, the reference cache adjustment ratio corresponding to the reference evaluation range into which it falls is obtained as the aforementioned cache adjustment ratio.
[0104] 2. Adjust the target adjustment cache space based on the sliding window adjustment area, wherein the target adjustment cache space is at least one of the first data cache space and the second data cache space.
[0105] Specifically, after determining the sliding window adjustment area from the available cache space, the service platform associates the sliding window adjustment area with the target adjustment cache space, that is, it allocates the sliding window adjustment area to the target adjustment cache space.
[0106] In a specific implementation scenario, the total cache space of the service platform can consist of a first data cache space and a second data cache space. That is, the service platform pre-divides the total cache space into a first data cache space and a second data cache space for caching frequently accessed data. Under dynamic cache adjustment, a sliding window-like approach is used. For example, if it is determined that more first data cache space is needed (i.e., the first data cache space is used as the target adjustment cache space), a sliding window adjustment area can be selected from the second data cache space to divide the target adjustment cache space. The entire cache adjustment process can avoid increasing the time complexity of cache management and the load on the cache system. Adopting a corresponding cache space adjustment method significantly reduces the overhead of cache management and improves the utilization efficiency of cache space.
[0107] Furthermore, the service platform executes the method of dynamically adjusting the cache to determine the sliding window adjustment area and the target adjustment cache space, and adjusts the cache space of the target adjustment cache space based on the sliding window adjustment area, which can be:
[0108] A2: The service platform can obtain fluctuation data of new and old users and / or fluctuation parameters of hot and cold data, and determine the target adjustment cache space from the first data cache space and the second data cache space based on the fluctuation data of new and old users and / or the fluctuation parameters of hot and cold data.
[0109] Understandably, the need for subsequent cold and hot data caching management can be determined based on fluctuations in new and old user data and / or fluctuations in hot and cold data. Based on this need, the cache space can be adjusted from the first and second data cache spaces to the target area. For example, based on user distribution information, it can be determined that the distribution ratio of new / old user types or the fluctuation in user distribution is significant. Illustratively, if the distribution ratio of new user types or the fluctuation in user distribution is significant, it can be determined that the need for subsequent cold data caching management is high, and then a second data cache space for storing cold data is added. Similarly, if the distribution ratio of old user types or the fluctuation in user distribution is significant, it can be determined that the need for subsequent hot data caching management is high, and then a first data cache space for storing hot data is added.
[0110] A4: The service platform can determine the first cache adjustment ratio for the third data cache space; the third data cache space is the data cache space other than the target adjustment cache space in the first data cache space and the second data cache space.
[0111] Understandably, the third data cache space serves as the aforementioned adjustable cache space. If the cache adjustment ratio is 10%, then 10% of the cache space is determined from the adjustable third data cache space as the sliding window adjustment area.
[0112] Optionally, the first cache adjustment ratio can be a set baseline cache adjustment ratio, which is adjusted according to the baseline cache adjustment ratio each time the cache is dynamically adjusted.
[0113] Optionally, the first cache adjustment ratio can be dynamic. The service platform can dynamically determine the first cache adjustment ratio based on real-time monitored user distribution information, and determine the sliding window adjustment area based on the first cache adjustment ratio, such as determining the sliding window adjustment area from the available third data cache space based on the first cache adjustment ratio. For details on dynamically determining the first cache adjustment ratio, please refer to the aforementioned explanation of dynamically determining the cache adjustment ratio, which will not be repeated here.
[0114] A6: After determining the first cache adjustment ratio, the service platform can select a first sliding window adjustment area from the third data cache space based on the first cache adjustment ratio, and associate the first sliding window adjustment area with the target adjustment cache space.
[0115] Understandably, the first sliding window adjustment area is usually not a cached area that already caches cold / hot data.
[0116] In one or more embodiments of this specification, the total cache space of the service platform can be set with a lower limit ratio relative to the total cache space for the first cache space and the second cache space, and the space ratio of the first cache space and the second cache space needs to be greater than or equal to the lower limit ratio.
[0117] Optionally, for cache spaces used to cache hot and cold data, the same cache eviction mechanism is usually used for updating cold / hot data in the cache space for all types of cache spaces. However, under conditions of drastic fluctuations, the aforementioned method is difficult to adapt to the current scenario. Therefore, based on the current target cache adjustment method, the cache eviction mechanism of the first data cache space and / or the second data cache space is adjusted.
[0118] As an illustration, each type of cache space typically employs a single cache eviction mechanism for cache management. In one or more embodiments of this specification, if the target cache adjustment method is a dynamic cache adjustment method, different cache eviction mechanisms can be used for the first data cache space and the second data cache space. If the target cache adjustment method is a cache periodic adjustment method, different cache eviction mechanisms may not be enabled for cache eviction management; the existing cache eviction mechanism can be used for control and management.
[0119] In one or more embodiments of this specification, considering the impact of new and old user types on subsequent hot and cold data caching requirements, if the target cache adjustment method is a dynamic cache adjustment method, the Least Recently Used (LRU) cache mechanism can be used to perform cache eviction processing on the first data cache space, and the Least Frequently Used (LFU) cache mechanism can be used to perform cache eviction processing on the second data cache space. In this way, the subsequent hot and cold data can be efficiently updated in combination with the hot and cold data caching requirements.
[0120] In a specific implementation scenario, the total cache space of the service platform can consist of a first data cache space, a second data cache space, and a reserved cache space. By setting the reserved cache space, the regional data cache type can be dynamically adjusted and the corresponding data cache eviction policy can be updated in real time based on the cold and hot data cache requirements.
[0121] In the dynamic cache adjustment method, a sliding window-like approach is used to select all or part of the reserved cache space as the adjustment area. For example, if it is determined that more first data cache space is needed, and the first data cache space is taken as the target adjustment cache space, the sliding window adjustment area can be selected from the reserved cache space to divide the target adjustment cache space. The entire cache adjustment process can avoid increasing the time complexity of cache management and the load on the cache system. By adjusting the cache space accordingly, the overhead of cache management is significantly reduced to a certain extent, and the utilization efficiency of cache space is improved.
[0122] Furthermore, the service platform executes the method of dynamically adjusting the cache to determine the sliding window adjustment area and the target adjustment cache space, and adjusts the cache space of the target adjustment cache space based on the sliding window adjustment area, which can be:
[0123] B2: The service platform can obtain fluctuation data of new and old users and / or fluctuation parameters of hot and cold data, and determine the target adjustment cache space from the first data cache space and the second data cache space based on the fluctuation data of new and old users and / or the fluctuation parameters of hot and cold data;
[0124] B4: Obtain the reserved cache space and determine the second cache adjustment ratio for the reserved cache space; the reserved cache space is the data cache space other than the first data cache space and the second data cache space;
[0125] Understandably, the reserved cache space is used as the aforementioned adjustable cache space. For example, if the cache adjustment ratio can be 10%, then 10% of the adjustable reserved cache space is determined as the sliding window adjustment area.
[0126] Optionally, the second cache adjustment ratio can be the set baseline cache adjustment ratio, which is adjusted according to the baseline cache adjustment ratio each time the cache is dynamically adjusted.
[0127] Optionally, the second cache adjustment ratio can be dynamic. The service platform can dynamically determine the second cache adjustment ratio based on real-time monitored user distribution information, and determine the sliding window adjustment area based on the second cache adjustment ratio, such as determining the sliding window adjustment area from the available reserved cache space based on the second cache adjustment ratio. For details on dynamically determining the second cache adjustment ratio, please refer to the aforementioned explanation of dynamically determining the cache adjustment ratio, which will not be repeated here.
[0128] Optionally, the service platform can continuously monitor the situation. When the user traffic fluctuation status of the service platform changes from a state of severe fluctuation to a state of stable fluctuation, the service platform can release the aforementioned sliding window adjustment area, that is, release the sliding window adjustment area and reset it as the cache area corresponding to the reserved cache space.
[0129] B6: Based on the second cache adjustment ratio, select a second sliding window adjustment area from the reserved cache space, and associate the second sliding window adjustment area with the target adjustment cache space.
[0130] Understandably, the second sliding window adjustment area is usually not a cached area that already caches cold / hot data.
[0131] In one or more embodiments of this specification, the service platform monitors the cache fluctuation status of hot and cold data to obtain current access user distribution information, and dynamically adjusts the cache space of the first data cache space and / or the second data cache space based on the access user distribution information. Based on the access user distribution information, the fluctuation of the cache amount of hot and cold data can be predicted to a certain extent, allowing for pre-adjustment of the corresponding cache space, improving the cache hit rate when requesting data, reducing the processing pressure on the service platform; and avoiding the need for cache space migration of cached data, which reduces the time complexity of cache management and the load on the cache system, as well as saving cache management costs; and, in the case of drastic fluctuations, the platform can automatically and accurately monitor and decide on an appropriate cache eviction mechanism for cache management.
[0132] Please see Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of a cache management method proposed in one or more embodiments of this specification. Specifically:
[0133] S302: Monitor the cache fluctuation status for hot and cold data, and obtain access user distribution information based on the cache fluctuation status;
[0134] S304: Based on the access user distribution information, adjust the cache space of the first data cache space and / or the second data cache space;
[0135] S306: Obtain the first cached data to be stored for the first data cache space and / or the second data cache space;
[0136] The first cached data can be understood as cached data to be stored on the service platform. It can be a hot data type to be stored in the first data cache space or a cold data type to be stored in the second data cache space.
[0137] As an illustration, service platforms typically employ caching mechanisms to optimize data access. The service platform maintains cache spaces and a database for storing storage data. When a client initiates a user request to retrieve corresponding data, the service platform checks the client's request data. First, the service platform checks if the requested data exists in the maintained cache spaces (first cache space, second cache space). If the requested data is not found in the cache spaces, the service platform queries the database and returns the requested data. Understandably, the service platform can store this requested data in the cache spaces (first cache space, second cache space). Furthermore, the requested data to be stored is also the first cached data to be stored in the cache spaces (first cache space, second cache space).
[0138] As an illustration, whenever the service data changes, the service platform can synchronously update the cache information data in the cache space to ensure that users do not retrieve old cache information data in the cache space. Furthermore, the aforementioned cache information data to be synchronously updated is also the first cache data to be stored in the cache space (first cache space, second cache space) to synchronously update the old cache information data.
[0139] S308: Perform target encoding processing on the first cached data to obtain second cached encoded data; the second cached encoded data is cached encoded data that does not contain key element data in key-value pairs.
[0140] In related technologies, the first cached information to be stored is usually encoded and stored in the cache space using a cache encoding method such as key-value pairs. The key is the keyword and the value is the value. Key-value is a data encoding storage form that stores data in key-value pairs.
[0141] To illustrate, taking user information as the first cached data as an example, when storing data in the cache space, it will store "user index + user information". The user information is usually encoded in key-value pairs, such as the common JSON format. The user index is the user's ID, and the user information is stored as {"name":"Zhang San","age":20}.
[0142] In one or more embodiments of this specification, instead of using the aforementioned key-value encoding to cache the first cached data, a target encoding method is used, so that the second cached encoded data after target encoding does not contain the keyword element data in the key-value pair.
[0143] To illustrate, taking the user information storage {"Name":"Zhang San","Age":20} as an example, after only target encoding processing, only the object's value - "Zhang San" and "20" will be cached, but the object's key elements - "Name" and "Age" will not be cached. That is, the second cached encoded data does not contain the key element data of the key-value pair.
[0144] In one feasible implementation, the service platform performs target encoding processing on the first cached data to obtain second cached encoded data, specifically:
[0145] C2: Determine the first cache key information corresponding to the first cache data. The first cache key information includes keyword element data and value element data generated based on the key-value pair encoding method.
[0146] The first cache key information can be understood as cache information encoded in a key-value pair encoding method. Taking the aforementioned first cache data as user information as an example, the "user information" in the first cache data "user index + user information" is also the first cache key information.
[0147] The first cache key information is generated based on key-value pair encoding, which includes keyword element data and value element data. In the data {"Name":"Zhang San","Age":20}: "Name" and "Age" are keyword element data, and "Zhang San" and 20 are value element data.
[0148] C4: Determine the delimiter for the keyword element data, and perform encoding processing based on the value element data and the delimiter to obtain the second cached data.
[0149] Understandably, delimiters can be used to replace keyword element data. Delimiters occupy less space than keyword element data, which can significantly save space occupied by cache encoding.
[0150] Optionally, the separator can serve only to distinguish data elements of different categories. The data elements indicated before and after the separator belong to the different categories of key elements. For example, the data {"Name":"Zhang San","Age":20} can be encoded into "Zhang San##20", where "##" is the separator.
[0151] Optionally, the delimiter can be associated with the keyword element, that is, the mapping relationship between different categories of keyword elements and their corresponding reference delimiters can be pre-set, and the delimiter for the keyword element data can be determined based on the mapping relationship.
[0152] Understandably, after determining the delimiter for the keyword element data, encoding processing is performed based on the value element data and the delimiter to replace the keyword element data using the delimiter. Then, based on the replaced delimiter and the value element data, a second cached data can be generated. For example, taking the data {"Name":"Li Si","Age":30} as an example, using the delimiter "??" to replace the keyword elements "Name" and "Age", the resulting second cached data could be "Li Si??30".
[0153] S310: Cache and store the second cached data.
[0154] Understandably, the second cached data is cached in the corresponding data cache space based on its data type. If the data type of the second cached data is a frequently accessed data type, it is cached in the first data cache space. This approach is suitable for service scenarios with limited cache space and can effectively solve the problem of high load pressure on the service platform.
[0155] For illustrative purposes, the data type of the second cached data is the same as that of the first cached data.
[0156] S312: Retrieve the second cached data in response to the client's data query request;
[0157] The data query request is initiated by the client to the service platform. The service platform provides corresponding transaction services to the outside world. Based on actual needs, the client's users can initiate a data query request to the service platform on the client to obtain the corresponding service data.
[0158] Understandably, when a service platform receives a data query request from a client, it first checks whether the requested data indicated by the data query request exists in the maintained cache space (first cache space and second cache space). If the requested data exists, it retrieves the requested data from the cache space (first cache space and second cache space) and uses it as the second cached data.
[0159] As an illustration, the service platform can provide local services to the outside world. Typically, a local service is an SDK (Software Development Kit) installed on the client. Data query requests initiated by the client are processed collaboratively by the local service and the service platform. The service platform can receive data query requests based on the local service and obtain second cached data.
[0160] S314: Perform target decoding processing on the second cached data to obtain the third cached data, and send the third cached data to the client;
[0161] The target decoding process can be understood as the inverse process of the target encoding process.
[0162] In one feasible implementation, the step of performing target decoding processing on the second cached data to obtain the third cached data includes:
[0163] Determine the user index information and the second user information corresponding to the second cached data, wherein the second user information includes value element data and a delimiter;
[0164] Keyword element data is determined based on the value element data and the delimiter. Encoding processing is then performed based on the user index information, the value element data, and the keyword element data to obtain third cached encoded data.
[0165] The service platform performs target decoding processing on the second cached data to obtain the third cached data, which can be:
[0166] D2: Determine the second cache key information corresponding to the second cache data. The second cache key information includes value element data and delimiter.
[0167] In practical applications, there are multiple second-cached data sets. Based on actual transaction needs, the cached data typically consists of index information and cache key information. The index information is used to locate the requested cached data from multiple cached data sets. Based on this, second-cached key information can be extracted from the second-cached data. The second-cached key information is data obtained after target encoding processing and includes value element data and delimiters.
[0168] D4: Determine keyword element data based on the value element data and / or the delimiter, and perform encoding processing based on the value element data and the keyword element data to obtain third cache data, wherein the third cache encoded data is cache encoded data containing keyword element data in key-value pairs.
[0169] Understandably, the data type of the value element can be determined, and the data type of the keyword element can be determined based on the data type of the value element. The data type of the value element is strongly correlated with the data type of the keyword element. For example, if the value element data is "Zhang San", its data type is usually "name", then the keyword element data will be the "name" keyword element.
[0170] Understandably, keyword element data can be determined based on delimiters. During target encoding processing, if different delimiters are used based on different keyword elements, the keyword element data corresponding to the delimiter can be determined based on the mapping relationship between different delimiters and corresponding keyword elements.
[0171] Optionally, keyword element data can be determined based on both value element data and the delimiter, that is, data fitting is performed on the two types of keyword element data to obtain the final keyword element data.
[0172] Furthermore, after determining the keyword element data, encoding processing is performed based on the value element data and the keyword element data. One approach is to directly generate third cache data based on the combination of the value element data and the keyword element data. Another approach is to replace the delimiter in the second cache key information with the keyword element data and generate third cache data based on the replaced data.
[0173] Furthermore, after the service platform generates the third cache data, it can then send the third cache data to the client.
[0174] S316: Send the second cached data to the client so that the client can perform target decoding processing on the second cached data to obtain the third cached data.
[0175] Understandably, after responding to a client's data query request and retrieving the second cached data, the service platform can avoid decoding it locally to reduce the cache management burden on the service platform. Instead, it can directly send the second cached data to the client, instructing the client to perform target decoding processing on the second cached data to obtain the third cached data.
[0176] In one or more embodiments of this specification, the execution process of the client performing target decoding processing on the second cached data to obtain the third cached data is the same as the execution process of the service platform performing target decoding processing on the second cached data to obtain the third cached data, the only difference being the execution subject, which will not be described in detail here.
[0177] In a specific implementation scenario, the service platform can provide a local service, which can be used for decoding to alleviate the pressure on the service platform. Data query requests are directly sent to the local service. If the cache query is hit, the local service then performs target decoding processing based on the second cached data fed back by the service platform. Taking the second cached key information "Zhang San##20" in the second cached data as an example, the decoding will restore it to {"Name":"Zhang San","Age":20}.
[0178] In one or more embodiments of this specification, the service platform monitors the cache fluctuation status of hot and cold data to obtain current access user distribution information, and dynamically adjusts the cache space of the first data cache space and / or the second data cache space based on the access user distribution information. Based on the access user distribution information, the fluctuation of the cached amount of hot and cold data can be predicted to a certain extent, allowing for pre-adjustment of the corresponding cache space, improving the cache hit rate when requesting data, reducing the processing pressure on the service platform; and avoiding the need for cache space migration of cached data, thus reducing the time complexity of cache management and the load on the cache system, and saving cache management costs; furthermore, in the case of drastic fluctuations, the platform can automatically and accurately monitor and decide on an appropriate cache eviction mechanism for cache management; and, when cache space is insufficient, encoding and decoding can be used to cache more data in a limited cache space, improving the resource utilization of the cache space.
[0179] The following will combine Figure 5 This manual provides a detailed description of the cache management device provided. It should be noted that... Figure 5 The cache management device shown is used to execute this application. Figures 1-4 The methods of the embodiments shown are illustrated only in the parts relevant to this specification for ease of explanation. For specific technical details not disclosed, please refer to this application. Figures 1-4 The example shown.
[0180] Please see Figure 5 This diagram illustrates the structure of the cache management device described in this specification. The cache management device 1 can be implemented as all or part of a user terminal through software, hardware, or a combination of both. According to some embodiments, the cache management device 1 includes an information acquisition module 11 and a data processing module 12, specifically used for:
[0181] Information acquisition module 11 is used to monitor the cache fluctuation status of hot data and cold data, and acquire access user distribution information based on the cache fluctuation status;
[0182] Data processing module 12 is used to adjust the cache space of the first data cache space and / or the second data cache space based on the access user distribution information. The first data cache space is a data storage space for caching the hot data, and the second data cache space is a data cache space for caching the cold data.
[0183] Optional, such as Figure 6 As shown, the information acquisition module 11 includes:
[0184] Data monitoring unit 111 is used to monitor the buffer fluctuation ratio for hot data and cold data;
[0185] The information acquisition unit 112 is used to acquire access user distribution information if the cache fluctuation ratio is greater than or equal to the fluctuation ratio threshold.
[0186] Optionally, the information acquisition module 11 is specifically used for:
[0187] Obtain first user access data for new user types and second user access data for existing user types;
[0188] Based on the first user access data and the second user access data, the fluctuation data of new and old users is determined, and the fluctuation data of new and old users is used as the access user distribution information.
[0189] The new user type and the old user type are user types categorized for users accessing the service platform.
[0190] Optional, such as Figure 7 As shown, the data processing module 12 includes:
[0191] The method determination unit 121 is used to determine the target cache adjustment method based on the access user distribution information;
[0192] The space adjustment unit 122 is used to adjust the cache space of the first data cache space and / or the second data cache space using the target cache adjustment method.
[0193] Optionally, the access user distribution information is fluctuation data of new and old users, and the method determination unit 121 is specifically used for:
[0194] Based on the fluctuation data of new and old users, determine the user traffic fluctuation status for the service platform;
[0195] If the user traffic fluctuation state is a state of severe fluctuation, then the target cache adjustment method is determined to be the dynamic cache adjustment method;
[0196] If the user traffic fluctuation state is a stable fluctuation state, then the target cache adjustment method is determined to be the cache cycle adjustment method.
[0197] Optionally, the method determining unit 121 is specifically used for:
[0198] The data on fluctuations in new and old users includes user growth and the ratio of new to old users;
[0199] If the user growth is greater than the incremental threshold, and the proportion of new and old users is greater than the user proportion threshold, then the user traffic fluctuation state for the service platform is determined to be the drastic fluctuation state.
[0200] Optionally, the target cache adjustment method is a dynamic cache adjustment method, and the space adjustment unit 122 is specifically used for:
[0201] The sliding window adjustment area and the target adjustment cache space are determined using the aforementioned dynamic cache adjustment method. The target adjustment cache space is adjusted based on the sliding window adjustment area. The target adjustment cache space is at least one of the first data cache space and the second data cache space.
[0202] Optionally, the space adjustment unit 122 is specifically used for:
[0203] The cache adjustment ratio is determined based on the access user distribution information, and the sliding window adjustment area is determined based on the cache adjustment ratio.
[0204] Optionally, the space adjustment unit 122 is specifically used for:
[0205] Obtain fluctuation data of new and old users and / or fluctuation parameters of hot and cold data; based on the fluctuation data of new and old users and / or the fluctuation parameters of hot and cold data, determine the target adjustment cache space from the first data cache space and the second data cache space;
[0206] Determine the first cache adjustment ratio for the third data cache space;
[0207] Based on the first cache adjustment ratio, a first sliding window adjustment area is selected from the third data cache space, and the first sliding window adjustment area is associated with the target adjustment cache space. The third data cache space is the data cache space other than the target adjustment cache space in the first data cache space and the second data cache space.
[0208] Optionally, the space adjustment unit 122 is specifically used for:
[0209] Obtain fluctuation data of new and old users and / or fluctuation parameters of hot and cold data; based on the fluctuation data of new and old users and / or the fluctuation parameters of hot and cold data, determine the target adjustment cache space from the first data cache space and the second data cache space;
[0210] Obtain reserved cache space and determine a second cache adjustment ratio for the reserved cache space; the reserved cache space is a data cache space other than the first data cache space and the second data cache space;
[0211] Based on the second cache adjustment ratio, a second sliding window adjustment area is selected from the reserved cache space, and the second sliding window adjustment area is associated with the target adjustment cache space.
[0212] Optionally, the device 1 is further configured to:
[0213] Based on the target cache adjustment method, a cache eviction mechanism is applied to adjust the first data cache space and / or the second data cache space.
[0214] Optionally, the device 1 is further configured to:
[0215] If the target cache adjustment method is a dynamic cache adjustment method, then the least recently used cache mechanism is used to perform cache eviction processing on the first data cache space, and the least frequently used cache mechanism is used to perform cache eviction processing on the second data cache space.
[0216] Optional, such as Figure 8 As shown, the device 1 includes:
[0217] Data caching module 13 is used to obtain the first cached data to be stored for the first data cache space and / or the second data cache space;
[0218] The data caching module 13 is further configured to perform target encoding processing on the first cached data to obtain second cached encoded data; the second cached encoded data is cached encoded data that does not contain key element data in key-value pairs.
[0219] The second cached data is cached and stored.
[0220] Optionally, the data caching module 13 is further configured to:
[0221] Determine the first cache key information corresponding to the first cache data. The first cache key information includes keyword element data and value element data generated based on the key-value pair encoding method.
[0222] Determine the delimiter for the keyword element data, and perform encoding processing based on the value element data and the delimiter to obtain the second cached data.
[0223] Optionally, the data caching module 13 is further configured to:
[0224] In response to the client's data query request, retrieve the second cached data;
[0225] The second cached data is subjected to target decoding processing to obtain third cached data, and the third cached data is sent to the client; or, the second cached data is sent to the client so that the client performs target decoding processing on the second cached data to obtain the third cached data.
[0226] The third cached data is cached encoded data containing the keyword element data in the key-value pairs.
[0227] Optionally, the data caching module 13 is further configured to:
[0228] Determine the second cache key information corresponding to the second cache data, the second cache key information including value element data and delimiter;
[0229] Keyword element data is determined based on the value element data and / or the delimiter, and encoding processing is performed based on the value element data and the keyword element data to obtain the third cache data.
[0230] It should be noted that the cache management device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the cache management method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the cache management device and the cache management method embodiments provided in the above embodiments belong to the same concept, and the implementation process can be found in the method embodiments, which will not be repeated here.
[0231] The serial numbers in this specification are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0232] In one or more embodiments of this specification, the service platform monitors the cache fluctuation status of hot and cold data to obtain current access user distribution information, and dynamically adjusts the cache space of the first data cache space and / or the second data cache space based on the access user distribution information. Based on the access user distribution information, the fluctuation of the cache amount of hot and cold data can be predicted to a certain extent, and the corresponding cache space can be adjusted in advance, improving the cache hit rate when requesting data and reducing the processing pressure on the service platform.
[0233] This specification also provides a computer storage medium capable of storing multiple instructions adapted to be loaded and executed by a processor as described above. Figures 1-4 The cache management method described in the illustrated embodiment can be found in the following document for a detailed execution process: Figures 1-4 The specific details of the illustrated embodiments will not be elaborated here.
[0234] This application also provides a computer program product storing at least one instruction, which is loaded and executed by the processor as described above. Figures 1-4 The cache management method described in the illustrated embodiment can be found in the following document for a detailed execution process: Figures 1-4 The specific details of the illustrated embodiments will not be elaborated here.
[0235] Please refer to Figure 9 This diagram illustrates a structural block diagram of an electronic device provided in an exemplary embodiment of this application. The electronic device in this application may include one or more components such as a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, memory 120, input device 130, and output device 140 may be connected via the bus 150.
[0236] Processor 110 may include one or more processing cores. Processor 110 connects to various parts of the electronic device via various interfaces and lines, and performs various functions and processes data of electronic device 100 by running or executing instructions, programs, code sets, or instruction sets stored in memory 120, and by calling data stored in memory 120. Optionally, processor 110 may be implemented using at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). Processor 110 may integrate one or more of the following: central processing unit (CPU), graphics processing unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 110 and may be implemented separately through a communication chip.
[0237] The memory 120 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 120 may include a non-transitory computer-readable storage medium. The memory 120 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), instructions for implementing the various method embodiments described below, etc. The operating system may be the Android system, including systems deeply developed based on the Android system, the iOS system developed by Apple Inc., including systems deeply developed based on the iOS system, or other systems. The data storage area may also store data created by the electronic device during use, such as phonebook data, audio and video data, chat log data, etc.
[0238] See Figure 10As shown, the memory 120 can be divided into operating system space and user space. The operating system runs in the operating system space, while native and third-party applications run in the user space. To ensure that different third-party applications can achieve good running performance, the operating system allocates corresponding system resources for each application. However, different application scenarios within the same third-party application have different requirements for system resources. For example, in local resource loading scenarios, third-party applications have high requirements for disk read speed; in animation rendering scenarios, third-party applications have high requirements for GPU performance. Since the operating system and third-party applications are independent of each other, the operating system often cannot promptly perceive the current application scenario of a third-party application, resulting in the operating system's inability to adapt system resources accordingly to the specific application scenario of the third-party application.
[0239] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to establish data communication between the third-party applications and the operating system. This would allow the operating system to obtain the current scenario information of the third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
[0240] Taking the Android operating system as an example, the programs and data stored in memory 120 are as follows: Figure 11As shown, the memory 120 can store the Linux kernel layer 320, the system runtime library layer 340, the application framework layer 360, and the application layer 380. The Linux kernel layer 320, system runtime library layer 340, and application framework layer 360 belong to the operating system space, while the application layer 380 belongs to the user space. The Linux kernel layer 320 provides low-level drivers for various hardware components of the electronic device, such as display drivers, audio drivers, camera drivers, Bluetooth drivers, Wi-Fi drivers, and power management. The system runtime library layer 340 provides support for key features of the Android system through several C / C++ libraries. For example, the SQLite library provides database support, the OpenGL / ES library provides 3D graphics support, and the Webkit library provides browser kernel support. The system runtime library layer 340 also provides the Android runtime library, which mainly provides core libraries that allow developers to write Android applications using the Java language. The Application Framework Layer 360 provides various APIs that may be used when building applications. Developers can also use these APIs to build their own applications, such as activity management, window management, view management, notification management, content provider, package management, call management, resource management, and location management. At least one application runs in the Application Layer 380. These applications can be native applications that come with the operating system, such as contacts, SMS, clock, and camera apps; or third-party applications developed by third-party developers, such as games, instant messaging, and photo editing apps.
[0241] Taking the operating system as an example (iOS), the programs and data stored in memory 120 are as follows: Figure 12As shown, the iOS system includes: Core OS layer 420, Core Services layer 440, Media layer 460, and Cocoa Touch layer 480. Core OS layer 420 includes the operating system kernel, drivers, and low-level program frameworks. These low-level program frameworks provide hardware-level functionality for use by the program frameworks located in Core Services layer 440. Core Services layer 440 provides system services and / or program frameworks required by applications, such as Foundation framework, account framework, advertising framework, data storage framework, network connectivity framework, geolocation framework, motion framework, etc. Media layer 460 provides applications with audiovisual interfaces, such as interfaces related to graphics and images, audio technology, video technology, and AirPlay (wireless playback of audio and video transmission technologies). Cocoa Touch layer 480 provides various commonly used interface-related frameworks for application development and is responsible for user touch interaction on electronic devices. Examples include local notification services, remote push services, advertising frameworks, game tool frameworks, message user interface (UI) frameworks, UIKit user interface frameworks, map frameworks, and so on.
[0242] exist Figure 12 The framework shown includes, but is not limited to, the base framework in the core service layer 440 and the UIKit framework in the touchable layer 480. The base framework provides many basic object classes and data types, offering the most basic system services to all applications, and is independent of the UI. The UIKit framework, on the other hand, provides a basic UI class library for creating touch-based user interfaces. iOS applications can use the UIKit framework to provide their UI, thus providing the application's infrastructure for building user interfaces, drawing, handling user interaction events, responding to gestures, and so on.
[0243] The methods and principles for implementing data communication between third-party applications and the operating system in the iOS system can be referenced from the Android system, and will not be elaborated here.
[0244] The input device 130 is used to receive input instructions or data, and includes, but is not limited to, a keyboard, mouse, camera, microphone, or touch device. The output device 140 is used to output instructions or data, and includes, but is not limited to, a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined into a touch screen, which is used to receive touch operations from the user using a finger, stylus, or any suitable object on or near it, and to display the user interface of various applications. The touch screen is usually located on the front panel of the electronic device. The touch screen can be designed as a full-screen, curved screen, or irregularly shaped screen. The touch screen can also be designed as a combination of a full-screen and a curved screen, or a combination of an irregularly shaped screen and a curved screen; this specification does not limit this.
[0245] In addition, those skilled in the art will understand that the structure of the electronic device shown in the above figures does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the electronic device may also include radio frequency circuits, input units, sensors, audio circuits, wireless fidelity (WiFi) modules, power supplies, Bluetooth modules, etc., which will not be described in detail here.
[0246] In this specification, the entity executing each step can be the electronic device described above. Optionally, the entity executing each step can be the operating system of the electronic device. The operating system can be Android, iOS, or other operating systems; this specification does not limit this.
[0247] The electronic device described in this manual may also be equipped with a display device. This display device can be any device capable of displaying information, such as a cathode ray tube display (CR), a light-emitting diode display (LED), an electronic ink screen, a liquid crystal display (LCD), or a plasma display panel (PDP). Users can use the display device on electronic device 101 to view displayed text, images, videos, and other information. The electronic device may be a server, service platform, smartphone, tablet computer, gaming device, AR (Augmented Reality) device, automobile, data storage device, audio playback device, video playback device, laptop, desktop computing device, etc.
[0248] exist Figure 9 In the illustrated electronic device, which can be a service platform, the processor 110 can be used to call the application stored in the memory 120 and specifically perform the following operations:
[0249] Monitor cache fluctuations for hot and cold data, and obtain access user distribution information based on the cache fluctuation status.
[0250] Based on the access user distribution information, the cache space of the first data cache space and / or the second data cache space is adjusted. The first data cache space is a data storage space for caching the hot data, and the second data cache space is a data cache space for caching the cold data.
[0251] In one embodiment, when the processor 110 performs the operation of monitoring the cache fluctuation status for hot and cold data and obtaining access user distribution information based on the cache fluctuation status, it specifically performs the following operations:
[0252] Monitor the cache fluctuation ratio for hot and cold data;
[0253] If the cache fluctuation ratio is greater than or equal to the fluctuation ratio threshold, then the distribution information of accessing users is obtained.
[0254] In one embodiment, when the processor 110 performs the step of obtaining the access user distribution information, it performs the following operations:
[0255] Obtain first user access data for new user types and second user access data for existing user types;
[0256] Based on the first user access data and the second user access data, the fluctuation data of new and old users is determined, and the fluctuation data of new and old users is used as the access user distribution information.
[0257] The new user type and the old user type are user types categorized for users accessing the service platform.
[0258] In one embodiment, when the processor 110 performs cache space adjustment on the first data cache space and / or the second data cache space based on the access user distribution information, it performs the following steps:
[0259] Based on the access user distribution information, determine the target cache adjustment method;
[0260] The target cache adjustment method is used to adjust the cache space of the first data cache space and / or the second data cache space.
[0261] In one embodiment, the access user distribution information is fluctuation data of new and old users. When the processor 110 executes the step of determining the target cache adjustment method based on the access user distribution information, it performs the following steps:
[0262] Based on the fluctuation data of new and old users, determine the user traffic fluctuation status for the service platform;
[0263] If the user traffic fluctuation state is a state of severe fluctuation, then the target cache adjustment method is determined to be the dynamic cache adjustment method;
[0264] If the user traffic fluctuation state is a stable fluctuation state, then the target cache adjustment method is determined to be the cache cycle adjustment method.
[0265] In one embodiment, when the processor 110 performs the step of determining the user traffic fluctuation status for the service platform based on the fluctuation data of new and old users, it executes the following steps:
[0266] The data on fluctuations in new and old users includes user growth and the ratio of new to old users;
[0267] If the user growth is greater than the incremental threshold, and the proportion of new and old users is greater than the user proportion threshold, then the user traffic fluctuation state for the service platform is determined to be the drastic fluctuation state.
[0268] In one embodiment, the target cache adjustment method is a dynamic cache adjustment method. When the processor 110 performs cache space adjustment on the first data cache space and / or the second data cache space using the target cache adjustment method, it performs the following steps:
[0269] The sliding window adjustment area and the target adjustment cache space are determined using the aforementioned dynamic cache adjustment method. The target adjustment cache space is adjusted based on the sliding window adjustment area. The target adjustment cache space is at least one of the first data cache space and the second data cache space.
[0270] In one embodiment, when the processor 110 performs the step of determining the sliding window adjustment area, it performs the following steps:
[0271] The cache adjustment ratio is determined based on the access user distribution information, and the sliding window adjustment area is determined based on the cache adjustment ratio.
[0272] In one embodiment, when the processor 110 performs the following steps when determining the sliding window adjustment region and the target adjustment cache space using the dynamic cache adjustment method, and adjusting the cache space of the target adjustment cache space based on the sliding window adjustment region:
[0273] Obtain fluctuation data of new and old users and / or fluctuation parameters of hot and cold data; based on the fluctuation data of new and old users and / or the fluctuation parameters of hot and cold data, determine the target adjustment cache space from the first data cache space and the second data cache space;
[0274] Determine the first cache adjustment ratio for the third data cache space;
[0275] Based on the first cache adjustment ratio, a first sliding window adjustment area is selected from the third data cache space, and the first sliding window adjustment area is associated with the target adjustment cache space. The third data cache space is the data cache space other than the target adjustment cache space in the first data cache space and the second data cache space.
[0276] In one embodiment, when the processor 110 performs the following steps when determining the sliding window adjustment region and the target adjustment cache space using the dynamic cache adjustment method, and adjusting the cache space of the target adjustment cache space based on the sliding window adjustment region:
[0277] Obtain fluctuation data of new and old users and / or fluctuation parameters of hot and cold data; based on the fluctuation data of new and old users and / or the fluctuation parameters of hot and cold data, determine the target adjustment cache space from the first data cache space and the second data cache space;
[0278] Obtain reserved cache space and determine a second cache adjustment ratio for the reserved cache space; the reserved cache space is a data cache space other than the first data cache space and the second data cache space;
[0279] Based on the second cache adjustment ratio, a second sliding window adjustment area is selected from the reserved cache space, and the second sliding window adjustment area is associated with the target adjustment cache space.
[0280] In one embodiment, when executing the cache management method, the processor 110 further performs the following steps:
[0281] Based on the target cache adjustment method, a cache eviction mechanism is applied to adjust the first data cache space and / or the second data cache space.
[0282] In one embodiment, when the processor 110 performs cache eviction mechanism adjustment on the first data cache space and / or the second data cache space based on the target cache adjustment method, it performs the following steps:
[0283] If the target cache adjustment method is a dynamic cache adjustment method, then the least recently used cache mechanism is used to perform cache eviction processing on the first data cache space, and the least frequently used cache mechanism is used to perform cache eviction processing on the second data cache space.
[0284] In one embodiment, when executing the cache management method, the processor 110 further performs the following steps:
[0285] Retrieve the first cached data to be stored for the first data cache space and / or the second data cache space;
[0286] The first cached data is subjected to target encoding processing to obtain the second cached encoded data; the second cached encoded data is cached encoded data that does not contain the key element data in the key-value pair.
[0287] The second cached data is cached and stored.
[0288] In one embodiment, when the processor 110 performs target encoding processing on the first cached data to obtain the second cached data, it specifically performs the following steps:
[0289] Determine the first cache key information corresponding to the first cache data. The first cache key information includes keyword element data and value element data generated based on the key-value pair encoding method.
[0290] Determine the delimiter for the keyword element data, and perform encoding processing based on the value element data and the delimiter to obtain the second cached data.
[0291] In one embodiment, when executing the cache management method, the processor 110 further performs the following steps:
[0292] In response to the client's data query request, retrieve the second cached data;
[0293] The second cached data is subjected to target decoding processing to obtain third cached data, and the third cached data is sent to the client; or, the second cached data is sent to the client so that the client performs target decoding processing on the second cached data to obtain the third cached data.
[0294] The third cached data is cached encoded data containing the keyword element data in the key-value pairs.
[0295] In one embodiment, when the processor 110 performs target decoding processing on the second cached data to obtain the third cached data, it specifically performs the following steps:
[0296] Determine the second cache key information corresponding to the second cache data, the second cache key information including value element data and delimiter;
[0297] Keyword element data is determined based on the value element data and / or the delimiter, and encoding processing is performed on the value element data and the keyword element data to obtain the third cache data.
[0298] In one or more embodiments of this specification, the service platform monitors the cache fluctuation status of hot and cold data to obtain current access user distribution information, and dynamically adjusts the cache space of the first data cache space and / or the second data cache space based on the access user distribution information. Based on the access user distribution information, the fluctuation of the cache amount of hot and cold data can be predicted to a certain extent, and the corresponding cache space can be adjusted in advance, improving the cache hit rate when requesting data and reducing the processing pressure on the service platform.
[0299] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.
[0300] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A cache management method applied to a service platform, the method comprising: Monitor cache fluctuations for hot and cold data, and obtain access user distribution information based on the cache fluctuation status. Based on the access user distribution information, determine the target cache adjustment method; The target cache adjustment method is used to adjust the cache space of the first data cache space and / or the second data cache space. The first data cache space is the data storage space for caching the hot data, and the second data cache space is the data cache space for caching the cold data. When the target cache adjustment method is a dynamic cache adjustment method, the step of adjusting the cache space of the first data cache space and / or the second data cache space using the target cache adjustment method includes: The service platform's total cache space includes a first data cache space and a second data cache space. A sliding window adjustment area and a target adjustment cache space are determined. The sliding window adjustment area is allocated to the target adjustment cache space for cache space adjustment. The target adjustment cache space is at least one of the first and second data cache spaces. The sliding window adjustment area is not a cache area that already caches cold / hot data; the sliding window adjustment area is selected from a third data cache space other than the target adjustment cache space, within the first and second data cache spaces. Alternatively, The service platform's total cache space includes a first data cache space, a second data cache space, and a reserved cache space. A sliding window adjustment area and a target adjustment cache space are determined. The sliding window adjustment area is allocated to the target adjustment cache space for cache space adjustment. User traffic fluctuations are continuously monitored, and the sliding window adjustment area is released based on these fluctuations. The target adjustment cache space is at least one of the first and second data cache spaces. The sliding window adjustment area is not a cache area that already caches cold / hot data. The sliding window adjustment area is selected from all or part of the reserved cache space as the sliding window adjustment area. The process of determining the sliding window adjustment area includes: weighting each type of monitoring parameter based on at least one monitoring parameter in the monitored user access distribution information of each round to obtain an evaluation value, determining the reference evaluation range in which the evaluation value falls among multiple set reference evaluation ranges, obtaining the reference cache adjustment ratio corresponding to the reference evaluation range as the cache adjustment ratio, and determining the sliding window adjustment area based on the cache adjustment ratio. The method further includes: Obtain the first cached data to be stored for the first data cache space and / or the second data cache space, and determine the first cache key information corresponding to the first cached data. The first cache key information includes keyword element data and value element data generated based on the key-value pair encoding method. Based on the mapping relationship between different delimiters and the corresponding keyword elements of the delimiters, a delimiter for the keyword element data is determined. The delimiter is used to replace the keyword element data and the space occupied by the delimiter is smaller than that of the keyword element data. The value element data and the delimiter are encoded to obtain the second cache data. The second cache data is cache-encoded data that does not contain the keyword element data in the key-value pair. The second cache data is cached and stored. In response to a client's data query request, the system retrieves second cached data, performs target decoding on the second cached data to obtain third cached data, and sends the third cached data to the client; or, the system sends the second cached data to the client so that the client performs target decoding on the second cached data to obtain third cached data, wherein the third cached data is cache-encoded data containing keyword element data in key-value pairs; The step of performing target decoding processing on the second cached data to obtain the third cached data includes: determining the second cache key information corresponding to the second cached data, wherein the second cache key information includes value element data and delimiter; The method involves determining the data type of the value element data to determine the keyword element data based on the data type of the value element data; and / or, based on the mapping relationship between different delimiters and keyword elements, determining the keyword element data corresponding to the delimiter in the second cache key information; The third cache data is obtained by encoding the value element data and the keyword element data.
2. The method according to claim 1, wherein monitoring the cache fluctuation status for hot data and cold data, and obtaining access user distribution information based on the cache fluctuation status, includes: Monitor the cache fluctuation ratio for hot and cold data; If the cache fluctuation ratio is greater than or equal to the fluctuation ratio threshold, then the distribution information of accessing users is obtained.
3. The method according to claim 1 or 2, wherein obtaining the access user distribution information includes: Obtain first user access data for new user types and second user access data for existing user types; Based on the first user access data and the second user access data, the fluctuation data of new and old users is determined, and the fluctuation data of new and old users is used as the access user distribution information. The new user type and the old user type are user types categorized for users accessing the service platform.
4. The method according to claim 1, wherein the access user distribution information is fluctuation data of new and old users. The step of determining the target cache adjustment method based on the access user distribution information includes: Based on the fluctuation data of new and old users, determine the user traffic fluctuation status for the service platform; If the user traffic fluctuation state is a state of severe fluctuation, then the target cache adjustment method is determined to be the dynamic cache adjustment method; If the user traffic fluctuation state is a stable fluctuation state, then the target cache adjustment method is determined to be the cache cycle adjustment method.
5. The method according to claim 4, wherein determining the user traffic fluctuation status for the service platform based on the new and old user fluctuation data includes: The data on fluctuations in new and old users includes user growth and the ratio of new to old users; If the user growth is greater than the incremental threshold, and the proportion of new and old users is greater than the user proportion threshold, then the user traffic fluctuation state for the service platform is determined to be the drastic fluctuation state.
6. The method according to claim 1, wherein determining the sliding window adjustment area comprises: The cache adjustment ratio is determined based on the access user distribution information, and the sliding window adjustment area is determined based on the cache adjustment ratio.
7. The method according to claim 1, wherein determining the sliding window adjustment area and the target adjustment cache space, and allocating the sliding window adjustment area to the target adjustment cache space for cache space adjustment, comprises: Obtain fluctuation data of new and old users and / or fluctuation parameters of hot and cold data; based on the fluctuation data of new and old users and / or the fluctuation parameters of hot and cold data, determine the target adjustment cache space from the first data cache space and the second data cache space; Determine the first cache adjustment ratio for the third data cache space; Based on the first cache adjustment ratio, a first sliding window adjustment area is selected from the third data cache space, and the first sliding window adjustment area is associated with the target adjustment cache space. The third data cache space is the data cache space other than the target adjustment cache space in the first data cache space and the second data cache space.
8. The method according to claim 1, wherein determining the sliding window adjustment area and the target adjustment cache space using the dynamic cache adjustment method, and allocating the sliding window adjustment area to the target adjustment cache space for cache space adjustment, comprises: Obtain fluctuation data of new and old users and / or fluctuation parameters of hot and cold data; based on the fluctuation data of new and old users and / or the fluctuation parameters of hot and cold data, determine the target adjustment cache space from the first data cache space and the second data cache space; Obtain reserved cache space and determine a second cache adjustment ratio for the reserved cache space; the reserved cache space is a data cache space other than the first data cache space and the second data cache space; Based on the second cache adjustment ratio, a second sliding window adjustment area is selected from the reserved cache space, and the second sliding window adjustment area is associated with the target adjustment cache space.
9. The method according to claim 1, further comprising: Based on the target cache adjustment method, a cache eviction mechanism is applied to adjust the first data cache space and / or the second data cache space.
10. The method according to claim 9, wherein adjusting the first data cache space and / or the second data cache space based on the target cache adjustment method using a cache eviction mechanism includes: If the target cache adjustment method is a dynamic cache adjustment method, then the least recently used cache mechanism is used to perform cache eviction processing on the first data cache space, and the least frequently used cache mechanism is used to perform cache eviction processing on the second data cache space.
11. A cache management device, the device comprising: The information acquisition module is used to monitor the cache fluctuation status of hot data and cold data, and to acquire access user distribution information based on the cache fluctuation status. The data processing module is used to determine a target cache adjustment method based on the access user distribution information, and to adjust the cache space of the first data cache space and / or the second data cache space using the target cache adjustment method. The first data cache space is a data storage space for caching the hot data, and the second data cache space is a data cache space for caching the cold data. When the target cache adjustment method is a dynamic cache adjustment method, the step of adjusting the cache space of the first data cache space and / or the second data cache space using the target cache adjustment method includes: The service platform's total cache space includes a first data cache space and a second data cache space. A sliding window adjustment area and a target adjustment cache space are determined. The sliding window adjustment area is allocated to the target adjustment cache space for cache space adjustment. The target adjustment cache space is at least one of the first and second data cache spaces. The sliding window adjustment area is not a cache area that already caches cold / hot data; the sliding window adjustment area is selected from a third data cache space other than the target adjustment cache space, within the first and second data cache spaces. Alternatively, The total cache space of the service platform includes a first data cache space, a second data cache space, and a reserved cache space. A sliding window adjustment area and a target adjustment cache space are determined. The sliding window adjustment area is allocated to the target adjustment cache space for cache space adjustment. User traffic fluctuation status is continuously detected, and the sliding window adjustment area is released based on the user traffic fluctuation status. The target adjustment cache space is at least one of the first data cache space and the second data cache space. The sliding window adjustment area is not a cache area that has already cached cold / hot data. The sliding window adjustment area is selected from all or part of the reserved cache space as the sliding window adjustment area. The process of determining the sliding window adjustment area includes: weighting each type of monitoring parameter based on at least one monitoring parameter in the monitored user access distribution information of each round to obtain an evaluation value, determining the reference evaluation range in which the evaluation value falls among multiple set reference evaluation ranges, obtaining the reference cache adjustment ratio corresponding to the reference evaluation range as the cache adjustment ratio, and determining the sliding window adjustment area based on the cache adjustment ratio. The device is also used for: Obtain the first cached data to be stored for the first data cache space and / or the second data cache space, and determine the first cache key information corresponding to the first cached data. The first cache key information includes keyword element data and value element data generated based on the key-value pair encoding method. Based on the mapping relationship between different delimiters and the corresponding keyword elements of the delimiters, a delimiter is determined for the keyword element data. The delimiter is used to replace the keyword element data and the space occupied by the delimiter is smaller than that of the keyword element data. Encoding processing is performed based on the value element data and the delimiter to obtain the second cache data. The second cache data is cache-encoded data that does not contain the keyword element data in the key-value pairs. The second cache data is cached and stored. In response to a client's data query request, the system retrieves second cached data, performs target decoding on the second cached data to obtain third cached data, and sends the third cached data to the client; or, the system sends the second cached data to the client so that the client performs target decoding on the second cached data to obtain third cached data, wherein the third cached data is cache-encoded data containing keyword element data in key-value pairs; The step of performing target decoding processing on the second cached data to obtain the third cached data includes: determining the second cache key information corresponding to the second cached data, wherein the second cache key information includes value element data and delimiter; The method involves determining the data type of the value element data to determine the keyword element data based on the data type of the value element data; and / or, based on the mapping relationship between different delimiters and keyword elements, determining the keyword element data corresponding to the delimiter in the second cache key information; The third cache data is obtained by encoding the value element data and the keyword element data.
12. A computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the method steps of any one of claims 1 to 10.
13. A computer program product storing at least one instruction, said at least one instruction being loaded by a processor and executing the method steps of any one of claims 1 to 10.
14. An electronic device comprising: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the method steps as claimed in any one of claims 1 to 10.
Citation Information
Patent Citations
Access scheduling method, apparatus and system, terminal, server and storage medium
CN107426302A
Data cache service system and method, and terminal
CN107562804A
Cold and hot data exchange method and system based on optical storage
CN110442309A
Cache space management method and device for storage volume and electronic equipment
CN112015343A
Storage management method, electronic equipment and computer program product
CN113742131A