Memory management method and device, equipment and storage medium
By dividing static memory and dynamic memory for sub-businesses, and updating dynamic memory information while the actual static memory is consistent with the expected static memory, the problem of memory usage imbalance is solved, and memory usage efficiency and system stability are improved.
Patent Information
- Application Number
- CN202510623998.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-08-08
AI Technical Summary
The prior art is difficult to effectively control the memory usage in the processing process of each sub-service, resulting in imbalance in memory resource allocation and low utilization efficiency.
By dividing static memory and dynamic memory for each sub-service in the to-process business, and when the actual static memory is consistent with the expected static memory, the initial dynamic memory information is determined based on the service type of the sub-service, and update it based on the dynamic memory to be applied, and integrating the actual static memory, expected static memory and target dynamic memory information is achieved to achieve flexible management of dynamic memory.
It realizes refined control of memory usage during the processing of each sub-business, avoids excessive or unreasonable use of memory, and improves memory usage efficiency and system stability.
Smart Images

Figure CN120448126A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a memory management method, apparatus, device, medium, and program product. Background Art
[0002] With the rapid development of artificial intelligence (AI), the demand for business storage across various industries has exploded, and memory resource consumption is increasing exponentially. Against this backdrop, establishing an efficient memory resource management and monitoring mechanism has become crucial for improving resource utilization and avoiding waste.
[0003] Currently, memory pooling is commonly used to manage total memory usage during business processing. However, this approach struggles to effectively manage memory usage across the various sub-businesses within a business, leading to frequent problems such as unbalanced memory resource allocation and inefficient utilization. Summary of the Invention
[0004] In view of the above problems, the present application provides a memory management method, apparatus, device, medium and program product.
[0005] According to one aspect of the present application, a memory management method is provided, comprising:
[0006] In response to the fact that the actual static memory of the sub-business in the pending business is consistent with the expected static memory, the initial dynamic memory information is determined based on the business type of the sub-business. The expected static memory is the expected basic memory to support the processing process of the sub-business. The initial dynamic memory information includes a dynamic memory threshold that represents the upper limit of the dynamic memory that can be occupied during the processing of the sub-business and the available dynamic memory determined by the dynamic memory threshold; when it is determined that the dynamic memory to be applied determined by the sub-business is less than or equal to the available dynamic memory, the initial dynamic memory information is updated based on the dynamic memory to be applied to obtain the target dynamic memory information; based on the actual static memory, expected static memory and target dynamic memory information of the sub-business in the pending business, the memory information during the processing of the pending business is determined.
[0007] Another aspect of the present application provides a memory management device, comprising: a first determination module, configured to, in response to the actual static memory of a sub-business in a pending business being consistent with the expected static memory, determine initial dynamic memory information based on the business type of the sub-business, wherein the expected static memory is the basic memory supporting the processing of the sub-business, and the initial dynamic memory information includes a dynamic memory threshold representing the upper limit of the dynamic memory that can be occupied during the processing of the sub-business and the available dynamic memory determined by the dynamic memory threshold; an update module, configured to, when determining that the dynamic memory to be applied for determined by the sub-business is less than or equal to the available dynamic memory, update the initial dynamic memory information based on the dynamic memory to be applied for to obtain target dynamic memory information; a second determination module, configured to determine the memory information during the processing of the pending business based on the actual static memory, expected static memory, and target dynamic memory information of the sub-business in the pending business. Another aspect of the present application provides an electronic device, comprising: one or more processors; a memory configured to store one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0008] Another aspect of the present application further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the computer program or instructions are executed by a processor.
[0009] Another aspect of the present application further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the computer program or instructions are executed by a processor.
[0010] According to the memory management method of the present application, by dividing static memory and dynamic memory for each sub-business processing process in a pending business, and after comparing the actual static memory with the expected static memory to determine that the sub-business can be processed normally, the initial dynamic memory information is determined based on the business type of the sub-business, and the dynamic memory to be applied is determined based on the sub-business. The initial dynamic memory information is updated when it does not exceed the available dynamic memory determined by the dynamic memory threshold, thereby achieving flexible management of dynamic memory. The actual static memory, expected static memory, and target dynamic memory information of each sub-business are integrated to determine the overall memory information of the pending business processing process. Since the memory used in the sub-business processing process is divided into static memory and dynamic memory, and the memory that can be occupied during the sub-business processing process is controlled by the expected static memory and dynamic memory thresholds, refined management of memory usage in each sub-business processing process is achieved. This at least partially solves the technical problem of the difficulty in effectively controlling memory usage in each sub-business processing process, effectively avoids excessive or unreasonable memory usage in each sub-business processing process, and improves memory usage efficiency and system stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above contents and other objects, features and advantages of the present application will become more apparent through the following description of the embodiments of the present application with reference to the accompanying drawings, in which:
[0012] Figure 1 Schematically illustrates an application scenario diagram of the memory management method, apparatus, device, medium, and program product according to an embodiment of the present application;
[0013] Figure 2 The following schematically shows a flow chart of a memory management method according to an embodiment of the present application;
[0014] Figure 3 The data flow diagram of the memory management method according to an embodiment of the present application is schematically shown;
[0015] Figure 4 A schematic diagram schematically illustrates memory information of a business system according to an embodiment of the present application;
[0016] Figure 5 A schematic diagram of a memory management device according to an embodiment of the present application is shown; and
[0017] Figure 6 A block diagram of an electronic device suitable for implementing a memory management method according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0018] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present application. In the detailed description below, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present application. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessarily confusing the concepts of the present application.
[0019] The terms used herein are only for describing specific embodiments and are not intended to limit this application. The terms "comprise," "include," etc. used herein indicate the presence of the features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0020] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0021] When expressions such as "at least one of A, B, and C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0022] During the research process, we discovered that demand for storage services continues to grow across various industries. As storage system business functions evolve, the demand for hardware resources is also increasing, including the ever-increasing memory consumption. To effectively utilize memory resources, effective memory management and monitoring mechanisms are required. Currently, the storage sector generally provides overall memory statistics, but lacks effective control over memory usage by each business module during sub-business processing. For example, how can we effectively monitor whether business modules are abusing memory, rather than waiting until the system's overall memory is running low to report it?
[0023] In view of this, an embodiment of the present application provides a memory management method, including: in response to the actual static memory of a sub-business in a pending business being consistent with the expected static memory, determining initial dynamic memory information based on the business type of the sub-business, the expected static memory being the expected basic memory to support the processing process of the sub-business, the initial dynamic memory information including a dynamic memory threshold representing the upper limit of the dynamic memory that can be occupied during the processing of the sub-business and the available dynamic memory determined by the dynamic memory threshold; when it is determined that the dynamic memory to be applied determined by the sub-business is less than or equal to the available dynamic memory, updating the initial dynamic memory information based on the dynamic memory to be applied to obtain the target dynamic memory information; based on the actual static memory, expected static memory and target dynamic memory information of the sub-business in the pending business, determining the memory information during the processing of the pending business.
[0024] Figure 1 The application scenario diagram of the memory management method, apparatus, device, medium and program product according to the embodiments of the present application is schematically shown.
[0025] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links or optical fiber cables.
[0026] A user may use a first terminal device 101, a second terminal device 102, or a third terminal device 103 to interact with a server 105 via a network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, or the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (for example only).
[0027] The first terminal device 101 , the second terminal device 102 , and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0028] The server 105 may be a server that provides various services, such as a background management server (for example only) that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process received data such as user requests, and feed back processing results (e.g., web pages, information, or data obtained or generated based on user requests) to the terminal devices.
[0029] It should be noted that the memory management method provided in the embodiment of the present application can generally be executed by the server 105. Accordingly, the memory management device provided in the embodiment of the present application can generally be set in the server 105. The memory management method provided in the embodiment of the present application can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the memory management device provided in the embodiment of the present application can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0030] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0031] The following will be based on Figure 1 The scene described by Figures 2 to 4 The memory management method of the application embodiment is described in detail.
[0032] Figure 2 The flowchart of the memory management method according to an embodiment of the present application is schematically shown.
[0033] like Figure 2 As shown, the method includes operations S210 to S230.
[0034] In operation S210, in response to the actual static memory of the sub-business in the business to be processed being consistent with the expected static memory, the initial dynamic memory information is determined based on the business type of the sub-business. The expected static memory is the expected basic memory to support the processing process of the sub-business. The initial dynamic memory information includes a dynamic memory threshold that characterizes the upper limit of the dynamic memory that can be occupied by the sub-business processing process and the available dynamic memory determined by the dynamic memory threshold.
[0035] In operation S220 , when it is determined that the dynamic memory to be applied determined by the sub-business is less than or equal to the available dynamic memory, the initial dynamic memory information is updated based on the dynamic memory to be applied to obtain target dynamic memory information.
[0036] In operation S230 , memory information during the processing of the pending service is determined based on the actual static memory, expected static memory, and target dynamic memory information of the sub-services in the pending service.
[0037] Pending transactions can be received and processed by a business system. The business system can include at least one business module, each of which is responsible for processing a sub-transaction of a specific business type. Pending transactions can include at least one sub-transaction. After receiving a pending transaction, the business system can process the sub-transaction of the corresponding business type by at least one business module.
[0038] A business module is a functional unit in a business system that is responsible for business processing. It consists of code, data structure, related configurations, and interaction mechanisms with other modules to achieve specific business functions.
[0039] The functions implemented by the business module are related to the business system. For example, if the business system is a storage system, the business module is a module that provides various storage services.
[0040] Based on the business system's software architecture and business model, the memory available to each business module during sub-business processing can be divided into static memory and dynamic memory. Static memory is defined as the memory that supports the normal functions of the business module, specifically the memory that prepares for or supports the processing of sub-businesses. Dynamic memory is defined as the memory related to the specific processing of sub-businesses.
[0041] The sub-business processing process may include a sub-business processing preparation phase and a sub-business actual processing phase. The sub-business processing preparation phase may be the phase where the business module is initialized and has not yet officially started sub-business processing. The sub-business actual processing phase may be the phase where the business module starts sub-business processing.
[0042] The actual static memory and initial dynamic memory information of each sub-business may be determined in the business processing preparation stage, and the pending dynamic memory and target dynamic memory information of each sub-business may be determined in the actual processing stage of the sub-business.
[0043] The expected static memory may be the expected static memory, which may be the expected basic memory amount occupied by the basic data structures and resources that can support the normal operation of the business module functions. The static memory will not be released during the life cycle of the storage system protocol stack process.
[0044] The dynamic memory threshold is the maximum dynamic memory that a business module can use or occupy while processing a sub-business. Dynamic memory is allocated based on sub-business processing requirements and is dynamically allocated and released. The actual amount of dynamic memory used by a business module during sub-business processing is a variable value. For example, this includes memory used for metadata such as storage pools and volume bitmaps.
[0045] The expected static memory and dynamic memory thresholds can be stored in the configuration file of the business system and solidified, so that the expected static memory and dynamic memory thresholds of each business module when processing each sub-business can be quickly learned from the configuration file.
[0046] Each business module can use different mechanisms to manage static memory and dynamic memory when processing sub-businesses. Static memory can be managed using the Static Memory Management (SMM) mechanism. Dynamic memory can be managed using the Dynamic Memory Management (DMM) mechanism.
[0047] The static memory management mechanism can monitor the actual static memory usage of each business module when processing sub-businesses during the initialization phase to see if it is consistent with the expected static memory usage. If it is determined that the actual static memory usage is consistent with the expected static memory usage, it can send a startup notification to the DMM mechanism.
[0048] The dynamic memory management mechanism can be started upon receiving a start-up notification sent by the SMM mechanism. The dynamic memory management mechanism can monitor and manage whether the memory occupied by the business data generated by each business module is within its respective dynamic memory threshold during the sub-business processing of each business module.
[0049] The initial dynamic memory information during the sub-service processing process may include: service module identifier, dynamic memory threshold, occupied dynamic memory, and available dynamic memory. Since the initial dynamic memory information is generated during the sub-service processing preparation phase, the preset value of occupied dynamic memory may be 0.
[0050] The available dynamic memory can be the dynamic memory that can be applied for and used by the business module in the process of processing the sub-business. The occupied dynamic memory can be the dynamic memory that has been occupied by the current business module in the process of processing the sub-business.
[0051] Because each business module has a maximum business scale limit when processing sub-businesses, such as the maximum pool volume size and the maximum number of disk enclosures supported, the dynamic memory that can be used by each sub-business during processing is limited by the corresponding business scale. The dynamic memory threshold can be determined based on the dynamic memory occupied by the business module when processing a sub-business with the maximum business scale. The dynamic memory threshold is also related to the business type of the sub-business.
[0052] During the initial dynamic memory information generation process, the dynamic memory threshold may be determined from a configuration file of the business system based on the business type of the sub-business.
[0053] The memory information during the processing of the pending business can also be considered as the memory information of the business system. The above memory information may include dynamic memory statistical information and static memory statistical information. The static memory statistical information can be obtained based on the actual static memory and expected static memory of at least one sub-business. The dynamic memory statistical information can be obtained based on the current dynamic memory occupancy of at least one sub-business. For example: when in the sub-business processing preparation stage, the dynamic memory statistical information can be obtained from the initial dynamic memory information of at least one sub-business. When in the actual processing stage of the sub-business, the dynamic memory statistical information can be obtained from the target dynamic memory information of at least one sub-business.
[0054] Since the business module is used to process sub-businesses, the dynamic memory threshold, actual static memory, expected static memory, available dynamic memory, and occupied dynamic memory determined during the sub-business processing process can all be considered as memory information corresponding to the business module. Therefore, during the sub-business processing preparation phase, dynamic memory statistics can be shown in Table 1 below.
[0055] Table 1
[0056]
[0057] The dynamic memory thresholds for business modules A, B, C, ..., and N are Max_a, Max_b, Max_c, ..., and Max_n, respectively. Because sub-businesses are not yet being processed, the currently occupied dynamic memory for each business module is 0. Available dynamic memory is the amount of dynamic memory that the business module can continue to request, which is the value obtained by subtracting the occupied dynamic memory from the dynamic memory threshold. Since the occupied dynamic memory is 0, the available dynamic memory equals the dynamic memory threshold. For example, in business module A, the occupied dynamic memory is 0, and the available dynamic memory, Available_a, is equal to Max_a - 0.
[0058] For business modules that do not require dynamic memory, the dynamic memory threshold, occupied dynamic memory, and available dynamic memory corresponding to these business modules in the dynamic memory statistics are always 0.
[0059] The dynamic memory to be applied for can be the dynamic memory required to process the sub-business, which is related to the business scale of the sub-business.
[0060] When it is determined that the dynamic memory to be applied is less than or equal to the available dynamic memory, it can be determined that the dynamic memory occupied by the business module does not exceed the dynamic memory threshold of the business module, so that the initial dynamic memory information can be updated to obtain the target dynamic memory information.
[0061] If the dynamic memory to be requested exceeds the available dynamic memory, the dynamic memory occupied by the business module exceeds the dynamic memory threshold for that business module, indicating that the business module has exceeded its memory usage specifications. Therefore, an error reporting process is triggered, and the business module identifier, available dynamic memory, occupied dynamic memory, dynamic memory to be requested, and dynamic memory threshold for that business module are embedded in a pre-set error reporting template. This generates a target error message and sends it to the operations and maintenance personnel.
[0062] According to the memory management method of the present application, by dividing static memory and dynamic memory for each sub-business in the pending business, and after comparing the actual static memory with the expected static memory to determine that the sub-business can be processed normally, the initial dynamic memory information is determined based on the business type of the sub-business, and the dynamic memory to be applied is determined based on the sub-business. The initial dynamic memory information is updated when it does not exceed the available dynamic memory determined by the dynamic memory threshold, thereby achieving flexible management of dynamic memory. The actual static memory, expected static memory, and target dynamic memory information of each sub-business are integrated to determine the overall memory information during the processing of the pending business. Since the memory used during the sub-business processing is divided into static memory and dynamic memory, and the memory that can be occupied during the sub-business processing is controlled by the expected static memory and dynamic memory thresholds, refined management of memory usage during the processing of each sub-business is achieved. This at least partially solves the technical problem of the difficulty in effectively controlling memory usage during the processing of each sub-business, effectively avoids excessive or unreasonable memory usage during the processing of each sub-business, and improves memory usage efficiency and system stability.
[0063] According to an embodiment of the present application, the initial dynamic information also includes: occupied dynamic memory; updating the initial dynamic memory information based on the dynamic memory to be applied to obtain target dynamic memory information may include the following operations.
[0064] Based on the dynamic memory to be applied, the occupied dynamic memory is updated to obtain the target occupied dynamic memory; based on the dynamic memory to be applied and the available dynamic memory, the target available dynamic memory is determined; based on the target occupied dynamic memory and the target available dynamic memory, the initial dynamic memory information is updated to obtain the target dynamic memory information.
[0065] A subtraction operation may be performed on the available dynamic memory and the dynamic memory to be applied, so that the difference between the two is determined as the target available dynamic memory.
[0066] The dynamic memory to be applied for and the occupied dynamic memory may be added together, so that the sum of the two may be determined as the target occupied dynamic memory.
[0067] The sum of the target occupied dynamic memory and the target available dynamic memory can be compared with the dynamic memory threshold to verify whether there are calculation errors in the target occupied dynamic memory and the target available dynamic memory. If the sum of the target occupied dynamic memory and the target available dynamic memory is determined to be unequal to the dynamic memory threshold, it can be determined that one or both of the target occupied dynamic memory and the target available dynamic memory have calculation errors. If they are determined to be the same, it is determined that there are no calculation errors in either.
[0068] The dynamic memory statistical information obtained from the target dynamic memory information of at least one sub-service may be as shown in Table 2 below.
[0069] Table 2
[0070]
[0071] Taking business module A as an example, the target occupied dynamic memory, Allocated_a, equals Max_a - Available_a'. Allocated_a is calculated by adding the occupied dynamic memory and the pending dynamic memory of business module A. Available_a' is calculated by subtracting the pending dynamic memory from Available_a.
[0072] When service module A receives a new pending service and Allocated_a has not been released, the target dynamic memory information of service module A can be updated based on the new pending dynamic memory of the new pending service, thereby obtaining new target dynamic memory information.
[0073] For example, if the new dynamic memory to be requested is Extra_a1, Extra_a1 can be compared with Available_a'. If Extra_a1 is less than or equal to Available_a', dynamic memory equal to Extra_a1 can be allocated to business module A. This means that the target occupied dynamic memory and target available dynamic memory can also be updated based on Extra_a1. Specifically, the new Available_a' = Available_a' - Extra_a1, and the new Allocated_a = Allocated_a + Extra_a1. If Extra_a1 is greater than Available_a', the error reporting process is triggered.
[0074] According to an embodiment of the present application, by dynamically updating the occupied dynamic memory and accurately calculating the available dynamic memory, over-allocation or under-allocation of dynamic memory is avoided, so that dynamic memory resources can be more fully utilized. At the same time, determining the target dynamic memory information based on multiple dynamic memory factors such as the dynamic memory threshold, target occupied dynamic memory, and target available dynamic memory facilitates more detailed memory management and facilitates monitoring of whether the dynamic memory usage of the business module in the process of processing sub-businesses exceeds the dynamic memory threshold and other abnormal conditions.
[0075] According to an embodiment of the present application, the dynamic memory threshold is determined in the following manner.
[0076] Based on a preset performance detection tool, determine the processing performance indicators collected when processing sample sub-businesses of multiple business scales, where the sample sub-businesses and the sub-businesses have the same business type; construct performance description information based on multiple business scales and the processing performance indicators corresponding to the business scales; perform feature analysis on the performance description information to determine the scale threshold range when processing the sample sub-businesses of the business type; determine the dynamic memory threshold based on the memory occupied by the samples of the sample sub-businesses whose business scales are within the scale threshold range.
[0077] A preset performance monitoring tool monitors the performance indicators of a sample business module when processing sample services. The sample business module can be a module in the same business scenario and with the same business functions as the business module. Performance indicators are quantitative parameters used to measure the operational performance of the sample business module when processing the sample service. Performance indicators can reflect the performance characteristics of the business module from multiple dimensions, such as processing power, resource utilization efficiency, and reliability. For example, performance indicators may include sub-performance indicators such as the business module's throughput, response time, CPU utilization, and processing error rate.
[0078] The performance description information may be information representing the mapping relationship between multiple service scales and performance indicators. The performance description information may include at least one sub-performance description information, and the sub-performance description information may be constructed by mapping the relationship between each sub-performance indicator and multiple service scales.
[0079] Multiple business scales can be increased from small to large according to preset growth parameters, so that for each sub-function description information, the mapping relationship between the business scale and the sub-performance indicator can be arranged according to the size of the multiple business scales, thereby facilitating subsequent feature analysis.
[0080] There is no limitation on the method of feature analysis of performance description information. By using algorithms such as polynomial regression and exponential regression to perform curve fitting between business scale and performance indicators, a curve showing how performance indicators change with business scale can be constructed. By analyzing the inflection points or mutation areas in the curve, the scale threshold range can be determined.
[0081] The performance indicators in the performance description information can also be clustered to divide business scales with similar performance into the same category. The business scale corresponding to the boundary category is the threshold candidate value, and the scale threshold range is determined by the threshold candidate value.
[0082] The business scales of multiple sample sub-businesses can be matched with the scale threshold range, and the target sample sub-business with the smallest business scale can be determined from the candidate sample sub-businesses whose business scales fall within the scale threshold range. The sample occupied memory of the target sample sub-business can be subtracted from the expected static memory of the sample business module to determine the dynamic memory threshold.
[0083] According to the embodiments of the present application, a preset performance testing tool is used to obtain performance indicators when processing sample sub-services of different business scales, construct performance description information and perform feature analysis to determine the scale threshold range. Furthermore, the dynamic memory threshold is determined based on the memory occupied by samples in the sample sub-service processing within this range. This can more accurately determine the dynamic memory threshold of the business module, align memory allocation with actual business needs, effectively avoid wasted or insufficient memory resources, improve the memory utilization efficiency of the business system, and ensure stable system operation.
[0084] According to an embodiment of the present application, the actual static memory is determined in the following manner.
[0085] In response to being in the configuration information configuration stage for the sub-business processing process, the first total available memory of the memory space before the configuration information is configured and the second total available memory after the configuration information is configured are obtained; the difference between the first total available memory and the second total available memory is used as the actual static memory of the business module.
[0086] The configuration information configuration phase for the sub-service processing process may be a phase for initializing a service module for processing the sub-service.
[0087] The first total available memory and the second total available memory are the total available memory in the memory space of the business system before and after the business module is initialized.
[0088] The static memory statistics may be determined based on the actual static memory and the expected static memory. Since the actual static memory may be different in different stages, the static memory statistics in different system stages may also be different.
[0089] For example, when the service system is in the protocol stack process startup phase, the static memory statistics information obtained may be as shown in Table 3 below.
[0090] Table 3
[0091]
[0092] The expected static memory of business modules A, B, C, ..., N are Budget_a, Budget_b, Budget_c, ..., Budget_N respectively. At this time, because the business modules have not been initialized, the expected static memory is 0.
[0093] During the protocol stack process initialization phase, each service module can be initialized serially. For example, in Table 3, the service module initialization order is ABC…N. Before initializing service module A, the first total available memory value of the current service system is recorded. After service module A completes initialization, the second total available memory value of the current service system is recorded. The difference between the two values is the actual static memory of service module A, denoted as Consume_a. Similarly, using the same method as for service module A, the actual static memory of service modules B, C, and D can be determined as Consume_b, Consume_c, and Consume_d, respectively. The resulting static memory statistics can be shown in Table 4 below.
[0094] Table 4
[0095]
[0096] According to the embodiments of the present application, by obtaining the available memory of the business system before and after the business module is initialized, that is, obtaining the configuration information for the sub-business processing process, the difference between the two is used to accurately determine the actual static memory of the business module. A convenient and accurate method for calculating the static memory of the business module is provided, which avoids complex code analysis and estimation, and can quickly and intuitively determine the static memory actually occupied by the business module during the initialization process, providing a reliable basis for the planning and management of system memory resources. In addition, the actual static memory of each business module is determined separately at different system stages, and the static memory statistics of the business system are generated in real time, so that refined management of memory usage can be achieved, and it has real-time performance.
[0097] According to an embodiment of the present application, the situation where the actual static memory is inconsistent with the expected static memory includes: the difference between the actual static memory and the expected static memory is greater than a preset threshold; the memory management method may also include the following operations.
[0098] When it is determined that the difference between the actual static memory and the expected static memory is greater than the preset threshold, the business processing logic for the sub-business is analyzed to obtain the logic analysis result; when it is determined that the logic analysis result indicates that the business processing logic is consistent with the historical business processing logic, the memory usage of the configured configuration information is analyzed to determine the cause of the abnormal memory usage.
[0099] The preset threshold can be a positive number and is not limited to a specific value. It can be set based on actual conditions. If the difference between the actual static memory and the expected static memory is greater than the preset threshold, it can be determined that the actual static memory is greater than the expected static memory, indicating that the service module may have a feature change or memory abuse.
[0100] Therefore, by analyzing the business processing logic of the sub-business, that is, performing a functional analysis of the business module, the current functional information of the business module can be determined. When it is determined that the current functional information is different from the historical functional information of the business module, it can be determined that there is a feature change in the business module. Therefore, the expected static memory of the business module in the configuration file and static memory statistics of the business system can be updated based on the actual static memory, and update notification information can be sent to the operation and maintenance personnel.
[0101] There are no specific limitations on the method for functional analysis. Static code analysis tools can be used to scan the source code of a business module, extracting the module's code structure, including functions, classes, and interfaces, through syntax tree parsing and lexical analysis, to clarify its underlying business logic. Alternatively, comments in the source code can be extracted and, combined with regular expressions or natural language processing techniques, keywords in the comments can be matched to obtain functional information.
[0102] The historical function information may be obtained by performing a function analysis on the business modules at historical moments.
[0103] When it is determined that the current function information is the same as the historical function information of the business module, the possibility of feature changes in the business module can be ruled out. Therefore, the memory usage of the initialized business module can be analyzed, that is, the storage occupancy in the configuration information after configuration can be analyzed to determine whether there is memory abuse in the business module.
[0104] There is no limitation on memory usage analysis of business modules. It can compare the currently occupied static memory of each component in the business module with the historically occupied static memory, and determine the cause of abnormal memory usage based on the inconsistency between the currently occupied static memory and the historically occupied static memory.
[0105] When the difference between the actual static memory and the expected static memory is greater than the preset threshold, an alarm message can also be sent to the operation and maintenance personnel. The alarm message may include the business module identifier, the actual static memory, and the expected static memory. It also includes prompt information, which can be used to remind the operation and maintenance personnel that the actual static memory of the business module has increased, and it is necessary to check whether there are feature changes or other abnormalities. If it is determined that the above situation is caused by a feature change, the expected static memory configured for this module should be updated in a timely manner. If it is determined that the above situation is caused by other abnormalities, it is necessary to check whether there is memory abuse in the business module.
[0106] According to the embodiments of the present application, anomalies are determined by comparing the difference between actual static memory and expected static memory. When the difference exceeds a preset threshold and the business processing logic for a sub-business is consistent with the historical business processing logic, memory usage analysis is performed to locate the cause of the anomaly. This allows accurate identification of abnormal memory usage after business module initialization, eliminates memory usage fluctuations caused by functional changes, and quickly determines the cause of memory anomalies, thereby optimizing business modules in a targeted manner, improving memory usage efficiency, and ensuring stable system operation.
[0107] The situation where the actual static memory is inconsistent with the expected static memory also includes: the difference between the actual static memory and the expected static memory is less than a second preset threshold. The second preset threshold may be a negative number.
[0108] When it is determined that the difference between the actual static memory and the expected static memory is less than the second preset threshold, it can be determined that the actual static memory is less than the expected static memory, that is, the business module processing the sub-business may have static memory reduction or initialization failure.
[0109] Therefore, you can analyze the module change log of the business module to determine whether there are any operations that cause static memory reduction, or perform initialization troubleshooting to determine whether there are any components that have not been successfully initialized.
[0110] An alarm message can also be sent to maintenance personnel. The alarm message can include the business module identifier, actual static memory, and expected static memory. It also includes a prompt message to remind the tester that the business module's static memory has been reduced. Please confirm whether this is normal. If the reduction is normal, the expected static memory of the business module will be updated to the actual static memory. If it is not normal, it is necessary to investigate whether there is an initialization failure.
[0111] According to the embodiments of the present application, a more fine-grained classification is performed based on the inconsistency between actual static memory and expected static memory, and different exception analyses are performed according to different situations, thereby more quickly determining the cause of the exception, thereby optimizing business modules in a targeted manner, improving memory usage efficiency, and ensuring stable system operation. Furthermore, alarm messages with different prompts are generated, which can help operation and maintenance personnel to more quickly and conveniently troubleshoot problems, thereby ensuring stable system operation.
[0112] According to an embodiment of the present application, the pending service includes at least one sub-service; the memory information further includes: reserved memory; before the sub-service determines the pending application dynamics, the method further includes:
[0113] The actual static memory and dynamic memory threshold of at least one sub-business are accumulated to obtain the business memory sum; when it is determined that the sum of the business memory and the module memory is less than or equal to the target difference, the dynamic memory to be applied is determined based on the sub-business, and the target difference is obtained according to the initial total memory and the reserved memory.
[0114] The memory space of a business system can include occupied space, available space, and reserved space. Occupied space includes the target occupied dynamic memory and actual static memory allocated to each business module; available space includes the memory in the business system that has not yet been allocated to each business module or other activities; and reserved space includes reserved memory. Initial memory and total memory are memory space.
[0115] Reserved memory can be used to support caching tasks and other non-Input / Output (I / O) system activities in pending business. Reserved memory can also be dynamically allocated and released.
[0116] When the business memory and the difference are less than or equal to the target value, it can be determined that the business system can operate normally.
[0117] After generating dynamic memory statistics based on at least one initial dynamic memory information, or after obtaining the dynamic memory threshold for at least one business module, the DMM mechanism can perform a check on the overall memory usage planning of the business system. Reserved memory is recorded as Remaining_free, and the total system memory is recorded as total. The DMM mechanism can check the overall system memory usage planning by determining whether the sum of the actual static memory and dynamic memory threshold of each business module is less than or equal to the total system memory minus the reserved memory, that is, Consume_a+Consume_b+Consume_c+…+Consume_n+Max_a+Max_b+Max_c+…+Max_n<=total-Remaining_free.
[0118] This check ensures that the system's overall memory can support the business operations of each business module even when each module's sub-businesses are at their maximum capacity. This confirms the system's ability to operate normally. If normal operation is confirmed, the system enters the pending business processing phase, where each business module determines the pending dynamic memory required to process its corresponding sub-businesses. If the difference between the business memory and the target value exceeds the target, an error message is generated and sent to operations and maintenance personnel for anomaly detection.
[0119] According to an embodiment of the present application, the sum of the business memory is calculated by adding the actual static memory of at least one sub-business to the dynamic memory threshold. The difference between the initial total memory of the business system and the target reserved memory is calculated, and the normal operation of the business system is determined based on the relationship between the two. This implements a business processing strategy based on accurate memory resource assessment, ensuring the stable operation of the business system under the premise of reasonable memory resource allocation, effectively avoiding business processing failures or system crashes caused by insufficient memory, and improving business processing efficiency and system reliability.
[0120] According to an embodiment of the present application, the business to be processed also includes a cache task; when the reserved memory is less than the memory required for the cache task, the target proportion of available dynamic memory of the sub-business is allocated to the cache task; the memory management method may also include the following operations.
[0121] When it is determined that the dynamic memory to be applied is less than or equal to the available dynamic memory, the dynamic memory to be applied is compared with the third total available memory of the memory space to obtain a comparison result; when it is determined that the comparison result indicates that the third total available memory is less than the dynamic memory to be applied, the cached data stored by the cache task is released until the third total available memory is greater than or equal to the dynamic memory to be applied.
[0122] The third total available memory is also the memory that has not been allocated in the available space of the business system.
[0123] If the reserved memory cannot support the cache task, a target proportion of the available dynamic memory of at least one business module can be allocated to the cache task. This means that the cache task can also use a target proportion of the available memory in the business system's memory space, improving the performance and memory usage efficiency of the business system during business processing.
[0124] For example, when the target ratio is 80%, the memory available for cache operations is 80%*(total-(Consume_a+Consume_b+Consume_c+…+Consume_n+Allocated_a+Allocated_b+Allocated_c+…+Allocated_n)).
[0125] In addition, when it is determined that the business module's pending dynamic memory is less than or equal to the business module's available dynamic memory, but the remaining available memory of the business module in the business system's memory space cannot support the business module's dynamic memory allocation, the cache can be flushed to release memory until the third total available memory in the business system is greater than or equal to the pending dynamic memory.
[0126] According to an embodiment of the present application, when reserved memory is insufficient, the business module's available dynamic memory can be allocated to cache operations according to a target ratio. When allocating pending dynamic memory to a business module, its relationship with the business module's available dynamic memory can be first determined, and then compared with the business system's third total available memory. If insufficient, cached data is released according to preset rules. This allows for dynamic adjustment of memory allocation based on the system's actual memory status, ensuring sufficient resources for cache operations while meeting the business's dynamic memory application requirements, thus avoiding system performance degradation or crashes due to insufficient memory.
[0127] According to an embodiment of the present application, when it is determined that the dynamic memory occupancy trend of the business module is an increasing trend during the processing of a sub-business, the target available dynamic memory at the current moment in the processing of the sub-business is compared with the third total available memory in the memory space, wherein the dynamic memory occupancy trend is determined based on the target dynamic memory information of multiple historical moments; when it is determined that the target available dynamic memory at the current moment is greater than the third available memory, the data stored in the cache operation is released based on the difference between the target available dynamic memory and the third available memory.
[0128] The target dynamic memory information of multiple historical moments can be analyzed by using a time series analysis method to determine the dynamic memory occupancy trend of the business module in the process of processing sub-businesses. By analyzing the dynamic memory occupancy trend of each sub-business processing process separately, when it is determined that the dynamic memory occupancy trend is continuously increasing, it is possible to first determine whether the total available memory of the memory space can meet the needs of the sub-business processing process, so as to avoid the situation in which no memory is available when applying for memory at a future moment in the sub-business processing process, and the need to wait for cache release. And when releasing cached data, the difference between the target available dynamic memory and the third available memory can be calculated first, thereby releasing cached data that is greater than or equal to the difference.
[0129] According to an embodiment of the present application, after determining that the dynamic memory usage in the sub-business processing process shows an increasing trend, by comparing the current target available dynamic memory in the sub-business processing process with the third total available memory of the business system, and releasing the cached data based on the difference between the two when the former is greater than the latter, the memory pressure can be relieved in advance, the memory utilization rate can be improved, and dynamic balance can be achieved; at the same time, it can also ensure the operation of key businesses and reduce memory fragmentation.
[0130] Figure 3 The data flow diagram of the memory management method according to an embodiment of the present application is schematically shown.
[0131] like Figure 3As shown, in response to receiving a pending task, the service system enters the protocol stack process startup phase. The SMM mechanism can read the expected static memory 302 that can be occupied by each sub-service processing process from the configuration file 301 and generate first static memory statistical information 303. In the first static memory statistical information 303, since each service module has not yet been initialized, the actual static memory of each service module can be a preset value, for example, 0.
[0132] In response to the business system being in the protocol stack process initialization stage, the SMM mechanism can serially initialize each business module, thereby determining the actual static memory 304 of each business module based on the available memory of the business system before and after the initialization of each business module. The first static memory statistical information 303 can be updated through the actual static memory 304 of each business module to obtain the second static memory statistical information 305.
[0133] In response to the completion of initialization of each business module, the DMM mechanism can read the dynamic memory threshold 306 of each business module from the configuration file 301 and generate first dynamic memory statistical information 307. The first dynamic memory statistical information 307 includes the initial dynamic memory information of each business module. Since business deployment has not yet been performed, the occupied dynamic memory of each business module can be a preset value, such as 0, and the available dynamic memory can be equal to the dynamic memory threshold.
[0134] In response to the business module processing the sub-business, the DMM mechanism can determine the dynamic memory to be applied 309 based on the sub-business 308 included in the business to be processed, and when it is determined that the dynamic memory to be applied 309 is less than or equal to the available dynamic memory in the initial dynamic memory information of the business module, the initial dynamic memory information is updated based on the dynamic memory to be applied to obtain the target dynamic memory information, and the first dynamic memory statistical information 307 is updated through the target dynamic memory information of each business module to obtain the second dynamic memory statistical information 310.
[0135] According to the embodiments of the present application, the static and dynamic statistical information generated above, along with the SMM and DMM mechanisms, can effectively monitor and manage memory usage by business modules at all stages of system operation, promptly identifying abnormalities in system operation and, combined with cache usage strategies, improving memory utilization. This can also clearly outline the overall memory planning of the system, facilitating version evolution and iteration.
[0136] Figure 4 A schematic diagram schematically shows memory information of a business system according to an embodiment of the present application.
[0137] like Figure 4As shown, memory information may include static memory statistics 410, dynamic memory statistics 420, and reserved memory. During the service system initialization phase, the SMM mechanism manages and collects statistics on service memory usage, generating static memory statistics 410. During the operational phase after service deployment, the DMM mechanism manages and generates dynamic memory statistics 420, which are continuously updated based on actual memory usage. This allows for a clear understanding of the system's overall memory planning, monitoring memory usage by each module during sub-service processing, improving memory utilization, and promptly detecting system operation anomalies.
[0138] Figure 4 It is also shown in FIG that the overall system memory includes not only the static memory managed by the SMM mechanism and the dynamic memory managed by the DMM mechanism, but also the reserved memory Remaining_free.
[0139] The static memory statistics 410 show the expected static memory and actual static memory of service modules A, B, C, D, ... For example, the expected static memory of service module A is Budget_a, and the actual static memory is Consume_a. Similarly, the expected static memory and actual static memory of service modules B, C, D, ... can also be determined.
[0140] Dynamic memory statistics 420 shows the dynamic memory thresholds, occupied dynamic memory, and available dynamic memory for service modules A, B, C, D, ... For example, the dynamic memory threshold for service module A is MAX_a, the occupied dynamic memory is Allocated_a, and the available dynamic memory is Available_a. Similarly, the expected static memory and actual static memory dynamic memory thresholds, occupied dynamic memory, and available dynamic memory can also be determined for service modules B, C, D, ...
[0141] Therefore, when you need to calculate business system memory usage, by extracting data from the static and dynamic memory statistics tables, you can quickly determine the memory usage of each business module when processing its corresponding sub-business, with real-time efficiency. Furthermore, the expected static and dynamic memory thresholds are fixed data and can be extracted from the configuration file without running the system.
[0142] Based on the above memory management method, this application also provides a memory management device. Figure 5 The device is described in detail.
[0143] Figure 5 The structural block diagram of the memory management device according to an embodiment of the present application is schematically shown.
[0144] like Figure 5As shown, the memory management device 500 of this embodiment includes a first determination module 510 , an update module 520 and a second determination module 530 .
[0145] The first determination module 510 is used to determine the initial dynamic memory information based on the business type of the sub-business in response to the actual static memory of the sub-business in the business to be processed being consistent with the expected static memory. The expected static memory is the expected basic memory to support the processing process of the sub-business. The initial dynamic memory information includes a dynamic memory threshold that represents the upper limit of the dynamic memory that can be occupied during the processing of the sub-business and the available dynamic memory determined by the dynamic memory threshold.
[0146] The updating module 520 is configured to update the initial dynamic memory information based on the dynamic memory to be applied to obtain target dynamic memory information when it is determined that the dynamic memory to be applied determined by the sub-business is less than or equal to the available dynamic memory.
[0147] The second determining module 530 is configured to determine memory information during the processing of the pending service based on actual static memory, expected static memory, and target dynamic memory information of the sub-services in the pending service.
[0148] According to an embodiment of the present application, the initial dynamic information further includes: occupied dynamic memory. The updating module 520 includes: a first updating submodule, a second updating submodule and an information determining submodule.
[0149] The first updating submodule is configured to update the occupied dynamic memory based on the dynamic memory to be applied for, so as to obtain the target occupied dynamic memory.
[0150] The second updating submodule is configured to determine a target available dynamic memory based on the dynamic memory to be applied for and the available dynamic memory.
[0151] The information determination submodule is used to update the initial dynamic memory information based on the target occupied dynamic memory and the target available dynamic memory to obtain the target dynamic memory information.
[0152] According to an embodiment of the present application, the memory management device 500 further includes: a performance determination module, a performance description module, a feature analysis module, and a threshold determination module.
[0153] The performance determination module is used to determine the processing performance indicators collected when processing sample sub-businesses of multiple business scales based on a preset performance detection tool, where the sample sub-businesses and the sub-businesses have the same business type.
[0154] The performance description module is used to construct performance description information based on multiple business scales and performance indicators corresponding to the business scales.
[0155] The feature analysis module is used to perform feature analysis on the performance description information and determine the scale threshold range when processing sample sub-services of the service type.
[0156] The threshold determination module is used to determine a dynamic memory threshold based on the memory occupied by samples of sample sub-businesses whose business scales are within a scale threshold range.
[0157] According to an embodiment of the present application, the memory management device 500 further includes: a memory determination module and a difference determination module.
[0158] The memory determination module is used to obtain a first total available memory of the memory space before the configuration information is configured and a second total available memory after the configuration information is configured in response to being in a configuration information configuration stage for the sub-business processing process.
[0159] The difference determination module is used to use the difference between the first total available memory and the second total available memory as the actual static memory of the business module.
[0160] According to an embodiment of the present application, the situation where the actual static memory is inconsistent with the expected static memory includes: the difference between the actual static memory and the expected static memory is greater than a preset threshold. The memory management device 500 further includes: a function analysis module and a usage analysis module.
[0161] The function analysis module is used to analyze the business processing logic for the sub-business and obtain a logic analysis result when it is determined that the difference between the actual static memory and the expected static memory is greater than a preset threshold.
[0162] The analysis module is used to perform memory usage analysis on the configured configuration information to determine the cause of abnormal memory usage when it is determined that the logic analysis result indicates that the business processing logic is consistent with the historical business processing logic.
[0163] According to an embodiment of the present application, the business to be processed includes at least one sub-business; the memory information also includes: reserved memory; the memory management device 500 also includes: a calculation module and an application quantity determination module.
[0164] The operation module is used to perform cumulative operation on the actual static memory and dynamic memory threshold of at least one sub-business to obtain a business memory sum.
[0165] The application amount determination module is used to determine the dynamic memory to be applied based on the sub-business when the business memory is determined to be less than or equal to the target difference. The target difference is obtained based on the initial total memory and the reserved memory.
[0166] According to an embodiment of the present application, the business to be processed also includes a cache task; when the reserved memory is less than the memory required for the cache task, the target proportion of available dynamic memory of the sub-business is allocated to the cache task; the memory management device 500 also includes: a comparison module and a release module.
[0167] The comparison module is configured to compare the dynamic memory to be applied with the third total available memory of the memory space to obtain a comparison result when it is determined that the dynamic memory to be applied is less than or equal to the available dynamic memory.
[0168] The release module is configured to release cache data stored by the cache task when determining that the comparison result indicates that the third total available memory is less than the dynamic memory to be applied, until the third total available memory is greater than or equal to the dynamic memory to be applied.
[0169] According to embodiments of the present application, any multiple modules among the first determination module 510, the update module 520, and the second determination module 530 may be combined into a single module, or any one of these modules may be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of other modules and implemented in a single module. According to embodiments of the present application, at least one of the first determination module 510, the update module 520, and the second determination module 530 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or may be implemented in hardware or firmware through any other reasonable means of circuit integration or packaging, or may be implemented in any one of the three implementation methods of software, hardware, and firmware, or any appropriate combination of these. Alternatively, at least one of the first determination module 510, the update module 520, and the second determination module 530 may be at least partially implemented as a computer program module that, when executed, performs the corresponding functionality.
[0170] Figure 6 A block diagram of an electronic device suitable for implementing a memory management method according to an embodiment of the present application is schematically shown.
[0171] like Figure 6As shown, an electronic device 600 according to an embodiment of the present application includes a processor 601, which can perform various appropriate actions and processes based on a program stored in a read-only memory (ROM) 602 or a program loaded from a storage unit 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present application.
[0172] Various programs and data required for the operation of the electronic device 600 are stored in the RAM 603. The processor 601, ROM 602, and RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flow according to the embodiment of the present application by executing the programs in the ROM 602 and / or RAM 603. It should be noted that the programs may also be stored in one or more memories other than the ROM 602 and RAM 603. The processor 601 may also perform various operations of the method flow according to the embodiment of the present application by executing the programs stored in the one or more memories.
[0173] According to an embodiment of the present application, electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to bus 604. Electronic device 600 may also include one or more of the following components connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including devices such as a cathode ray tube (CRT), liquid crystal display (LCD), and speakers; a storage section 608 including a hard disk; and a communication section 609 including a network interface card such as a LAN card or modem. Communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. Removable media 611, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed in drive 610 as needed, so that computer programs read from the removable media can be installed into storage section 608 as needed.
[0174] This application also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not be incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the method according to the embodiments of this application is implemented.
[0175] According to an embodiment of the present application, a computer-readable storage medium may be a non-volatile computer-readable storage medium, and may include, for example, but not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present application, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present application, a computer-readable storage medium may include the ROM 602 and / or RAM 603 described above and / or one or more memories other than ROM 602 and RAM 603.
[0176] The embodiments of the present application also include a computer program product, which includes a computer program containing program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the memory management method provided in the embodiments of the present application.
[0177] The computer program executes the above functions defined in the system / device of the embodiment of the present application when the computer program is executed by the processor 601. According to the embodiment of the present application, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0178] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 609, and / or installed from a removable medium 611. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0179] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from a removable medium 611. When the computer program is executed by the processor 601, the above-mentioned functions defined in the system of the embodiment of the present application are performed. According to the embodiment of the present application, the systems, devices, means, modules, units, etc. described above can be implemented by computer program modules.
[0180] According to an embodiment of the present application, the program code for executing the computer program provided by the embodiment of the present application can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).
[0181] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0182] Those skilled in the art will appreciate that the features described in the various embodiments of this application may be combined and / or coupled in various ways, even if such combinations or couplings are not explicitly described in this application. In particular, the features described in the various embodiments of this application may be combined and / or coupled in various ways without departing from the spirit and teachings of this application. All such combinations and / or couplings fall within the scope of this application.
[0183] The embodiments of the present application have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present application. Although each embodiment has been described separately above, this does not mean that the measures in each embodiment cannot be advantageously used in combination. Without departing from the scope of the present application, those skilled in the art may make various substitutions and modifications, and these substitutions and modifications should all fall within the scope of the present application.
Claims
1. A memory management method, characterized in that: The method comprises: In response to the actual static memory of a sub-business in the to-be-processed business being consistent with the expected static memory, initial dynamic memory information is determined based on the business type of the sub-business, where the expected static memory is an expected basic memory to support the processing of the sub-business, and the initial dynamic memory information includes a dynamic memory threshold representing an upper limit of the dynamic memory that can be occupied during the processing of the sub-business and available dynamic memory determined by the dynamic memory threshold; When it is determined that the dynamic memory to be applied determined by the sub-business is less than or equal to the available dynamic memory, the initial dynamic memory information is updated based on the dynamic memory to be applied to obtain target dynamic memory information; Based on the actual static memory of the sub-service in the service to be processed, the expected static memory and the target dynamic memory information, the memory information during the processing of the service to be processed is determined.
2. The method according to claim 1, characterized in that The initial dynamic information also includes: occupied dynamic memory; the updating of the initial dynamic memory information based on the dynamic memory to be applied to obtain target dynamic memory information includes: The occupied dynamic memory is updated based on the dynamic memory to be applied to obtain the target occupied dynamic memory; Determining target available dynamic memory based on the dynamic memory to be applied and the available dynamic memory; Based on the target occupied dynamic memory and the target available dynamic memory, the initial dynamic memory information is updated to obtain target dynamic memory information.
3. The method according to claim 1 or 2, characterized in that The dynamic memory threshold is determined in the following manner: Determining, based on a preset performance testing tool, processing performance indicators collected when processing sample sub-businesses of multiple business scales, the sample sub-businesses being of the same business type as the sub-business; Constructing performance description information based on the plurality of business scales and processing performance indicators corresponding to the business scales; Performing feature analysis on the performance description information to determine a scale threshold range for processing sample sub-services of the service type; The dynamic memory threshold is determined based on the memory occupied by samples of sample sub-services whose service scales are within the scale threshold range.
4. The method according to claim 1, wherein The actual static memory is determined as follows: In response to being in a configuration information configuration stage for the sub-service processing process, obtaining a first total available memory of the memory space before configuring the configuration information and a second total available memory after configuring the configuration information; The difference between the first total available memory and the second total available memory is used as the actual static memory of the business module.
5. The method according to claim 4, characterized in that The situation where the actual static memory is inconsistent with the expected static memory includes: a difference between the actual static memory and the expected static memory is greater than a preset threshold; the method further includes: When it is determined that the difference between the actual static memory and the expected static memory is greater than a preset threshold, analyzing the business processing logic for the sub-business to obtain a logic analysis result; When it is determined that the logic analysis result indicates that the business processing logic is consistent with the historical business processing logic, a memory usage analysis is performed on the configured configuration information to determine the cause of the abnormal memory usage.
6. The method according to claim 1, characterized in that The business to be processed includes at least one sub-business; The memory information also includes: reserved memory; before the sub-service determines the dynamic state to be applied, the method further includes: Accumulate the actual static memory and dynamic memory threshold of at least one of the sub-services to obtain a service memory sum; When it is determined that the sum of the business memory is less than or equal to the target difference, the dynamic memory to be applied is determined based on the sub-business, and the target difference is obtained according to the initial total memory and the reserved memory.
7. The method according to claim 1 or 6, characterized in that The to-be-processed business also includes a cache task; when the reserved memory is less than the memory required by the cache task, the target proportion of available dynamic memory of the sub-business is allocated to the cache task; The method further comprises: When it is determined that the dynamic memory to be applied is less than or equal to the available dynamic memory, the dynamic memory to be applied is compared with the third total available memory of the memory space to obtain a comparison result; If it is determined that the comparison result indicates that the third total available memory is less than the dynamic memory to be applied, the cache data stored by the cache task is released until the third total available memory is greater than or equal to the dynamic memory to be applied.
8. A memory management device, characterized in that: The device comprises: a first determining module configured to, in response to an actual static memory of a sub-business in a pending business being consistent with an expected static memory, determine initial dynamic memory information based on a business type of the sub-business, wherein the expected static memory is basic memory supporting a processing process of the sub-business, and the initial dynamic memory information includes a dynamic memory threshold representing an upper limit of dynamic memory that can be occupied during processing of the sub-business and available dynamic memory determined by the dynamic memory threshold; an updating module, configured to, when it is determined that the dynamic memory to be applied for determined by the sub-business is less than or equal to the available dynamic memory, update the initial dynamic memory information based on the dynamic memory to be applied for to obtain target dynamic memory information; The second determining module is configured to determine the memory information during the processing of the pending business based on the actual static memory of the sub-business in the pending business, the expected static memory and the target dynamic memory information.
9. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.