Memory management method, system and device for memory database and memory database server

By obtaining memory usage information and using the release time prediction model to dynamically calculate the memory release time, the delay glitch and memory bloating problems of the memory database are solved, and the stability of memory resources and smooth data elimination are achieved.

CN120276682AActive Publication Date: 2025-07-08ALIBABA CLOUD COMPUTING CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202510734593.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-07-08
Estimated Expiration
2045-06-04

AI Technical Summary

Technical Problem

现有内存数据库在内存写满后存在时延毛刺和内存膨胀问题,影响性能和资源稳定性。

Method used

By obtaining memory usage information, calculating memory release information, and using the release time prediction model to dynamically predict memory release time, balancing data writing and elimination processing, avoiding memory bloat and delay glitches.

Benefits of technology

It realizes smooth data elimination of memory databases in different scenarios, ensures the stability and effective control of memory resources, and avoids memory bloating and delay glitching problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276682A_ABST
    Figure CN120276682A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a memory management method, system and device for a memory database and a memory database server, and the memory management method for the memory database comprises the steps that in response to an operation instruction submitted for the memory database, memory use information of the memory database is obtained; calculating memory release information of the memory database according to the memory use information under the condition of determining that the memory database meets a memory release condition according to the memory use information; the memory release information is input into a release time prediction model to be processed, memory release time is obtained, and the memory release time prediction model predicts the memory release time according to gain information corresponding to the memory release information; and for the memory database, releasing redundant data according to the memory release time, and executing the operation instruction of writing data into the memory database according to a data release result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of database technology, and particularly to a memory management method, system, device, and memory database server for a memory database. Background Art

[0002] With the development of computer and Internet technologies, the application of memory databases has laid the foundation for efficient data processing. Memory databases implement memory management and data eviction strategies. When faced with the contradiction between a large amount of data writing and limited memory resources, they allow users to evict data in the memory database according to different strategies after the memory is full and reaches a preset threshold, ensuring that memory usage is both efficient and controllable. In the prior art, in order to achieve the above effects, an eviction strategy is usually configured for the memory database. However, the setting of the eviction strategy is affected by the scenario, and there are still problems of latency spikes and memory inflation. Latency spike means that when eviction occurs after the memory is full, if the amount of evicted data is too large at this time, the user needs to wait for the data eviction to complete before being able to continue writing, resulting in a significant drop in QPS and a rapid increase in latency, affecting performance. Memory inflation means that when eviction occurs after the memory is full, in order to avoid latency spikes, a fixed waiting latency is set. During this latency interval, the server performs eviction, and new commands are executed after this latency ends. If the writing speed is greater than the eviction speed at this time, the user's running memory will continue to increase, thus causing the problem of memory inflation. Therefore, an effective solution is urgently needed to solve the above problems. Summary of the Invention

[0003] In view of this, the embodiments of this specification provide a memory management method for a memory database. One or more embodiments of this specification simultaneously relate to a memory management system for a memory database, a memory database server, a memory management device for a memory database, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.

[0004] According to the first aspect of the embodiments of this specification, a memory management method for a memory database is provided, including: Responding to an operation instruction submitted for the memory database, and obtaining the memory usage information of the memory database; When it is determined according to the memory usage information that the memory database meets the memory release condition, calculating the memory release information of the memory database according to the memory usage information; Inputting the memory release information into a release time prediction model for processing to obtain a memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information; Release redundant data from the memory database according to the memory release time, and execute the operation instruction to write data to the memory database according to the data release result.

[0005] According to a second aspect of the embodiments of the present specification, there is provided a memory management system for a memory database, including a server and a client, including: The client is configured to receive an operation instruction submitted for a target service item and submit the operation instruction to the server; The server is configured to, in response to an operation instruction submitted for the memory database, obtain the memory usage information of the memory database; when it is determined according to the memory usage information that the memory database meets the memory release condition, calculate the memory release information of the memory database according to the memory usage information; input the memory release information into a release time prediction model for processing to obtain a memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information; release redundant data from the memory database according to the memory release time, and execute the operation instruction to write data to the memory database according to the data release result; and feedback data operation information to the client according to the data writing result.

[0006] According to a third aspect of the embodiments of the present specification, there is provided a memory database server, including: A memory database, a memory, and a processor; The memory is used to store memory management instructions for managing the memory database, and the processor is used to execute the memory management instructions. When the memory management instructions are executed by the processor to manage the memory database, the steps of the memory management method of the memory database are implemented.

[0007] According to a fourth aspect of the embodiments of the present specification, there is provided a memory management device for a memory database, including: An acquisition module configured to, in response to an operation instruction submitted for the memory database, obtain the memory usage information of the memory database; A calculation module configured to, when it is determined according to the memory usage information that the memory database meets the memory release condition, calculate the memory release information of the memory database according to the memory usage information; A processing module configured to input the memory release information into a release time prediction model for processing to obtain a memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information; A release module, configured to release redundant data for the in-memory database according to the in-memory release time, and execute the operation instruction of writing data to the in-memory database according to the data release result.

[0008] According to a fifth aspect of the embodiments of the present specification, a computing device is provided, including: A memory and a processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the above-mentioned in-memory management method of the in-memory database are implemented.

[0009] According to a sixth aspect of the embodiments of the present specification, a computer-readable storage medium is provided, which stores computer-executable instructions. When the instructions are executed by a processor, the steps of the above-mentioned in-memory management method of the in-memory database are implemented.

[0010] According to a seventh aspect of the embodiments of the present specification, a computer program product is provided, including a computer program or instruction. When the computer program or instruction is executed by a processor, the steps of the above-mentioned in-memory management method of the in-memory database are implemented.

[0011] For the in-memory management method of the in-memory database provided in this embodiment, in order to solve the problems of latency jitter and memory bloat, after receiving an operation instruction submitted for the in-memory database, the in-memory usage information of the in-memory database can be obtained first; and then if it is determined according to the in-memory usage information that the in-memory database meets the in-memory release condition, it means that data elimination processing can be performed at this time. In order to achieve the dynamic balance of writing and eliminating data, the in-memory release information of the in-memory database can be calculated according to the in-memory usage information; at this time, the in-memory release information is input into the release time prediction model for processing to obtain the in-memory release time, where the release time prediction model predicts the in-memory release time according to the gain information corresponding to the in-memory release information; and then the in-memory release time corresponding to different stages is dynamically calculated, so as to balance the writing and elimination processing of data, avoid memory bloat and latency jitter problems, and finally redundant data can be released for the in-memory database according to the in-memory release time, and the operation instruction of writing data to the in-memory database is executed according to the data release result. By dynamically calculating the in-memory release time, the in-memory database can perform smooth data elimination, effectively control memory bloat, and thus ensure the stability of the in-memory database in providing in-memory resources in different scenarios. Description of the Drawings

[0012] Figure 1 is a flowchart of an in-memory management method of an in-memory database provided by an embodiment of the present specification; Figure 2aIt is a schematic diagram of threshold setting in a memory management method of a memory database provided by an embodiment of this specification; Figure 2b It is a schematic diagram of membership degree division in a memory management method of a memory database provided by an embodiment of this specification; Figure 3 It is a flowchart of the processing process of a memory management method of a memory database provided by an embodiment of this specification; Figure 4 It is a schematic diagram of the structure of a memory management system of a memory database provided by an embodiment of this specification; Figure 5 It is a schematic diagram of the structure of a memory management device of a memory database provided by an embodiment of this specification; Figure 6 It is a block diagram of the structure of a computing device provided by an embodiment of this specification. Detailed implementation manners

[0013] Many specific details are set forth in the following description in order to provide a thorough understanding of this specification. However, this specification can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the connotation of this specification. Therefore, this specification is not limited by the specific implementations disclosed below.

[0014] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "the" and "said" used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more of the associated listed items.

[0015] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first can also be referred to as the second, and similarly, the second can also be referred to as the first. Depending on the context, the word "if" as used herein can be interpreted as "when" or "upon" or "in response to determining".

[0016] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data that have been authorized by the user or fully authorized by all parties. Moreover, the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or reject.

[0017] First, the noun terms involved in one or more embodiments of this specification are explained.

[0018] Redis (Remote Dictionary Server) is an open-source, in-memory data structure storage system that can be used as a database, cache, and message middleware. Redis supports multiple data structures such as strings, hashes, lists, sets, sorted sets, etc., and provides rich operation commands to efficiently manage and query these data structures.

[0019] Data eviction: When the in-memory database is full of data, data eviction is triggered, and some data is evicted from the database to allow new data to be written. It can be controlled by setting eviction policies such as "random eviction", "evict infrequently used", "do not evict", etc.

[0020] Eviction latency: In some in-memory databases, if the memory capacity is full, new write commands need to wait for the database to evict some data before writing new data. This waiting time is called eviction latency.

[0021] Latency spike: The time from when a command is executed to when it returns is the latency of the command. If this latency suddenly increases in a short period of time, it is called a latency spike.

[0022] PID: The PID controller (Proportional-Integral-Derivative Controller) is a closed-loop control algorithm widely used in the fields of industrial control and automation. By continuously adjusting the output of the system, the actual output is made as close as possible to the set reference input (target value).

[0023] In this specification, a method for memory management of an in-memory database is provided. One or more embodiments of this specification also involve a memory management system for an in-memory database, an in-memory database server, a memory management device for an in-memory database, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail one by one in the following embodiments.

[0024] See Figure 1 , Figure 1 which shows a flowchart of a memory management method for an in-memory database provided according to an embodiment of this specification, specifically including the following steps.

[0025] Step S102: In response to an operation instruction submitted for the in-memory database, obtain the memory usage information of the in-memory database.

[0026] The memory management method for the in-memory database provided in this embodiment can be applied to any in-memory database, such as Redis, Memcached, Aerospike, VoltDB, etc., and is used to dynamically calculate the memory release time, which can enable the in-memory database to perform smooth data elimination, effectively control memory expansion, and thus ensure the stability of the in-memory database in providing memory resources in different scenarios.

[0027] In this embodiment, the in-memory database is taken as Redis as an example to illustrate the memory management method for the in-memory database. For the memory management method for the in-memory database in other scenarios, the same or corresponding descriptions in this embodiment can be referred to, and this embodiment will not elaborate too much here.

[0028] Among them, the operation instruction specifically refers to the instruction for a user to submit operation data when using a target service project. This instruction is used to trigger writing data into the in-memory database so that data can be read from the in-memory database later for executing the target service project. Correspondingly, the memory usage information specifically refers to the amount of memory space that the in-memory database has been used at the current moment when the operation instruction is received, and is used to provide a basis for subsequent judgment of whether to perform data elimination.

[0029] Based on this, in order to solve the problems of latency jitter and memory bloat, after receiving an operation instruction submitted for the in-memory database, the memory usage information of the in-memory database can be obtained first; then, if it is determined according to the memory usage information that the in-memory database meets the memory release condition, it means that data elimination processing can be performed at this time. In order to achieve the dynamic balance of writing and eliminating data, the memory release information of the in-memory database can be calculated according to the memory usage information; at this time, the memory release information is input into the release time prediction model for processing to obtain the memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information; furthermore, the memory release time corresponding to different stages can be dynamically calculated to balance the writing and elimination processing of data, avoid memory bloat and latency jitter problems, and finally, redundant data can be released for the in-memory database according to the memory release time, and the operation instruction to write data to the in-memory database can be executed according to the data release result. By dynamically calculating the memory release time, the in-memory database can perform smooth data elimination, effectively control memory bloat, and thus ensure the stability of the in-memory database in providing memory resources in different scenarios.

[0030] Step S104, when it is determined according to the memory usage information that the in-memory database meets the memory release condition, calculate the memory release information of the in-memory database according to the memory usage information.

[0031] Specifically, after determining the memory usage information of the in-memory database at the current moment according to the operation instruction, further, it can be detected according to the memory usage information whether the in-memory database needs to perform data elimination processing. If it is determined according to the memory usage information that the in-memory database meets the memory release condition, it means that the remaining memory resources of the in-memory database at this time are not enough to complete the data writing operation corresponding to the operation instruction, so data elimination processing is required. In order to dynamically balance data elimination and writing, the memory release information of the in-memory database can be calculated first according to the memory usage information, so as to calculate the memory release time in combination with the memory release information later, so as to ensure that the memory release time calculated in each stage meets the current data elimination requirements, that is, there will be no large amount of latency jitter and no memory bloat will be caused.

[0032] Among them, the memory release condition specifically refers to the condition for judging whether it is necessary to execute the data elimination mechanism on the data stored in the in-memory database at the current moment, which can be constructed by setting a memory elimination threshold; correspondingly, the memory release information specifically refers to the information on the size of the memory space that the in-memory database needs to release after calculation according to the memory usage information, and is used for subsequent calculation of the memory release time.

[0033] Further, when determining whether the in-memory database needs to perform data elimination, it can be achieved by comparing with a set threshold. In this embodiment, the specific implementation method is as follows: Determine the early release threshold and the late release threshold of the in-memory database, and compare the memory usage information with the early release threshold and the late release threshold; in the case where the memory usage information is greater than the early release threshold and less than the late release threshold, determine that the in-memory database meets the memory release condition, and execute the step of calculating the memory release information of the in-memory database according to the memory usage information; wherein, the early release threshold is less than the memory capacity of the in-memory database, and the late release threshold is greater than the memory capacity.

[0034] Specifically, the early release threshold specifically refers to the threshold for the in-memory database that can execute the data elimination mechanism in advance, which is less than the memory capacity of the in-memory database; the late release threshold specifically refers to the threshold for the in-memory database that can block operation instructions and only perform data elimination, which is greater than the content capacity of the in-memory database.

[0035] Based on this, before determining whether to calculate the memory release time according to the current memory usage information, the early release threshold and the late release threshold of the in-memory database can be determined first, and at this time, the memory usage information can be compared with the early release threshold and the late release threshold; in the case where the memory usage information is greater than the early release threshold and less than the late release threshold, it means that the usage situation of the in-memory database is about to reach the maximum memory capacity at this time. If the operation command continues to be executed, it will cause congestion of operation instructions, and then only data elimination will be performed. However, only performing data elimination will cause congestion of subsequent operation commands and may not meet the user's needs. Therefore, in the case where the memory usage information is greater than the early release threshold and less than the late release threshold, it can be determined that the in-memory database meets the memory release condition, and at this time, the step of calculating the memory release information of the in-memory database according to the memory usage information can be executed.

[0036] In summary, by setting the early release threshold and the late release threshold, the execution of the elimination mechanism can be dynamically controlled, thereby ensuring that different memory usage situations select different elimination mechanisms for data elimination, and thus improving the load balancing ability.

[0037] In addition, if the memory usage information is not between the early release threshold and the late release threshold, other strategies need to be used to execute the operation instructions. In this embodiment, the specific implementation method is as follows: When the memory usage information is less than or equal to the early release threshold, execute the operation instruction to write data to the in-memory database; when the memory usage information is greater than or equal to the delayed release threshold, release the redundant data according to the set memory release time, and execute the operation instruction to write data to the in-memory database according to the data release result.

[0038] Specifically, the set memory release time specifically refers to the time when, when the memory usage information is greater than or equal to the delayed release threshold, only the congestion operation instruction is directly executed and only data elimination is performed.

[0039] Based on this, when the memory usage information is less than or equal to the early release threshold, it indicates that the in-memory database still has more memory resources available at this time. Therefore, there is no need to perform data elimination, and the operation instruction to write data to the in-memory database can be directly executed. When the memory usage information is greater than or equal to the delayed release threshold, it indicates that the usage of the in-memory database has exceeded the maximum content capacity of the in-memory database. If the data write operation is still carried out according to the original plan, it may cause the waiting time of the operation instruction to increase infinitely. Therefore, to avoid this problem, the redundant data can be released according to the set memory release time until the set memory release time ends, and then the operation instruction to write data to the in-memory database can be executed according to the data release result.

[0040] In summary, by setting the early release threshold and the delayed release threshold, different elimination strategies can be selected under different memory usage conditions, thereby effectively improving the memory resource utilization rate of the in-memory database.

[0041] Furthermore, when calculating the memory release information, it can be completed by combining the memory capacity information and the memory usage information. In this embodiment, the specific implementation method is as follows: Determine the memory capacity information corresponding to the in-memory database, and calculate the memory release information of the in-memory database according to the memory capacity information and the memory usage information.

[0042] Specifically, the memory capacity information specifically refers to the maximum memory capacity of the in-memory database. Based on this, when it is determined that the in-memory database needs to perform data elimination, the memory capacity information corresponding to the in-memory database can be determined first, and then the memory release information of the in-memory database can be calculated according to the memory capacity information and the memory usage information for subsequent calculation and use of the memory release time.

[0043] For example, after the user submits a write command for Redis, such as Figure 2aAs shown in the figure, the maximum memory capacity of Redis is 1GB, the set early elimination threshold is 0.8GB, and the delayed elimination threshold is 1.2GB. On this basis, it can be determined that the memory value corresponding to Redis at the current moment is 0.9GB. By comparison, it is determined that the memory value corresponding to the current moment, 0.9GB, is greater than the early elimination threshold of 0.8GB and less than the delayed elimination threshold of 1.2GB. This further indicates that at this time, Redis can perform dynamic calculation of the elimination time to ensure that excessive latency glitches and memory inflation problems are avoided at the current moment. At the same time, the memory value to be eliminated at the current moment can be calculated based on the above-obtained memory value. After calculation, it is determined that the memory value occupied by the data to be eliminated is 0.1GB, denoted as e(t). Subsequently, the elimination time can be calculated according to the memory value to be eliminated e(t) = 0.1GB.

[0044] In addition, if the memory usage value corresponding to Redis at the current moment is 0.5GB, and it is determined by comparison that the memory value corresponding to the current moment is less than the early elimination threshold of 0.8GB, the write command can be directly executed to write data into Redis. If the memory usage value corresponding to Redis at the current moment is 1.5GB, and it is determined by comparison that the memory value corresponding to the current moment is greater than the delayed elimination threshold of 1.2GB, if data elimination is not performed in a timely manner at this time, it may cause memory inflation, and at the same time, the write command waiting time is too long. Therefore, the write command can be congested, and the set elimination time of 100ms can be determined. Thereafter, data elimination of Redis can be performed for 100ms, and it can be determined that the memory space of Redis is released after the data elimination is completed. Furthermore, the congested write command can be continued to be executed.

[0045] Step S106: Input the memory release information into the release time prediction model for processing to obtain the memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information.

[0046] Specifically, after obtaining the memory release information as above, in order to avoid the occurrence of latency glitches and memory inflation problems, the memory release information at the current moment can be combined and processed through the release time prediction model to calculate the most appropriate memory release time at the current moment, so as to realize the release operation of redundant data according to the dynamically calculated memory release time in the follow-up. Moreover, when the release time prediction model predicts the memory release time, it completes the prediction by inputting the memory release information and combining its corresponding gain information, which can ensure that the memory release time calculated in each stage is more in line with the release requirements of the current scenario, and avoid affecting the normal service operation due to too long or too short time.

[0047] Among them, the release time prediction model specifically refers to a model that inputs memory release information and calculates the memory release time in combination with its corresponding gain information; correspondingly, the memory release time specifically refers to the duration required to make the memory database perform data elimination at the current moment, which can be different durations through calculation in different stages, so as to achieve the purpose of elastic data elimination.

[0048] On the one hand, when calculating the memory release time according to the memory release information, the PID model can be used to dynamically adjust the delay of each time when the elimination is triggered. In this embodiment, the specific implementation method is as follows: In the case where the operation instruction corresponds to the first data release scenario, select the release time prediction model associated with the first data release scenario, and input the memory release information into the release time prediction model; use the release time prediction model to calculate the first error ratio, the first error integral, and the first error differential term according to the gain information corresponding to the memory release information; determine the memory release time based on the first error ratio, the first error differential, and the first error differential term.

[0049] Specifically, the first data release scenario specifically refers to the default data writing scenario of the memory database. In this scenario, the operation instruction has no special indication, and the memory release time can be directly calculated in combination with its corresponding release time prediction model.

[0050] Based on this, in the case where the operation instruction corresponds to the first data release scenario, it indicates that the memory database deployment scenario at this time is not overloaded and will not be affected by parameters in other dimensions. Therefore, the release time prediction model associated with the first data release scenario can be directly selected, and the memory release information can be input into the release time prediction model; then, the release time prediction model can be used to calculate the first error ratio, the first error integral, and the first error differential term according to the gain information corresponding to the memory release information; and the memory release time can be determined based on the first error ratio, the first error differential, and the first error differential term.

[0051] In practical applications, when it is determined that data elimination needs to be performed on the memory database, the user needs to wait until all redundant data is evicted before continuing to write, which will cause the QPS to drop to zero instantly and the command latency to increase significantly, resulting in a large number of latency spikes and affecting the user experience. If data is released according to a fixed elimination time, and at this time if the write speed is greater than the elimination speed, it will cause the memory to increase. Therefore, in order to balance the elimination speed and the command latency, the memory release time can be calculated in combination with the memory release information in the first data release scenario. Thus, when the memory increases rapidly, the latency of each access command can be increased, and the data elimination time can be longer to control the memory increase speed. If the memory increases slowly, the latency of each access command can be reduced, and the data elimination time can be shorter.

[0052] Based on this, according to the above-described logic, the delay of each time when triggering elimination, that is, the memory release time, can be dynamically adjusted based on the classic PID (differential, integral, difference) model (release time prediction model) in the control field, which can be expressed by the following formula (1): (1) Where K p represents the proportional gain, K i represents the integral gain, K d represents the differential gain, e represents the error, which is equal to the setpoint (SP) minus the recovery value (PV), t represents the target time, u represents the state input, e(t) represents the difference between the instance memory and the actual memory, and u(t) represents the elimination time of each access, that is, the memory release time.

[0053] It can be understood that in the case of rapid fluctuations of e(t), by adjusting K p , K i and K d parameters, u(t) can reach a stable value quickly and smoothly, so as to realize the release of redundant data according to the calculated memory release time, and the elimination speed and command delay can be balanced.

[0054] Following the above example, when determining that the memory value to be eliminated e(t) = 0.1GB, the proportional, integral, and differential terms corresponding to e(t) can be calculated through the above formula (1), and then the elimination time u(t) = 50ms corresponding to the current moment can be obtained by summation. Subsequently, the redundant data in Redis can be eliminated according to u(t) = 50ms.

[0055] In summary, by using the PID model to calculate the memory release time in combination with the memory release information, it can be ensured that the calculated memory release time better meets the requirements of the current scenario, thus avoiding the memory inflation problem caused by setting a fixed release time.

[0056] On the other hand, in the face of complex data elimination scenarios, in order to make the calculation of the memory release time more interpretable and adapt to more complex scenarios, the memory release time can be calculated by calculating the memory change rate. In this embodiment, the specific implementation method is as follows: When the operation instruction corresponds to the second data release scenario, select a release time prediction model associated with the second data release scenario, and input the memory release information into the release time prediction model; use the release time prediction model to calculate the memory change rate corresponding to the memory release information, and determine the gain information corresponding to the memory release information according to the memory change rate and the memory release information; calculate the second error ratio, the second error integral, and the second error differential term according to the gain information, and determine the memory release time based on the second error ratio, the second error differential, and the second error differential term.

[0057] Specifically, the second data release scenario is a complex data elimination scenario, which can be understood as directly calculating the memory release time based on the memory release information. In this scenario, the calculation result may not be accurate enough due to the load scenario environment. Therefore, a release time prediction model associated with the second data release scenario can be selected for calculating the memory release time. Correspondingly, the memory change rate specifically refers to the change probability corresponding to the memory release information.

[0058] Based on this, when the operation instruction corresponds to the second data release scenario, it indicates that a release time prediction model associated with the second data release scenario needs to be selected at this time for calculating the memory release time, so as to ensure the calculation accuracy. Therefore, the memory release information can be input into the release time prediction model; use the release time prediction model to calculate the memory change rate corresponding to the memory release information. On this basis, then determine the gain information corresponding to the memory release information according to the memory change rate and the memory release information; calculate the second error ratio, the second error integral, and the second error differential term according to the gain information. After that, the memory release time can be determined based on the second error ratio, the second error differential, and the second error differential term for subsequent use in releasing redundant data.

[0059] In summary, using the release time prediction model corresponding to the second data release scenario for predicting memory release information in complex scenarios can ensure the calculation accuracy of the memory release time in complex scenarios. Releasing memory in this way can avoid generating a large number of glitches and avoid memory inflation, thus balancing data elimination and data writing.

[0060] During this process, determining the gain information corresponding to the memory release information according to the memory change rate and the memory release information includes: Map the memory change rate and the memory release information to the target universe of discourse according to the linear mapping algorithm; calculate the first membership degree corresponding to the memory change rate and the second membership degree corresponding to the memory release information according to the mapping result; perform a conversion on the first membership degree and the second membership degree, and calculate the gain information corresponding to the memory release information according to the membership degree conversion result.

[0061] Specifically, the linear mapping algorithm specifically refers to an algorithm that maps the memory change rate and memory release information. The target domain specifically refers to the domain of the fuzzy set corresponding to the memory change rate and memory release information. The first membership degree specifically refers to the membership degree corresponding to the memory change rate, and the second membership degree specifically refers to the membership degree corresponding to the memory release information.

[0062] Based on this, when calculating the gain information, the memory change rate and memory release information can be mapped to the target domain according to the linear mapping algorithm; thereafter, the first membership degree corresponding to the memory change rate and the second membership degree corresponding to the memory release information can be calculated according to the mapping results; on this basis, the first membership degree and the second membership degree are converted to calculate the gain information corresponding to the memory release information according to the membership degree conversion result.

[0063] In summary, by calculating the membership degree to determine the gain information, it can ensure that the prediction result is more accurate when predicting the memory release time subsequently.

[0064] Furthermore, converting the first membership degree and the second membership degree and calculating the gain information corresponding to the memory release information according to the membership degree conversion result includes: Querying the proportional rule table, integral rule table, and differential term rule table according to the first membership degree and the second membership degree; determining the proportional membership degree, integral membership degree, and differential term membership degree according to the query results, and calculating the initial gain information according to the proportional membership degree, the integral membership degree, and the differential term membership degree; updating the initial gain information to obtain the gain information corresponding to the memory release information.

[0065] Specifically, the proportional rule table specifically refers to a data table that records the membership degrees related to proportion, the integral rule table specifically refers to a data table that records the membership degrees related to integral, and the differential term rule table specifically refers to a data table that records the membership degrees related to differential terms.

[0066] Based on this, when calculating the gain information according to the first membership degree and the second membership degree, the proportional rule table, integral rule table, and differential term rule table can be queried according to the first membership degree and the second membership degree; thereby, the proportional membership degree, integral membership degree, and differential term membership degree can be determined according to the query results. On this basis, the initial gain information is calculated according to the proportional membership degree, integral membership degree, and differential term membership degree; on this basis, the initial gain information is updated to obtain the gain information corresponding to the memory release information for calculating the memory release time and ensuring the calculation accuracy.

[0067] In practical applications, in the second data release scenario, the prediction accuracy of the memory release time can be improved by configuring the release time prediction model corresponding to this scenario. Specifically, when predicting the memory release time, input fuzzification can be performed first. Combining with the method of fuzzy control, the fuzzy sets of the input variable error e(t) and the change value ec(t) of the error variable can be set as {negative, negative medium, negative small, zero, positive small, positive medium, positive large}, and briefly recorded as {NB, NM, NS, ZO, PS, PM, PB}. The domain of the fuzzy set is set as {-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6}. The maximum and minimum values of e(t) and ec(t) can be obtained through the actual stress test results, denoted as Emin, Emax, ECmin, and ECmax. Then, through linear mapping, the values of e(t) and ec(t) can be mapped to the interval range [-6, 6] of the fuzzy subset domain, which can be achieved by the following formula (2): (2) Furthermore, the membership degrees of the above input variables to the fuzzy set can be calculated through the membership function / membership degree graph. At this time, a triangular narrow membership function can be selected (for example, the two sides of the triangle with NM as the vertex both belong to NM), and the corresponding values of f(e) and f(ce) can be mapped to the corresponding membership degrees. See Figure 2b the schematic diagram shown. If the value calculated by f(e) is -3, the membership degree belonging to NM is 0.5, and the membership degree belonging to NS is also 0.5.

[0068] Furthermore, after fuzzification, fuzzy control rules can be established for fuzzy inference. That is, the membership degrees of the input variables are changed through certain conditional rules to obtain the membership degrees of the output variables. This process involves the parameter adjustment of the three variables K p ,K i ,K d , so it is necessary to set the fuzzy rule tables for the three variables △K p ,△K i ,△K d . The fuzzy set is also defined as {negative, negative medium, negative small, zero, positive small, positive medium, positive large}, and briefly recorded as {NB, NM, NS, ZO, PS, PM, PB}. The domain of the fuzzy set is set as {-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6}. Among them, the fuzzy rule table of △K p is shown in Table 1 below, the fuzzy rule table of △K i is shown in Table 2 below, and the fuzzy rule table of △K d is shown in Table 3 below:

[0069] Table 1

[0070] Table 2

[0071] Table 3 For example, if the membership degree of f(e) is 0.4NM + 0.6NS and the membership degree of f(ec) is 0.3PS + 0.7PM, then the membership degree output after querying the above fuzzy rule table is: △K p = 0.4 * 0.3 PS + 0.4 * 0.7 ZO + 0.6 * 0.3ZO + 0.6 * 0.7NS = 0.12PS + 0.46ZO + 0.42NS △K i = 0.4 * 0.3 NS + 0.4 * 0.7 ZO + 0.6 * 0.3ZO + 0.6 * 0.7PS = 0.12NS + 0.46ZO + 0.42PS △K d = 0.4 * 0.3 NM + 0.4 * 0.7 NS + 0.6 * 0.3NS + 0.6 * 0.7NS = 0.12NM + 0.88NS After obtaining the output value △K p ,△K i ,△K d with their membership degree values, defuzzification output can be performed. At this time, the centroid method can be used to calculate the quantization value of the output, which can be achieved through the following formula (3): (3) where Mi is the membership degree value and Fi is the defuzzified value (e.g., NM = -4).

[0072] Continuing with the above example, after obtaining the membership degrees determined by the query table, the membership degree values of the proportional, integral, and differential terms can be further calculated: △K p = 0.12PS + 0.46ZO + 0.42NS = 0.12 * 2 + 0.46 * 0 + 0.42 * -2 = -0.6 △K i = 0.12NS + 0.46ZO + 0.42PS = 0.12 * -2 + 0.46 * 0 + 0.42 * 2 = 0.6 △K d = 0.12NM + 0.88NS = 0.12 * -4 + 0.88 * -2 = -1.28 After obtaining the quantized value of the defuzzified output, the change amplitude can be adjusted by setting coefficients, which can be achieved through the following formula (4): (4) where K represents the PID coefficient K p , K i , K d , and α represents the change coefficient of △K.

[0073] That is to say, based on the fuzzy rule table, the input error variables e(t) and ec(t) can not only adjust the change of the input quantity u(t), but also adjust the PID parameters during the process, so as to improve the stability of the dynamic change of the time delay under different data elimination scenarios, which can be expressed by the following formula (5): (5) where K p , K i , K d are affected by the changes of e(t) and ec(t) during the input process.

[0074] It can be understood that in the case of rapid fluctuations of e(t), the parameters of K p , K i and K d can be adjusted to make u(t) reach a stable value quickly and smoothly, so as to realize the release of redundant data according to the calculated memory release time, and the elimination speed and command time delay can be balanced.

[0075] Continuing with the above example, when determining that the memory value to be eliminated e(t) = 0.1GB, the corresponding change rate ec(t) of e(t) can be calculated first, and then the updated values of the PID parameters K p (t), K i (t) and K d (t) can be calculated through e(t) and ec(t) in combination with the above formulas (2) to (5). Based on the updated K p (t), K i (t) and K d (t), the proportional, integral and differential terms of the corresponding error can be calculated, and then the elimination time u(t) = 25ms corresponding to the current moment can be obtained through summation. Subsequently, the redundant data in Redis can be eliminated according to u(t) = 25ms.

[0076] In summary, by querying the rule tables of different dimensions to determine the membership degree and using it for the prediction of the memory release time, the calculation accuracy and efficiency can be effectively improved.

[0077] Step S108: Release redundant data from the in-memory database according to the in-memory release time, and execute the operation instruction of writing data to the in-memory database according to the data release result.

[0078] Specifically, after calculating the in-memory release time corresponding to the current moment through the release time prediction model, redundant data can be released from the in-memory database according to the in-memory release time. After the in-memory release time ends, the operation instruction of writing data to the in-memory database can be executed according to the data release result, so as to complete the operation process of writing the data corresponding to the operation instruction to the in-memory database. Among them, redundant data specifically refers to the data that can be deleted at the current moment in the in-memory database, such as data with a long storage time, data occupying a large amount of memory space, etc.

[0079] Furthermore, in order to ensure that the released redundant data does not affect the running target service project, redundant data can be determined according to a set strategy. In this embodiment, the specific implementation method is as follows: Determine redundant data in the in-memory database according to the set release strategy, release the redundant data according to the in-memory release time, and execute the operation instruction of writing data to the in-memory database according to the data release result.

[0080] Specifically, the set release strategy specifically refers to the strategy for determining redundant data. For example, the storage time of each piece of data can be sorted, and the data with the longest storage time can be selected as redundant data. Or the occupied space of each piece of data can be compared, and the data with an occupied space greater than the set threshold can be selected as redundant data.

[0081] Based on this, after determining the in-memory release time, redundant data can be determined in the in-memory database according to the set release strategy. After that, the redundant data can be released according to the in-memory release time, and the operation instruction of writing data to the in-memory database can be executed according to the data release result.

[0082] Continuing with the above example, after determining that the elimination time u(t) = 50ms, the redundant data to be deleted can be determined in Redis. For example, n pieces of redundant data with a too long storage time can be determined according to the storage time. At this time, these n pieces of redundant data can be deleted and continue for 50ms. After the elimination time ends, the data corresponding to the write command can be written to Redis, so as to ensure the normal operation of the target service project.

[0083] The memory management method of the memory database provided in this embodiment can solve the problems of latency jitter and memory bloat. After receiving an operation instruction submitted for the memory database, it can first obtain the memory usage information of the memory database. Then, if it is determined according to the memory usage information that the memory database meets the memory release condition, it means that data eviction processing can be performed at this time. In order to achieve the dynamic balance of writing and evicting data, the memory release information of the memory database can be calculated according to the memory usage information. At this time, the memory release information is input into the release time prediction model for processing to obtain the memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information. Furthermore, the memory release time corresponding to different stages can be dynamically calculated to balance the writing and eviction processing of data, avoid memory bloat and latency jitter problems, and finally, redundant data can be released for the memory database according to the memory release time, and the operation instruction to write data to the memory database can be executed according to the data release result. By dynamically calculating the memory release time, the memory database can perform smooth data eviction, effectively control memory bloat, and thus ensure the stability of the memory database in providing memory resources in different scenarios.

[0084] The above is a schematic solution of a memory management system for a memory database in this embodiment. It should be noted that the technical solution of the memory management system for the memory database belongs to the same concept as the technical solution of the above-mentioned memory management method for the memory database. For the details not described in the technical solution of the memory management system for the memory database, reference can be made to the description of the technical solution of the above-mentioned memory management method for the memory database.

[0085] The following combines the attached Figure 3 , taking the application of the memory management method of the memory database provided in this specification in the data eviction scenario of the memory database as an example, to further illustrate the memory management method of the memory database. Among them, Figure 3 shows the processing procedure flowchart of a memory management method for a memory database provided in an embodiment of this specification, which specifically includes the following steps.

[0086] Step S302, in response to an operation instruction submitted for the memory database, obtain the memory usage information of the memory database.

[0087] Step S304, determine the early release threshold and late release threshold of the memory database, and compare the memory usage information with the early release threshold and the late release threshold.

[0088] Step S306, when the memory usage information is greater than the early release threshold and less than the late release threshold, determine that the memory database meets the memory release condition.

[0089] Step S308: Determine the memory capacity information corresponding to the in-memory database, and calculate the memory release information of the in-memory database based on the memory capacity information and the memory usage information.

[0090] Step S310: Input the memory release information into the release time prediction model for processing to obtain the memory release time. Among them, the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information.

[0091] An optional processing method: In the case where the operation instruction corresponds to the first data release scenario, select the release time prediction model associated with the first data release scenario, and input the memory release information into the release time prediction model; use the release time prediction model to calculate the first error ratio, the first error integral, and the first error differential term according to the gain information corresponding to the memory release information; determine the memory release time based on the first error ratio, the first error differential, and the first error differential term.

[0092] Another optional processing method: In the case where the operation instruction corresponds to the second data release scenario, select the release time prediction model associated with the second data release scenario, and input the memory release information into the release time prediction model; use the release time prediction model to calculate the memory change rate corresponding to the memory release information, and map the memory change rate and the memory release information to the target universe of discourse according to the linear mapping algorithm; calculate the first membership degree corresponding to the memory change rate and the second membership degree corresponding to the memory release information according to the mapping result; query the proportional rule table, the integral rule table, and the differential term rule table according to the first membership degree and the second membership degree; determine the proportional membership degree, the integral membership degree, and the differential term membership degree according to the query result, and calculate the initial gain information according to the proportional membership degree, the integral membership degree, and the differential term membership degree; update the initial gain information to obtain the gain information corresponding to the memory release information, calculate the second error ratio, the second error integral, and the second error differential term according to the gain information, and determine the memory release time based on the second error ratio, the second error differential, and the second error differential term.

[0093] Step S312: Determine redundant data in the in-memory database according to the set release policy, and release the redundant data according to the memory release time.

[0094] Step S314: Execute the operation instruction to write data to the in-memory database according to the data release result.

[0095] In summary, to solve the problems of latency jitter and memory bloat, after receiving an operation instruction submitted for the in-memory database, the in-memory usage information of the in-memory database can be obtained first. Then, if it is determined according to the in-memory usage information that the in-memory database meets the memory release condition, it means that data eviction processing can be performed at this time. To achieve the dynamic balance between writing and evicting data, the in-memory release information of the in-memory database can be calculated based on the in-memory usage information. At this time, the in-memory release information is input into the release time prediction model for processing to obtain the in-memory release time, where the release time prediction model predicts the in-memory release time according to the gain information corresponding to the in-memory release information. Furthermore, the in-memory release time corresponding to different stages can be dynamically calculated to balance the writing and eviction processing of data, avoid memory bloat and latency jitter problems, and finally, redundant data can be released for the in-memory database according to the in-memory release time, and the operation instruction to write data to the in-memory database can be executed according to the data release result. By dynamically calculating the in-memory release time, the in-memory database can perform smooth data eviction, effectively control memory bloat, and thus ensure the stability of the in-memory database in providing in-memory resources in different scenarios.

[0096] Corresponding to the above method embodiments, this specification also provides an embodiment of an in-memory management system for an in-memory database. Figure 4 FIG. shows a schematic structural diagram of an in-memory management system for an in-memory database provided by an embodiment of this specification. As Figure 4 shown, the in-memory management system 400 of the in-memory database includes a server 420 and a client 410, including: The client 410 is configured to receive an operation instruction submitted for a target service item and submit the operation instruction to the server. The server 420 is configured to, in response to an operation instruction submitted for the in-memory database, obtain the in-memory usage information of the in-memory database; when it is determined according to the in-memory usage information that the in-memory database meets the memory release condition, calculate the in-memory release information of the in-memory database according to the in-memory usage information; input the in-memory release information into the release time prediction model for processing to obtain the in-memory release time, where the release time prediction model predicts the in-memory release time according to the gain information corresponding to the in-memory release information; release redundant data for the in-memory database according to the in-memory release time, and execute the operation instruction to write data to the in-memory database according to the data release result; and feedback data operation information to the client according to the data writing result.

[0097] In an alternative embodiment, the server 420 is further configured to determine an early release threshold and a delayed release threshold of the in-memory database, and compare the memory usage information with the early release threshold and the delayed release threshold; in a case where the memory usage information is greater than the early release threshold and less than the delayed release threshold, determine that the in-memory database meets the memory release condition, and perform a step of calculating memory release information of the in-memory database according to the memory usage information; wherein, the early release threshold is less than the memory capacity of the in-memory database, and the delayed release threshold is greater than the memory capacity.

[0098] In an alternative embodiment, the server 420 is further configured to determine memory capacity information corresponding to the in-memory database, and calculate memory release information of the in-memory database according to the memory capacity information and the memory usage information; wherein, releasing redundant data from the in-memory database according to the memory release time, and performing the operation instruction of writing data into the in-memory database according to the data release result includes: determining redundant data in the in-memory database according to a set release policy, releasing the redundant data according to the memory release time, and performing the operation instruction of writing data into the in-memory database according to the data release result.

[0099] In an alternative embodiment, when the operation instruction corresponds to a first data release scenario, the server 420 is further configured to select a release time prediction model associated with the first data release scenario, and input the memory release information into the release time prediction model; use the release time prediction model to calculate a first error ratio, a first error integral, and a first error differential term according to the gain information corresponding to the memory release information; determine the memory release time based on the first error ratio, the first error differential, and the first error differential term.

[0100] In an alternative embodiment, when the operation instruction corresponds to a second data release scenario, the server 420 is further configured to select a release time prediction model associated with the second data release scenario, and input the memory release information into the release time prediction model; use the release time prediction model to calculate a memory change rate corresponding to the memory release information, and determine gain information corresponding to the memory release information according to the memory change rate and the memory release information; calculate a second error ratio, a second error integral, and a second error differential term according to the gain information, and determine the memory release time based on the second error ratio, the second error differential, and the second error differential term.

[0101] In an alternative embodiment, the server 420 is further configured to map the memory change rate and the memory release information to a target universe of discourse according to a linear mapping algorithm; calculate a first membership degree corresponding to the memory change rate and a second membership degree corresponding to the memory release information according to the mapping result; perform a conversion on the first membership degree and the second membership degree, and calculate gain information corresponding to the memory release information according to the membership degree conversion result.

[0102] In an alternative embodiment, the server 420 is further configured to query a proportional rule table, an integral rule table, and a differential term rule table according to the first membership degree and the second membership degree; determine a proportional membership degree, an integral membership degree, and a differential term membership degree according to the query result, and calculate initial gain information according to the proportional membership degree, the integral membership degree, and the differential term membership degree; perform an update on the initial gain information to obtain the gain information corresponding to the memory release information.

[0103] In an alternative embodiment, the server 420 is further configured to execute the operation instruction of writing data to the memory database when the memory usage information is less than or equal to the early release threshold; release the redundant data at a set memory release time when the memory usage information is greater than or equal to the late release threshold, and execute the operation instruction of writing data to the memory database according to the data release result.

[0104] The memory management system of the memory database provided in this embodiment can, in order to solve the problems of latency glitches and memory bloat, obtain the memory usage information of the memory database after receiving an operation instruction submitted for the memory database; and then, if it is determined according to the memory usage information that the memory database meets the memory release condition, it means that data eviction processing can be performed at this time. In order to achieve a dynamic balance between writing and evicting data, the memory release information of the memory database can be calculated according to the memory usage information; at this time, the memory release information is input into a release time prediction model for processing to obtain a memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information; and then the memory release time corresponding to different stages can be dynamically calculated, so as to balance the writing and evicting processing of data, avoid memory bloat and latency glitch problems, and finally the redundant data can be released from the memory database according to the memory release time, and the operation instruction of writing data to the memory database is executed according to the data release result. By dynamically calculating the memory release time, the memory database can perform smooth data eviction, effectively control memory bloat, and thus ensure the stability of the memory database in providing memory resources in different scenarios.

[0105] Corresponding to the above method embodiments, this specification also provides embodiments of a memory management device for a memory database. Figure 5 The structure diagram of a memory management device for a memory database provided by an embodiment of this specification is shown. As Figure 5 shown, the device includes: An acquisition module 502, configured to acquire the memory usage information of the memory database in response to an operation instruction submitted for the memory database; A calculation module 504, configured to calculate the memory release information of the memory database according to the memory usage information when it is determined that the memory database meets the memory release condition according to the memory usage information; A processing module 506, configured to input the memory release information into a release time prediction model for processing to obtain a memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information; A release module 508, configured to release redundant data for the memory database according to the memory release time, and execute the operation instruction to write data to the memory database according to the data release result.

[0106] In an optional embodiment, when it is determined that the memory database meets the memory release condition according to the memory usage information, calculating the memory release information of the memory database according to the memory usage information includes: Determine the early release threshold and the late release threshold of the memory database, and compare the memory usage information with the early release threshold and the late release threshold; when the memory usage information is greater than the early release threshold and less than the late release threshold, determine that the memory database meets the memory release condition, and execute the step of calculating the memory release information of the memory database according to the memory usage information; where the early release threshold is less than the memory capacity of the memory database, and the late release threshold is greater than the memory capacity.

[0107] In an optional embodiment, calculating the memory release information of the memory database according to the memory usage information includes: Determine the memory capacity information corresponding to the in-memory database, and calculate the memory release information of the in-memory database according to the memory capacity information and the memory usage information; wherein, the operation of releasing redundant data according to the memory release time for the in-memory database and executing the operation instruction of writing data to the in-memory database according to the data release result includes: determining redundant data in the in-memory database according to a set release policy, releasing the redundant data according to the memory release time, and executing the operation instruction of writing data to the in-memory database according to the data release result.

[0108] In an optional embodiment, the operation of inputting the memory release information into a release time prediction model for processing to obtain the memory release time includes: In the case where the operation instruction corresponds to a first data release scenario, select a release time prediction model associated with the first data release scenario, and input the memory release information into the release time prediction model; use the release time prediction model to calculate a first error ratio, a first error integral, and a first error differential term according to the gain information corresponding to the memory release information; determine the memory release time based on the first error ratio, the first error differential, and the first error differential term.

[0109] In an optional embodiment, the operation of inputting the memory release information into a release time prediction model for processing to obtain the memory release time includes: In the case where the operation instruction corresponds to a second data release scenario, select a release time prediction model associated with the second data release scenario, and input the memory release information into the release time prediction model; use the release time prediction model to calculate the memory change rate corresponding to the memory release information, and determine the gain information corresponding to the memory release information according to the memory change rate and the memory release information; calculate a second error ratio, a second error integral, and a second error differential term according to the gain information, and determine the memory release time based on the second error ratio, the second error differential, and the second error differential term.

[0110] In an optional embodiment, the operation of determining the gain information corresponding to the memory release information according to the memory change rate and the memory release information includes: Map the memory change rate and the memory release information to a target universe of discourse according to a linear mapping algorithm; calculate a first membership degree corresponding to the memory change rate and a second membership degree corresponding to the memory release information according to the mapping result; perform a conversion on the first membership degree and the second membership degree, and calculate the gain information corresponding to the memory release information according to the membership degree conversion result.

[0111] In an alternative embodiment, the conversion of the first membership degree and the second membership degree and the calculation of the gain information corresponding to the memory release information according to the membership degree conversion result include: Query a proportional rule table, an integral rule table, and a differential term rule table according to the first membership degree and the second membership degree; determine a proportional membership degree, an integral membership degree, and a differential term membership degree according to the query results, and calculate initial gain information according to the proportional membership degree, the integral membership degree, and the differential term membership degree; update the initial gain information to obtain the gain information corresponding to the memory release information.

[0112] In an alternative embodiment, after the step of comparing the memory usage information with the early release threshold and the late release threshold, the following is further included: In the case where the memory usage information is less than or equal to the early release threshold, execute the operation instruction to write data to the memory database; in the case where the memory usage information is greater than or equal to the late release threshold, release the redundant data according to the set memory release time, and execute the operation instruction to write data to the memory database according to the data release result.

[0113] The memory management device of the memory database provided in this embodiment can, in order to solve the problems of latency glitches and memory bloat, first obtain the memory usage information of the memory database after receiving an operation instruction submitted for the memory database; then, if it is determined according to the memory usage information that the memory database meets the memory release condition, it means that data eviction processing can be performed at this time. In order to achieve a dynamic balance between writing and evicting data, the memory release information of the memory database can be calculated according to the memory usage information; at this time, the memory release information is input into a release time prediction model for processing to obtain a memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information; furthermore, the memory release time corresponding to different stages can be dynamically calculated to balance the writing and eviction processing of data, avoid memory bloat and latency glitch problems, and finally, the redundant data can be released from the memory database according to the memory release time, and the operation instruction to write data to the memory database can be executed according to the data release result. By dynamically calculating the memory release time, the memory database can perform smooth data eviction, effectively control memory bloat, and thus ensure the stability of the memory database in providing memory resources in different scenarios.

[0114] The above is a schematic solution of a memory management device for a memory database according to this embodiment. It should be noted that the technical solution of the memory management device for the memory database and the technical solution of the memory management method for the memory database described above belong to the same concept. For the details not described in detail in the technical solution of the memory management device for the memory database, reference can be made to the description of the technical solution of the memory management method for the memory database described above.

[0115] An embodiment of this specification provides a memory database server, including: a memory database, a memory, and a processor; The memory is used to store memory management instructions for managing the memory database, and the processor is used to execute the memory management instructions. When the memory management instructions are executed by the processor to manage the memory database, the steps of the memory management method for the memory database are implemented.

[0116] The above is a schematic solution of a memory database server according to this embodiment. It should be noted that the technical solution of the memory database server and the technical solution of the memory management method for the memory database described above belong to the same concept. For the details not described in detail in the technical solution of the memory database server, reference can be made to the description of the technical solution of the memory management method for the memory database described above.

[0117] Figure 6 The structural block diagram of a computing device 600 provided according to an embodiment of this specification is shown. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 through a bus 630, and a database 650 is used to store data.

[0118] The computing device 600 also includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of such networks include the Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interface (e.g., a network interface controller (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.

[0119] In one embodiment of the present specification, the above components of the computing device 600, as well as Figure 6 other components not shown, may also be connected to each other, for example, via a bus. It should be understood that Figure 6 the block diagram of the computing device shown is for illustrative purposes only and is not a limitation on the scope of the present specification. Those skilled in the art may add or replace other components as needed.

[0120] The computing device 600 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 600 can also be a mobile or stationary server.

[0121] Among them, the processor 620 is used to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the memory management method of the above memory database.

[0122] The above is a schematic solution of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the memory management method of the above memory database belong to the same concept. For the detailed content not described in the technical solution of the computing device, reference can be made to the description of the technical solution of the memory management method of the above memory database.

[0123] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions, which when executed by a processor implement the steps of the memory management method of the above memory database.

[0124] The above is a schematic solution of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the memory management method of the above memory database belong to the same concept. For the detailed content not described in the technical solution of the storage medium, reference can be made to the description of the technical solution of the memory management method of the above memory database.

[0125] An embodiment of this specification also provides a computer program, which when executed on a computer causes the computer to execute the steps of the memory management method of the above memory database.

[0126] The above is a schematic solution of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the memory management method of the above memory database belong to the same concept. For the detailed content not described in the technical solution of the computer program, reference can be made to the description of the technical solution of the memory management method of the above memory database.

[0127] An embodiment of this specification also provides a computer program product including a computer program or instruction, which when executed by a processor implement the steps of the memory management method of the above memory database.

[0128] The above is a schematic solution of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the memory management method of the above memory database belong to the same concept. For the detailed content not described in the technical solution of the computer program product, reference can be made to the description of the technical solution of the memory management method of the above memory database.

[0129] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0130] The computer instructions include computer program code, which can be in the form of source code, object code, executable files, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, external hard drives, magnetic disks, optical disks, computer memories, read-only memories (ROMs), random access memories (RAMs), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0131] It should be noted that for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of this specification are not limited by the described order of actions, because according to the embodiments of this specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this specification.

[0132] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0133] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The alternative embodiments do not exhaust all the details, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can understand and utilize this specification well. This specification is only limited by the claims and their full scope and equivalents.

Claims

1. A memory management method for an in-memory database, comprising: Obtaining the memory usage information of the in-memory database in response to an operation instruction submitted for the in-memory database; When it is determined that the in-memory database meets the memory release condition according to the memory usage information, calculating the memory release information of the in-memory database according to the memory usage information; Inputting the memory release information into a release time prediction model for processing to obtain a memory release time, wherein the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information; Releasing redundant data from the in-memory database according to the memory release time, and executing the operation instruction of writing data to the in-memory database according to the data release result.

2. The memory management method for an in-memory database according to claim 1, wherein when it is determined that the in-memory database meets the memory release condition according to the memory usage information, calculating the memory release information of the in-memory database according to the memory usage information comprises: Determining an early release threshold and a late release threshold of the in-memory database, and comparing the memory usage information with the early release threshold and the late release threshold; When the memory usage information is greater than the early release threshold and less than the late release threshold, determining that the in-memory database meets the memory release condition, and executing the step of calculating the memory release information of the in-memory database according to the memory usage information; Wherein, the early release threshold is less than the memory capacity of the in-memory database, and the late release threshold is greater than the memory capacity.

3. The memory management method for an in-memory database according to claim 1, wherein calculating the memory release information of the in-memory database according to the memory usage information comprises: Determining the memory capacity information corresponding to the in-memory database, and calculating the memory release information of the in-memory database according to the memory capacity information and the memory usage information; Wherein, releasing redundant data from the in-memory database according to the memory release time, and executing the operation instruction of writing data to the in-memory database according to the data release result comprises: Determining redundant data in the in-memory database according to a set release strategy, releasing the redundant data according to the memory release time, and executing the operation instruction of writing data to the in-memory database according to the data release result.

4. The memory management method for an in-memory database according to any one of claims 1 to 3, wherein inputting the memory release information into a release time prediction model for processing to obtain a memory release time comprises: When the operation instruction corresponds to a first data release scenario, selecting a release time prediction model associated with the first data release scenario, and inputting the memory release information into the release time prediction model; Using the release time prediction model to calculate a first error ratio, a first error integral, and a first error differential term according to the gain information corresponding to the memory release information; Determine the memory release time based on the first error ratio, the first error differential, and the first error differential term.

5. The memory management method of the memory database according to any one of claims 1 to 3, wherein inputting the memory release information into the release time prediction model for processing to obtain the memory release time includes: In the case where the operation instruction corresponds to a second data release scenario, select a release time prediction model associated with the second data release scenario, and input the memory release information into the release time prediction model; Use the release time prediction model to calculate the memory change rate corresponding to the memory release information, and determine the gain information corresponding to the memory release information according to the memory change rate and the memory release information; Calculate the second error ratio, the second error integral, and the second error differential term according to the gain information, and determine the memory release time based on the second error ratio, the second error differential, and the second error differential term.

6. The memory management method of the memory database according to claim 5, wherein determining the gain information corresponding to the memory release information according to the memory change rate and the memory release information includes: Map the memory change rate and the memory release information to the target universe of discourse according to the linear mapping algorithm; Calculate the first membership degree corresponding to the memory change rate and the second membership degree corresponding to the memory release information according to the mapping result; Perform conversion on the first membership degree and the second membership degree, and calculate the gain information corresponding to the memory release information according to the membership degree conversion result.

7. The memory management method of the memory database according to claim 6, wherein performing conversion on the first membership degree and the second membership degree, and calculating the gain information corresponding to the memory release information according to the membership degree conversion result includes: Query the proportional rule table, the integral rule table, and the differential term rule table according to the first membership degree and the second membership degree; Determine the proportional membership degree, the integral membership degree, and the differential term membership degree according to the query result, and calculate the initial gain information according to the proportional membership degree, the integral membership degree, and the differential term membership degree; Update the initial gain information to obtain the gain information corresponding to the memory release information.

8. After the step of comparing the memory usage information with the early release threshold and the late release threshold in the memory management method of the memory database according to claim 2, it further includes: In the case where the memory usage information is less than or equal to the early release threshold, execute the operation instruction to write data into the memory database; In the case where the memory usage information is greater than or equal to the late release threshold, release the redundant data according to the set memory release time, and execute the operation instruction to write data into the memory database according to the data release result.

9. A memory management system of a memory database, including a server and a client, including: The client is used to receive an operation instruction submitted for a target service item and submit the operation instruction to the server; The server is configured to obtain the memory usage information of the in-memory database in response to an operation instruction submitted for the in-memory database; When it is determined that the in-memory database meets the memory release condition according to the memory usage information, calculate the memory release information of the in-memory database according to the memory usage information; Input the memory release information into a release time prediction model for processing to obtain a memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information; Release redundant data from the in-memory database according to the memory release time, and execute the operation instruction to write data to the in-memory database according to the data release result; feedback data operation information to the client according to the data write result.

10. An in-memory database server, comprising: An in-memory database, a memory, and a processor; The memory is used to store memory management instructions for managing the in-memory database, and the processor is used to execute the memory management instructions. When the memory management instructions are executed by the processor to manage the in-memory database, the steps of the method according to any one of claims 1 to 8 are implemented.

11. A memory management device for an in-memory database, comprising: An acquisition module, configured to obtain the memory usage information of the in-memory database in response to an operation instruction submitted for the in-memory database; A calculation module, configured to calculate the memory release information of the in-memory database according to the memory usage information when it is determined that the in-memory database meets the memory release condition according to the memory usage information; A processing module, configured to input the memory release information into a release time prediction model for processing to obtain a memory release time, where the release time prediction model predicts the memory release time according to the gain information corresponding to the memory release information; A release module, configured to release redundant data from the in-memory database according to the memory release time, and execute the operation instruction to write data to the in-memory database according to the data release result.

12. A computing device, comprising: A memory and a processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method according to any one of claims 1 to 8 are implemented.

13. A computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

14. A computer program product, comprising a computer program or instruction. When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • In cell touch panel and display device

    CN104020910A

  • Composite expiration method and device of redis full-load time key, server and storage medium

    CN110895524A

  • Memory release method and device, equipment, storage medium and program product

    CN114090248A

  • Memory database management method and device and storage medium

    CN116560848A

  • Storage space release method and device, computer equipment and storage medium

    CN117891394A