Performance optimization method and device of Java virtual machine, equipment and medium

By collecting system data in Java virtual machines and using memory prediction models to optimize thread resources and cache memory, the performance problems of Java virtual machines in high-load environments are solved, the system's response speed and memory utilization are improved, and the stability and efficient operation of insurance services are ensured.

CN120508350APending Publication Date: 2025-08-19CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510578642.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

When existing Java virtual machines deal with high-load insurance services, there are problems of response latency and low memory utilization, resulting in system performance degradation and affecting business continuity and stability.

Method used

By collecting system data when the Java virtual machine is running, using preset memory prediction models to make memory predictions, obtain predicted memory requirements, and optimize thread resources and cache memory based on the predicted needs and the current available memory, including adjusting the number of threads, cache size and task priority to optimize system resource utilization.

Benefits of technology

Improves the performance of Java virtual machines, ensures that applications make full use of system resources, improves response speed and memory utilization, and improves the real-timeness of user experience and business decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508350A_ABST
    Figure CN120508350A_ABST
Patent Text Reader

Abstract

The invention discloses a performance optimization method and device of a Java virtual machine, equipment and a medium. The method is applied to a Java virtual machine system and comprises the following steps: when a Java virtual machine carries out service processing, collecting real-time system data, and obtaining memory prediction data; performing memory prediction on the memory prediction data through a preset memory prediction model to obtain a predicted memory demand; and performing corresponding optimization adjustment on thread resources and cache memory in the system according to the predicted memory demand, the current available memory and a preset optimization strategy. By implementing the method provided by the invention, the problem of low application efficiency of the Java virtual machine in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of system optimization and financial technology, and in particular to a performance optimization method, device, equipment and medium for a Java virtual machine. Background Art

[0002] In the financial sector, especially in the insurance business, high-load processing and real-time performance of systems are crucial. However, existing Java Virtual Machines (JVMs) often face response delays and low memory utilization when handling such demanding tasks. Insurance business systems typically need to process a large number of user requests and data transactions, which poses a severe performance challenge to the JVM. Under high-load environments, the JVM may experience slow response times due to inefficient algorithms, frequent garbage collection (GC), and unreasonable memory allocation. Especially when processing real-time transactions and data analysis, any delay can negatively impact user experience and business decisions. In addition, low memory utilization can exacerbate performance issues. The ineffective memory management and low resource utilization efficiency of existing JVMs can even affect the continuity and stability of insurance business. Summary of the Invention

[0003] The embodiments of the present invention provide a Java virtual machine performance optimization method, apparatus, device and medium, aiming to solve the problem of low Java virtual machine application efficiency in the prior art.

[0004] In a first aspect, an embodiment of the present invention provides a performance optimization method for a Java virtual machine, which is applied to a Java virtual machine system, and includes: collecting real-time system data when the Java virtual machine performs business processing to obtain memory prediction data; performing memory prediction on the memory prediction data through a preset memory prediction model to obtain predicted memory demand; and optimizing and adjusting the thread resources and cache memory in the system according to the predicted memory demand, the current available memory, and a preset optimization strategy.

[0005] In the second aspect, an embodiment of the present invention also provides a performance optimization device for a Java virtual machine, which is applied to a Java virtual machine system and includes: an acquisition unit, which is used to collect real-time system data when the Java virtual machine performs business processing and obtain memory prediction data; a prediction unit, which is used to perform memory prediction on the memory prediction data through a preset memory prediction model and obtain predicted memory requirements; an adjustment unit, which is used to optimize and adjust the thread resources and cache memory in the system according to the predicted memory requirements, the current available memory and the preset optimization strategy.

[0006] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.

[0007] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the above method can be implemented.

[0008] An embodiment of the present invention provides a method, apparatus, device, and medium for optimizing the performance of a Java virtual machine. The method is applied to a Java virtual machine system and includes: collecting real-time system data when the Java virtual machine performs business processing to obtain memory prediction data; performing memory prediction on the memory prediction data using a preset memory prediction model to obtain predicted memory demand; and optimizing and adjusting thread resources and cache memory within the system based on the predicted memory demand, current available memory, and a preset optimization strategy. The embodiment of the present invention collects data while the Java virtual machine is running to collect various performance parameters of the JVM at run time, providing a basis for subsequent memory prediction and optimization adjustments. The memory prediction data is used to perform memory prediction using a preset memory prediction model to predict the JVM's memory demand for a period of time in the future, thereby facilitating subsequent optimization adjustments based on the predicted memory demand and current available memory. By performing corresponding optimization adjustments based on the predicted memory demand, the performance of the JVM can be improved in a more systematic and comprehensive manner, ensuring that the application can fully utilize system resources and achieve optimal performance during runtime, thereby improving its application efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0010] Figure 1 A schematic diagram of a flow chart of a method for optimizing the performance of a Java virtual machine according to an embodiment of the present invention;

[0011] Figure 2 A schematic diagram of a sub-process of a method for optimizing the performance of a Java virtual machine according to an embodiment of the present invention;

[0012] Figure 3 A schematic diagram of a sub-process of a method for optimizing the performance of a Java virtual machine according to an embodiment of the present invention;

[0013] Figure 4A schematic diagram of a sub-process of a method for optimizing the performance of a Java virtual machine according to an embodiment of the present invention;

[0014] Figure 5 A schematic diagram of a sub-process of a method for optimizing the performance of a Java virtual machine according to an embodiment of the present invention;

[0015] Figure 6 A schematic diagram of a sub-process of a method for optimizing the performance of a Java virtual machine according to an embodiment of the present invention;

[0016] Figure 7 A schematic diagram of a sub-process of a method for optimizing the performance of a Java virtual machine according to an embodiment of the present invention;

[0017] Figure 8 A schematic block diagram of a performance optimization device for a Java virtual machine provided by an embodiment of the present invention;

[0018] Figure 9 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0020] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0021] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in the specification and appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0022] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0023] See also Figure 1 , Figure 1This is a flowchart of a Java virtual machine performance optimization method provided by an embodiment of the present invention. The Java virtual machine performance optimization method of this embodiment can be applied to a Java virtual machine system. By employing this method, runtime memory can be predicted, thereby optimizing the use of memory and thread resources in the system, ensuring that applications can fully utilize system resources during runtime and achieve optimal performance.

[0024] Figure 1 1 is a flow chart of a method for optimizing the performance of a Java virtual machine according to an embodiment of the present invention. As shown in the figure, the method includes the following steps S110-S130.

[0025] S110 . When the Java virtual machine performs business processing, real-time system data is collected to obtain memory prediction data.

[0026] In this embodiment, the memory prediction data is used to predict future system memory requirements. The system data is collected during the Java virtual machine's operation, such as time series (e.g., system uptime), current memory usage, CPU load, and number of threads. After the system data is cleaned and processed, the resulting data becomes the memory prediction data. By collecting system data to obtain predicted memory data, subsequent memory requirements can be predicted based on current system usage, allowing for timely optimization and adjustment.

[0027] In one embodiment, if Figure 2 As shown, step S110 includes steps S111-S112.

[0028] S111, performing pre-processing operations of noise cleaning and data conversion on the collected system data;

[0029] S112. Obtain the memory prediction data according to the preprocessed system data.

[0030] In this embodiment, noise cleaning is a method for removing irrelevant information, duplicate information, outliers, or erroneous data from the data. Specifically, it includes methods such as removing duplicate data, handling missing values, identifying and handling outliers, and data denoising. Data conversion is the process of converting data into a format suitable for analysis or modeling. The collected system data undergoes noise cleaning and data conversion preprocessing. Specifically, abnormally high or low data in the system memory usage data can be removed, as well as filler data. For example, if the memory usage data has a used memory value of -128MB at a certain point in time, this is clearly an invalid value (because memory usage cannot be negative), and this value is removed. The system data is converted into a format or form suitable for use in analysis or predictive models. Assume there are two features: CPU usage and memory usage. CPU usage typically ranges from 0% to 100%, while memory usage may range from 0% to a certain upper limit (e.g., 90%). To compare these two features on the same scale, a normalization method (e.g., min-max normalization) can be used to convert them to values between 0 and 1. The specific noise cleaning and data conversion are not limited and can be determined based on the specific device data. The system data after the preprocessing operation is determined as the memory prediction data. By preprocessing the collected system data to obtain standard data that can be used for memory prediction, the accuracy of the prediction results is improved.

[0031] S120: Perform memory prediction on the memory prediction data through a preset memory prediction model to obtain predicted memory demand.

[0032] In this embodiment, the preset memory prediction model is a trained model capable of performing memory prediction, wherein the preset memory prediction model can be constructed according to business needs and data characteristics, and the memory prediction model includes but is not limited to: machine learning models, deep learning models, etc. The preprocessed system data (memory prediction data) is input into the trained preset memory prediction model. These data should have the same format and characteristics as the data used when training the model. The preset memory prediction model predicts memory requirements based on the input data and predicts the memory usage prediction value at one or more future time points, wherein the result of the model output is the predicted memory requirement. By performing memory prediction according to the preset memory prediction model, the memory requirements in the future time can be obtained, so as to facilitate optimization and adjustment according to the memory requirements.

[0033] In one embodiment, if Figure 3 As shown, the step S120 includes steps S1201-S1202.

[0034] S1201: Input the memory prediction data into a preset machine learning algorithm for model training;

[0035] S1202: Construct the preset memory prediction model according to the training results.

[0036] In this embodiment, the preset machine learning algorithm is a preselected machine learning algorithm that is used to learn memory usage patterns from the input data. This algorithm can be any machine learning model suitable for regression problems, as memory prediction is typically a regression task (i.e., predicting a continuous value). Machine learning algorithms include support vector regression (SVR) and neural networks, and the specific algorithm is not limited. The memory prediction data is input into the preset machine learning algorithm for model training. Specifically, the memory prediction data is used as a training set to train the machine learning algorithm. The training process involves adjusting the model parameters to minimize the prediction error, i.e., the difference between the model's predicted memory usage and the actual memory usage. The preset memory prediction model is constructed based on the training results. Specifically, the training results are the output obtained after the model training process, which include the trained model parameters (such as weights and biases). These parameters define how the model calculates the predicted memory usage from the input features. The training results are integrated into a deployable model that can accept new input data and output predicted memory usage. In a machine learning framework, this typically means saving the trained model parameters to a file and creating a model instance that can load these parameters and use them for prediction. By constructing the preset memory prediction model based on the training results of the preset machine learning algorithm, the preset memory prediction model can predict future memory requirements in real time or in batches, thereby providing valuable insights for tasks such as system resource management, performance optimization or capacity planning.

[0037] S130 , optimizing and adjusting thread resources and cache memory in the system accordingly according to the predicted memory demand, current available memory, and a preset optimization strategy.

[0038] In this embodiment, the currently available memory refers to the amount of unused memory in the system, reflecting the current state of the system's memory resources. This information can typically be obtained from the operating system's memory management module. The preset optimization policy is a set of optimization measures tailored to system requirements and objectives. These policies may include adjusting the number of threads, changing the cache size, and releasing unnecessary memory resources. Based on the predicted memory demand, the currently available memory, and the preset optimization policy, the thread resources and cache memory within the system are optimized and adjusted accordingly. Specifically, the predicted memory demand is compared with the currently available memory, and based on the comparison results, an assessment is made as to whether thread resources need to be adjusted. If the predicted memory demand indicates an increase, but the currently available memory is insufficient, the number of threads is reduced to reduce memory usage. Conversely, if the predicted memory demand indicates a decrease, the number of threads can be increased to improve the system's parallel processing capabilities. Furthermore, the cache size and policy are adjusted based on the predicted memory demand and current cache usage. If the predicted memory demand indicates an increase, the cache size may need to be reduced to free up memory resources. If the predicted memory demand indicates a stable or decreasing state, the cache size may be increased to improve data access speed. After implementing the optimization policy, system performance, particularly memory usage and system response time, is continuously monitored. If the optimization strategy fails to achieve the expected results or system performance degrades, the strategy needs to be adjusted and re-optimized. By optimizing the thread resources and cache memory within the system based on the predicted memory demand and the current available memory, the system's resource utilization efficiency is significantly improved and memory bottlenecks are reduced.

[0039] In one embodiment, if Figure 4 As shown, the step S130 also includes steps S131-S132.

[0040] S131, if the predicted memory demand exceeds the currently available memory, increasing the processing level and cache layer position of high-priority threads and high-priority task data;

[0041] S132: Reduce the memory usage of low-priority threads and data.

[0042] In this embodiment, the high-priority threads and data are those that are considered to require priority processing, which usually perform important tasks or require a quick response. The cache layer position is the position of the cache layer close to the CPU. The cache is usually divided into multiple levels, and the closer the cache is to the CPU, the faster the access speed. Improving the cache layer position means moving these threads or task data to a higher level cache to reduce access latency. The predicted memory requirements are compared with the available memory. If the predicted memory requirements exceed the current available memory, it means that the current available memory is insufficient and the efficiency of processing the corresponding tasks is low. At this time, the processing level and cache layer position of high-priority threads and high-priority task data are improved. Specifically, more memory resources are allocated to high-priority threads, while pausing or reducing the resource usage of low-priority threads, and the cache position of high-priority data is increased, while the cache position of low-priority data is reduced. The memory usage of low-priority threads and data is reduced. Specifically, low-priority threads and data are less urgent or important tasks or data, and they can be temporarily compressed or delayed when system resources are tight. In order to free up memory to meet the needs of high-priority tasks, the system will take memory reduction measures for low-priority threads and data, such as compressing data, writing data to disk to free up memory (paging or swapping), suspending or terminating low-priority threads, etc. These measures are intended to reduce the memory resource usage of low-priority tasks, thereby making room for high-priority tasks. If the predicted memory demand does not exceed the current available memory, it means that there is sufficient memory at this time, and some low-priority data can be appropriately released. Among them, memory usage and system performance will be continuously monitored to verify the match between the predicted memory demand and the actual available memory consumption. If the prediction error is large, the parameters of the preset memory prediction model will be dynamically adjusted to improve the prediction accuracy. By flexibly adjusting resource allocation according to the priority of the task and the memory demand of the system, the system performance and response speed are optimized.

[0043] In one embodiment, if Figure 5 As shown, the step S130 also includes steps S1301-S1303 before the step S130.

[0044] S1301, determining high-priority tasks and low-priority tasks according to preset task priorities;

[0045] S1302. Allocate corresponding thread resources according to the priority of the task to obtain corresponding high-priority threads and low-priority threads;

[0046] S1303. Allocate corresponding memory resources according to the priority of the thread.

[0047] In this embodiment, the preset task priority is set based on the task type (e.g., user interaction tasks, background data processing tasks, etc.). Specifically, this priority can be determined through a configuration file, hard-coded logic, or dynamic evaluation strategy. High-priority tasks are typically critical, such as real-time data processing and user interaction responses. They need to be completed as quickly as possible to ensure system stability and user satisfaction. Low-priority tasks are less urgent, such as insurance data backup and insurance log recording, and can be executed when system resources are relatively idle. Thread resources are allocated based on task priority to obtain corresponding high-priority and low-priority threads. Specifically, more thread resources and higher-performance memory areas are allocated to high-priority tasks. Resources are dynamically adjusted for low-priority tasks, releasing them for more important tasks when necessary. High-priority threads are assigned to high-priority tasks to ensure that these tasks can quickly obtain CPU time and complete as quickly as possible. Low-priority threads handle lower-priority tasks and may be preempted or delayed when system resources are limited. Memory resources are allocated based on thread priority. Specifically, each thread is bound to a corresponding memory area at startup, with high-priority tasks bound to faster memory tiers. Among them, according to changes in system load, low-priority threads can be automatically paused and low-activity data can be migrated to free up resources for high-priority tasks. Memory and thread status are continuously monitored to dynamically adjust priorities and resource allocation rules. For example, threads and memory resources are allocated from the global resource pool based on priority. If there is insufficient memory or thread overload, low-priority tasks will give up resources to high-priority tasks. After the resources are released, they are returned to the resource pool for use by other tasks. By allocating corresponding memory resources according to thread priority, system resources can be reasonably allocated through priority management to ensure that high-priority tasks can be processed in a timely manner while taking into account the execution of low-priority tasks.

[0048] In one embodiment, if Figure 6 As shown, the step S130 also includes steps S1304-S1305 before the step S130.

[0049] S1304: Differentiate the cache layers according to their processing speeds to obtain a high-speed cache layer, a medium-speed cache layer, and a low-speed cache layer;

[0050] S1305: Store task data of different priorities into corresponding cache layers according to preset task priorities.

[0051] In this embodiment, the cache layer typically temporarily stores data to speed up data access. Different cache layers may be composed of different types of storage media or have different hardware configurations and architectural designs, resulting in differences in processing speed. The cache layers are differentiated based on their processing speed, resulting in high-speed cache layers, intermediate-speed cache layers, and low-speed cache layers. Specifically, they are categorized based on processing speed (i.e., the speed at which data is read and written) and hardware performance. The high-speed cache layer has the fastest processing speed and can quickly respond to data read and write requests. It may be composed of high-performance RAM (random access memory) or utilize other fast access technologies. The high-speed cache layer is typically used to store the most critical data, which is frequently accessed and has high performance requirements. The intermediate-speed cache layer has a processing speed between the high-speed and low-speed cache layers. It may be composed of slower but less expensive storage media such as RAM or SSDs (solid-state drives). The intermediate-speed cache layer is typically used to store less critical data that still requires fast access. The low-speed cache tier has the slowest processing speed and is typically used to store infrequently accessed data or as a data backup. It may consist of an HDD (hard disk drive) or other slower storage media. The low-speed cache tier may not perform as well as the high- and medium-speed cache tiers, but it may be less expensive and offer greater storage capacity. Task data of different priorities is stored in corresponding cache tiers based on preset task priorities. Specifically, task data of different priorities is stored based on preset priorities such as access frequency (highest weight), task priority, data type, and time weight. For example, frequently used data is stored in the high-speed cache tier, while less frequently used data is migrated to the medium / low-speed cache tiers to access the corresponding high- and low-priority task data. High-priority task data is stored in the high-speed cache tier to ensure rapid access and processing. By storing task data of different priorities in corresponding cache tiers based on preset task priorities, the system can more efficiently utilize resources, improve overall performance, and ensure that high-priority tasks are processed promptly. This strategy also helps reduce data access latency and improve user experience.

[0052] In one embodiment, if Figure 7 As shown, step S1305 further includes steps S1306-S1307.

[0053] S1306: Monitor in real time whether the available memory and / or the task data triggers a preset migration condition;

[0054] S1307: If triggered, dynamically adjust the cache layer where the task data is located according to a preset migration strategy.

[0055] In this embodiment, the preset migration conditions are conditions set according to preset rules, wherein the specific conditions can be set based on the specific needs and performance objectives of the system. Real-time monitoring of the available memory and / or task data is performed to determine whether the preset migration conditions are triggered. Specifically, the amount of available memory in the current system is continuously monitored, which is an important factor in determining whether the cache policy needs to be adjusted. Simultaneously, the status of the task data is monitored, including its size, access frequency, usage duration, etc. This information is used to assess whether the task data meets the preset migration conditions. If the memory usage of a certain layer exceeds a preset threshold, the preset migration condition is triggered. Alternatively, the preset migration condition can be triggered when the priority of the task data decreases or increases. If triggered, the cache layer where the task data resides is dynamically adjusted according to the preset migration policy. Specifically, if the access frequency or task priority of a data block increases, it is migrated from a low-speed cache layer to a high-speed cache layer. For example, if hot data is detected to be frequently accessed within a short period of time, it is automatically promoted to a high-speed layer. At the same time, low-priority data that has not been accessed recently is migrated to a low-speed cache layer or compressed. For example, a least-recently-used data can be selected using a least-recently-used algorithm for downgraded migration. And when the low-speed cache layer is close to full, it clears out data that is no longer needed to free up space. Among them, when migrating data from the low-speed cache layer to the high-speed cache layer, it can be migrated through batch migration (reducing the impact of a single migration on performance), asynchronous migration (avoiding blocking the main thread and handing over the migration task to the background thread for asynchronous execution), incremental migration (only migrating the data with the largest priority change to reduce migration overhead), etc. By dynamically adjusting the cache layer where the task data is located according to the preset migration strategy, the system can more effectively manage resources, improve performance, and adapt to changing workloads.

[0056] Figure 8 FIG. 2 is a schematic block diagram of a Java virtual machine performance optimization device 200 provided by an embodiment of the present invention. Figure 8 As shown, corresponding to the above Java virtual machine performance optimization method, the present invention also provides a Java virtual machine performance optimization device. The Java virtual machine performance optimization device includes a unit for executing the above Java virtual machine performance optimization method. The device can be configured in a desktop computer, tablet computer, laptop computer, etc. Specifically, please refer to Figure 8 The performance optimization device of the Java virtual machine includes an acquisition unit 210, a prediction unit 220, and an adjustment unit 230.

[0057] The acquisition unit 210 is used to collect real-time system data and obtain memory prediction data when the Java virtual machine performs business processing.

[0058] In one embodiment, the acquisition unit 210 includes a processing unit and an acquisition sub-unit.

[0059] A processing unit, configured to perform pre-processing operations of noise cleaning and data conversion on the collected system data;

[0060] The acquisition subunit is used to acquire the memory prediction data based on the preprocessed system data.

[0061] The prediction unit 220 is configured to perform memory prediction on the memory prediction data using a preset memory prediction model to obtain predicted memory demand.

[0062] In one embodiment, the prediction unit 220 includes a training unit and a construction unit.

[0063] A training unit, configured to input the memory prediction data into a preset machine learning algorithm for model training;

[0064] A construction unit is used to construct the preset memory prediction model according to the training results.

[0065] The adjustment unit 230 is configured to optimize and adjust the thread resources and cache memory in the system according to the predicted memory demand, the current available memory, and a preset optimization strategy.

[0066] In one embodiment, the adjusting unit 230 includes an increasing unit and a decreasing unit.

[0067] an improving unit, configured to improve the processing level and cache layer position of high-priority threads and high-priority task data if the predicted memory demand exceeds the currently available memory;

[0068] The reduction unit is used to reduce the memory usage of low-priority threads and data.

[0069] In one embodiment, the adjustment unit 230 includes a determination unit, a thread allocation unit, and a resource allocation unit.

[0070] A determination unit, configured to determine high-priority tasks and low-priority tasks according to preset task priorities;

[0071] The thread allocation unit is used to allocate corresponding thread resources according to the priority of the task to obtain corresponding high-priority threads and low-priority threads;

[0072] The resource allocation unit is used to allocate corresponding memory resources according to the priority of the thread.

[0073] In one embodiment, the adjustment unit 230 includes a distinguishing unit and a storage unit.

[0074] a distinguishing unit, configured to distinguish the cache layers according to their processing speeds, and obtain a high-speed cache layer, a medium-speed cache layer, and a low-speed cache layer;

[0075] The storage unit is used to store task data of different priorities into corresponding cache layers according to preset task priorities.

[0076] In one embodiment, the adjustment unit 230 includes a monitoring unit and an adjustment sub-unit.

[0077] A monitoring unit, configured to detect in real time whether the priority of the task data is updated according to a preset migration mechanism;

[0078] The adjustment subunit is used to dynamically adjust the cache layer where the task data is located according to a preset migration strategy if triggered.

[0079] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the performance optimization device 200 and each unit of the above-mentioned Java virtual machine can refer to the corresponding description in the aforementioned method embodiment. For the convenience and brevity of the description, it will not be repeated here.

[0080] The performance optimization device of the Java virtual machine can be implemented in the form of a computer program. Figure 9 Runs on the computer equipment shown.

[0081] See also Figure 9 , Figure 9 This is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 can be a terminal or a server. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, personal digital assistant, wearable device, or other electronic device with communication capabilities. The server can be a standalone server or a server cluster consisting of multiple servers.

[0082] See Figure 9 The computer device 500 includes a processor 502 , a memory, and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .

[0083] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions, which, when executed, can cause the processor 502 to execute a performance optimization method for a Java virtual machine.

[0084] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500.

[0085] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a performance optimization method of a Java virtual machine.

[0086] The network interface 505 is used to communicate with other devices through the network. Figure 9 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0087] The processor 502 is configured to run a computer program 5032 stored in the memory to implement the steps of the above method.

[0088] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0089] Those skilled in the art will appreciate that all or part of the steps in the method of the above-described embodiment can be implemented by instructing the relevant hardware through a computer program. The computer program includes program instructions, which can be stored in a storage medium that is computer-readable. The program instructions are executed by at least one processor in the computer system to implement the steps in the method of the above-described embodiment.

[0090] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor performs the steps of the above method.

[0091] The storage medium may be any computer-readable storage medium that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk.

[0092] Those skilled in the art will 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 composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0093] In the several embodiments provided herein, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the various units is merely a logical functional division, and actual implementation may employ other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not implemented.

[0094] The steps in the methods of the embodiments of the present invention may be adjusted in order, combined, or deleted as needed. The units in the devices of the embodiments of the present invention may be combined, divided, or deleted as needed. Furthermore, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit.

[0095] If this integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the existing technology, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, terminal, or network device, etc.) to execute all or part of the steps of the method described in various embodiments of the present invention.

[0096] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and such modifications or substitutions are intended to be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.

Claims

1. A method for optimizing the performance of a Java virtual machine, characterized in that: The method is applied to a Java virtual machine system, and the method includes: When the Java virtual machine is processing business, real-time system data is collected to obtain memory prediction data; Perform memory prediction on the memory prediction data through a preset memory prediction model to obtain predicted memory demand; According to the predicted memory demand, the current available memory and the preset optimization strategy, the thread resources and cache memory in the system are correspondingly optimized and adjusted.

2. The method according to claim 1, characterized in that The step of collecting real-time system data and obtaining memory prediction data when the Java virtual machine performs business processing includes: Performing pre-processing operations of noise cleaning and data conversion on the collected system data; The memory prediction data is obtained according to the preprocessed system data.

3. The method according to claim 2, characterized in that Before the step of performing memory prediction on the memory prediction data through a preset memory prediction model, the method further includes: Inputting the memory prediction data into a preset machine learning algorithm for model training; The preset memory prediction model is constructed according to the training results.

4. The method according to claim 1, wherein The step of optimizing and adjusting the thread resources and cache memory in the system according to the predicted memory demand, the current available memory, and the preset optimization strategy includes: If the predicted memory demand exceeds the currently available memory, increasing the processing level and cache layer position of high-priority threads and high-priority task data; Reduce the memory usage of low-priority threads and data.

5. The method according to claim 4, characterized in that Before the step of increasing the processing level and cache layer position of high-priority threads and high-priority task data, the method includes: Determine high-priority tasks and low-priority tasks based on preset task priorities; Allocate corresponding thread resources according to the priority of the task to obtain the corresponding high-priority thread and low-priority thread; Allocate corresponding memory resources according to the thread priority.

6. The method according to claim 4, characterized in that Before the step of increasing the processing level and cache layer position of high-priority threads and high-priority task data, the method includes: Differentiate the cache layers according to their processing speeds to obtain a high-speed cache layer, a medium-speed cache layer, and a low-speed cache layer; Task data of different priorities are stored in the corresponding cache layer according to the preset task priority.

7. The method according to claim 6, characterized in that After the step of storing task data of different priorities into corresponding cache layers according to preset task priorities, the following steps are included: Detecting in real time whether the priority of the task data is updated according to a preset migration mechanism; If triggered, the cache layer where the task data is located is dynamically adjusted according to a preset migration strategy.

8. A performance optimization device for a Java virtual machine, characterized in that: The device is applied to a Java virtual machine system, and includes: An acquisition unit is used to collect real-time system data and obtain memory prediction data when the Java virtual machine performs business processing; A prediction unit, configured to perform memory prediction on the memory prediction data through a preset memory prediction model to obtain predicted memory demand; The adjustment unit is used to optimize and adjust the thread resources and cache memory in the system according to the predicted memory demand, the current available memory and the preset optimization strategy.

9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 7 can be implemented.