A database memory management method, device, equipment and medium

CN120994405BActive Publication Date: 2026-09-15SHENZHEN INST OF COMPUTING SCI
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511502283.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-21
Publication Date
2026-09-15
Estimated Expiration
2045-10-21

AI Technical Summary

Technical Problem

[0004]本发明实施例提供一种数据库内存管理方法、装置、计算机设备及存储介质,以解决如何对数据库内存进行管理,提高业务执行的稳定性的问题

Benefits of technology

[0010] Specifically, by dividing memory into rigid state memory to ensure the normal execution of business modules and elastic state memory to affect the performance of business modules, when the current available memory of a session does not meet the first requirement of the business module to be executed, the rigid memory share is adjusted. Based on the memory occupied by all executing business modules in the business to which the business module to be executed belongs, the first requirement and the second requirement, a memory retry allocation mechanism is implemented to reallocate the rigid state memory of all business modules corresponding to the business, so as to balance the stability and performance of business execution. After reallocation, the updated allocated rigid memory of the session is used to support the normal execution of all business modules corresponding to the business, which alleviates the problem that the failure of memory allocation of a single business module directly leads to the failure of the entire business execution, and improves the stability and reliability of business execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994405B_ABST
    Figure CN120994405B_ABST
Patent Text Reader

Abstract

The application discloses a database memory management method, device, equipment and medium, comprising: if it is detected that the current available memory amount of a session does not meet the first demand amount of rigid state memory of a to-be-executed business module, updating the rigid memory share, if the total memory amount of the session meets the updated rigid memory share, updating the allocated rigid memory amount according to the occupied memory amount of all executing business modules in the business to which the to-be-executed business module belongs, the second demand amount and the first demand amount of rigid state memory of the executing business module, and obtaining the first updated allocated rigid memory amount. By implementing the memory retry allocation mechanism when the demand amount of rigid state memory of the to-be-executed business module is not met, the elastic memory amount occupied by the business module is reduced, the stability and performance of business execution are balanced, the problem that the entire business execution fails directly due to the memory allocation failure of a single business module is alleviated, and the stability and reliability of business execution are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of database technology, and in particular to a database memory management method, apparatus, device, and medium. Background Technology

[0002] In database scenarios, database business systems typically consist of multiple relatively independent yet interconnected business systems. Each business system contains one or more business subsystems, which work together to implement specific business logic and fulfill the designed functions of the business system. After a client establishes a session connection with the database, the database can use this session to call the corresponding business system to complete the data operations or business processing requested by the session. In existing technologies, when a session calls a business system to complete a specific business process, each business subsystem within the business system must request a memory quota from the database memory manager before executing the operation, based on its estimated memory requirements. Execution can only proceed after the memory quota is allocated. However, due to the order in which these business subsystems request or allocate memory quotas, a subsystem that requests or allocates its quota later may have an estimated memory requirement exceeding the actual available memory in the session. In this case, the subsystem that requests or allocates its quota later will fail to obtain sufficient memory, thus preventing the business system from fulfilling its specific function and resulting in execution failure.

[0003] Therefore, how to manage database memory and improve the stability of business operations has become an urgent problem to be solved. Summary of the Invention

[0004] This invention provides a database memory management method, apparatus, computer device, and storage medium to address the problem of how to manage database memory and improve the stability of business operations.

[0005] A database memory management method, comprising: The first requirement of the business module to be executed for rigid state memory during execution is obtained, and the current available memory of the session to which the business module to be executed belongs is obtained, wherein the rigid state memory refers to the memory that ensures the normal execution of the business module; Detect whether the current available memory amount meets the first demand amount. If the current available memory amount does not meet the first demand amount, obtain the allocated rigid memory amount and rigid memory share of the session for the rigid state memory. Update the rigid memory share according to the first demand amount and the allocated rigid memory amount to obtain the updated rigid memory share. Obtain the total memory of the session, and check whether the total memory meets the updated rigid memory share. If the total memory meets the updated rigid memory share, determine the memory occupied by all executing business modules in the business to which the business module to be executed belongs. The occupied memory includes the occupied rigid memory for the rigid state memory and the occupied elastic memory for the elastic state memory. The elastic state memory refers to the memory that affects the execution performance of the business module. Obtain the second requirement of each executing business module in the business for the rigid state memory. Based on the occupied memory, the first requirement, and all second requirements, update the allocated rigid memory to obtain the first updated allocated rigid memory. The first updated allocated rigid memory is used to support the normal execution of the business module to be executed and all executing business modules in the business.

[0006] A database memory management device, comprising: The first acquisition module is used to acquire the first requirement of rigid state memory for the business module to be executed during execution, and to acquire the current available memory of the session to which the business module to be executed belongs, wherein the rigid state memory refers to the memory that ensures the normal execution of the business module; The first update module is used to detect whether the current available memory amount meets the first demand amount. If the current available memory amount does not meet the first demand amount, the module obtains the allocated rigid memory amount and rigid memory share of the session for the rigid state memory. Based on the first demand amount and the allocated rigid memory amount, the module updates the rigid memory share to obtain the updated rigid memory share. The retry judgment module is used to obtain the total memory of the session, detect whether the total memory meets the updated rigid memory share, and if the total memory meets the updated rigid memory share, determine the memory occupied by all executing business modules in the business to which the business module to be executed belongs. The occupied memory includes the occupied rigid memory for the rigid state memory and the occupied elastic memory for the elastic state memory. The elastic state memory refers to the memory that affects the execution performance of the business module. The retry allocation module is used to obtain the second demand amount of the rigid state memory for each executing business module in the business, and update the allocated rigid memory amount according to the occupied memory amount, the first demand amount and all the second demand amounts to obtain the first updated allocated rigid memory amount. The first updated allocated rigid memory amount is used to support the normal execution of the business module to be executed and all executing business modules in the business.

[0007] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the database memory management method described above when executing the computer program.

[0008] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned database memory management method.

[0009] The aforementioned database memory management method, apparatus, computer equipment, and storage medium obtain the first requirement of the rigid state memory for the business module to be executed during execution, and obtain the current available memory of the session to which the business module belongs. Rigid state memory refers to the memory that ensures the normal execution of the business module. If it is detected that the current available memory does not meet the first requirement, the allocated rigid memory and rigid memory share of the session are obtained. Based on the first requirement and the allocated rigid memory, the rigid memory share is updated to obtain the updated rigid memory share. If it is detected that the total memory of the session meets the updated rigid memory... The share determines the amount of memory already occupied by all executing business modules in the business to which the business module to be executed belongs. The amount of memory already occupied includes the amount of rigid memory already occupied for rigid state memory and the amount of elastic memory already occupied for elastic state memory. Elastic state memory refers to memory that affects the execution performance of business modules. Based on the amount of memory already occupied, the first demand, and the second demand of each executing business module in the business for rigid state memory, the allocated rigid memory is updated to obtain the first updated allocated rigid memory. The first updated allocated rigid memory is used to support the normal execution of the business module to be executed and all executing business modules in the business.

[0010] Specifically, by dividing memory into rigid state memory to ensure the normal execution of business modules and elastic state memory to affect the performance of business modules, when the current available memory of a session does not meet the first requirement of the business module to be executed, the rigid memory share is adjusted. Based on the memory occupied by all executing business modules in the business to which the business module to be executed belongs, the first requirement and the second requirement, a memory retry allocation mechanism is implemented to reallocate the rigid state memory of all business modules corresponding to the business, so as to balance the stability and performance of business execution. After reallocation, the updated allocated rigid memory of the session is used to support the normal execution of all business modules corresponding to the business, which alleviates the problem that the failure of memory allocation of a single business module directly leads to the failure of the entire business execution, and improves the stability and reliability of business execution. Attached Figure Description

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

[0012] Figure 1 This is a flowchart illustrating a database memory management method provided in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the overall process of a database memory management method provided in Embodiment 1 of the present invention; Figure 3 This is a flowchart illustrating a database memory management method provided in Embodiment 2 of the present invention; Figure 4 This is a flowchart illustrating a database memory management method provided in Embodiment 3 of the present invention; Figure 5 This is a flowchart illustrating a database memory management method provided in Embodiment 4 of the present invention; Figure 6 This is a flowchart illustrating a database memory management method provided in Embodiment 5 of the present invention; Figure 7 This is a schematic diagram of the structure of a database memory management device provided in Embodiment Six of the present invention; Figure 8 This is a schematic diagram of the structure of a computer device provided in Embodiment 7 of the present invention. Detailed Implementation

[0013] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0014] In one embodiment, such as Figure 1 The diagram shown is a flowchart of a database memory management method according to Embodiment 1 of the present invention. This database memory management method includes the following steps: Step S101: Obtain the first requirement of rigid state memory for the business module to be executed, and obtain the current available memory of the session to which the business module to be executed belongs.

[0015] In this embodiment, the database business system is usually composed of multiple relatively independent but interconnected business systems. Each business system contains one or more business subsystems. These business subsystems are used to jointly implement specific business logic to complete the specific functions designed by the business system. If any business subsystem fails to execute, the business system to which it belongs will also fail to execute.

[0016] The pending business module can refer to a business subsystem that needs to be allocated memory quota for execution. The business to which the pending business module belongs can refer to the business system to which the pending business module belongs. Rigid state memory can refer to the memory that guarantees the normal execution of the business module. That is, if the business module cannot fully request the required amount of memory when requesting memory, it will directly lead to the failure of the business module execution or failure to meet the minimum performance expectations. This part of memory is the rigid state memory. The first demand amount can refer to the amount of rigid state memory required by the pending business module when it is executed. The time corresponding to the first demand amount of the pending business module is recorded as the current time. The current available memory amount can refer to the amount of idle memory of the session to which the pending business module belongs at the current time.

[0017] Specifically, before obtaining the initial memory requirement of the business module to be executed, the memory requirement of the business module to be executed is evaluated. The evaluation includes the evaluation of the memory requirement type (rigid state memory and elastic state memory) and the corresponding memory requirement amount. If the evaluation shows that the business module to be executed only requires the rigid state memory during execution, then the initial memory requirement of the business module to be executed during execution is obtained, as well as the current available memory of the session to which the business module to be executed belongs is obtained.

[0018] Step S102: Detect whether the current available memory amount meets the first requirement. If the current available memory amount does not meet the first requirement, obtain the allocated rigid memory amount and rigid memory share of the session for rigid state memory. Update the rigid memory share according to the first requirement and the allocated rigid memory amount to obtain the updated rigid memory share.

[0019] In this embodiment, the allocated rigid memory amount can refer to the amount of rigid state memory that the session has already allocated at the current moment. The rigid memory share can refer to the minimum amount of memory that the session reserves for rigid state memory in the current available memory amount. That is, in the current available memory amount, at least a rigid memory share of memory must be used for the business module's demand for rigid state memory. The business module's demand for elastic state memory cannot encroach on it. Updating the rigid memory share can refer to the rigid memory share updated based on the first demand amount and the allocated rigid memory amount.

[0020] Specifically, after obtaining the first requirement of the rigid state memory for the business module to be executed, it checks whether the current available memory of the session to which the business module belongs meets the first requirement. If the current available memory meets the first requirement, a memory quota of the first requirement is allocated to the rigid state memory of the business module to be executed. If the current available memory does not meet the first requirement, the allocated rigid memory and rigid memory share of the session are obtained. Based on the first requirement and the allocated rigid memory, the rigid memory share is updated to obtain the updated rigid memory share.

[0021] Optionally, during the process of updating the rigid memory share based on the first demand and the allocated rigid memory amount to obtain the updated rigid memory share, the quota adjustment ratio of the session for rigid state memory can be obtained, and the rigid memory share can be updated based on the quota adjustment ratio, the first demand and the allocated rigid memory amount to obtain the updated rigid memory share.

[0022] The quota adjustment ratio can be a pre-set ratio that increases the minimum amount of memory reserved for rigid memory from the currently available memory. Specifically, this quota adjustment ratio is a real number greater than 1. In obtaining the updated rigid memory share, the first demand and the already allocated rigid memory are summed. The quota adjustment ratio is then multiplied by the sum, and the rigid memory share is updated to the multiplicative result.

[0023] Step S103: Obtain the total memory of the session, and check whether the total memory is sufficient to update the rigid memory share. If the total memory is sufficient to update the rigid memory share, determine the amount of memory already occupied by all executing business modules in the business to which the business module to be executed belongs.

[0024] Step S104: Obtain the second demand for rigid state memory for each executing business module in the business, and update the allocated rigid memory based on the occupied memory, the first demand and all the second demands to obtain the first updated allocated rigid memory.

[0025] In this embodiment, the total memory can refer to the memory limit of the entire session. The executing business module can refer to the business module to which the business module to be executed belongs, and the business module with allocated memory quota currently being executed. The occupied memory can refer to the total memory occupied by all executing business modules in the business module to which the business module to be executed belongs, including the occupied rigid memory for rigid state memory and the occupied elastic memory for elastic state memory. The occupied rigid memory can refer to the total memory occupied by all executing business modules in the business module to which the business module to be executed belongs for rigid state memory. The occupied elastic state memory can refer to the total memory occupied by all executing business modules in the business module to which the business module to be executed belongs for rigid state memory. The total amount of memory occupied by the business modules for elastic state memory. If there is no already occupied elastic state memory among the already occupied memory, then the memory quota for rigid state memory cannot be retried and adjusted for the pending business modules and all executing business modules. The memory allocation of the pending business modules and all executing business modules will fail, and the execution of the business will fail. Elastic state memory refers to the memory that affects the execution performance of business modules. That is, when a business module applies for memory, it can only obtain a certain proportion of the required memory or cannot obtain the required memory at all. It only affects the improvement of the execution performance of the business module. This part of the memory is the elastic state memory.

[0026] The second demand can refer to the amount of rigid state memory required by the executing business module during execution. The first updated allocated rigid memory amount can refer to the amount of rigid state memory that the session has allocated after reallocating the memory quota for rigid state memory to the business module to be executed and all executing business modules based on the occupied memory amount, the first demand amount, and all second demands amount. The first updated allocated rigid memory amount is used to support the normal execution of the business module to be executed and all executing business modules in the business.

[0027] Specifically, the system checks whether the total memory volume meets the requirements for updating the rigid memory share. If the total memory volume does not meet the requirements for updating the rigid memory share, it determines that the application for rigid state memory by the business module to be executed has failed. If the total memory volume meets the requirements for updating the rigid memory share, the system retryes and adjusts the memory quota for rigid state memory for the business module to be executed and all business modules in execution based on the occupied memory volume, the first demand volume, and all second demand volumes. After adjustment, the system obtains the first updated allocated rigid memory volume, which is used to support the normal execution of the business module to be executed and all business modules in execution.

[0028] like Figure 2The diagram shown is a schematic representation of the overall process of a database memory management method according to Embodiment 1 of the present invention. The database business system includes an external service module, an evaluation module, an execution coordination module, and an execution module. The execution module includes business module A, business module B, and a memory management module. The database memory management method is applied to the memory management module, and its overall process is as follows: The external service module establishes a session connection with the client, receives the client's business requests, and sends the execution tasks of the business modules (business module A and business module B) to the evaluation module. The evaluation module evaluates the memory requirements of the business module tasks during execution and sends the evaluation results to the corresponding business modules (optionally, the preliminary evaluation process of this evaluation module is not necessary). The evaluation module sends the execution tasks of the business modules to the execution coordination module, which then distributes the execution tasks to business module A and business module B. When business module A and business module B receive an execution task, they assess the memory requirement type (rigid state memory and elastic state memory) and corresponding memory requirement based on the characteristics of the task. If the total memory of the session is 75M and the rigid memory share is 0M, business module A assesses that both rigid state memory and elastic state memory are needed, with a rigid state memory requirement of 20M and an elastic state memory requirement of 60M. Business module B assesses that only rigid state memory is needed, but the specific requirement is not assessed. Business module A starts first and requests a memory quota from the memory management module. Since the total memory of the session is 75M, and business module B has not started, the current available memory of the session is also 75M. The current available memory of 75M meets the rigid state memory requirement of business module A of 20M, so a memory share of 20M is directly allocated to the rigid state memory of business module A. At this time, the elastic state memory share of the session can be calculated as 75M - max(20M, 0M) = 55M. Since the elastic memory share of 55M does not meet the elastic state memory requirement of business module A of 60M, a memory quota of 55M is allocated to the elastic state memory of business module A. During the execution of business module A based on a memory quota of 20M of rigid state memory and a memory quota of 55M of elastic state memory, business module B starts. Business module B assesses its first requirement for rigid state memory as 4M. However, since the total memory of 75M has already been fully allocated to business module A for business execution, the current available memory for the session is 0M. The current available memory of 0M does not meet the first requirement of 4M for business module B, so business module B's memory request fails. If the quota adjustment ratio is 1.5, then based on the quota adjustment ratio of 1.5, the session's allocated rigid state memory of 20M, and business module B's first requirement of 4M, the rigid memory share is updated to 1.5 × (20M + 4M) = 36M. The memory management module feeds back the information about business module B's memory request failure and the updated rigid memory share to the execution coordination module. The total memory of 75M satisfies the 36M rigid memory share for the update. The execution coordination module then sends the re-execution adjustment information to the memory management module. The memory management module then releases the 20M rigid memory already occupied by business module A in rigid state memory and the 55M elastic memory already occupied in elastic state memory, resulting in an update available memory of 75M for the session. The rigid memory requirements of business module A (20M) and business module B (24M) are summed to obtain a total rigid memory requirement of 24M for both business modules. The update available memory of 75M satisfies this total requirement of 24M. Therefore, a new memory quota of 20M is allocated to the rigid state memory of business module A, and a new memory quota of 4M is allocated to the rigid state memory of business module B. After the allocation is completed, the first update allocated rigid memory of the session is 24M. This 24M allocated rigid memory is used to support the normal execution of business modules A and B. Based on the total memory of 75M, the rigid memory allocated in the first update of the session is 24M, and the rigid memory share for the update is 36M, the memory reserved for the elastic state memory in the session after the retry adjustment is 75M - max(24M, 36M) = 39M. This reserved memory of 39M for the elastic state memory does not meet the elastic state memory requirement of 60M for business module A. Therefore, a memory quota of 39M is reallocated to the elastic state memory of business module A.

[0029] Optionally, after updating the available memory to 75M to meet the total demand of 24M in step 5) above, when reallocating memory quotas for business module A and business module B, first reallocate memory quotas for both rigid and elastic states for business module A, and then reallocate memory quotas for both rigid and elastic states for business module B. When reallocating memory quotas, the memory demand for rigid states for business module A and business module B may differ from the demand before the retry. For example, if the memory demand for rigid states for business module B is 4M before the retry, the memory demand for rigid states for business module B may become 11M when retrying the rigid memory allocation.

[0030] In this embodiment, memory is divided into rigid state memory that ensures the normal execution of business modules and elastic state memory that affects the performance of business modules. When the current available memory of a session does not meet the first requirement of the business module to be executed, the rigid memory share is adjusted. Based on the memory occupied by all executing business modules in the business to which the business module to be executed belongs, the first requirement and the second requirement, a memory retry allocation mechanism is implemented to reallocate the rigid state memory of all business modules corresponding to the business. After reallocation, the updated allocated rigid memory of the session is used to support the normal execution of all business modules corresponding to the business, which alleviates the problem that the failure of memory allocation of a single business module directly leads to the failure of the entire business execution, and improves the stability and reliability of business execution.

[0031] In one embodiment, such as Figure 3 The diagram shown is a flowchart of a database memory management method according to Embodiment 2 of the present invention. In step S104 above, the allocated rigid memory is updated based on the occupied memory, the first demand, and all second demands to obtain the first updated allocated rigid memory, including the following steps: Step S301: Release the occupied memory, update the current available memory, and obtain the updated available memory for the session.

[0032] Step S302: Based on the updated available memory, the first demand, and all second demands, reallocate the memory quota for rigid state memory to the business modules to be executed and each executing business module in the business.

[0033] Step S303: After the memory quota for rigid state memory is reallocated to the business module to be executed and all business modules in execution within the business, the first updated allocated rigid memory amount is obtained.

[0034] In this embodiment, updating the available memory amount can refer to the amount of memory that is idle in the session after releasing the occupied memory amount.

[0035] Specifically, the system releases the occupied rigid memory and occupied elastic memory of all executing business modules within the business to which the pending business module belongs. After the release is complete, the updated available memory of the session is obtained. The first demand and all second demands are summed to obtain the total demand for rigid state memory of the pending business module and all executing business modules. The system checks whether the updated available memory meets the total demand. If the updated available memory meets the total demand, the system reallocates the memory quota for rigid state memory to the pending business module and the corresponding executing business module according to the first demand and all second demands. After the memory quota for rigid state memory is reallocated, the first updated allocated rigid memory is obtained. This first updated allocated rigid memory is used to support the normal execution of the pending business module and all executing business modules within the business.

[0036] Specifically, after checking whether the available memory for updating meets the total demand, if it is found that the available memory for updating does not meet the total demand, it is determined that the memory quota for rigid state memory cannot be retried and adjusted for the pending business module and all executing business modules. The memory application of the pending business module and all executing business modules fails, and the execution of the corresponding business fails.

[0037] Optionally, after obtaining the updated allocated rigid memory amount, the third demand for elastic state memory for each executing business module in the business can also be obtained. Based on the total memory amount, the first updated allocated rigid memory amount, the updated rigid memory share, and all third demands, the memory quota for elastic state memory is reallocated for each executing business module in the business.

[0038] The third demand can refer to the amount of elastic state memory required by the business module during execution.

[0039] That is, based on the total memory, the rigid memory already allocated in the first update, and the rigid memory share in the update, the amount of memory reserved by the session for the elastic state memory is obtained. All third-party demand amounts are summed to obtain the total demand for elastic state memory from all running business modules. It is then checked whether the amount of memory reserved by the session for the elastic state memory in the update's available memory meets the total demand. If it is found that the amount of memory reserved by the session for the elastic state memory in the update's available memory meets the total demand, then the memory share of elastic state memory is reallocated to the corresponding running business module according to each third-party demand amount. If it is found that the amount of memory reserved by the session for the elastic state memory in the update's available memory does not meet the total demand, then the memory share of elastic state memory is reallocated to each running business module according to the amount of memory reserved by the session for the elastic state memory in the update's available memory.

[0040] In the process of obtaining the amount of memory reserved by the session in the updated available memory for allocation to elastic state memory, the maximum value of the first updated allocated rigid memory and the updated rigid memory share can be taken, and the total memory can be subtracted from the maximum value to obtain the amount of memory reserved by the session in the updated available memory for allocation to elastic state memory.

[0041] In this embodiment, by releasing the memory occupied by all executing business modules in the business to which the pending business module belongs, and implementing a memory retry allocation mechanism based on the updated available memory, the first demand, all second demands, and the third demand, the memory quota for rigid state memory and the memory quota for elastic state memory are reallocated for the pending business module and each executing business module, the problem of the entire business execution failing directly due to the memory allocation failure of a single business module is alleviated, thereby improving the stability and reliability of business execution.

[0042] In one embodiment, such as Figure 4 The diagram shown is a flowchart of a database memory management method provided in Embodiment 3 of the present invention, which also includes the following steps: Step S401: Obtain the fourth requirement of elastic state memory for the business module to be executed.

[0043] Step S402: Based on the total memory, the allocated rigid memory, and the rigid memory share, obtain the first elastic memory share of the session for the elastic state memory.

[0044] Step S403: Detect whether the first elastic memory share meets the fourth demand. If the first elastic memory share meets the fourth demand, then allocate memory quotas for the elastic state memory to the business module to be executed according to the fourth demand.

[0045] Step S404: If it is detected that the first elastic memory share does not meet the fourth demand, then according to the first elastic memory share, allocate memory quotas for the elastic state memory to the business module to be executed.

[0046] In this embodiment, the fourth demand can refer to the demand for elastic state memory by the business module to be executed, the elastic memory share can refer to the amount of memory reserved by the session in the amount of free memory and allocated to the elastic state memory, and the first elastic memory share can refer to the amount of memory reserved by the session in the amount of currently available memory and allocated to the elastic state memory.

[0047] Specifically, before obtaining the fourth requirement of the business module to be executed, the memory requirement of the business module to be executed is evaluated. If the evaluation shows that the business module to be executed only needs the elastic state memory requirement during execution, then the fourth requirement of the elastic state memory required by the business module to be executed during execution is obtained. After obtaining the fourth requirement, the maximum value of the allocated rigid memory amount and rigid memory share of the session is retrieved. The total memory is subtracted from the maximum value to obtain the first elastic memory share. It is then checked whether the first elastic memory share meets the fourth requirement. If the first elastic memory share meets the fourth requirement, then a memory quota of the fourth requirement size is allocated to the elastic state memory of the business module to be executed. If the first elastic memory share does not meet the fourth requirement, then a memory quota of the first elastic memory share size is allocated to the elastic state memory of the business module to be executed.

[0048] In this embodiment, when the fourth requirement of the business module to be executed for elastic state memory is obtained, based on the total memory, the allocated rigid memory, and the rigid memory share, and after reserving the minimum amount of memory for the session to be allocated to rigid state memory, the first elastic memory share that can be allocated to elastic state memory is calculated. Based on the first elastic memory share and the fourth requirement, the memory quota of elastic state memory is allocated to the business module to be executed. While ensuring that the business module corresponding to the business can be executed normally, the memory quota of elastic state memory allocated to the business module to be executed is maximized, thereby improving the execution performance of the business module to be executed.

[0049] In one embodiment, such as Figure 5 The diagram shown is a flowchart of a database memory management method provided in Embodiment 4 of the present invention, which also includes the following steps: Step S501: Obtain the first demand and the fifth demand for elastic state memory by the business module to be executed.

[0050] Step S502: Detect whether the current available memory meets the first requirement. If the current available memory meets the first requirement, allocate memory quotas for rigid state memory to the business modules to be executed according to the first requirement.

[0051] Step S503: After allocating the memory quota for rigid state memory to the business module to be executed, the second updated allocated rigid memory amount is obtained.

[0052] Step S504: Based on the total memory, the second updated allocated rigid memory, and the rigid memory share, obtain the second elastic memory share of the session for the elastic state memory.

[0053] Step S505: Detect whether the second elastic memory share meets the fifth requirement. If the second elastic memory share meets the fifth requirement, then allocate memory quotas for the elastic state memory to the business module to be executed according to the fifth requirement.

[0054] Step S506: If it is detected that the second elastic memory share does not meet the fifth demand, then according to the second elastic memory share, allocate memory quotas for the elastic state memory to the business module to be executed.

[0055] In this embodiment, the fifth demand amount can refer to the demand amount of elastic state memory for the business module to be executed during execution. The second updated allocated rigid memory amount can refer to the amount of rigid state memory that the session has allocated after allocating a memory quota for rigid state memory to the business module to be executed based on the current available memory amount and the first demand amount. The second elastic memory share can refer to the amount of memory reserved by the session in the idle memory amount for allocation to elastic state memory after the memory quota for rigid state memory is not retried and adjusted to be allocated to the business module to be executed.

[0056] Specifically, before obtaining the first and fifth memory requirements of the business module to be executed, the memory requirements of the business module to be executed are evaluated. If the evaluation shows that the business module to be executed requires both rigid state memory and elastic state memory during execution, then the first requirement for rigid state memory and the fifth requirement for elastic state memory are obtained. After obtaining the first and fifth requirements, it is checked whether the current available memory meets the first requirement. If the current available memory meets the first requirement, then a memory quota of the first requirement size is allocated to the rigid state memory of the business module to be executed. After completion, the memory quota allocated to the rigid state memory of the business module to be executed, which is the first required amount, is added to the already allocated rigid memory amount of the session to obtain the second updated allocated rigid memory amount. The maximum value of the second updated allocated rigid memory amount and the rigid memory share is taken, and the total memory is subtracted from the maximum value to obtain the second elastic memory share. It is then checked whether the second elastic memory share meets the fifth required amount. If the second elastic memory share meets the fifth required amount, the memory quota of the fifth required amount is allocated to the elastic state memory of the business module to be executed. If the second elastic memory share does not meet the fifth required amount, the memory quota of the second elastic memory share is allocated to the elastic state memory of the business module to be executed.

[0057] In this embodiment, when the first requirement of rigid state memory and the fifth requirement of elastic state memory for the business module to be executed are obtained, if the current available memory meets the first requirement, a memory quota of rigid state memory is allocated to the business module to be executed based on the current available memory and the first requirement. After the rigid state memory allocation is completed, a memory quota of elastic state memory is allocated to the business module to be executed based on the total memory, the second updated allocated rigid memory, and the rigid memory share. While ensuring the normal execution of the business module to be executed, the memory share of elastic state memory is allocated to the business module to be executed to the maximum extent, thereby improving the execution performance of the business module to be executed.

[0058] In one embodiment, such as Figure 6 The diagram shown is a flowchart of a database memory management method provided in Embodiment 5 of the present invention. After detecting whether the current available memory meets the first requirement in step S502 above, the method further includes the following steps: Step S601: If it is detected that the current available memory amount does not meet the first requirement, then the step of obtaining the allocated rigid memory amount and rigid memory share of the session for rigid state memory is executed to obtain the first updated allocated rigid memory amount.

[0059] Step S602: Based on the total memory, the first updated allocated rigid memory, and the updated rigid memory share, obtain the third elastic memory share of the session for the elastic state memory.

[0060] Step S603: Detect whether the third elastic memory share meets the fifth requirement. If the third elastic memory share meets the fifth requirement, then allocate memory quotas for the elastic state memory to the business module to be executed according to the fifth requirement.

[0061] Step S604: If it is detected that the third elastic memory share does not meet the fifth requirement, then allocate memory quotas for the elastic state memory to the business module to be executed according to the third elastic memory share.

[0062] In this embodiment, the third elastic memory share can refer to the amount of memory reserved by the session in the idle memory for allocation to elastic state memory after the retry is adjusted to allocate the memory quota to the rigid state memory for the pending business module.

[0063] Specifically, if the current available memory amount is detected to be insufficient to meet the first requirement, then according to the content of steps S102 to S104 above, a retry adjustment is performed to reallocate the memory share of rigid state memory for the business module to be executed and all business modules in execution. After the allocation is completed, the first updated allocated rigid memory amount is obtained. The maximum value of the first updated allocated rigid memory amount and the updated rigid memory share is taken, and the total memory is subtracted from the maximum value to obtain the third elastic memory share. It is then checked whether the third elastic memory share meets the fifth requirement. If the third elastic memory share meets the fifth requirement, then a memory quota of the fifth requirement size is allocated to the elastic state memory of the business module to be executed. If the third elastic memory share does not meet the fifth requirement, then a memory quota of the third elastic memory share size is allocated to the elastic state memory of the business module to be executed.

[0064] In this embodiment, when the current available memory does not meet the first requirement, a memory retry allocation mechanism is implemented to reallocate the rigid state memory of all business modules corresponding to the business. This alleviates the problem that the failure of memory allocation for a single business module directly leads to the failure of the entire business execution, and improves the stability and reliability of business execution. After the rigid state memory allocation is completed, based on the total memory, the first updated allocated rigid memory, and the updated rigid memory share, a memory quota of elastic state memory is allocated to the business modules to be executed. While ensuring the normal execution of the business modules to be executed, the memory share of elastic state memory is allocated to the business modules to be executed to the maximum extent, thereby improving the execution performance of the business modules to be executed.

[0065] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0066] In one embodiment, such as Figure 7 The diagram shown is a structural schematic of a database memory management device provided in Embodiment Six of the present invention. This database memory management device corresponds one-to-one with the database memory management methods in the above embodiments. Figure 7 As shown, the database memory management device includes a first acquisition module 71, a first update module 72, a retry judgment module 73, and a retry allocation module 74. Detailed descriptions of each functional module are as follows: The first acquisition module 71 is used to acquire the first requirement of rigid state memory for the business module to be executed during execution, and to acquire the current available memory of the session to which the business module to be executed belongs, wherein the rigid state memory refers to the memory that ensures the normal execution of the business module; The first update module 72 is used to detect whether the current available memory amount meets the first demand amount. If it is detected that the current available memory amount does not meet the first demand amount, the allocated rigid memory amount and rigid memory share of the session for the rigid state memory are obtained. The rigid memory share is updated according to the first demand amount and the allocated rigid memory amount to obtain the updated rigid memory share. The retry judgment module 73 is used to obtain the total memory of the session, detect whether the total memory meets the updated rigid memory share, and if the total memory meets the updated rigid memory share, determine the memory occupied by all executing business modules in the business to which the business module to be executed belongs. The occupied memory includes the occupied rigid memory for the rigid state memory and the occupied elastic memory for the elastic state memory. The elastic state memory refers to the memory that affects the execution performance of the business module. The retry allocation module 74 is used to obtain the second demand amount of the rigid state memory for each executing business module in the business, and update the allocated rigid memory amount according to the occupied memory amount, the first demand amount and all the second demand amounts to obtain the first updated allocated rigid memory amount. The first updated allocated rigid memory amount is used to support the normal execution of the business module to be executed and all executing business modules in the business.

[0067] Optionally, the first update module 72 mentioned above includes: The second acquisition unit is used to acquire the quota adjustment ratio of the session for the rigid state memory; The first calculation unit is used to update the rigid memory share based on the quota adjustment ratio, the first demand, and the allocated rigid memory amount, to obtain the updated rigid memory share.

[0068] Optionally, the retry allocation module 74 mentioned above includes: The release unit is used to release the occupied memory and update the current available memory to obtain the updated available memory of the session. The first allocation unit is used to reallocate the memory quota of the rigid state memory to the business module to be executed and each business module in execution in the business according to the updated available memory amount, the first demand amount and all the second demand amounts. The second update unit is used to obtain the first updated allocated rigid memory amount after the memory quota for the rigid state memory has been reallocated to the business module to be executed and all business modules in execution in the business is reallocated.

[0069] Optionally, the database memory management device further includes: The third acquisition module is used to acquire the third requirement of each executing business module in the business for the elastic state memory; The second allocation module is used to reallocate the memory quota of the elastic state memory to each executing business module in the business according to the total memory, the first updated allocated rigid memory, the updated rigid memory share, and all third demand quantities.

[0070] Optionally, the database memory management device further includes: The fourth acquisition module is used to acquire the fourth requirement of the elastic state memory for the business module to be executed during execution; The second calculation module is used to obtain the first elastic memory share of the session to the elastic state memory based on the total memory, the allocated rigid memory, and the rigid memory share; The third allocation module is used to detect whether the first elastic memory share meets the fourth demand. If the first elastic memory share meets the fourth demand, then according to the fourth demand, the module to be executed allocates memory quota to the elastic state memory. The fourth allocation module is used to allocate memory quotas to the business module to be executed based on the first elastic memory share if it is detected that the first elastic memory share does not meet the fourth demand.

[0071] Optionally, the database memory management device further includes: The fifth acquisition module is used to acquire the first demand and the fifth demand of the business module to be executed for the elastic state memory when it is executed; The fifth allocation module is used to detect whether the current available memory meets the first requirement. If the current available memory meets the first requirement, then the module allocates a memory quota to the rigid state memory for the business module to be executed according to the first requirement. The third update module is used to obtain the second updated allocated rigid memory amount after allocating the memory quota for the rigid state memory to the business module to be executed; The third calculation module is used to obtain the second elastic memory share of the session to the elastic state memory based on the total memory, the second updated allocated rigid memory amount, and the rigid memory share; The sixth allocation module is used to detect whether the second elastic memory share meets the fifth requirement. If the second elastic memory share meets the fifth requirement, then according to the fifth requirement, the module to be executed allocates memory quota to the elastic state memory. The seventh allocation module is used to allocate memory quotas to the pending business module based on the second elastic memory share if it is detected that the second elastic memory share does not meet the fifth requirement.

[0072] Optionally, the database memory management device further includes: The fourth update module is used to execute the step of obtaining the allocated rigid memory amount and rigid memory share of the session for the rigid state memory if it is detected that the current available memory amount does not meet the first demand amount, so as to obtain the first updated allocated rigid memory amount. The fourth calculation module is used to obtain the third elastic memory share of the session to the elastic state memory based on the total memory, the first updated allocated rigid memory, and the updated rigid memory share. The eighth allocation module is used to detect whether the third elastic memory share meets the fifth requirement. If the third elastic memory share meets the fifth requirement, then according to the fifth requirement, the module to be executed allocates memory quota to the elastic state memory. The ninth allocation module is used to allocate memory quotas to the pending business module based on the third elastic memory share if it is detected that the third elastic memory share does not meet the fifth demand.

[0073] For specific limitations regarding the database memory management device, please refer to the limitations on the database memory management method above, which will not be repeated here. Each module in the aforementioned database memory management device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0074] In one embodiment, such as Figure 8 The diagram shown is a structural schematic of a computer device provided in Embodiment 7 of the present invention. This computer device can be a server, and its internal structure can be as follows: Figure 8As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The database stores a first memory requirement, currently available memory, a first allocated memory, a first memory share, and a total memory. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a database memory management method.

[0075] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the database memory management method described in the above embodiment, for example... Figure 1 As shown in S101-S104, or Figures 2 to 6 As shown, to avoid repetition, it will not be described again here. Alternatively, when the processor executes a computer program, it implements the functions of each module / unit in this embodiment of the database memory management device, for example... Figure 7 The functions of the database memory management device shown are not described again here to avoid repetition.

[0076] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program implements the database memory management method described in the above embodiment, for example... Figure 1 As shown in S101-S104, or Figures 2 to 6 As shown, to avoid repetition, it will not be described again here. Alternatively, when the computer program is executed by the processor, it implements the functions of each module / unit in this embodiment of the database memory management device, for example... Figure 7 The functions of the database memory management device shown are not described again here to avoid repetition.

[0077] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0078] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0079] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A database memory management method, characterized in that, include: The first requirement of the business module to be executed for rigid state memory during execution is obtained, and the current available memory of the session to which the business module to be executed belongs is obtained, wherein the rigid state memory refers to the memory that ensures the normal execution of the business module; The system checks whether the current available memory meets the first requirement. If the current available memory does not meet the first requirement, it obtains the allocated rigid memory and rigid memory share of the session for the rigid state memory. Based on the first requirement and the allocated rigid memory, the rigid memory share is updated to obtain an updated rigid memory share. The rigid memory share refers to the minimum amount of memory that the session reserves for the rigid state memory in the current available memory. At least the rigid memory share exists in the current available memory for the service module's requirement for the rigid state memory. The service module's requirement for the elastic state memory cannot be encroached upon. Obtain the total memory of the session, and check whether the total memory meets the updated rigid memory share. If the total memory meets the updated rigid memory share, determine the memory occupied by all executing business modules in the business to which the business module to be executed belongs. The occupied memory includes the occupied rigid memory for the rigid state memory and the occupied elastic memory for the elastic state memory. The elastic state memory refers to the memory that affects the execution performance of the business module. Obtain the second requirement of each executing business module in the business for the rigid state memory; based on the occupied memory, the first requirement and all second requirements, update the allocated rigid memory to obtain the first updated allocated rigid memory. The first updated allocated rigid memory is used to support the normal execution of the business module to be executed and all executing business modules in the business. The step of updating the rigid memory share based on the first demand and the allocated rigid memory amount to obtain the updated rigid memory share includes: Obtain the quota adjustment ratio of the rigid state memory for the session; The rigid memory share is updated based on the quota adjustment ratio, the first demand, and the allocated rigid memory amount to obtain the updated rigid memory share; The step of updating the allocated rigid memory amount based on the occupied memory amount, the first demand amount, and all second demands to obtain the first updated allocated rigid memory amount includes: Release the occupied memory, update the current available memory, and obtain the updated available memory for the session; Based on the updated available memory, the first demand, and all second demands, the memory quota for the rigid state memory is reallocated to the business module to be executed and each executing business module in the business; After the memory quota for the rigid state memory is reallocated to the business module to be executed and all business modules in execution within the business, the first updated allocated rigid memory amount is obtained.

2. The database memory management method as described in claim 1, characterized in that, After obtaining the updated allocated rigid memory amount, the process also includes: Obtain the third requirement of each executing business module in the business for the elastic state memory; Based on the total memory, the first updated allocated rigid memory, the updated rigid memory share, and all third demand amounts, the memory quota for the elastic state memory is reallocated to each executing business module in the business.

3. The database memory management method as described in claim 1, characterized in that, The database memory management method also includes: Obtain the fourth requirement of the elastic state memory for the business module to be executed; Based on the total memory, the allocated rigid memory, and the rigid memory share, the first elastic memory share of the session for the elastic state memory is obtained; Detect whether the first elastic memory share meets the fourth requirement. If the first elastic memory share meets the fourth requirement, then allocate memory quota to the elastic state memory for the business module to be executed according to the fourth requirement. If it is detected that the first elastic memory share does not meet the fourth requirement, then according to the first elastic memory share, a memory quota for the elastic state memory is allocated to the business module to be executed.

4. The database memory management method as described in claim 1, characterized in that, The database memory management method also includes: Obtain the first demand and the fifth demand of the business module to be executed for the elastic state memory during execution; Detect whether the current available memory meets the first requirement. If the current available memory meets the first requirement, allocate a memory quota to the rigid state memory for the business module to be executed according to the first requirement. After allocating memory quotas for the rigid state memory to the business module to be executed, the second updated allocated rigid memory amount is obtained; Based on the total memory, the second updated allocated rigid memory, and the rigid memory share, the second elastic memory share of the session for the elastic state memory is obtained; Detect whether the second elastic memory share meets the fifth requirement. If the second elastic memory share meets the fifth requirement, then allocate memory quota to the elastic state memory for the business module to be executed according to the fifth requirement. If it is detected that the second elastic memory share does not meet the fifth requirement, then according to the second elastic memory share, a memory quota for the elastic state memory is allocated to the business module to be executed.

5. The database memory management method as described in claim 4, characterized in that, After detecting whether the current available memory meets the first requirement, the method further includes: If it is detected that the current available memory amount does not meet the first requirement, then the step of obtaining the allocated rigid memory amount and rigid memory share of the session for the rigid state memory is executed to obtain the first updated allocated rigid memory amount; Based on the total memory, the first updated allocated rigid memory, and the updated rigid memory share, the third elastic memory share of the session for the elastic state memory is obtained. Detect whether the third elastic memory share meets the fifth requirement. If the third elastic memory share meets the fifth requirement, then allocate memory quota to the elastic state memory for the business module to be executed according to the fifth requirement. If it is detected that the third elastic memory share does not meet the fifth requirement, then according to the third elastic memory share, memory quotas for the elastic state memory are allocated to the business module to be executed.

6. A database memory management device, characterized in that, include: The first acquisition module is used to acquire the first requirement of rigid state memory for the business module to be executed during execution, and to acquire the current available memory of the session to which the business module to be executed belongs, wherein the rigid state memory refers to the memory that ensures the normal execution of the business module; The first update module is used to detect whether the current available memory amount meets the first demand amount. If it is detected that the current available memory amount does not meet the first demand amount, the module obtains the allocated rigid memory amount and rigid memory share of the session for the rigid state memory. Based on the first demand amount and the allocated rigid memory amount, the rigid memory share is updated to obtain the updated rigid memory share. The rigid memory share refers to the minimum amount of memory that the session reserves for the rigid state memory in the current available memory amount. At least the rigid memory share of memory exists in the current available memory amount for the business module's demand for the rigid state memory. The business module's demand for elastic state memory cannot be encroached upon. The retry judgment module is used to obtain the total memory of the session, detect whether the total memory meets the updated rigid memory share, and if the total memory meets the updated rigid memory share, determine the memory occupied by all executing business modules in the business to which the business module to be executed belongs. The occupied memory includes the occupied rigid memory for the rigid state memory and the occupied elastic memory for the elastic state memory. The elastic state memory refers to the memory that affects the execution performance of the business module. The retry allocation module is used to obtain the second demand amount of the rigid state memory for each executing business module in the business, and update the allocated rigid memory amount according to the occupied memory amount, the first demand amount and all the second demand amounts to obtain the first updated allocated rigid memory amount. The first updated allocated rigid memory amount is used to support the normal execution of the business module to be executed and all executing business modules in the business. The first update module includes: The second acquisition unit is used to acquire the quota adjustment ratio of the session for the rigid state memory; The first calculation unit is used to update the rigid memory share according to the quota adjustment ratio, the first demand and the allocated rigid memory amount, to obtain the updated rigid memory share; The retry allocation module includes: The release unit is used to release the occupied memory and update the current available memory to obtain the updated available memory of the session. The first allocation unit is used to reallocate the memory quota of the rigid state memory to the business module to be executed and each business module in execution in the business according to the updated available memory amount, the first demand amount and all the second demand amounts. The second update unit is used to obtain the first updated allocated rigid memory amount after the memory quota for the rigid state memory has been reallocated to the business module to be executed and all business modules in execution in the business is reallocated.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the database memory management method according to any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the database memory management method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Container memory adjusting method and device

    CN112835685A