A method and device for processing system data

By dynamically adjusting the number of server threads, the problems of low real-time and automation in the existing technology are solved, and the stability and user experience of the server system are improved.

CN113064620BActive Publication Date: 2024-12-27北京天空卫士网络安全技术有限公司
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202110363442.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-02
Publication Date
2024-12-27
Estimated Expiration
2041-04-02

AI Technical Summary

Technical Problem

The existing technology has poor real-time performance and low degree of automation when adjusting the number of server threads, resulting in unstable server system and affecting user experience.

Method used

By obtaining system data, we determine whether the thread update conditions are met, and dynamically adjust the number of threads according to the preset strategy, including reducing or increasing the maximum number of threads, core threads and running threads to ensure system stability.

Benefits of technology

It improves the real-time and automation of the server system, enhances system stability, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113064620B_ABST
    Figure CN113064620B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for processing system data, and relates to the field of computer technology. A specific implementation of the method includes: being able to obtain system data, judging whether to update the system thread according to the value of the system data, and if so, updating the thread processing the current system data; improving the real-time and automation of processing server system pressure problems, improving the stability of the server system, and improving the user experience of obtaining data from the server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for processing system data. Background Art

[0002] With the continuous development of information technology, the total amount of global information data has shown explosive growth. In the era of big data, cloud computing, and artificial intelligence, the data processing capabilities of servers are increasingly required. When the server system is under too much pressure due to processing a large amount of data, it often causes system instability or even crashes, affecting the user experience. Therefore, it is necessary to adjust the number of system threads to alleviate server pressure.

[0003] However, the existing method of adjusting the number of threads of the system is that the technician takes the server to be adjusted offline and puts it back online after modifying the number of threads, or the technician modifies the number of threads of the server system through a remote call interface. The existing method of handling server system pressure problems by adjusting threads has poor real-time performance and low automation, which affects the user experience of obtaining data from the server. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and device for processing system data, which can obtain system data and determine whether to update the system thread based on the value of the system data. If so, update the thread processing the current system data; improve the real-time and automation level of processing server system pressure problems, improve the stability of the server system, and improve the user experience of obtaining data from the server.

[0005] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a method for processing system data is provided, characterized in that it includes: obtaining current system data of a system running on a device; determining whether the value of the current system data meets a thread update condition; if so, obtaining the current number of threads of the system; updating the thread processing the current system data according to the current number of threads and a preset thread update strategy.

[0006] Optionally, the method for processing system data is characterized by:

[0007] The current system data includes one or more types of data;

[0008] Determining whether the value of the current system data meets the thread update condition includes:

[0009] Determine whether the data volume of any one of the types of data is not less than the first set threshold corresponding to the type, or determine whether the data volume of any one of the types of data is not greater than the second set threshold corresponding to the type. If so, determine that the value of the current system data meets the thread update condition.

[0010] Optionally, the method for processing system data is characterized by further comprising:

[0011] When the amount of data of each type is less than the corresponding first set threshold or the amount of data of each type is greater than the corresponding second set threshold,

[0012] It is determined whether the length of the current waiting queue of the system is greater than a set queue threshold, and if so, it is determined that the value of the current system data meets the thread update condition.

[0013] Optionally, the method for processing system data is characterized by a preset thread update strategy, including: reducing the number of threads for the system when the data volume of any one of the types of data is not less than a first set threshold corresponding to the type or the data volume of any one of the types of data is not greater than a second set threshold corresponding to the type.

[0014] Optionally, the method for processing system data is characterized in that the preset thread update strategy further includes: when the length of the current waiting queue is greater than a set queue threshold, increasing the number of threads for the system.

[0015] Optionally, the method for processing system data is characterized by further comprising:

[0016] Obtain the current number of threads of the system including the maximum number of threads, the number of core threads and / or the number of running threads;

[0017] The step of updating the thread for processing the current system data is performed by using the maximum number of threads, the number of core threads and / or the number of running threads.

[0018] Optionally, the method for processing system data is characterized in that updating the thread for processing the current system data further includes: reducing the maximum number of threads based on a set first thread adjustment ratio.

[0019] Optionally, the method for processing system data is characterized in that the updating of the thread for processing the current system data further includes: if the reduced maximum number of threads is greater than the core number of threads, updating the core number of threads to the reduced maximum number of threads.

[0020] Optionally, the method for processing system data is characterized in that the updating of the thread for processing the current system data further includes: if the number of running threads is greater than the number of core threads and less than the maximum number of threads, updating the maximum number of threads to the number of running threads; and reducing the number of core threads based on a set second thread adjustment ratio.

[0021] Optionally, the method for processing system data is characterized in that the thread for updating the processing of the current system data further includes: if the acquired number of running threads is less than the acquired number of core threads, updating the maximum number of threads to the value of the number of core threads; and reducing the number of core threads based on a set third thread adjustment ratio and the number of running threads.

[0022] Optionally, the method for processing system data is characterized in that updating the thread for processing the current system data further comprises: when the length of the current waiting queue is greater than a set queue threshold, obtaining the number of core threads and the maximum number of threads of the system;

[0023] Determine whether the values ​​of the core thread number and the maximum thread number are the same,

[0024] If yes, increasing the maximum number of threads based on the set fourth thread adjustment ratio;

[0025] Otherwise, increase the number of core threads or the maximum number of threads so that the number of core threads and the maximum number of threads are the same.

[0026] Optionally, the method for processing system data is characterized in that updating the thread for processing the current system data further comprises:

[0027] The increase in the number of core threads is controlled not to exceed the number of cores of the central processing unit of the system or a core threshold is set; the increase in the maximum number of threads is controlled not to exceed a set multiple of the number of cores of the central processing unit of the system or a maximum threshold is set.

[0028] To achieve the above object, according to a second aspect of an embodiment of the present invention, a device for processing system data is provided, characterized in that it includes: a data acquisition module, a data judgment module and a thread processing module; wherein,

[0029] The data acquisition module is used to acquire current system data of the system running on the device;

[0030] The data determination module is used to determine whether the value of the current system data meets the thread update condition; if so, obtain the current thread number of the system.

[0031] The processing thread module is used to update the thread processing the current system data according to the current number of threads and a preset thread update strategy.

[0032] Optionally, the device for processing system data is characterized by:

[0033] The current system data includes one or more types of data;

[0034] Determining whether the value of the current system data meets the thread update condition includes:

[0035] Determine whether the data volume of any one of the types of data is not less than the first set threshold corresponding to the type, or determine whether the data volume of any one of the types of data is not greater than the second set threshold corresponding to the type. If so, determine that the value of the current system data meets the thread update condition.

[0036] Optionally, the device for processing system data is characterized by further comprising:

[0037] When the amount of data of each type is less than the corresponding first set threshold or the amount of data of each type is greater than the corresponding second set threshold,

[0038] It is determined whether the length of the current waiting queue of the system is greater than a set queue threshold, and if so, it is determined that the value of the current system data meets the thread update condition.

[0039] Optionally, the device for processing system data is characterized by a preset thread update strategy, including: reducing the number of threads for the system when the data volume of any one of the types of data is not less than a first set threshold corresponding to the type or the data volume of any one of the types of data is not greater than a second set threshold corresponding to the type.

[0040] Optionally, the device for processing system data is characterized in that the preset thread update strategy further includes: when the length of the current waiting queue is greater than a set queue threshold, increasing the number of threads for the system.

[0041] Optionally, the device for processing system data is characterized by further comprising:

[0042] Obtain the current number of threads of the system including the maximum number of threads, the number of core threads and / or the number of running threads;

[0043] The step of updating the thread for processing the current system data is performed by using the maximum number of threads, the number of core threads and / or the number of running threads.

[0044] Optionally, the device for processing system data is characterized in that updating the thread for processing the current system data further includes: reducing the maximum number of threads based on a set first thread adjustment ratio.

[0045] Optionally, the device for processing system data is characterized in that the updating of the thread for processing the current system data further includes: if the reduced maximum number of threads is greater than the core number of threads, updating the core number of threads to the reduced maximum number of threads.

[0046] Optionally, the device for processing system data is characterized in that the thread for updating the processing of the current system data further includes: if the number of running threads is greater than the number of core threads and less than the maximum number of threads, updating the maximum number of threads to the number of running threads; and reducing the number of core threads based on a set second thread adjustment ratio.

[0047] Optionally, the device for processing system data is characterized in that the thread for updating the processing of the current system data further includes: if the acquired number of running threads is less than the acquired number of core threads, updating the maximum number of threads to the value of the number of core threads; and reducing the number of core threads based on a set third thread adjustment ratio and the number of running threads.

[0048] Optionally, the device for processing system data is characterized in that updating the thread for processing the current system data further comprises: when the length of the current waiting queue is greater than a set queue threshold, obtaining the number of core threads and the maximum number of threads of the system;

[0049] Determine whether the values ​​of the core thread number and the maximum thread number are the same,

[0050] If yes, increasing the maximum number of threads based on the set fourth thread adjustment ratio;

[0051] Otherwise, increase the number of core threads or the maximum number of threads so that the number of core threads and the maximum number of threads are the same.

[0052] Optionally, the device for processing system data is characterized in that updating the thread for processing the current system data further comprises:

[0053] The increase in the number of core threads is controlled not to exceed the number of cores of the central processing unit of the system or a core threshold is set; the increase in the maximum number of threads is controlled not to exceed a set multiple of the number of cores of the central processing unit of the system or a maximum threshold is set.

[0054] To achieve the above-mentioned purpose, according to the third aspect of an embodiment of the present invention, there is provided an electronic device for processing system data, characterized in that it comprises: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described in the above-mentioned methods for processing system data.

[0055] To achieve the above-mentioned purpose, according to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, any method as described in the above-mentioned method for processing system data is implemented.

[0056] An embodiment of the above invention has the following advantages or beneficial effects: it can obtain system data, determine whether to update the system thread based on the value of the system data, and if so, update the thread that processes the current system data; improve the real-time and automation level of processing server system pressure problems, improve the stability of the server system, and improve the user experience of obtaining data from the server.

[0057] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0059] Figure 1 It is a flowchart of a method for processing system data provided by an embodiment of the present invention;

[0060] Figure 2 It is a flowchart of updating a system thread provided by an embodiment of the present invention;

[0061] Figure 3 is a schematic diagram of the structure of a device for processing system data provided by an embodiment of the present invention;

[0062] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0063] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0064] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0065] like Figure 1 As shown, an embodiment of the present invention provides a method for processing system data, which may include the following steps:

[0066] Step S101: Acquire current system data of the system running on the device.

[0067] Specifically, system data of a system on a device (eg, a server) is obtained, where the system may be an operating system, or a system for processing data, such as a JVM (Java Virtual Machine) system. The present invention takes the JVM system as an example to describe a method for processing system data.

[0068] Furthermore, the current system data includes one or more types of data; for example: memory information of the JVM system, network rate, and network throughput; wherein, the method for obtaining the memory information of the JVM system can be obtained by utilizing the JVM's runtime tool library or the JAVA tool library, for example: obtaining the memory information used by the current JVM or the remaining available memory information; the method for obtaining network information, for example: network rate and network throughput can be obtained by utilizing the open source JAVA component SNMP4J (or other third-party open source components), or a custom tool; the data on the relevant required network bandwidth can be preset by the administrator or the bandwidth can be calculated by a custom tool.

[0069] Furthermore, the current system data includes one or more types of data, and may also include the length of the current waiting queue of the system. For example, the information of the current waiting queue may be obtained through the getQueue().remainingCapacity() method.

[0070] Furthermore, the current system data is obtained according to a set time interval, for example, a timer is set to start the process of obtaining data; the module for obtaining system data can be deployed in the running system, or it can be independent of the currently running system and collect (obtain) system data through a remote method. It is understandable that the timer can be controlled, and if the thread update condition is not met, the timer interval can be modified to achieve dynamic adjustment.

[0071] Step S102: determine whether the value of the current system data meets the thread update condition; if so, obtain the number of running threads of the system.

[0072] Specifically, the description of the current system data is consistent with the description of step S101 and will not be repeated here. Further, it is determined whether the value of the current system data meets the thread update condition. If so, the current number of threads of the system is obtained.

[0073] Specifically, determining whether the value of the current system data meets the thread update condition includes:

[0074] Determine whether the data volume of any one of the types of data is not less than a first set threshold value corresponding to the type, or determine whether the data volume of any one of the types of data is not greater than a second set threshold value corresponding to the type; if so, determine whether the value of the current system data satisfies the thread update condition; for example: determine whether the memory information is not less than 80% of the maximum value; whether the network rate is not less than 50% of the maximum value; wherein the memory information or the network rate is any one type of data, and 80% and 50% are the first set threshold values; for another example: determine whether the remaining memory information is not greater than 20%, the memory information is any one type of data, and 20% is the second set threshold value; the present invention does not limit the specific values ​​and specific formats of the first set threshold value and the second set threshold value.

[0075] Further, if the length of the current waiting queue is a part of the current system data, then the data volume of each type of data described above is greater than the corresponding first set threshold or it is judged whether the data volume of any type of data is not greater than the second set threshold corresponding to the type, specifically refers to: whether the data of each type other than the length of the current waiting queue is not less than the first set threshold corresponding to the type or it is judged whether the data volume of any type of data is not greater than the second set threshold corresponding to the type; further, when the data volume of each type of data is less than the corresponding first set threshold or the data volume of each type of data is greater than the corresponding second set threshold, it is judged whether the length of the current waiting queue of the system is greater than the set queue threshold, and if so, it is determined that the value of the current system data meets the thread update condition. Wherein, the set queue threshold can be the maximum waiting queue (for example: obtained by getLargestPoolSize) or the set queue threshold (for example: 85%); the present invention does not limit the specific value and specific format of the set queue threshold.

[0076] Furthermore, when it is determined that the value of the current system data satisfies the thread update condition; the current number of threads of the system is obtained; specifically, obtaining the current number of threads includes obtaining the maximum number of threads, the number of core threads, and / or the number of running threads, and based on the obtained numbers of threads, the number of threads of the current system can be dynamically updated to realize real-time monitoring of the system data of the system, and based on the system data, the operation of updating the threads is executed without human intervention, thereby improving the real-time and efficiency of processing system data.

[0077] Step S103: updating the thread for processing the current system data according to the current number of threads and a preset thread update strategy.

[0078] Specifically, obtaining the current number of threads includes obtaining the maximum number of threads, the number of core threads, and / or the number of running threads of the system; further, updating the thread for processing the current system data according to the current number of threads and a preset thread update strategy.

[0079] Among them, the preset thread update strategy includes: reducing the number of threads for the system when the data volume of any one of the types of data is not less than the first set threshold corresponding to the type or the data volume of any one of the types of data is not greater than the second set threshold corresponding to the type.

[0080] Furthermore, when the data volume of each type of data is less than the corresponding first set threshold or the data volume of each type of data is greater than the corresponding second set threshold, determine whether the length of the current waiting queue of the system is greater than the set queue threshold; if the length of the current waiting queue is greater than the set queue threshold, increase the number of threads for the system.

[0081] The description of updating (increasing or reducing) the thread that processes the current system data according to a preset thread update strategy is consistent with the description of steps S201 to S206 and will not be repeated here; wherein, the thread that processes the current system data includes a thread that processes a task corresponding to the current system data, and each task running on the thread is associated with each system data. For example, when the JVM memory information exceeds a set threshold, the efficiency of processing the task is reduced, etc. Therefore, the thread that processes the task is dynamically and accurately updated according to the system operation status indicated by the system data.

[0082] There are two methods for implementing steps S101 to S103:

[0083] The first method is to integrate the code implemented based on the method of the present invention into the service of the JVM system to be monitored or dynamically optimized.

[0084] The second method is to use the code implemented based on the method of the present invention as a separate service, and to monitor or dynamically optimize the JVM service through a RESTFUL interface or RMI (remote method invocation).

[0085] It can be seen that by automatically updating the threads of the system, the server can automatically adjust the pressure of processing data to improve the stability of the server system. In addition, when updating the number of threads for the system, the system administrator does not need to determine whether the tasks running in the system are CPU-intensive tasks or network-intensive tasks, and it is also impossible to distinguish the types of various tasks; the embodiment of the present invention determines whether to update the number of threads through memory information and network information, thereby improving the efficiency and automation of optimizing the number of threads in the system thread pool and improving the stability of the system.

[0086] like Figure 2 As shown, an embodiment of the present invention provides a method for processing system data, which may include the following steps:

[0087] Step S201: Acquire current system data including one or more types of data.

[0088] Specifically, the description on obtaining the current system data and the description that the current system data includes one or more types of data are consistent with the description of step S101 and are not repeated here.

[0089] Step S202: Determine whether the data volume of any one of the types of data is not less than a first set threshold corresponding to the type or determine whether the data volume of any one of the types of data is not greater than a second set threshold corresponding to the type.

[0090] Specifically, the description of determining whether the data volume of any one of the types of data is not less than the first set threshold corresponding to the type or determining whether the data volume of any one of the types of data is not greater than the second set threshold corresponding to the type is consistent with the description of step S102 and will not be repeated here.

[0091] Further, when the data volume of any one of the types of data is not less than the first set threshold corresponding to the type or the data volume of any one of the types of data is not greater than the second set threshold corresponding to the type, execute step S204; otherwise, execute step S203.

[0092] Step S203: Determine whether the length of the current waiting queue of the system is greater than a set queue threshold.

[0093] Specifically, the description about the current waiting queue and determining whether the length of the current waiting queue of the system is greater than the set queue threshold is consistent with the description of step S102 and will not be repeated here.

[0094] If so, that is, when it is determined that the length of the current waiting queue of the system is greater than the set queue threshold, step S205 is executed; otherwise, step S206 is executed.

[0095] Step S204: reducing the number of threads for the system.

[0096] Specifically, when it is determined that the number of threads for the system needs to be reduced, the maximum number of threads, the number of core threads and / or the number of running threads included in the current number of threads of the system are obtained; the step of updating the thread processing the current system data is performed using the maximum number of threads, the number of core threads and / or the number of running threads. The maximum number of threads can be obtained using the getMaximumPoolSize method, the number of core threads can be obtained using the getCorePoolSize method, and the number of running threads can be obtained using the getActiveCount method; the step of updating the thread processing the current system data includes reducing the number of threads for the system.

[0097] Furthermore, updating the thread further includes: reducing the maximum number of threads based on the set first thread adjustment ratio. The first thread adjustment ratio is set according to the system situation and usage scenario. For example, if the first thread adjustment ratio is set to 75%, the maximum number of threads is reduced to 75% of the current maximum number of threads. The method used may be setMaximumPoolSize, and the result obtained is the adjusted maximum number of threads, that is, the value obtained by multiplying the maximum number of threads before adjustment by 75%. It can be understood that the calculated result is rounded. That is, based on the set first thread adjustment ratio, the maximum number of threads is reduced.

[0098] Furthermore, if the maximum number of threads after the reduction is greater than the number of core threads, the number of core threads is updated to the maximum number of threads after the reduction. For example, if the number of core threads is 10 and the maximum number of threads after the reduction is 15, it can be seen that the maximum number of threads after the reduction is greater than the number of core threads, the number of core threads is updated to 15, that is, the number of core threads is updated to the maximum number of threads after the reduction.

[0099] Alternatively, the number of running threads is obtained. If the number of running threads is greater than the number of core threads and less than the maximum number of threads, the maximum number of threads is updated to the number of running threads; based on the set second thread adjustment ratio, the number of core threads is reduced. For example: the number of running threads is 20, the number of core threads is 18, and the maximum number of threads is 22, that is, the number of running threads is greater than the number of core threads and less than the maximum number of threads, then the maximum number of threads is updated from 22 to 20, that is, the maximum number of threads is updated to the number of running threads, which is another method of reducing the maximum number of threads. Further, if the set second thread adjustment ratio is 80%, the number of core threads is reduced to 80% of the current value, and 14 is rounded, that is, based on the set second thread adjustment ratio, the number of core threads is reduced; wherein, the number of running threads is associated with the number of core threads and the maximum number of threads, so as to achieve the technical effect of dynamically adjusting threads.

[0100] Further judgment: if the obtained number of running threads is less than the obtained number of core threads, the maximum number of threads is updated to the value of the core number of threads; based on the set third thread adjustment ratio and the number of running threads, the number of core threads is reduced. For example: the number of running threads is 16, the number of core threads is 20, and the maximum number of threads is 22, that is, the number of running threads is less than the obtained number of core threads, then the maximum number of threads is updated to 20, that is, the maximum number of threads is updated to the value of the core number of threads, and based on the set third thread adjustment ratio (for example: 90%), the number of core threads is updated to 16*90%, and 14 is rounded, that is, based on the set third thread adjustment ratio and the number of running threads, the number of core threads is reduced.

[0101] It can be understood that, in order to determine whether the value of the current system data meets the thread update condition, if the number of threads needs to be reduced, it is also necessary to determine whether the number of threads included in the current number of threads is the minimum value; for example: assuming that the minimum value of the maximum number of threads included in the current number of threads is 1, if it is the minimum value, the update operation will not be performed for the number of threads.

[0102] Step S205: increasing the number of threads for the system.

[0103] Specifically, when it is determined that the number of threads for the system needs to be increased, the maximum number of threads and the number of core threads of the system are obtained; and the step of updating the thread for processing the current system data is performed using the maximum number of threads and the number of core threads. The step of updating the thread for processing the current system data includes increasing the number of threads for the system.

[0104] That is, when the length of the current waiting queue is greater than the set queue threshold, the core thread number and the maximum thread number of the system are obtained; it is determined whether the core thread number and the maximum thread number have the same value. If so, the maximum thread number is increased based on the set fourth thread adjustment ratio; otherwise, the core thread number or the maximum thread number is increased to make the core thread number and the maximum thread number have the same value. For example: the core thread number is 20 and the maximum thread number is 20, that is, the core thread number and the maximum thread number have the same value, then the maximum thread number is increased based on the set fourth thread adjustment ratio. For example, if the set fourth thread adjustment ratio is 10%, the maximum thread number is increased to 22. If the core thread number is 18 and the maximum thread number is 20, that is, the core thread number and the maximum thread number are not the same value, then the core thread number or the maximum thread number is increased to make the core thread number and the maximum thread number have the same value. For example, the number of core threads is increased from 18 to 20 (the maximum number of threads is 20), so that the value of the core thread number and the maximum number of threads are the same.

[0105] Furthermore, in the case of adding threads, the number of core threads is controlled not to exceed the number of cores of the central processing unit of the system or a core threshold is set; the number of maximum threads is controlled not to exceed a set multiple of the number of cores of the central processing unit of the system, or a maximum threshold is set. It can be understood that in the case of adding threads, when setting the fourth thread adjustment ratio, it is necessary to determine it in combination with the number of cores of the central processing unit (CPU) corresponding to the system. Preferably, the number of core threads is controlled not to exceed the number of cores of the central processing unit of the system or a core threshold is set; the number of maximum threads is controlled not to exceed a set multiple of the number of cores of the central processing unit of the system, wherein the set core threshold and the set multiple of the number of cores of the central processing unit (for example, 2 times) can be set by the system administrator according to the scenario and the use experience of the system.

[0106] It can be understood that the values ​​of the maximum number of threads, the number of core threads, and the number of running threads used in the above examples are only examples, and the present invention does not limit the order of magnitude and values ​​of each value; in addition, the first thread adjustment ratio, the second thread adjustment ratio, the third thread adjustment ratio, and the fourth thread adjustment ratio are set according to the application scenario, and these four values ​​can be all equal, partially equal, or unequal.

[0107] Step S206: End.

[0108] like Figure 3As shown, the embodiment of the present invention provides a device 300 for processing system data, including: a data acquisition module 301, a data determination module 302 and a thread processing module 303; wherein,

[0109] The data acquisition module 301 is used to acquire current system data of the system running on the device;

[0110] The data determination module 302 is used to determine whether the value of the current system data meets the thread update condition; if so, the current number of threads of the system is obtained.

[0111] The processing thread module 303 is used to update the thread processing the current system data according to the current number of threads and a preset thread update strategy.

[0112] An embodiment of the present invention also provides an electronic device for processing system data, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.

[0113] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method provided in any of the above embodiments is implemented.

[0114] Figure 4 An exemplary system architecture 400 is shown to which the method for processing system data or the apparatus for processing system data according to the embodiment of the present invention can be applied.

[0115] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0116] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Terminal devices 401, 402, 403 can be installed with various client applications, such as e-commerce client applications, web browser applications, search applications, etc.

[0117] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting various client applications, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0118] The server 405 may be a server that provides various services, such as a background management server that provides support for client applications used by users using the terminal devices 401, 402, and 403. The background management server may process the received data processing request and feed back the processing result to the terminal device.

[0119] It should be noted that the method for processing system data provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the device for processing system data is generally disposed in the server 405 .

[0120] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0121] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0122] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0123] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0124] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.

[0125] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0126] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0127] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be provided in a processor. For example, they may be described as follows: a processor includes a data acquisition module, a data judgment module, and a thread processing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the data acquisition module may also be described as a "module for acquiring current system data of a system running on a device."

[0128] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining the current system data of the system running on the device; determining whether the value of the current system data meets the thread update condition; if so, obtaining the current number of threads of the system; and updating the thread processing the current system data according to the current number of threads and the preset thread update strategy.

[0129] The embodiments of the present invention can obtain system data, determine whether to update the system thread based on the value of the system data, and if so, update the thread that processes the current system data; thereby improving the real-time and automation level of processing server system pressure issues, improving the stability of the server system, and improving the user experience of obtaining data from the server.

[0130] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for processing system data, characterized in that: include: Obtaining current system data of a system running on a device; wherein the system is a JVM system, and the current system data includes any one or more types of data: system memory information, network rate, network throughput, and length of a current waiting queue; Determine whether the value of the current system data meets the thread update condition; if so, obtain the current thread number of the system; According to the current number of threads and a preset thread update strategy, updating the thread processing the current system data; The method further includes: using the code implementing the method as a separate service, and using the separate service to implement the service of monitoring or dynamically optimizing the JVM system through a RESTFUL interface or a remote method call.

2. The method according to claim 1, characterized in that: Determining whether the value of the current system data meets the thread update condition includes: Determine whether the data volume of any one of the types of data is not less than the first set threshold corresponding to the type, or determine whether the data volume of any one of the types of data is not greater than the second set threshold corresponding to the type. If so, determine that the value of the current system data meets the thread update condition.

3. The method according to claim 2, characterized in that Further including: When the amount of data of each type is less than the corresponding first set threshold or the amount of data of each type is greater than the corresponding second set threshold, It is determined whether the length of the current waiting queue of the system is greater than a set queue threshold, and if so, it is determined that the value of the current system data meets the thread update condition.

4. The method according to claim 2, characterized in that: Preset thread update strategies, including: When the amount of data of any one of the types is not less than a first set threshold corresponding to the type or the amount of data of any one of the types is not greater than a second set threshold corresponding to the type, the number of threads for the system is reduced.

5. The method according to claim 3, characterized in that: The preset thread update strategy further includes: When the length of the current waiting queue is greater than a set queue threshold, the number of threads is increased for the system.

6. The method according to claim 4, characterized in that Further including: Obtain the current number of threads of the system including the maximum number of threads, the number of core threads and / or the number of running threads; The step of updating the thread for processing the current system data is performed by using the maximum number of threads, the number of core threads and / or the number of running threads.

7. The method according to claim 6, characterized in that The updating process of the thread for processing the current system data further comprises: Based on the set first thread adjustment ratio, the maximum number of threads is reduced.

8. The method according to claim 7, characterized in that The updating process of the thread for processing the current system data further comprises: If the reduced maximum number of threads is greater than the core number of threads, the core number of threads is updated to the reduced maximum number of threads.

9. The method according to claim 6, characterized in that The updating process of the thread for processing the current system data further comprises: If the number of running threads is greater than the number of core threads and less than the maximum number of threads, updating the maximum number of threads to the number of running threads; Based on the set second thread adjustment ratio, the number of core threads is reduced.

10. The method according to claim 6, characterized in that The updating process of the thread for processing the current system data further comprises: If the acquired number of running threads is less than the acquired number of core threads, updating the maximum number of threads to the value of the number of core threads; Based on the set third thread adjustment ratio and the number of running threads, the number of core threads is reduced.

11. The method according to claim 1, characterized in that The thread for updating and processing the current system data further comprises: When the length of the current waiting queue is greater than the set queue threshold, Obtain the number of core threads and the maximum number of threads of the system; Determine whether the values ​​of the core thread number and the maximum thread number are the same, If yes, increasing the maximum number of threads based on the set fourth thread adjustment ratio; Otherwise, increase the number of core threads or the maximum number of threads so that the number of core threads and the maximum number of threads are the same.

12. The method according to claim 11, characterized in that The thread for updating and processing the current system data further comprises: Control the increase in the number of core threads to not exceed the number of cores of the central processing unit of the system or set a core threshold; The increase in the maximum number of threads is controlled not to exceed a set multiple of the number of cores of the central processing unit of the system, or a maximum threshold is set.

13. A device for processing system data, characterized in that: include: Acquisition data module, judgment data module and processing thread module; wherein, The data acquisition module is used to acquire current system data of the system running on the device; wherein the system is a JVM system; the current system data includes any one or more types of data: system memory information, network rate, network throughput, and length of the current waiting queue; The data determination module is used to determine whether the value of the current system data meets the thread update condition; if so, obtain the current thread number of the system; The processing thread module is used to update the thread processing the current system data according to the current number of threads and a preset thread update strategy; The device is further used to use the code for implementing any method for processing system data as claimed in claims 1 to 12 as a separate service, and use the separate service to implement the service of monitoring or dynamically optimizing the JVM system through a RESTFUL interface or remote method call.

14. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 12.

15. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

  • Method and device for controlling thread quantity in thread pool

    CN107220033A

  • Linux system problem automatic analysis method and system

    CN107943657A

  • Mobile terminal, limiting method for inter-process communication of mobile terminal and storage medium

    CN108924128A

  • Thread control method and device based on cloud monitoring, electronic equipment and storage medium

    CN109840141A

  • Android system stability test device and method and storage medium

    CN111008115A