Application performance optimization method, device, electronic device and storage medium
By obtaining application metric data in the colocation cluster, detecting interference and dynamically adjusting CPU core allocation, and using Cgroup files to update bound CPU cores, this solves application performance interference caused by CPU core preemption and improves application performance and overall machine utilization.
Patent Information
- Application Number
- CN202211548824.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-05
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2042-12-05
AI Technical Summary
In a colocation cluster, CPU core preemption disrupts application performance, dramatically increases scheduling overhead, and affects application efficiency.
By obtaining the indicator data of each application, detecting whether it is interfered with, dynamically adjusting the CPU core allocation, and using the Cgroup file to update the bound CPU core, the application performance is optimized.
It achieves real-time monitoring and resolution of application interference, improves application performance and overall machine utilization, and resolves performance interference issues caused by CPU core preemption.
Smart Images

Figure CN116149846B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of cloud computing technology, and more specifically, relates to an application performance optimization method, device, electronic device and storage medium. Background Art
[0002] Currently, applications in colocation clusters are primarily deployed in containers as microservices. Containerized applications are deployed on servers in two different CPU usage modes: CPU set mode, which binds applications to fixed CPU cores. In this mode, the CPU cores available to an application are pre-allocated and exclusive to that application, preventing preemption by other applications. In CPU share mode, all applications share all CPU cores in a shared CPU pool. In this mode, all applications share the same CPU cores that are not exclusively used by applications in CPU set mode.
[0003] With the rapid development of cloud computing, more and more applications are transitioning from the CPU set mode to the CPU share mode. However, in the CPU share mode, applications share CPU cores in the same CPU pool, which inevitably leads to the problem of application preemption of CPU cores. This leads to serious interference during application execution, which in turn dramatically increases scheduling overhead. The operating system spends a lot of time swapping threads in and out of CPU cores, leaving only a small amount of CPU time slices for actual use by applications, severely impacting application performance.
[0004] It can be seen that the existing technology has the problem of CPU core preemption in a colocation cluster causing interference with application performance. Summary of the Invention
[0005] In response to the shortcomings of related technologies, the present invention provides an application performance optimization method, device, electronic device and storage medium, aiming to solve the problem of application performance being disturbed due to CPU core preemption in a colocation cluster existing in related technologies.
[0006] The technical solution is as follows:
[0007] According to one aspect of the present application, an application performance optimization method is applied to a colocation cluster, the method comprising: obtaining indicator data, the indicator data comprising first indicator data of each application during its operation in a current time period, and second indicator data related to the system kernel; based on the first indicator data of each application, detecting whether each application is interfered with; if there is an abnormal application that is interfered with, allocating a CPU core to the abnormal application from a CPU shared pool based on the second indicator data; and updating the control group Cgroup file of the abnormal application according to the CPU core allocated to the abnormal application.
[0008] According to one aspect of the present application, an application performance optimization device is deployed in a colocation cluster, the device including: an acquisition module for acquiring indicator data, the indicator data including first indicator data of each application during its operation in a current time period, and second indicator data related to the system kernel; an interference detection module for detecting whether each application is interfered with based on the first indicator data of each application; a resource allocation module for allocating a CPU core to the abnormal application from a CPU shared pool based on the second indicator data if there is an abnormal application that is interfered with; and a file update module for updating the control group Cgroup file of the abnormal application according to the CPU core allocated to the abnormal application.
[0009] According to one aspect of the present application, an electronic device includes: at least one processor, at least one memory, and at least one communication bus, wherein a computer program is stored in the memory, and the processor reads the computer program in the memory through the communication bus; when the computer program is executed by the processor, the application performance optimization method described above is implemented.
[0010] According to one aspect of the present application, a storage medium stores a computer program thereon, and when the computer program is executed by a processor, the application performance optimization method described above is implemented.
[0011] According to one aspect of the present application, a computer program product includes a computer program, the computer program is stored in a storage medium, a processor of a computer device reads the computer program from the storage medium, and the processor executes the computer program, so that the computer device implements the application performance optimization method described above when executing the computer program.
[0012] The beneficial effects of the technical solution provided by this application are:
[0013] In the above technical solution, various indicator data about each application and the system kernel on the colocation cluster is obtained, and based on the indicator data of each application, whether each application is interfered with is detected; when there is an abnormal application that is interfered with, the CPU core allocated to the application is dynamically adjusted based on the indicator data related to the system kernel in the indicator data to ensure application performance. The present invention monitors and resolves the interference to the application in real time based on the indicator data of each application, and dynamically adjusts the CPU resources based on the indicator data related to the system kernel. This greatly ensures the stability of the colocation cluster application, improves application performance and increases the utilization rate of the entire machine, and solves the problem of application performance interference caused by CPU core preemption in the colocation cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments of the present application.
[0015] Figure 1 This is a schematic diagram of an implementation environment of an application performance optimization method provided in an embodiment of the present application;
[0016] Figure 2 This is a flow chart of an application performance optimization method provided by an embodiment of the present application;
[0017] Figure 3 yes Figure 2 A flowchart of an embodiment corresponding to step 240 in an embodiment;
[0018] Figure 4 yes Figure 2 A flowchart of another embodiment corresponding to step 240 in the embodiment;
[0019] Figure 5 It is a schematic diagram of a specific implementation of an application performance optimization method in an application scenario;
[0020] Figure 6 is a block diagram of an application performance optimization device according to an exemplary embodiment;
[0021] Figure 7 is a hardware structure diagram of a server according to an exemplary embodiment;
[0022] Figure 8 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0023] The following describes in detail embodiments of the present application, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and are not to be construed as limiting the present application.
[0024] It will be understood by those skilled in the art that, unless expressly stated otherwise, the singular forms "a", "an", "said" and "the" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, "connected" or "coupled" as used herein may include wireless connections or wireless couplings. The term "and / or" used herein includes all or any units and all combinations of one or more associated listed items.
[0025] The following is an introduction and explanation of several terms involved in this application:
[0026] A CPU core is generally considered to be a logical core allocated to applications. Different logical cores can come from the same physical core or from different physical cores.
[0027] A socket refers to a CPU slot, the socket used to install a CPU. CPU resources often include CPU cores from multiple sockets. Applications should, if possible, bind CPU cores to the same socket. Crossing sockets wastes performance resources.
[0028] Cgroups, or control groups, are a Linux kernel feature used to limit, control, and isolate resources (such as CPU, memory, and disk I / O) for a group of processes. A CPU sharepool, also known as a CPU shared pool, has all CPU cores available to all processes.
[0029] The CPU share mode means that each application can share all CPU cores in the CPU sharing pool.
[0030] In CPU set mode, CPU cores available to an application are pre-allocated and exclusively used by that application, preventing other applications from preempting them. Applications in this mode are mostly high-priority online services.
[0031] Colocation clusters are a technology that combines clusters, scheduling different types of tasks onto the same physical resources. Through scheduling, resource isolation, and other control measures, this technology improves resource utilization and significantly reduces costs while ensuring SLOs. Colocation involves mixing workloads with different business characteristics, priorities, and resource usage models on the same machine, which inevitably leads to issues such as resource preemption.
[0032] As mentioned above, in related technologies, applications in a colocation cluster often encounter interference problems caused by resource preemption.
[0033] Typically, to address interference between applications in colocation clusters, efforts are made to optimize application deployment, continuously improving scheduling and deployment algorithms to reduce deployment costs and, in turn, reduce application interference. While these approaches have mitigated the difficulties of controlling application deployment costs and preventing performance interference, with the rapid growth of application scale and the increasing density of applications on servers, simply improving scheduling and deployment methods is no longer sufficient to prevent interference between applications. Furthermore, applications are inherently diverse, with widely varying characteristics, making it difficult to address all scenarios with a single mechanism or algorithm.
[0034] As can be seen from the above, the related art still has the limitation that the performance is disturbed due to the application's CPU core preemption.
[0035] To this end, the application performance optimization method provided in this application can dynamically adjust CPU resources and thus effectively improve application performance. Accordingly, the application performance optimization method is suitable for an application performance optimization device, which can be deployed in an electronic device. The electronic device can be a computer device configured with a von Neumann architecture, for example, the computer device can be a desktop computer, a laptop computer, a server, etc.
[0036] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0037] See also Figure 1 , which shows a schematic diagram of an implementation environment involved in an application performance optimization method provided by the present application. The implementation environment includes a monitoring component 101, a trigger component 102, a CPU scheduling and allocation component 103, a tuning component 104, and a control component 105.
[0038] The monitoring component 101 collects indicator data from applications and the system kernel, and sends the indicator data to the trigger component 102 and the CPU scheduling and allocation component 103. The indicator data includes first indicator data of each application running in the current time period and second indicator data related to the system kernel.
[0039] The trigger component 102 detects whether each application is interfered with based on the first indicator data of each application, and sends the detection result to the tuning component 104 .
[0040] The first indicator data refers to indicator data related to the application's operation during the current time period, such as request response delay, end-to-end delay, task completion time, etc.
[0041] The CPU scheduling and allocation component 103 calculates the CPU account book based on the second indicator data related to the system kernel collected by the monitoring component 101.
[0042] The second indicator data may include CPU core idleness, the location of CPU cores in each socket, which CPU cores are on the same physical core, etc. The CPU ledger refers to CPU cores divided into different levels. The division rules may be whether the CPU cores are located in the same socket, whether the CPU cores are located in the same physical core, whether there are any CPU cores that are exclusively occupied in the physical core where the CPU cores are located, or the idleness of each CPU core, or one or more of the above, which are not limited here.
[0043] If the detection result sent by the trigger component 102 is that there is an abnormal application that is interfered with, the tuning component 104 allocates a CPU core to the abnormal application from the CPU shared pool based on the CPU ledger obtained from the CPU scheduling and allocation component 103, obtains the CPU allocation strategy, and sends the CPU allocation strategy to the control component 105.
[0044] After receiving the CPU allocation policy sent by the tuning component 104, the management and control component 105 checks whether the CPU allocation policy is correct. If correct, it traverses each abnormal application that needs to adjust the CPU resources, finds the Cgroup file of the abnormal application, and modifies the CPU core bound to the abnormal application in the Cgroup file to the target value to achieve the binding of the abnormal application with the CPU core indicated by the CPU allocation policy, that is, adjusts the CPU resources of the abnormal application, and then optimizes the performance of the abnormal application, so that the abnormal application returns to normal.
[0045] See also Figure 2 , an embodiment of the present application provides an application performance optimization method, which is applied to a colocation cluster.
[0046] In the following method embodiments, for ease of description, each step of the method is described by taking the execution subject as a server in a colocation cluster as an example, but this does not constitute a specific limitation.
[0047] like Figure 2 As shown, the method may include the following steps:
[0048] Step 200: Obtain indicator data.
[0049] The indicator data includes first indicator data of each application during operation in the current time period, and second indicator data related to the system kernel.
[0050] The first indicator data refers to indicator data related to the application's operation during the current time period, such as request response delay, end-to-end delay, task completion time, etc.
[0051] The second indicator data refers to indicator data related to the system kernel, such as the scheduling delay of the application on the CPU core, the CPI (average number of cycles required to execute instructions) of the application, the utilization rate of each CPU core, the position of the CPU core in each socket, which CPU cores are on the same physical core, etc.
[0052] Regarding the acquisition of indicator data, one possible implementation method is to use monitoring components deployed in the colocation cluster to monitor and collect the application running process and / or system kernel in real time.
[0053] Step 220: Based on the first indicator data of each application, detect whether each application is interfered with.
[0054] In one possible implementation, whether the application is interfered with is determined by detecting whether the application has performance fluctuations. That is, if the application has performance fluctuations, it is determined that the application is interfered with.
[0055] Specifically, step 220 may include the following steps: obtaining historical indicator data of each application during its operation within a historical time period, and obtaining performance fluctuation data of each application by comparing and analyzing the first indicator data of each application with the historical indicator data of each application during its operation within a historical time period. Then, based on the performance fluctuation data, determining whether each application is interfered with, thereby completing the detection of whether each application is interfered with.
[0056] The historical indicator data refers to the indicator data related to the operation of each application in the historical time period, such as the response delay of the request, end-to-end delay, task completion time, etc.
[0057] In a possible implementation, the performance fluctuation data may be obtained by calculating the difference between the first indicator data and certain historical indicator data.
[0058] In a possible implementation, the performance fluctuation data may be obtained by comparing the first indicator data with an average of all historical indicator data within a certain historical time period.
[0059] Step 240: If there is an abnormal application that is disturbed, a CPU core is allocated to the abnormal application from the CPU shared pool based on the second indicator data.
[0060] Among them, the application that is disturbed is regarded as an abnormal application. Since the CPU cores in the CPU shared pool are shared by various applications, in order to avoid CPU core preemption, before allocating CPU cores to the abnormal application, it is necessary to select a specific number and position of CPU cores from the CPU shared pool based on the second indicator data, and then allocate them to the abnormal application, thereby dynamically adjusting the CPU resources of the abnormal application.
[0061] For example, based on the second indicator data, the CPU core with the highest idleness in the CPU shared pool is allocated to the abnormal application.
[0062] Step 260 : updating the control group Cgroup file of the abnormal application according to the CPU core allocated to the abnormal application.
[0063] Cgroups (control groups) are a Linux kernel feature used to limit, control, and isolate resources (such as CPU, memory, and disk I / O) for a process group. Updating the Cgroup file can update the CPU cores bound to the application.
[0064] In an exemplary embodiment, after step 260, the method may further include the following steps:
[0065] Step 261 : After the Cgroup file of the abnormal application is updated, based on the first indicator data of the abnormal application during operation in the current time period, it is detected whether the abnormal application has returned to normal.
[0066] That is to say, continue to obtain the first indicator data of the abnormal application during the operation process after completing the Cgroup file update, and obtain the performance fluctuation data of the abnormal application after completing the Cgroup file update by comparing and analyzing the first indicator data of the abnormal application with the historical indicator data of the abnormal application during the operation process in the historical time period. Then, based on the performance fluctuation of the abnormal application after completing the Cgroup file update indicated by the performance fluctuation data, determine whether the abnormal application has returned to normal after completing the Cgroup file update.
[0067] If the abnormal application returns to normal after completing the Cgroup file update, step 262 is executed; otherwise, if the abnormal application is still abnormal after completing the Cgroup file update, the process returns to step 240 and continues to adjust CPU resources for the abnormal application until the abnormal application returns to normal.
[0068] Step 262: If it is detected that the abnormal application has returned to normal, the CPU core allocated to the abnormal application is restored to the CPU shared pool.
[0069] By modifying the Cgroup file of the abnormal application again and setting the number and position of the CPU cores bound to the abnormal application, the CPU cores allocated to the abnormal application when it is abnormal can be restored to the CPU shared pool.
[0070] In the above process, application interference is monitored and resolved in real time through the indicator data of each application. In addition, CPU resources are dynamically adjusted based on the indicator data related to the system kernel. This greatly ensures the stability of colocation cluster applications, improves application performance and overall machine utilization, and solves the problem of application performance interference caused by CPU core preemption in colocation clusters.
[0071] See also Figure 3 In an exemplary embodiment, step 240 may include the following steps:
[0072] Step 241 : If the abnormal application supports the CPU share mode, the CPU cores in the CPU sharing pool are divided into a plurality of idle levels according to the second indicator data of the system.
[0073] The CPU cores in the same idle level have the same allocation priority. It should be noted that the higher the idle level, the lower the allocation priority, indicating that it is more difficult for the CPU cores in the idle level to be allocated.
[0074] In one possible implementation, CPU cores in the same socket are assigned to the same idle tier. To prevent cross-socket CPU allocation to applications, CPU cores in the same socket are assigned to the same idle tier whenever possible. This approach effectively reduces the excess performance consumed by running CPU cores across sockets, further improving application performance.
[0075] In a possible implementation, CPU cores in the same physical core are divided into the same idle level.
[0076] In one possible implementation, the idleness of the CPU cores is determined based on the system's second indicator data, and CPU cores with idleness within the same set range are grouped into the same idle tier. The idleness can be determined based on the utilization rate of each CPU core, which is obtained from the second indicator data associated with the system core. For example, CPU cores with an idleness between 10% and 20% are grouped into one idle tier, and CPU cores with an idleness between 20% and 30% are grouped into another idle tier.
[0077] In one possible implementation, if a CPU core's physical core has exclusive CPU resources, the idle level of that CPU core is higher than the idle levels of other CPU cores. Other CPU cores refer to CPU cores in the physical core where the core resides that are not exclusively occupied. This approach effectively avoids interference with applications that support CPU set mode and occupy exclusive logical cores, further improving application performance.
[0078] In step 242 , based on the number of CPU cores required by the abnormal application and the idle level of the CPU cores, CPU cores of the same idle level are selected from the CPU shared pool to obtain a CPU allocation strategy.
[0079] The CPU allocation policy is used to indicate the CPU cores that can be allocated to the abnormal application.
[0080] Continue reading Figure 4 In an exemplary embodiment, step 240 may further include the following steps:
[0081] Step 243 : Based on the CPU cores that can be allocated to the abnormal application as indicated by the CPU allocation policy, it is detected whether the CPU allocation policy is correct.
[0082] If it is detected that the CPU allocation policy is correct, step 260 is executed.
[0083] On the contrary, if it is detected that the CPU allocation policy is incorrect, for example, the CPU cores that can be allocated to the abnormal application have been exclusively occupied by other applications that support the CPU set mode, step 244 is executed.
[0084] Step 244: If it is detected that the CPU allocation policy is wrong, a CPU core in the CPU shared pool is re-allocated to the abnormal application.
[0085] Through the coordination of the above-mentioned embodiments, CPU cores in the CPU shared pool are divided into several idle tiers to facilitate allocation to abnormal applications. By assigning CPU cores in the same socket to the same idle tier, this process effectively reduces the excess performance consumed by running CPUs across sockets, further improving application performance. The correctness of the allocation strategy is checked to prevent certain CPU cores from being monopolized by CPUset-type applications at the current moment, resulting in allocation failures.
[0086] Figure 5This diagram illustrates a specific implementation of an application performance optimization method in an application scenario. In this scenario, the CPU cores initially allocated to the application are from a shared CPU pool. Servers in the colocation cluster collect primary metric data from the application during the current time period and then determine whether the primary metric data is abnormal. If so, the CPU cores allocated to the application are adjusted. Otherwise, the server continues to collect data metrics and determine whether there are any anomalies.
[0087] After adjusting the CPU cores allocated to the application, continue to collect the first indicator data of the application and determine whether it is normal. If it is normal, the application returns to the initial state, that is, the CPU cores allocated to the application are restored to the CPU shared pool; otherwise, continue to adjust the CPU cores allocated to the application.
[0088] In this application scenario, real-time monitoring and resolution of application interference are achieved through the use of each application's indicator data. The CPU cores allocated to each application are dynamically adjusted, greatly ensuring the stability of colocation cluster applications, improving application performance and overall machine utilization. This resolves the issue of application performance interference caused by CPU core preemption in colocation clusters.
[0089] The following is an embodiment of the device of the present application, which can be used to perform the application performance optimization method involved in the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the method embodiment of the application performance optimization method involved in the present application.
[0090] See also Figure 6 In an embodiment of the present application, an application performance optimization device 900 is provided, which is deployed in a colocation cluster. The device 900 includes but is not limited to: an acquisition module 910, an interference detection module 930, a resource allocation module 950, and a file update module 970.
[0091] The acquisition module 910 is used to acquire indicator data, which includes first indicator data of each application during operation in the current time period and second indicator data related to the system kernel.
[0092] The interference detection module 930 is configured to detect whether each application is interfered with based on the first indicator data of each application.
[0093] The resource allocation module 950 is configured to allocate a CPU core from a CPU shared pool to an abnormal application that is disturbed based on the second indicator data.
[0094] The file updating module 970 is configured to update the control group Cgroup file of the abnormal application according to the CPU core allocated to the abnormal application.
[0095] It should be noted that the application performance optimization device provided in the above embodiment only uses the division of the above-mentioned functional modules as an example when performing application performance optimization. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the application performance optimization device will be divided into different functional modules to complete all or part of the functions described above.
[0096] In addition, the application performance optimization device and the application performance optimization method provided in the above embodiments belong to the same concept, and the specific manner in which each module performs operations has been described in detail in the method embodiments and will not be repeated here.
[0097] See also Figure 7 , which shows a schematic structural diagram of a server according to an exemplary embodiment.
[0098] It should be noted that the server is only an example adapted for this application and cannot be considered to provide any limitation on the scope of use of this application. The server cannot be interpreted as needing to rely on or must have Figure 7 One or more components of exemplary server 2000 are shown.
[0099] The hardware structure of the server 2000 may vary greatly due to different configurations or performances, such as Figure 7 As shown, the server 2000 includes a power supply 210 , an interface 230 , at least one memory 250 , and at least one central processing unit (CPU) 270 .
[0100] Specifically, the power supply 210 is used to provide operating voltage for each hardware device on the server 2000 .
[0101] The interface 230 includes at least one wired or wireless network interface 231 for interacting with external devices.
[0102] Of course, in other examples adapted by this application, the interface 230 may further include at least one serial-to-parallel conversion interface 233, at least one input-output interface 235, and at least one USB interface 237, etc. Figure 7 As shown, this does not constitute a specific limitation.
[0103] The memory 250 serves as a carrier for resource storage and can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon include an operating system 251, application 253 and data 255, etc. The storage method can be temporary storage or permanent storage.
[0104] Among them, the operating system 251 is used to manage and control the various hardware devices and application programs 253 on the server 2000 to enable the central processing unit 270 to calculate and process the massive data 255 in the memory 250. It can be WindowsServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0105] The application program 253 is a computer program that performs at least one specific task based on the operating system 251 and may include at least one module ( Figure 7 (not shown), each module may respectively include a computer program for the server 2000. For example, the application performance optimization device may be regarded as an application program 253 deployed on the server 2000.
[0106] The data 255 may be photos, pictures, etc. stored in a disk, or may be indicator data, etc. stored in the memory 250 .
[0107] The central processing unit 270 may include one or more processors and is configured to communicate with the memory 250 via at least one communication bus to read computer programs stored in the memory 250, thereby performing operations and processing on the massive amount of data 255 in the memory 250. For example, the application performance optimization method may be implemented by the central processing unit 270 reading a series of computer programs stored in the memory 250.
[0108] In addition, the present application can also be implemented through hardware circuits or hardware circuits combined with software. Therefore, the implementation of the present application is not limited to any specific hardware circuits, software, or a combination of the two.
[0109] See also Figure 8 In an embodiment of the present application, an electronic device 4000 is provided, which may include a server in a colocation cluster.
[0110] exist Figure 8 In the embodiment, the electronic device 4000 includes at least one processor 4001, at least one communication bus 4002, and at least one memory 4003. The processor 4001 and the memory 4003 are connected, for example, via the communication bus 4002.
[0111] Optionally, the electronic device 4000 may further include a transceiver 4004, which may be used for data exchange between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the number of transceivers 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0112] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0113] The communication bus 4002 may include a path for transmitting information between the above components. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0114] The memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0115] The memory 4003 stores a computer program, and the processor 4001 reads the computer program stored in the memory 4003 through the communication bus 4002 .
[0116] When the computer program is executed by the processor 4001, the application performance optimization method in the above-mentioned embodiments is implemented.
[0117] In addition, an embodiment of the present application provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the application performance optimization method in the above embodiments is implemented.
[0118] The present application provides a computer program product including a computer program stored in a storage medium. A processor of a computer device reads the computer program from the storage medium and executes the computer program, causing the computer device to perform the application performance optimization method described in each of the above embodiments.
[0119] Compared with related technologies, the present invention monitors and resolves interference to applications in real time based on the indicator data of each application, and dynamically adjusts CPU resources based on indicator data related to the system kernel. This greatly ensures the stability of colocation cluster applications, improves application performance and overall machine utilization, eliminates interference caused by application preemption of CPU cores in colocation servers, and solves the problem of application performance interference caused by CPU core preemption in colocation clusters.
[0120] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0121] It will be easily understood by those skilled in the art that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for optimizing application performance, characterized in that: Applied to a colocation cluster, the method includes: Obtaining indicator data, the indicator data including first indicator data of each application during operation in a current time period and second indicator data related to the system kernel; detecting, based on the first indicator data of each application, whether each application is interfered with, and if the performance fluctuation data of the application indicates that the application has performance fluctuations, detecting that the application is an abnormal application that has been interfered with; If there is an abnormal application that is disturbed, allocating a CPU core from a CPU shared pool to the abnormal application based on the second indicator data; Update a control group Cgroup file of the abnormal application according to the CPU core allocated to the abnormal application; Allocating a CPU core to the abnormal application from a CPU shared pool based on the second indicator data includes: If the abnormal application supports the CPU share mode, the CPU cores in the CPU sharing pool are divided into several idle levels according to the second indicator data of the system; the CPU cores in the same idle level have the same allocation priority; Selecting a CPU core from the CPU shared pool according to the number of CPU cores required by the abnormal application and the idle level of the CPU cores to obtain a CPU allocation policy; the CPU allocation policy is used to indicate the CPU cores that can be allocated to the abnormal application; Based on the second indicator data of the system, the idleness of the CPU cores is determined, and the CPU cores whose determined idleness is within the same set range are divided into the same idle level.
2. The method according to claim 1, wherein After updating the control group Cgroup file of the abnormal application according to the CPU core allocated to the abnormal application, the method further includes: After the Cgroup file of the abnormal application is updated, detecting whether the abnormal application has returned to normal based on the first indicator data of the abnormal application during operation in the current time period; If yes, the CPU core allocated to the abnormal application is restored to the CPU shared pool.
3. The method according to claim 1, wherein The detecting, based on the first indicator data of each application, whether each application is interfered with includes: Obtaining historical indicator data of each application during operation within a historical time period; Calculating performance fluctuation data of each application based on the first indicator data and historical indicator data of each application; If the performance fluctuation data of the application indicates that the application has performance fluctuation, the application is detected as an abnormal application that has been disturbed.
4. The method according to claim 1, wherein The allocating a CPU core to the abnormal application from a CPU shared pool based on the second indicator data further includes: Based on the CPU cores that can be allocated to the abnormal application indicated by the CPU allocation policy, detecting whether the CPU allocation policy is correct; If the CPU core that can be allocated to the abnormal application has been exclusively occupied by other applications supporting the CPU set mode, it is detected that the CPU allocation policy is wrong, and a CPU core in the CPU shared pool is re-allocated to the abnormal application.
5. The method according to claim 1, wherein According to the second indicator data of the system, the CPU cores in the CPU shared pool are divided into several idle levels, including: Assign the CPU cores in the same socket to the same idle level; or Assign CPU cores in the same physical core to the same idle level; or If there is an exclusively occupied CPU core among the physical cores where the CPU core is located, the idle level of the CPU core is higher than the idle levels of other CPU cores; the other CPU cores refer to the CPU cores that are not exclusively occupied among the physical cores where the CPU core is located.
6. The method according to any one of claims 1 to 5, characterized in that The updating of the Cgroup file of the abnormal application according to the CPU core allocated to the abnormal application includes: Determine the Cgroup location corresponding to the abnormal application, and find the Cgroup file of the abnormal application according to the determined Cgroup location; In the Cgroup file of the abnormal application, the CPU core allocated to the abnormal application is bound to the abnormal application.
7. An application performance optimization device, characterized in that: Deployed in a colocation cluster, the device includes: An acquisition module, configured to acquire indicator data, wherein the indicator data includes first indicator data of each application during operation in a current time period, and second indicator data related to the system kernel; an interference detection module, configured to detect, based on the first indicator data of each application, whether each application is interfered with, and if the performance fluctuation data of the application indicates that the application has performance fluctuations, detect the application as an abnormal application that has been interfered with; a resource allocation module, configured to allocate a CPU core from a CPU shared pool to an abnormal application that is disturbed based on the second indicator data if the abnormal application exists; A file updating module, configured to update a control group Cgroup file of the abnormal application according to the CPU core allocated to the abnormal application; Allocating a CPU core to the abnormal application from a CPU shared pool based on the second indicator data includes: If the abnormal application supports the CPU share mode, the CPU cores in the CPU sharing pool are divided into several idle levels according to the second indicator data of the system; the CPU cores in the same idle level have the same allocation priority; Selecting a CPU core from the CPU shared pool according to the number of CPU cores required by the abnormal application and the idle level of the CPU cores to obtain a CPU allocation policy; the CPU allocation policy is used to indicate the CPU cores that can be allocated to the abnormal application; Based on the second indicator data of the system, the idleness of the CPU cores is determined, and the CPU cores whose determined idleness is within the same set range are divided into the same idle level.
8. An electronic device, characterized in that: include: at least one processor, at least one memory, and at least one communication bus, wherein: The memory stores a computer program, and the processor reads the computer program in the memory through the communication bus; When the computer program is executed by the processor, the application performance optimization method according to any one of claims 1 to 6 is implemented.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the application performance optimization method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Cluster resource scheduling method and device, equipment and storage medium
CN113434253A
Auto-sizing for stream processing applications
US20210406086A1