Processing method and device of node, electronic equipment and storage medium
Patent Information
- Application Number
- CN202210571374.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-24
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2042-05-24
AI Technical Summary
[0004]本申请实施例提供一种节点的处理方法、装置、电子设备及存储介质,能够解决无法均衡服务器集群的业务的问题
[0009]在本申请实施例中,通过获取服务器集群中的每个节点所对应的线程数量;根据所述每个节点所对应的线程数量,确定第一线程数阈值;根据所述每个节点所对应的线程数量和所述第一线程数阈值,确定大于所述第一线程数阈值的线程数量所对应的第一目标节点;确定每个节点群组中所述第一目标节点的节点数量,其中,所述节点群组由预先对所述服务器集群中的所有所述节点进行分组得到;基于所述第一目标节点的节点数量,对所述第一目标节点所对应的节点群组进行节点调整操作,以进行每个所述节点群组的业务均衡,能够根据节点群组的第一目标节点的节点数量对节点群组进行节点的调整,使得节点群组的业务更加均衡,提升了服务器的系统性能,解决了无法均衡服务器集群的业务的问题。
Smart Images

Figure CN117155935B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of server applications, and specifically relates to a node processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] Hiawatha is a secure web server developed for Linux / UNIX. Designed to provide a dedicated platform for high-performance websites, it features advanced access control to prevent SQL injection and cross-site scripting attacks, checks for abnormal client behavior and automatically blocks arbitrary UIDs / GIDs for running CGLs programs, and is easy to configure and manage. Hiawatha is one of the better open-source lightweight web servers available. Its main features include: security, ease of configuration, lightweight, reverse proxy, support for .htaccess, Mod_Security, CGI / FastCGI, URL rewriting, and other important functionalities.
[0003] However, once Hiawatha is configured, the node configuration in the server cluster is fixed. Especially when the server is under heavy load, the node configuration of the server cluster cannot be dynamically adjusted, resulting in an inability to balance the business of the server cluster. Summary of the Invention
[0004] This application provides a node processing method, apparatus, electronic device, and storage medium that can solve the problem of unbalanced business in server clusters.
[0005] In a first aspect, embodiments of this application provide a node processing method, the method comprising: obtaining the number of threads corresponding to each node in a server cluster; determining a first thread count threshold based on the number of threads corresponding to each node; determining a first target node corresponding to a number of threads greater than the first thread count threshold based on the number of threads corresponding to each node and the first thread count threshold; determining the number of nodes of the first target node in each node group, wherein the node group is obtained by pre-grouping all the nodes in the server cluster; and performing a node adjustment operation on the node group corresponding to the first target node based on the number of nodes of the first target node, so as to perform business balancing for each node group.
[0006] Secondly, embodiments of this application provide a node processing apparatus, comprising: an acquisition module for acquiring the number of threads corresponding to each node in a server cluster; a first determination module for determining a first thread count threshold based on the number of threads corresponding to each node; a second determination module for determining a first target node corresponding to a number of threads greater than the first thread count threshold based on the number of threads corresponding to each node and the first thread count threshold; a third determination module for determining the number of nodes of the first target node in each node group, wherein the node group is obtained by pre-grouping all the nodes in the server cluster; and an adjustment module for performing node adjustment operations on the node groups corresponding to the first target node based on the number of nodes of the first target node, so as to perform business balancing for each node group.
[0007] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0009] In this embodiment, the number of threads corresponding to each node in the server cluster is obtained; a first thread count threshold is determined based on the number of threads corresponding to each node; a first target node corresponding to a number of threads greater than the first thread count threshold is determined based on the number of threads corresponding to each node and the first thread count threshold; the number of nodes of the first target node in each node group is determined, wherein the node group is obtained by pre-grouping all the nodes in the server cluster; based on the number of nodes of the first target node, a node adjustment operation is performed on the node group corresponding to the first target node to achieve business balancing of each node group. This allows for node adjustment of the node group based on the number of nodes of the first target node in the node group, making the business of the node group more balanced, improving the system performance of the server, and solving the problem of unbalanced business of the server cluster. Attached Figure Description
[0010] Figure 1 This is a flowchart illustrating a node processing method provided in an embodiment of this application;
[0011] Figure 2 This is a schematic diagram of the structure of a node processing device according to an embodiment of this application;
[0012] Figure 3 This is a schematic diagram of the structure of an electronic device according to another embodiment of this application. Detailed Implementation
[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0014] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0015] The node processing method, apparatus, electronic device, and storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0016] Figure 1 This illustration shows a node processing method according to an embodiment of the present invention. The method can be executed by an electronic device, which may include a server. In other words, the method can be executed by software or hardware installed on the electronic device, and the method includes the following steps:
[0017] Step 102: Obtain the number of threads corresponding to each node in the server cluster.
[0018] Specifically, nodes can be workstations, clients, network users, or personal computers, as well as servers, printers, and other network-connected devices; no specific limitations are made here.
[0019] You can configure server monitoring to enable monitoring of server cluster nodes from within the server cluster. Specifically, you can configure a mod_status module by editing the server cluster's module.conf configuration file and loading the mod_status module to monitor the server cluster nodes. You can also set up a crawling script to obtain the number of threads corresponding to each node in the server cluster through the server cluster's monitoring status interface.
[0020] Step 104: Determine the first thread count threshold based on the number of threads corresponding to each node.
[0021] Step 106: Based on the number of threads corresponding to each node and the first thread number threshold, determine the first target node corresponding to the number of threads that is greater than the first thread number threshold.
[0022] Specifically, the number of threads corresponding to each node can be compared with the first thread threshold, and the node corresponding to the number of threads that exceeds the first thread threshold can be determined as the first target node.
[0023] Step 108: Determine the number of nodes of the first target node in each node group.
[0024] Specifically, the node group is obtained by pre-grouping all the nodes in the server cluster.
[0025] All nodes in the server cluster can be pre-grouped. Grouping can be done according to the size of the nodes in the current server cluster, or by grouping them equally according to the number of nodes. For example, if there are 30 nodes in the server cluster, and they are divided into 6 nodes per group, then there will be 5 node groups, and each of the 2 node groups will contain 6 nodes.
[0026] Based on each node in each node group, the number of first target nodes in each node group whose number of threads is greater than the first thread count threshold can be determined.
[0027] Step 110: Based on the number of nodes of the first target node, perform node adjustment operations on the node groups corresponding to the first target node to achieve service balancing for each node group.
[0028] Specifically, based on the number of first target nodes in each node group, node adjustment operations can be performed on the node groups corresponding to the first target nodes. For example, if the number of first target nodes in a node group is too large, the nodes in that node group need to be adjusted to achieve business balance in that node group.
[0029] The node processing method provided in this embodiment of the invention obtains the number of threads corresponding to each node in the server cluster; determines a first thread count threshold based on the number of threads corresponding to each node; determines a first target node corresponding to the number of threads greater than the first thread count threshold based on the number of threads corresponding to each node and the first thread count threshold; and determines the number of nodes of the first target node in each node group. The node group is obtained by pre-grouping all nodes in the server cluster, and the node group can be adjusted according to the number of nodes of the first target node in the node group, making the business of the node group more balanced, improving the system performance of the server, and solving the problem of unbalanced business in the server cluster.
[0030] In one implementation, determining the first thread count threshold based on the number of threads corresponding to each node includes:
[0031] Based on the number of threads corresponding to each node, determine the second thread count threshold corresponding to each node group;
[0032] The first thread count threshold is determined based on the second thread count threshold corresponding to each node group.
[0033] Specifically, the second thread count threshold for each node group can be determined based on the number of threads in the nodes corresponding to each node group, and the first thread count threshold can be determined based on the second thread count threshold for each node group.
[0034] In one implementation, determining the second thread count threshold corresponding to each node group based on the number of threads corresponding to each node includes:
[0035] The second thread count threshold is calculated using the following formula;
[0036]
[0037] Wherein, θ represents the second thread count threshold, x represents the number of nodes corresponding to the node group, and ω i The number of threads corresponding to the i-th node in the node group is represented by t, which represents the time record value and is 1 by default. K represents the business trough variable, which is 0.8 during business peak time and 1 during business trough time.
[0038] Thus, the threshold number of the first thread for each node group can be calculated using the above formula.
[0039] As an example, continuing from the previous example, let t be 1, K be 1, and the 5 node groups be node group A, node group B, node group C, node group D, and node group E:
[0040] A(1, 12, 2, 3, 11, 1), the number of threads corresponding to each node in node group A are 3, 5, 4, 6, 8 respectively. According to the above formula, the second thread number threshold of node group A is 5.
[0041] B(6, 5, 3, 2, 10, 10), the number of threads corresponding to each node in node group B is 6, 6, 3, 4, 8, 9 respectively. According to the above formula, the second thread number threshold of node group B is 6.
[0042] C(1, 1, 3, 4, 2, 1), the number of threads corresponding to each node in node group C is 1, 1, 3, 5, 2, 1 respectively. According to the above formula, the second thread number threshold of node group C is 2.
[0043] D(4, 6, 4, 8, 2, 5), the number of threads corresponding to each node in node group D are 4, 6, 4, 8, 2, 5 respectively. According to the above formula, the second thread number threshold of node group C is calculated to be 5.
[0044] E(11, 4, 2, 2, 12, 11), the number of threads corresponding to each node in node group E are 8, 6, 3, 6, 10, and 9 respectively. According to the above formula, the second thread number threshold of node group E is calculated to be 7.
[0045] In one implementation, determining the first thread count threshold based on the second thread count threshold corresponding to each node group includes:
[0046] The first thread threshold is calculated using the following formula;
[0047]
[0048] Where L represents the first thread count threshold, m represents the number of node groups, and θ represents the number of nodes. r This represents the threshold number of the second thread corresponding to the r-th node group.
[0049] Thus, the threshold for the first number of threads can be calculated using the above formula.
[0050] Continuing with the example above, the number of node groups is 5, the second thread threshold for node group A is 5, the second thread threshold for node group B is 6, the second thread threshold for node group C is 2, the second thread threshold for node group D is 5, and the second thread threshold for node group E is 7. Therefore, the first thread threshold calculated using the above formula is 10.
[0051] In one implementation, determining the number of nodes of the first target node in each node group includes:
[0052] The number of nodes in the first target node can be calculated using the following formula;
[0053]
[0054] Where f represents the number of nodes in the first target node, x represents the number of nodes corresponding to the node group, and ω i L represents the number of threads corresponding to the i-th node in the node group, and L represents the first thread count threshold.
[0055] Thus, the number of nodes in the first target node in each node group can be calculated using the above formula.
[0056] Continuing with the example above, using the formula above, we find that the number of nodes in node group A that are greater than the first thread number threshold is 2, the number of nodes in node group B that are greater than the first thread number threshold is 0, the number of nodes in node group C that are greater than the first thread number threshold is 0, the number of nodes in node group D that are greater than the first thread number threshold is 0, and the number of nodes in node group E that are greater than the first thread number threshold is 3.
[0057] In one implementation, the step of adjusting the node group corresponding to the first target node based on the number of nodes of the first target node includes:
[0058] If the number of nodes corresponding to the first target node in any of the node groups is greater than a preset first node threshold, then a first preset number of nodes are added to any of the node groups.
[0059] Specifically, if the number of nodes corresponding to the first target node in any node group is greater than the preset first node threshold, it indicates that the service pressure of the nodes in the group is too high. In this case, a first preset number of nodes will be added to the node group to balance the service in the group. The preset number of nodes and the first preset number can be set according to actual needs.
[0060] In this way, if the number of nodes corresponding to the first target node in any node group is greater than a preset first node threshold, then a first preset number of nodes can be added to any node group. This can adjust the nodes in the node group where the number of nodes corresponding to the first target node is greater than the preset first node threshold, making the business of the node group more balanced, improving the system performance of the server, and solving the problem of unbalanced business of the server cluster.
[0061] Continuing with the example above, if the preset first node threshold is 2, the first preset number is 1, the number of nodes in node group A that are greater than the first thread number threshold is 2, the number of nodes in node group B that are greater than the first thread number threshold is 0, the number of nodes in node group C that are greater than the first thread number threshold is 0, the number of nodes in node group D that are greater than the first thread number threshold is 0, and the number of nodes in node group E that are greater than the first thread number threshold is 3, then the number of nodes corresponding to the first target node in node group E is greater than the preset first node threshold. Therefore, a new node is added to node group E to balance the business of the node group.
[0062] Optionally, the number of threads corresponding to each node in the server cluster can be obtained at at least three preset time points. The number of nodes of the first target node corresponding to each node group at each time point can be calculated using the above method. If the number of nodes of the first target node corresponding to the node group at any two adjacent time points is greater than the first preset node threshold, a new node is added to the node group to balance the business. In this way, the judgment of the business pressure of the corresponding node group can be more accurate through multiple rounds of comparison and calculation.
[0063] In one implementation, the method further includes:
[0064] If, in any of the node groups, the number of second target nodes whose thread count is less than the first thread count threshold is less than a preset second node threshold, then a second preset number of nodes are deleted from any of the node groups.
[0065] If the number of second target nodes in any node group whose number of threads is less than the first thread threshold is less than the preset second node threshold, it indicates that the node business pressure in the node cluster is relatively light. In this case, a second preset number of nodes can be deleted from the node group to balance the business in the node group.
[0066] Continuing the example above, if the second node threshold is 1, the second preset number is 1, the number of nodes in node group A that are greater than the first thread number threshold is 2, the number of nodes in node group B that are greater than the first thread number threshold is 0, the number of nodes in node group C that are greater than the first thread number threshold is 0, the number of nodes in node group D that are greater than the first thread number threshold is 0, and the number of nodes in node group E that are greater than the first thread number threshold is 3, therefore, the number of nodes of the second target node corresponding to node group B, node group C, and node group D is all less than the preset second node threshold. In this case, one node is deleted from each of node group B, node group C, and node group D to perform business balancing of the node groups.
[0067] Optionally, the number of threads corresponding to each node in the server cluster can be obtained at at least three preset time points. The number of nodes of the second target node corresponding to each node group at each time point can be calculated using the above method. If the number of nodes of the second target node corresponding to the node group at all time points is less than the second preset node threshold, a node is deleted from the node group to balance the business. In this way, the judgment of the business pressure of the corresponding node group can be more accurate through multiple rounds of comparison and calculation.
[0068] It should be noted that the node processing method provided in this application embodiment can be executed by a node processing device or a control module within that node processing device for executing the node processing method. This application embodiment uses the execution of the node processing method by a node processing device as an example to illustrate the node processing device provided in this application embodiment.
[0069] Figure 2 This is a schematic diagram of the structure of a node processing device according to an embodiment of the present invention. Figure 2 As shown, the node processing device 200 includes: an acquisition module 210, a first determination module 220, a second determination module 230, a third determination module 240, and an adjustment module 250.
[0070] The acquisition module 210 is used to acquire the number of threads corresponding to each node in the server cluster; the first determination module 220 is used to determine a first thread count threshold based on the number of threads corresponding to each node; the second determination module 230 is used to determine a first target node corresponding to a number of threads greater than the first thread count threshold based on the number of threads corresponding to each node and the first thread count threshold; the third determination module 240 is used to determine the number of nodes of the first target node in each node group, wherein the node group is obtained by pre-grouping all the nodes in the server cluster; and the adjustment module 250 is used to perform node adjustment operations on the node group corresponding to the first target node based on the number of nodes of the first target node, so as to perform business balancing for each node group.
[0071] In one implementation, the first determining module 220 is configured to: determine a second thread count threshold corresponding to each node group based on the number of threads corresponding to each node; and determine a first thread count threshold based on the second thread count threshold corresponding to each node group.
[0072] In one implementation, the first determining module 220 is configured to: calculate the second thread number threshold using the following formula;
[0073]
[0074] Wherein, θ represents the second thread count threshold, x represents the number of nodes corresponding to the node group, and ω i The number of threads corresponding to the i-th node in the node group is represented by t, which represents the time record value and is 1 by default. K represents the business trough variable, which is 0.8 during business peak time and 1 during business trough time.
[0075] In one implementation, the first determining module 220 is configured to: calculate the first thread threshold using the following formula;
[0076]
[0077] Where L represents the first thread count threshold, m represents the number of node groups, and θ represents the number of nodes. r This represents the threshold number of the second thread corresponding to the r-th node group.
[0078] In one implementation, the third determining module 240 is used to calculate the number of nodes of the first target node using the following formula;
[0079]
[0080] Where f represents the number of nodes in the first target node, x represents the number of nodes corresponding to the node group, and ω i L represents the number of threads corresponding to the i-th node in the node group, and L represents the first thread count threshold.
[0081] In one implementation, the adjustment module 250 is configured to: if the number of nodes corresponding to the first target node in any node group is greater than a preset first node threshold, then add a first preset number of nodes to any node group.
[0082] In one implementation, the adjustment module 250 is further configured to: if the number of nodes of a second target node in any of the node groups whose number of threads is less than the first thread number threshold is less than a preset second node threshold, then delete a second preset number of nodes in any of the node groups.
[0083] The processing device for the node in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0084] The node processing device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0085] The node processing device provided in this application embodiment can implement the various processes implemented in the method embodiment of 1. To avoid repetition, it will not be described again here.
[0086] Optionally, such as Figure 3As shown in the illustration, this application embodiment also provides an electronic device 300, including a processor 301 and a memory 302. The memory 302 stores a program or instructions that can run on the processor 301. When the program or instructions are executed by the processor 301, they perform the following: obtaining the number of threads corresponding to each node in a server cluster; determining a first thread count threshold based on the number of threads corresponding to each node; determining a first target node corresponding to a number of threads greater than the first thread count threshold based on the number of threads corresponding to each node and the first thread count threshold; determining the number of nodes of the first target node in each node group, wherein the node group is obtained by pre-grouping all the nodes in the server cluster; and performing a node adjustment operation on the node group corresponding to the first target node based on the number of nodes of the first target node to achieve service balancing for each node group.
[0087] In one implementation, a second thread count threshold corresponding to each node group is determined based on the number of threads corresponding to each node; and a first thread count threshold is determined based on the second thread count threshold corresponding to each node group.
[0088] In one implementation, the second thread count threshold is calculated using the following formula;
[0089]
[0090] Wherein, θ represents the second thread count threshold, x represents the number of nodes corresponding to the node group, and ω i The number of threads corresponding to the i-th node in the node group is represented by t, which represents the time record value and is 1 by default. K represents the business trough variable, which is 0.8 during business peak time and 1 during business trough time.
[0091] In one implementation, the first thread threshold is calculated using the following formula;
[0092]
[0093] Where L represents the first thread count threshold, m represents the number of node groups, and θ represents the number of nodes. r This represents the threshold number of the second thread corresponding to the r-th node group.
[0094] In one implementation, the number of nodes of the first target node is calculated using the following formula;
[0095]
[0096] Where f represents the number of nodes in the first target node, x represents the number of nodes corresponding to the node group, and ω i L represents the number of threads corresponding to the i-th node in the node group, and L represents the first thread count threshold.
[0097] In one implementation, if the number of nodes corresponding to the first target node in any of the node groups is greater than a preset first node threshold, then a first preset number of nodes are added to any of the node groups.
[0098] In one implementation, if the number of second target nodes in any node group whose number of threads is less than the first thread number threshold is less than a preset second node threshold, then a second preset number of nodes are deleted from any node group.
[0099] The specific execution steps can be found in the various steps of the above-mentioned node processing method embodiments, and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0100] It should be noted that the electronic devices in the embodiments of this application include: servers, terminals, or other devices besides terminals.
[0101] The above electronic device structure does not constitute a limitation on the electronic device. An electronic device may include more or fewer components than illustrated, or combine certain components, or arrange them differently. For example, an input unit may include a Graphics Processing Unit (GPU) and a microphone, and a display unit may use a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar display panels. User input units include at least one of a touch panel and other input devices. A touch panel is also called a touchscreen. Other input devices may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be elaborated further here.
[0102] Memory can be used to store software programs and various data. Memory can primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area can store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, memory can include volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SynchlinkDRAM, SLDRAM), and direct memory bus RAM (DRRAM).
[0103] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly handles operations related to the operating system, user interface, and applications, while the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor.
[0104] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-mentioned node processing method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0105] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as ROM, RAM, magnetic disk, or optical disk.
[0106] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0107] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0108] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method for processing nodes, characterized in that, The method includes: Get the number of threads corresponding to each node in the server cluster; Determine the first thread count threshold based on the number of threads corresponding to each node; Based on the number of threads corresponding to each node and the first thread number threshold, determine the first target node corresponding to the number of threads that is greater than the first thread number threshold; Determine the number of nodes of the first target node in each node group, wherein the node group is obtained by pre-grouping all the nodes in the server cluster; Based on the number of nodes of the first target node, a node adjustment operation is performed on the node group corresponding to the first target node to achieve service balancing for each node group; The step of determining the first thread count threshold based on the number of threads corresponding to each node includes: Based on the number of threads corresponding to each node, determine the second thread count threshold corresponding to each node group; The first thread count threshold is determined based on the second thread count threshold corresponding to each node group; The step of determining the second thread count threshold corresponding to each node group based on the number of threads corresponding to each node includes: The second thread count threshold is calculated using the following formula; ; Among them, the This represents the second thread count threshold, the This indicates the number of nodes corresponding to a node group. This represents the number of threads corresponding to each node in the i-th node group. This represents the time recording value, where t defaults to 1. The variable represents the business trough, where k is 0.8 during business peak periods and 1 during business trough periods. Determining the first thread count threshold based on the second thread count threshold corresponding to each node group includes: The first thread count threshold is calculated using the following formula; ; Among them, the Indicates the first thread count threshold, m represents the number of node groups, and the... This represents the threshold number of the second thread corresponding to the r-th node group.
2. The processing method according to claim 1, characterized in that, Determining the number of nodes of the first target node in each node group includes: The number of nodes in the first target node can be calculated using the following formula; ; Among them, the This indicates the number of nodes in the first target node. This indicates the number of nodes corresponding to the node group. This represents the number of threads corresponding to the i-th node in the node group. This represents the threshold number of the first thread.
3. The processing method according to claim 1, characterized in that, The step of adjusting the nodes in the node group corresponding to the first target node based on the number of nodes in the first target node includes: If the number of nodes corresponding to the first target node in any of the node groups is greater than a preset first node threshold, then a first preset number of nodes are added to any of the node groups.
4. The processing method according to claim 1, characterized in that, The method further includes: If, in any of the node groups, the number of second target nodes whose thread count is less than the first thread count threshold is less than a preset second node threshold, then a second preset number of nodes are deleted from any of the node groups.
5. A node processing apparatus, characterized in that, include: The acquisition module is used to obtain the number of threads corresponding to each node in the server cluster; The first determining module is used to determine a first thread number threshold based on the number of threads corresponding to each node; The second determining module is used to determine the first target node corresponding to the number of threads greater than the first thread number threshold based on the number of threads corresponding to each node and the first thread number threshold. The third determining module is used to determine the number of nodes of the first target node in each node group, wherein the node group is obtained by pre-grouping all the nodes in the server cluster; The adjustment module is used to perform node adjustment operations on the node group corresponding to the first target node based on the number of nodes of the first target node, so as to achieve service balancing for each node group. The first determining module is used to determine a second thread count threshold corresponding to each node group based on the number of threads corresponding to each node; The first thread count threshold is determined based on the second thread count threshold corresponding to each node group; The second thread count threshold is calculated using the following formula; ; Among them, the This represents the second thread count threshold, the This indicates the number of nodes corresponding to a node group. This represents the number of threads corresponding to each node in the i-th node group. This represents the time recording value, where t defaults to 1. The variable represents the business trough, where k is 0.8 during business peak periods and 1 during business trough periods. The first thread count threshold is calculated using the following formula; ; Among them, the Indicates the first thread count threshold, m represents the number of node groups, and the... This represents the threshold number of the second thread corresponding to the r-th node group.
6. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the processing method of the node as described in any one of claims 1-4.
7. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the node processing method as described in any one of claims 1-4.
Citation Information
Patent Citations
Load balancing implementation method, device and system
CN110198221A
Cluster resource management in distributed computing systems
CN110537169A