Web page memory management method, device and electronic device
By collecting and analyzing multi-dimensional server operation data, we can obtain memory performance prediction values and health data, solve the problem of traditional memory management methods that cannot predict memory trends, realize dynamic and accurate memory management, and improve server performance and stability.
Patent Information
- Application Number
- CN202510771844.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-06-10
AI Technical Summary
Traditional web page memory management methods cannot predict memory performance change trends in advance, resulting in server performance degradation, response delays, and even crashes. The lack of targeted measures affects user experience and server stability.
Collect multi-dimensional server operation data, obtain memory performance prediction values through feature extraction and analysis, and process it in combination with memory health-related data to achieve dynamic and accurate memory management.
Improved server performance and stability, reduced failures and freezes caused by memory issues, and enhanced user experience.
Smart Images

Figure CN120336030B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a network page memory management method, device, and electronic device. Background Art
[0002] In today's digital age, web page applications are becoming increasingly complex, and the requirements for server memory management are also getting higher and higher. Traditional web page memory management methods mostly rely on fixed threshold judgments and simple periodic cleanup strategies. These traditional methods can only monitor the immediate state of memory to a limited extent, and cannot predict the trend of memory performance changes in advance. It is difficult to effectively deal with potential problems such as memory leaks, which often leads to server performance degradation, response delays, and even crashes. At the same time, when dealing with memory problems, related technologies lack consideration of the comprehensive operating status of the server. The processing actions are relatively simple and not accurate enough. It is impossible to take targeted measures based on subtle differences in memory health status, which can easily lead to waste of system resources or untimely and inadequate handling of memory problems, greatly affecting the user experience of web pages and the stable operation efficiency of servers, and it is difficult to meet the high-performance and high-reliability memory management requirements of modern network applications. Summary of the Invention
[0003] The present disclosure provides a network page memory management method, device, and electronic device, the main purpose of which is to solve the problem of low accuracy in network page memory management.
[0004] According to a first aspect of the present disclosure, a network page memory management method is provided, comprising:
[0005] Collect multi-dimensional operation data from the server;
[0006] Extracting and analyzing features of the operating data to obtain a predicted value of network page memory performance;
[0007] Processing and analyzing the predicted value of the network page memory performance to obtain memory health related data;
[0008] The memory of the server is processed accordingly according to the memory health related data.
[0009] According to a second aspect of the present disclosure, a network page memory management device is provided, comprising:
[0010] Data collection module, used to collect multi-dimensional operation data from the server;
[0011] A feature extraction module, configured to extract and analyze features of the operating data to obtain a predicted value of the network page memory performance;
[0012] An analysis module, configured to process and analyze the network page memory performance prediction value to obtain memory health related data;
[0013] A memory processing module is used to perform corresponding processing on the memory of the server according to the memory health related data.
[0014] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0018] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.
[0019] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method as described in the first aspect above.
[0020] This disclosure enables comprehensive understanding of server operational status through the collection of multi-dimensional operational data from servers, providing a rich and accurate data foundation for subsequent memory performance prediction and health assessment. By extracting and analyzing feature data from operational data to obtain predicted values for web page memory performance, potential memory issues, such as insufficient memory and memory leaks, can be foreseen in advance. Consequently, server memory can be processed accordingly based on different memory health-related data, effectively optimizing memory usage and improving server performance and stability.
[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.
[0023] Figure 1 A flowchart of a web page memory management method provided by an embodiment of the present disclosure;
[0024] Figure 2A flowchart of another web page memory management method provided by an embodiment of the present disclosure;
[0025] Figure 3 A flowchart of another web page memory management method provided by an embodiment of the present disclosure;
[0026] Figure 4 A schematic diagram of the structure of a network page memory management device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0028] Current web applications (especially single-page applications) face severe memory management challenges. With the increasing complexity of front-end technologies, typical business scenarios such as large data visualization screens, real-time communication applications, and 3D editors are becoming increasingly common.
[0029] According to the 2024 Web Quality Annual Report, more than 83% of SPA applications have observable memory leaks, of which 42% are caused by improperly unbound DOM event listeners, 28% are caused by global cache objects not being released in time, and another 19% are related to residual references to third-party libraries.
[0030] Existing solutions have significant limitations: manual cleanup mechanisms implemented by developers (such as React's useEffect cleanup function) have a coverage rate of less than 60% in real-world projects. Scans of GitHub open-source projects reveal that approximately 35% of components lack properly configured cleanup logic. Due to its passive nature, browsers' native garbage collection (GC) mechanisms experience an average delay of over 5 seconds on mobile devices, resulting in a threefold increase in the rate of out-of-memory crashes. While static detection tools (such as the Chrome DevTools Memory panel) can identify some leaks, they suffer from a 22% false positive rate and lack proactive runtime intervention. More critically, traditional fixed-threshold cleanup strategies (e.g., triggering a collection when memory usage reaches 80%) face a dilemma: cleaning too early results in frequent resource rebuilds (increasing CPU overhead by 30%), while cleaning too late can cause interface lag (dropping FPS below 20). In this context, a new memory management system is urgently needed that integrates dynamic monitoring, intelligent decision-making, and hierarchical execution to fundamentally address the timeliness, accuracy, and compatibility issues of web page memory management.
[0031] The following describes a network page memory management method, apparatus, and electronic device according to embodiments of the present disclosure with reference to the accompanying drawings.
[0032] Figure 1 A flowchart of a web page memory management method provided by an embodiment of the present disclosure.
[0033] like Figure 1 As shown, the method comprises the following steps:
[0034] Step 101: Collect multi-dimensional operation data from the server;
[0035] In this embodiment, a server is a device or system that provides computing, storage, and service resources to network users. It can be a single high-performance computer or a cluster of computers. Servers can be categorized into various types based on their functionality, such as web servers, mail servers, and database servers. For example, a web server stores website webpage files (such as HTML files and images) and sends these files to client browsers via the HTTP protocol.
[0036] A web page is a document accessed over the internet, written in formats such as HTML (Hypertext Markup Language), and displayed in a browser. Web pages contain a variety of elements, including text, images, video, and audio, and are one of the primary ways users access information on the internet.
[0037] A server is the generator and provider of web pages. For example, a web server is responsible for storing web page files. When a user enters a URL in a browser and sends a request, the web server finds the corresponding web page file based on the request. For example, an e-commerce website's server stores various web page files, such as the product display page, shopping cart page, and checkout page. When a user wants to view product details, the server receives the request and sends the HTML file for the product details page, along with related images and CSS (Cascading Style Sheets) files, to the user's browser.
[0038] The server receives and processes requests from the user's browser. When a user performs an action on a web page, such as clicking a link or submitting a form (such as a login form or a search form), these actions send a request to the server. The server handles the request accordingly based on the type and content of the request. For example, when a user places an order on a shopping website, the server receives the order information, verifies the user's login status, checks product inventory, and other information. It then stores the order information in a database and returns a corresponding response page, such as an order confirmation page, to the user's browser.
[0039] Multi-dimensional operational data generated during server operation reflects server performance and operational status. This data comprehensively assesses server performance from multiple perspectives, including the rate of change in the number of Document Object Model (DOM) nodes, memory usage, network throughput, user interaction event frequency, and WebSocket connection liveness. Memory usage includes: real-time memory usage (the amount of memory used by the current page); peak memory usage (the maximum memory usage over a period of time); and average memory usage (the average memory consumption, reflecting overall trends). The rate of change in the number of DOM nodes tracks the rate of increase and decrease of DOM nodes on a page to prevent performance impacts caused by an excessive number of nodes. WebSocket connection liveness monitors the health of WebSocket connections, including whether they are opening, closing, and reconnecting normally. User interaction event frequency (clicks / page switches) counts clicks and page switch frequency, calculates concurrent requests, and analyzes user behavior patterns.
[0040] In an optional embodiment, probes are deployed on the server to capture multi-dimensional operational data. These probes can collect real-time data on various server performance indicators, such as CPU usage, memory usage, disk I / O, and network traffic. By continuously monitoring these key indicators, administrators are provided with real-time status information on server operations, helping to promptly identify performance bottlenecks or anomalies.
[0041] For example, you can deploy a DOM state tracker on the server, monitoring DOM tree changes using the MutationObserver API. You can also deploy an event leak detector on the server by overriding the addEventListener / removeEventListener methods to create an event listener mapping table. You can also deploy a performance metric collector on the server by calling the performance.memory API every 5 seconds to retrieve heap memory data and simultaneously monitor CPU performance data.
[0042] Step 102: extract and analyze the operating data to obtain a predicted value of the network page memory performance;
[0043] In this embodiment, feature extraction is a method that transforms the group measurement values of a pattern to highlight the representative characteristics of that pattern. Optional, commonly used methods for feature extraction include statistical analysis, traffic content analysis, machine learning, and information theory. Machine learning methods include principal component analysis (PCA), which linearly transforms the original network traffic features and projects them into a new feature space to obtain principal components. Principal components are linear combinations of the original features, preserving as much data variance as possible while reducing the data's dimensionality and removing redundant information. Linear discriminant analysis (LDA), a supervised learning dimensionality reduction method, aims to find a projection direction that keeps samples of the same type as close as possible in the network traffic feature space and samples of different types as far apart as possible. It is commonly used in network traffic classification tasks, such as classifying normal traffic from attack traffic. An autoencoder is an unsupervised neural network that learns to encode input data into a compressed representation and then decodes it back to the original data. During the encoding process, the compressed representation learned by the network can be used as a feature representation of the network traffic for subsequent classification, clustering, and other tasks. Convolutional neural networks (CNNs) can be used to extract features from network traffic data by converting it into images or other forms suitable for CNN processing. Through a combination of convolutional layers, pooling layers, and fully connected layers, CNNs can automatically learn local and global features in the data. Recurrent neural networks (RNNs) and their variants (such as LSTMs and GRUs) are suitable for processing sequence data in network traffic, such as time series traffic data or packet sequences in a session. RNNs can capture temporal dependencies and contextual information in sequences, thereby extracting features related to time series.
[0044] In a possible embodiment, the collected operating data is input into a pre-trained feature extraction model for in-depth feature analysis. The feature extraction model has been trained with a large amount of data and has powerful data analysis and mining capabilities. It can extract feature information closely related to the network page memory performance from complex operating data, and then output a predicted value of the network page memory performance. This predicted value provides an important basis for subsequent memory management decisions.
[0045] The memory performance forecast is the expected future performance value of the server's memory. It reflects the server's performance development trend. Optional memory performance forecasts include: memory increment forecast, memory forecast deviation rate, document object model node forecast deviation rate, and CPU forecast deviation rate.
[0046] Step 103: Process and analyze the predicted value of the network page memory performance to obtain memory health related data;
[0047] In this embodiment, the memory health data is an evaluation indicator of the server memory and reflects the future health of the server memory. Optionally, the memory health data includes memory leak parameters, memory health parameters, CPU health parameters, and Document Object Model node health parameters.
[0048] In one possible embodiment, the network page memory performance prediction value is input into a preset health calculation model for processing, taking into account the relative importance of each parameter in the network page memory performance prediction value in the overall health assessment, so that the health parameters can comprehensively and accurately reflect the comprehensive health status of the server memory and its associated resources.
[0049] Step 104: Perform corresponding processing on the memory of the server according to the memory health related data.
[0050] In this embodiment, the future health of the server's memory can be determined based on the memory health data. The server's future risk is then determined based on the health of the server's memory, and the server's memory is processed accordingly based on the severity of the risk. Optionally, the server's memory processing includes clearing the LRU cache, terminating idle WebWorkers, removing zombie DOM nodes, and unbinding unused events.
[0051] In summary, the method provided by the embodiments of the present disclosure can fully understand the operating status of the server by collecting multi-dimensional operating data in the server, and provide a rich and accurate data basis for subsequent memory performance prediction and health assessment. Feature extraction and analysis of the operating data to obtain the memory performance prediction value of the web page can predict possible memory problems in advance, such as insufficient memory, memory leaks, etc., so that measures can be taken in advance to prevent and deal with them. Obtaining memory health-related data based on the memory performance prediction value can quantitatively evaluate the health status of the memory and provide a basis for subsequent targeted memory processing. Finally, corresponding processing of the server memory according to different memory health-related data can effectively optimize memory usage, improve server performance and stability, reduce failures and freezes caused by memory problems, and enhance user experience.
[0052] In a possible embodiment, the operating data includes at least one of the following: memory-related data, document object model node-related data, and central processing unit-related data. The extracting and analyzing features of the operating data to obtain a predicted value of web page memory performance includes:
[0053] Perform time series feature extraction on the operating data to obtain data related to the network page memory health, wherein the network page memory performance prediction value includes at least one of the following: memory increment prediction value, memory prediction deviation rate, document object model node prediction deviation rate, and central processing unit prediction deviation rate.
[0054] In this embodiment, the memory-related data reflects the operating status of the server memory, the document object model node-related data reflects the number and changes of the document object model nodes in the server, and the central processing unit-related data reflects the operating status of the central processing unit in the server.
[0055] Optional, memory-related data includes but is not limited to: Memory usage: including used memory, available memory, total memory, etc., which reflects the current memory resource usage of the server and is a basic indicator for evaluating memory performance. Memory usage: The calculation formula is used memory / total memory × 100%, which intuitively shows the utilization of memory resources. A higher memory usage may mean insufficient memory, which may affect the performance of the server. Memory swap area usage: When physical memory is insufficient, the system will use the swap area on the disk as virtual memory to store some temporarily unused data. The usage and usage rate of the swap area are also one of the important indicators for measuring memory performance. Excessive use of the swap area will lead to decreased system performance because the read and write speed of the disk is much lower than that of the memory. Memory hit rate: refers to the success rate of directly obtaining data from the memory, reflecting the efficiency of memory access. A higher memory hit rate means that the system can quickly obtain the required data from the memory, thereby reducing access to the disk and improving system performance.
[0056] Optional data related to Document Object Model nodes includes, but is not limited to: DOM tree structure: Represents the hierarchical relationship and organizational structure of all DOM nodes on the page, including root nodes, element nodes, text nodes, attribute nodes, etc. By analyzing the DOM tree structure, you can understand the layout and composition of the page, as well as the relationships between different elements. DOM node count: Counts the number of various DOM nodes on the page, such as element nodes and text nodes. Excessive DOM nodes may cause page rendering performance to degrade, impacting the user experience. DOM node attributes: Each DOM node has specific attributes, such as the element node's ID, class, tag name, style attributes, and event attributes. These attributes describe the node's characteristics and behavior. By analyzing node attributes, you can understand the specific settings and functions of page elements. DOM operation frequency: Records the number of operations performed on DOM nodes, such as node creation, deletion, modification, and movement. Frequent DOM operations may cause page reflow and redrawing, affecting page rendering performance, so their frequency needs to be monitored.
[0057] Optional CPU-related data includes, but is not limited to, the following: CPU utilization: This is one of the most common CPU performance metrics, indicating the degree of CPU utilization and presented as a percentage. It reflects how busy the CPU is when executing tasks. Excessive utilization can cause slow system response or even lag. CPU core utilization: For multi-core CPUs, the utilization of each core can be viewed separately, providing a more detailed understanding of each core's operating status and whether some cores are overloaded while others are idle. CPU frequency: This refers to the CPU's clock frequency, typically measured in GHz. It indicates the number of cycles the CPU can process per second. The higher the frequency, the theoretically greater the CPU's processing power. However, actual performance is also affected by other factors, such as architecture and instruction set. CPU load average: This is typically expressed as an average over three time windows: 1 minute, 5 minutes, and 15 minutes. It indicates the number of processes waiting to run during that time. This value can help understand the overall system load. If the load average is consistently greater than the number of CPU cores, it may indicate system resource constraints.
[0058] Optionally, the running data is input into an LSTM model for feature extraction and analysis to obtain the predicted web page memory performance value. The LSTM model consists of three layers: input layer, core layer, and output layer. The input layer is used to input the running data. The core layer includes a forget gate, input gate, and output gate. This unit state control mechanism, consisting of the forget gate, input gate, and output gate, extracts time series features. The output layer outputs the predicted web page memory performance value.
[0059] In summary, the method provided by the embodiments of the present disclosure clarifies the specific content of the operating data, including memory-related data, document object model node-related data, central processing unit-related data, etc., covering the key factors affecting the memory performance of the web page, making data collection more targeted and comprehensive. Extracting time series features from the operating data can capture the changing trends and patterns of the data over time, more accurately reflect the changing dynamics of memory performance, and thus obtain more accurate network page memory performance prediction values, including memory increment prediction values, memory prediction deviation rates, document object model node prediction deviation rates, central processing unit prediction deviation rates, etc. These prediction values quantify memory performance from different angles, providing more detailed and comprehensive reference indicators for subsequent memory health analysis and processing, and helping to promptly discover potential memory problems and risks.
[0060] In a possible embodiment, the memory health related data includes a memory leak condition parameter, and the processing and analyzing according to the network page memory performance prediction value to obtain the memory health related data includes:
[0061] A memory leak condition parameter is determined based on a change in the memory increment prediction value.
[0062] In this embodiment, the predicted memory increment value reflects the expected future increase in server memory usage. During normal server operation, memory increments are inevitable. When applications or services on a server start up and process new tasks or requests, they request new memory space to store data, variables, program code, and so on, causing memory usage to gradually increase. For example, when a web server receives and processes client requests, it allocates a certain amount of memory for each request to store request data, session information, and so on. This results in a certain incremental trend in memory usage.
[0063] A memory leak occurs when a program fails to release allocated but unused memory after requesting it, causing memory usage to continue to increase. This unreleased memory cannot be reused by other programs or processes, resulting in a waste of memory resources.
[0064] The memory leak parameter reflects the severity of a server memory leak. When a server has a memory leak, memory usage will show abnormal growth characteristics. Even when there are no new tasks or requests being processed and the business load is stable, memory usage will continue to grow slowly and will not automatically decrease. Over time, memory usage will gradually approach or even reach the memory capacity limit, eventually causing the server to experience performance degradation, slow service response, or even crashes due to insufficient memory.
[0065] In summary, the method provided by the embodiments of the present disclosure determines memory leak parameters by analyzing changes in the predicted memory increment value, providing a direct and effective method for detecting memory leaks. This method can promptly detect memory leaks, preventing serious consequences such as gradual degradation of server performance and system crashes caused by memory leaks. This helps improve server reliability and stability, ensuring the normal operation of web pages.
[0066] In a possible embodiment, a network page memory management method is proposed. Figure 2 A flowchart of a network page memory management method provided by an embodiment of the present disclosure is shown as follows: Figure 2 As shown, the memory leak condition parameter is determined based on the change of the memory increment prediction value, including:
[0067] Step 201: Slide a sliding window of a preset size on the sampling points of the memory increment prediction value to obtain the memory increment prediction value corresponding to each sampling point in the sliding window;
[0068] Step 202 : Calculate the total memory growth rate in the sliding window according to the memory increment prediction value corresponding to each sampling point in the sliding window, and determine the total memory growth rate as the memory leakage parameter.
[0069] In this embodiment, when determining the total memory growth rate, a sliding window of a preset size is slid across the sampling points of the predicted memory increment value. The use of a sliding window enables local observation and analysis of time series data, avoiding interference from fluctuations in data at individual sampling points, thereby more accurately grasping the overall trend of memory increment changes. As the sliding window slides, the predicted memory increment value corresponding to each sampling point within the window is obtained. These data points aggregate detailed information about memory changes during that time period. A comprehensive calculation is then performed based on the predicted memory increment values for each sampling point within the sliding window to determine the total memory growth rate within the sliding window, which is then used as the memory leak parameter. This method not only improves the accuracy and reliability of the total memory growth rate calculation but also enables timely and dynamic reflection of the development of memory leaks, making memory leak detection more timely and accurate. This provides stronger support for subsequent targeted memory optimization measures, effectively enhancing the intelligence of server memory management, ensuring that web page memory operates in a healthy state, and avoiding potential risks caused by memory leaks.
[0070] In a possible embodiment, the size of the sliding window can accommodate 10 sampling points, and the time intervals between adjacent sampling points are equal (for example, 0.1 seconds). During the sliding process of the sliding window, the total memory growth rate in the sliding window is calculated by combining the memory increment prediction values of the sampling points therein.
[0071] In summary, the method provided by the embodiments of the present disclosure uses a sliding window of a preset size to slide on the sampling points of the memory increment prediction value, obtains the memory increment prediction value corresponding to each sampling point in the sliding window, and calculates the total memory growth rate based on this. This method can smooth data fluctuations, more accurately reflect the trend and amplitude of memory growth, avoid misjudgment due to short-term data fluctuations, make the determined memory leakage parameters more reliable, further improve the accuracy and stability of memory leak detection, and provide a more accurate basis for subsequent memory processing measures.
[0072] In a possible embodiment, the memory health-related data includes a health parameter, and the processing and analyzing according to the network page memory performance prediction value to obtain the memory health-related data further includes:
[0073] A health parameter is determined based on the memory prediction deviation rate, the document object model node prediction deviation rate, and the central processing unit prediction deviation rate.
[0074] In this embodiment, the health parameter comprehensively reflects the overall health of the server memory and is of great significance for comprehensively evaluating memory performance. When obtaining the health parameter, multiple key indicators in the web page memory performance prediction value are fully utilized, namely the memory prediction deviation rate, the document object model node prediction deviation rate, and the central processing unit prediction deviation rate. These prediction deviation rates reveal potential problems and abnormalities in the server's memory and related resources when running web pages from different perspectives, such as memory prediction accuracy, document object model node-related performance prediction deviation, and central processing unit-related performance prediction deviation. By comprehensively analyzing these three prediction deviation rates, the operating status of the memory and its associated resources can be comprehensively considered, and then a health parameter that can comprehensively reflect the health status of the memory can be determined. This method breaks the limitations of single-indicator evaluation and realizes a multi-dimensional comprehensive evaluation, making the judgment of memory health more comprehensive and accurate. It provides a more scientific and reliable basis for subsequent targeted memory management measures based on different health conditions, helps to achieve refined management of server memory, and improves the stability and performance of the overall operation of web pages.
[0075] In summary, the method provided by the embodiments of the present disclosure introduces a health parameter into the memory health-related data, and determines the parameter based on the memory prediction deviation rate, the document object model node prediction deviation rate, and the central processing unit prediction deviation rate. It comprehensively considers multiple key factors affecting memory health and can evaluate the overall health status of the memory more comprehensively and objectively. Compared with the evaluation method of a single indicator, this comprehensive evaluation method can more accurately reflect the actual operating status of the memory, provide more powerful support for the subsequent adoption of reasonable memory processing measures, and help to better ensure the stable operation of the server memory.
[0076] In a possible embodiment, a network page memory management method is proposed. Figure 3 This is a flow chart of a network page memory management method provided by an embodiment of the present disclosure. Figure 3 As shown, the health parameter is determined based on the memory prediction deviation rate, the document object model node prediction deviation rate, and the central processing unit prediction deviation rate, including:
[0077] Step 301: determining a memory health parameter based on the memory prediction deviation rate, the corresponding memory impact coefficient, and the memory prediction value confidence level;
[0078] In this embodiment, the memory impact coefficient reflects the importance of memory-related data to the overall health parameter, and the memory prediction value confidence reflects the credibility of the memory prediction deviation rate. In determining the memory health parameter, the memory prediction deviation rate and two important factors related to memory, namely the memory impact coefficient and the memory prediction value confidence, are fully considered. The memory impact coefficient reflects the weight of the impact of memory performance on the overall web page running performance, while the memory prediction value confidence reflects the reliability of the memory prediction result. Combining these three factors can more accurately measure the actual health status of the memory and derive more representative memory health parameters.
[0079] Step 302: determining a CPU health parameter based on the CPU prediction deviation rate, the corresponding CPU influence coefficient, and the CPU prediction value confidence level;
[0080] In this embodiment, the CPU influence coefficient reflects the importance of CPU-related data to the overall health parameter, and the CPU prediction value confidence reflects the reliability of the CPU prediction deviation rate. When determining the CPU health parameter, calculations are performed based on the CPU prediction deviation rate, the CPU influence coefficient, and the CPU prediction value confidence. The CPU influence coefficient represents the impact of CPU performance on web page execution, while the CPU prediction value confidence reflects the reliability of the prediction result. The CPU health parameter derived from these factors accurately reflects the health of the CPU in terms of memory management.
[0081] Step 303: determining a DOM node health parameter according to the DOM node prediction deviation rate, the corresponding DOM node influence coefficient, and the DOM node prediction value confidence level;
[0082] In this embodiment, the DOM node influence coefficient reflects the importance of the DOM node-related data to the overall health parameter, and the DOM node prediction value confidence reflects the credibility of the DOM node prediction deviation rate. The DOM node health parameter is determined by comprehensively considering the DOM node prediction deviation rate, the DOM node influence coefficient, and the DOM node prediction value confidence. The DOM node influence coefficient reflects the impact of the DOM node on the performance of the web page, while the prediction value confidence ensures the reliability of the prediction result, thereby deriving an accurate DOM node health parameter.
[0083] Step 304 : performing weighting according to the corresponding weights of the memory health parameter, the CPU health parameter, and the DOM node health parameter to obtain the health parameter.
[0084] In this embodiment, a weighted calculation is performed based on the corresponding weights of the memory health parameter, the CPU health parameter, and the Document Object Model node health parameter to obtain the final health parameter. This process fully considers the relative importance of each parameter in the overall health assessment, allowing the health parameter to comprehensively and accurately reflect the comprehensive health status of the server memory and its associated resources. This provides a solid data foundation for the subsequent implementation of precise memory management strategies, ensuring that web page memory management can be optimized based on comprehensive and accurate health assessment results, and improving the stability and efficiency of server operations.
[0085] In a possible embodiment, the health parameter is calculated using the following formula:
[0086]
[0087] The meanings of the parameters are: Memory prediction deviation rate, α Memory impact coefficient, λ Confidence of memory prediction value, CPU prediction deviation rate, γ CPU impact coefficient, v CPU prediction confidence, Document Object Model node prediction deviation rate, β Document Object Model node influence coefficient, μ Confidence of the predicted value of a Document Object Model node. is the memory health parameter, is the document object model node health parameter, It is the CPU health parameter.
[0088] In summary, the method provided by the embodiment of the present disclosure determines the memory health parameters based on the memory prediction deviation rate and the corresponding memory impact coefficient and the memory prediction value confidence, determines the central processing unit health parameters based on the central processing unit prediction deviation rate and the corresponding central processing unit impact coefficient and the central processing unit prediction value confidence, and determines the document object model node health parameters based on the document object model node prediction deviation rate and the corresponding document object model node impact coefficient and the document object model node prediction value confidence. It fully considers the importance and reliability differences of each factor, making the determination of each health parameter more scientific, reasonable and accurate. Then, the comprehensive health parameters are obtained by weighting according to the weights corresponding to these health parameters, further refining the health assessment process, which can more accurately reflect the overall health status of the memory system, and provide a more reliable basis for the subsequent targeted treatment measures according to different health levels, which helps to achieve refined management and optimization of server memory.
[0089] In a possible embodiment, the step of obtaining the weights corresponding to the memory health parameter, the CPU health parameter, and the document object model node health parameter includes:
[0090] Calculate the weight corresponding to the memory health parameter according to the occupied memory value and the total memory value;
[0091] Calculate the weight corresponding to the health parameter of the document object model node according to the effective value of the document object model node and the total value of the document object model node;
[0092] The weight corresponding to the CPU health parameter is calculated according to the CPU idle time and the total CPU running time.
[0093] In this embodiment, the weights corresponding to the memory health parameters are obtained by fully considering the actual situation of the server memory, that is, the calculation is performed based on the occupied memory value and the total memory value. The occupied memory value directly reflects the current memory usage, and the total memory value represents the overall memory capacity. By combining the two, the usage pressure and importance of the memory can be accurately measured, thereby obtaining reasonable memory health parameter weights, ensuring that the memory health status occupies an appropriate position in the overall health assessment. The weights corresponding to the document object model node health parameters are obtained by calculating based on the effective value of the document object model node and the total value of the document object model node. The effective value reflects the actual functioning part of the document object model node, and the total value covers all document object model nodes. This method can accurately evaluate the actual contribution and value of the document object model nodes in terms of quantity, and then determine reasonable weights so that the health status of the document object model nodes is accurately reflected in the comprehensive assessment. The weights corresponding to the CPU health parameters are obtained by analyzing the idle time of the CPU and the total running time of the CPU. Idle time reflects the CPU's unused resources, while total run time reflects the CPU's overall workload. The combination of the two accurately assesses CPU load and resource utilization, resulting in appropriate weights to ensure that the CPU's health status in the overall health assessment matches its actual operating conditions. These meticulous and appropriate weighting steps allow the calculation of health parameters to more accurately reflect the actual importance of each factor in memory health assessment, further enhancing the scientific and reliable nature of health parameters as a basis for memory management decisions. This provides strong support for precise and efficient server memory management, ensuring stable web page operation and optimized performance.
[0094] In a possible embodiment, the health parameter is calculated using the following formula:
[0095]
[0096] in, is the occupied memory value, is the total memory value, is a valid value for a Document Object Model node. is the total value of the Document Object Model node, is the idle time of the CPU, is the total CPU running time.
[0097] Optionally, different weights can be set according to the server type and memory capacity. Such dynamic adjustments can better adapt to the performance characteristics of different devices and achieve more refined memory management.
[0098] In summary, the method provided by the embodiments of the present disclosure clarifies the method for obtaining the weights corresponding to the memory health parameters, the central processing unit health parameters and the document object model node health parameters, calculates the weights corresponding to the memory health parameters based on the occupied memory value and the total memory value, calculates the weights corresponding to the document object model node health parameters based on the effective value of the document object model node and the total value of the document object model node, and calculates the weights corresponding to the central processing unit health parameters based on the idle time of the central processing unit and the total running time of the central processing unit. These methods make the determination of weights closely related to the actual resource occupancy and usage, and can more reasonably reflect the importance and influence of each health parameter in the overall memory health assessment, thereby improving the accuracy and credibility of the comprehensive health parameters, further optimizing the memory health assessment model, making it more in line with actual operating conditions, and providing a more scientific reference for subsequent memory processing decisions.
[0099] In a possible embodiment, the performing corresponding processing on the memory of the server according to the memory health related data includes:
[0100] Determine a response level according to the intervals of the health parameter and the memory leak parameter;
[0101] A corresponding processing action is determined according to the response level, and the processing action is executed on the server memory.
[0102] In this embodiment, during actual operation, the response level is first determined based on the intervals of the health parameter and the memory leak parameter. Different intervals of the health parameter represent varying degrees of health for the server memory, ranging from good to a warning state indicating potential issues, to a dangerous state with severe risks. Different intervals of the memory leak parameter represent varying degrees of health for the server memory, ranging from good to a warning state indicating potential issues, to a dangerous state with severe risks. By presetting reasonable health parameter interval division criteria, the level corresponding to the current memory health status can be quickly and accurately determined, providing a clear basis for subsequent appropriate treatment measures. After determining the response level, corresponding processing actions are determined based on the response level and executed on the server memory. These processing actions may include, but are not limited to, memory release, memory optimization, resource allocation, and process adjustment. The specific action selected depends on the severity of the response level and the specific characteristics of the memory health status. For example, a minor health warning may require only simple memory optimization operations; however, a serious health issue may require emergency measures such as immediately releasing a large amount of memory and adjusting the resource usage of key processes. By determining the response level based on the health parameter range and implementing the corresponding processing action strategy accordingly, it is possible to achieve dynamic and accurate management of server memory, respond to various memory problems in a timely manner, ensure that the server memory is always in a healthy and stable state, and thus ensure the smooth operation of web pages and improve user experience. It also helps to extend the service life of the server, reduce system maintenance costs, and provide a solid guarantee for the stable operation of web pages, ensuring that in a complex and changing network environment, the server can efficiently and reliably process various web page requests to meet the diverse needs of users.
[0103] In one possible embodiment, a memory leak is determined to have occurred when the memory leak parameter (i.e., the memory growth rate) within three consecutive windows exceeds 5%. When a memory leak is determined to have occurred, the following actions can be performed: Release unused memory: For detected and located memory leaks, modify the code to ensure that memory is released in a timely manner when it is no longer needed. Optimize memory management strategies: Adjust memory allocation and management strategies based on the characteristics and needs of the application. For example, use object pool technology to manage frequently created and destroyed objects to reduce the overhead of memory allocation and release; reasonably set the cache size and expiration strategy to prevent the cache from occupying too much memory.
[0104] In one possible embodiment, when the health parameter is less than 70%, operations such as clearing the LRU cache and terminating idle WebWorkers are executed. When the health parameter is less than 50%, operations such as removing zombie DOM nodes and unbinding unused events are executed. When the health parameter is less than 30%, operations such as forcibly triggering GC and pausing non-core rendering tasks are executed.
[0105] In summary, the method provided by the embodiments of the present disclosure determines the response level based on the interval between the health parameter and the memory leak parameter, can perform hierarchical management of the memory health status, and take corresponding processing actions according to the severity of different levels, thereby achieving refined management and efficient response of server memory. This method of executing corresponding processing actions according to different response levels can reasonably allocate system resources and avoid over-processing or under-processing. It can not only solve memory problems in a timely manner, but also reduce interference with the normal operation of the server, effectively improve the management efficiency and reliability of server memory, and ensure the stable operation of web pages.
[0106] It should be noted that the embodiments of the present disclosure may include multiple steps. For the convenience of description, these steps are numbered, but these numbers do not limit the execution time slots or execution order between the steps; these steps can be implemented in any order, and the embodiments of the present disclosure do not limit this.
[0107] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0108] According to an embodiment of the present disclosure, the present disclosure also provides a network page memory management device.
[0109] For example, Figure 4 This is a schematic diagram of the structure of a network page memory management device provided by an embodiment of the present disclosure. The network page memory management device 400 includes:
[0110] The data collection module 410 is used to collect multi-dimensional operation data from the server;
[0111] A feature extraction module 420 is used to extract and analyze features of the operating data to obtain a predicted value of the network page memory performance;
[0112] An analysis module 430 is configured to process and analyze the network page memory performance prediction value to obtain memory health related data;
[0113] The memory processing module 440 is used to perform corresponding processing on the memory of the server according to the memory health related data.
[0114] Furthermore, the feature extraction module 420 includes:
[0115] A feature extraction submodule is used to extract time series features from the operating data and obtain data related to the memory health of the network page, wherein the network page memory performance prediction value includes at least one of the following: memory increment prediction value, memory prediction deviation rate, document object model node prediction deviation rate, and central processing unit prediction deviation rate.
[0116] Furthermore, the feature extraction submodule includes:
[0117] A memory leak determination module is used to determine memory leak condition parameters based on changes in the memory increment prediction value.
[0118] Furthermore, the memory leak determination module includes:
[0119] The memory leak determination submodule is used to determine the memory leak condition parameter based on the change of the memory increment prediction value.
[0120] Furthermore, the memory leak determination submodule includes:
[0121] a sliding unit, configured to slide a sliding window of a preset size on the sampling points of the memory increment prediction value to obtain the memory increment prediction value corresponding to each sampling point in the sliding window;
[0122] A memory leak determination unit is used to calculate the total memory growth rate in the sliding window according to the memory increment prediction value corresponding to each sampling point in the sliding window, and determine the total memory growth rate as the memory leak condition parameter.
[0123] Furthermore, the analysis module 430 includes:
[0124] A health parameter determination module is used to determine the health parameter based on the memory prediction deviation rate, the document object model node prediction deviation rate, and the central processing unit prediction deviation rate.
[0125] Furthermore, the health parameter determination module includes:
[0126] A first determination module is used to determine a memory health parameter according to the memory prediction deviation rate and the corresponding memory impact coefficient and the memory prediction value confidence;
[0127] A second determining module is configured to determine a CPU health parameter based on the CPU prediction deviation rate, the corresponding CPU influence coefficient, and the CPU prediction value confidence level;
[0128] A third determination module is configured to determine a document object model node health parameter based on the document object model node prediction deviation rate, the corresponding document object model node influence coefficient, and the document object model node prediction value confidence;
[0129] The fourth determining module is configured to perform weighting according to the corresponding weights of the memory health parameter, the CPU health parameter and the document object model node health parameter to obtain the health parameter.
[0130] Furthermore, the device further comprises:
[0131] A first weight acquisition module is used to calculate the weight corresponding to the memory health parameter according to the occupied memory value and the total memory value;
[0132] A second weight acquisition module is used to calculate the weight corresponding to the health parameter of the document object model node according to the effective value of the document object model node and the total value of the document object model node;
[0133] The third weight acquisition module is used to calculate the weight corresponding to the CPU health parameter according to the CPU idle time and the CPU total running time.
[0134] Furthermore, the memory processing module 440 includes:
[0135] A response level determination module, configured to determine a response level according to the intervals between the health parameter and the memory leak parameter;
[0136] The processing module is used to determine a corresponding processing action according to the response level and execute the processing action on the server memory.
[0137] An embodiment of the present disclosure further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps of any of the above network page memory management method embodiments.
[0138] An embodiment of the present disclosure further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above-mentioned network page memory management method embodiments when running.
[0139] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0140] An embodiment of the present disclosure further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above network page memory management method embodiments are implemented.
[0141] An embodiment of the present disclosure further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above-mentioned network page memory management method embodiments are implemented.
[0142] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.
[0143] The above is a detailed introduction to a web page memory management method provided by the present disclosure. This article uses specific examples to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method of the present disclosure and its core ideas. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present disclosure, several improvements and modifications can be made to the present disclosure, and these improvements and modifications also fall within the scope of protection of the claims of the present disclosure.
Claims
1. A network page memory management method, characterized in that: include: Collect multi-dimensional operation data from the server; Extracting and analyzing features of the operating data to obtain a network page memory performance prediction value, wherein the network page memory performance prediction value includes at least one of the following: a memory increment prediction value, a memory prediction deviation rate, a document object model node prediction deviation rate, and a central processing unit prediction deviation rate, wherein the memory increment prediction value reflects an increase in the server memory value in the future; Processing and analyzing the predicted value of the network page memory performance to obtain memory health related data; Performing corresponding processing on the memory of the server according to the memory health related data; The memory health related data includes memory leakage parameters and health parameters, and the processing and analysis based on the network page memory performance prediction value to obtain the memory health related data includes: Determine a memory health parameter based on the memory prediction deviation rate, the corresponding memory impact coefficient, and the memory prediction value confidence, and calculate a corresponding weight based on the occupied memory value and the total memory value; Determining a CPU health parameter based on the CPU prediction deviation rate, the corresponding CPU influence coefficient, and the CPU prediction value confidence, and calculating a corresponding weight based on the effective value of the document object model node and the total value of the document object model node; Determining a document object model node health parameter based on the document object model node prediction deviation rate, the corresponding document object model node influence coefficient, and the document object model node prediction value confidence, and calculating a corresponding weight based on the idle time of the central processing unit and the total running time of the central processing unit; The health parameter is obtained by weighting according to the corresponding weights of the memory health parameter, the central processing unit health parameter and the document object model node health parameter.
2. The method according to claim 1, characterized in that The operating data includes at least one of the following: memory-related data, document object model node-related data, and central processing unit-related data. The feature extraction and analysis of the operating data to obtain the web page memory performance prediction value includes: Time series feature extraction is performed on the operating data to obtain data related to the memory health of the network page.
3. The method according to claim 2, characterized in that The processing and analyzing according to the network page memory performance prediction value to obtain memory health related data also includes: A memory leak condition parameter is determined based on a change in the memory increment prediction value.
4. The method according to claim 3, characterized in that The determining of the memory leak condition parameter based on the change of the memory increment prediction value includes: Sliding a sliding window of a preset size on the sampling points of the memory increment prediction value to obtain the memory increment prediction value corresponding to each sampling point in the sliding window; The total memory growth rate in the sliding window is calculated according to the memory increment prediction value corresponding to each sampling point in the sliding window, and the total memory growth rate is determined as the memory leakage condition parameter.
5. The method according to claim 1 or 4, characterized in that The performing corresponding processing on the memory of the server according to the memory health related data includes: Determine the response level based on the intervals of the health parameter and memory leak parameter; A corresponding processing action is determined according to the response level, and the processing action is executed on the server memory.
6. A network page memory management device, characterized in that: include: Data collection module, used to collect multi-dimensional operation data from the server; a feature extraction module, configured to extract and analyze features of the operating data to obtain a network page memory performance prediction value, wherein the network page memory performance prediction value includes at least one of the following: a memory increment prediction value, a memory prediction deviation rate, a document object model node prediction deviation rate, and a central processing unit prediction deviation rate, wherein the memory increment prediction value reflects the amount of increase in the server memory value in the future; An analysis module, configured to process and analyze the network page memory performance prediction value to obtain memory health related data; A memory processing module, configured to perform corresponding processing on the memory of the server according to the memory health related data; The memory health related data includes memory leakage parameters and health parameters, and the processing and analysis based on the network page memory performance prediction value to obtain the memory health related data includes: Determine a memory health parameter based on the memory prediction deviation rate, the corresponding memory impact coefficient, and the memory prediction value confidence, and calculate a corresponding weight based on the occupied memory value and the total memory value; Determining a CPU health parameter based on the CPU prediction deviation rate, the corresponding CPU influence coefficient, and the CPU prediction value confidence, and calculating a corresponding weight based on the effective value of the document object model node and the total value of the document object model node; Determining a document object model node health parameter based on the document object model node prediction deviation rate, the corresponding document object model node influence coefficient, and the document object model node prediction value confidence, and calculating a corresponding weight based on the idle time of the central processing unit and the total running time of the central processing unit; The health parameter is obtained by weighting according to the corresponding weights of the memory health parameter, the central processing unit health parameter and the document object model node health parameter.
7. An electronic device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method and device for predicting mobile application program page performance and electronic equipment
CN106294902A
Intelligent memory leak predicting and tracking method and system for micro-service architecture
CN119690725A