Pulsar Proxy Node Selection Method and Device

By evaluating the capabilities of Pulsar Proxy nodes, the system ensures that a more capable node continues to be used as the leader in the event of a failure, thus resolving the short-term interruption problem caused by node failure and improving system stability and task continuity.

CN116781495BActive Publication Date: 2026-04-21CHINA MOBILE GROUP JIANGSU +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA MOBILE GROUP JIANGSU
Filing Date
2022-03-11
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

During the Pulsar Proxy node selection process, there are many short-term interruptions caused by node failures, which affect system stability.

Method used

By acquiring the node degree, network environment information, host configuration information, and task execution information of the current leader node, its capability value is calculated, and if the capability value is higher than the preset value, it continues to be the leader node, reducing the probability of leader node reselection and switching.

Benefits of technology

This reduces short-term interruption issues and improves system stability and task continuity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116781495B_ABST
    Figure CN116781495B_ABST
Patent Text Reader

Abstract

This application relates to the field of computer technology, providing a Pulsar Proxy node selection method and apparatus. The method includes: in the event of a failure of the current leader node in a Pulsar Proxy node cluster, obtaining the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node; based on the node degree and network environment information of the current leader node, and the configuration information and task execution information of each host included in the current leader node, obtaining the capability value of the current leader node; if the capability value of the current leader node is higher than a preset value, continuing to use the current leader node as the leader node and initializing the current leader node. The Pulsar Proxy node selection method and apparatus provided in this application can reduce short-term interruption problems, thereby reducing the impact on the system and tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a Pulsar Proxy node selection method and apparatus. Background Technology

[0002] In the business support system, the Pulsar cloud-native messaging framework can be used to provide business processing platform capabilities for business support stream computing applications. The Pulsar Proxy service node (referred to as the "Pulsar Proxy node") acts as a message routing gateway, carrying out data communication between the Pulsar client and the Pulsar Broker service node (referred to as the "Pulsar Broker node"). The Pulsar Proxy node establishes a long-lived connection with the Pulsar Broker node through ZooKeeper's service discovery mechanism. For example... Figure 1 As shown, Pulsar Proxy nodes are stateless nodes, and a Pulsar Proxy node cluster can include 1 to N Pulsar Proxy nodes (i.e., Proxy1 to ProxyN). There are no dependencies between the Pulsar Proxy nodes, allowing for horizontal scaling. The message routing strategy between Pulsar Proxy nodes and Pulsar Broker nodes is as follows: after a Pulsar client establishes a long-lived connection with a Pulsar Proxy node, the Pulsar client's read and write requests are routed and distributed by the Pulsar Proxy node to the Pulsar Broker node, achieving end-to-end data transmission. When the number of nodes in the Broker cluster changes (added or removed), the Pulsar client is unaware of the change in the number of Pulsar Broker nodes and continues to provide normal communication services.

[0003] During communication between the Pulsar client and the Pulsar Proxy node, if the Proxy service process exits due to a failure of the Pulsar Proxy node, the long-lived connection established between the Pulsar client and the Pulsar Proxy node will be broken. The client's read and write requests will only be distributed to the surviving Pulsar Proxy nodes. In the Pulsar Proxy node cluster, there is a leader node. However, because the node may fail, a switchover is required, which will cause a short interruption in task execution. Summary of the Invention

[0004] This application provides a Pulsar Proxy node selection method and apparatus to solve the technical problem of frequent short-term interruptions in Pulsar Proxy node selection.

[0005] In a first aspect, embodiments of this application provide a Pulsar Proxy node selection method, including:

[0006] In the event of a failure of the current leader node in the Pulsar Proxy node cluster, obtain the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node.

[0007] Based on the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node, the capability value of the current leader node is obtained;

[0008] If the capability value of the current leader node is higher than the preset value, the current leader node will continue to be used as the leader node and the current leader node will be initialized.

[0009] In one embodiment, obtaining the capability value of the current leader node based on its node degree and network environment information, as well as the configuration information and task execution information of each host included in the current leader node, includes:

[0010] Based on the node degree of the current leader node, information on whether the current leader node is a core node is obtained, and based on the configuration information and task execution information of each host included in the current leader node, task execution capability information of the current leader node is obtained.

[0011] Based on information such as whether the current leader node is a core node, its network environment, and its task execution capabilities, the capability value of the current leader node is obtained.

[0012] In one embodiment, obtaining the capability value of the current leader node based on information such as whether the current leader node is a core node, its network environment information, and task execution capability information includes:

[0013] Based on preset weights, the weighted sum of information such as whether the current leader node is a core node, its network environment information, and its task execution capability information is obtained as the capability value of the current leader node.

[0014] In one embodiment, obtaining the task execution capability information of the current leader node based on the configuration information and task execution information of each host included in the current leader node includes:

[0015] Based on the configuration information of each host, obtain the theoretical value of the host's task execution capability, and based on the host's task execution information, obtain the actual value of the host's task execution capability.

[0016] Based on the theoretical and actual values ​​of the task execution capabilities of each host, the task execution capability information of the current leader node is obtained.

[0017] In one embodiment, after obtaining the capability value of the current leader node based on its node degree and network environment information, as well as the configuration information and task execution information of each host included in the current leader node, the method further includes:

[0018] If the capability value of the current leader node is lower than the preset value, the current leader node will not be the leader node, and a re-election process for the leader node will be initiated to select a PulsarProxy node different from the current leader node as the new leader node.

[0019] In one embodiment, after the process of initiating a leader node re-election and selecting a Pulsar Proxy node different from the current leader node as the new leader node, the method further includes:

[0020] The information of the new leader node is broadcast to each Pulsar Proxy node in the Pulsar Proxy node cluster.

[0021] Secondly, embodiments of this application provide a Pulsar Proxy node selection device, comprising:

[0022] The first acquisition module is used to acquire the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node, when the current leader node in the Pulsar Proxy node cluster fails.

[0023] The second acquisition module is used to acquire the capability value of the current leader node based on the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node;

[0024] The node selection module is used to continue using the current leader node as the leader node and initialize the current leader node when the capability value of the current leader node is higher than a preset value.

[0025] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory storing a computer program, wherein the processor executes the program to implement the first aspect or the Pulsar Proxy node selection method described above.

[0026] Fourthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the Pulsar Proxy node selection method described in the first aspect.

[0027] Fifthly, embodiments of this application provide a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the Pulsar Proxy node selection method described in the first aspect.

[0028] The Pulsar Proxy node selection method and apparatus provided in this application, when the current leader node in the Pulsar Proxy node cluster fails, obtains the capability value of the current leader node based on its node degree, network environment information, configuration information and task execution information of each host included in the current leader node, scores the capability of the current leader node, and continues to use the current leader node as the leader node if the capability value of the current leader node is higher than a preset value. This can minimize the probability of leader node reselection and switching, reduce short-term interruption problems, thereby reducing the impact on the system and tasks and improving the stability of the entire system. Attached Figure Description

[0029] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a schematic diagram of the structure of the Pulsar environment provided by existing technology;

[0031] Figure 2 This is a flowchart illustrating the Pulsar Proxy node selection method provided in the embodiments of this application;

[0032] Figure 3 This is a schematic diagram of the structure of the Pulsar Proxy node selection device provided in the embodiments of this application;

[0033] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. 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.

[0035] Figure 2 This is a flowchart illustrating the Pulsar Proxy node selection method provided in this application embodiment. (Refer to...) Figure 2 This application provides a Pulsar Proxy node selection method, which may include steps 201, 202 and 203.

[0036] Specifically, the execution entity of the Pulsar Proxy node selection method can be the Pulsar Proxy node selection device.

[0037] Step 201: In the event of a failure of the current leader node in the Pulsar Proxy node cluster, obtain the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node.

[0038] Specifically, the current leader node is a Pulsar Proxy node in the Pulsar Proxy node cluster, and the other Pulsar Proxy nodes in the Pulsar Proxy node cluster are follower nodes.

[0039] You can monitor the current leader node or each Pulsar Proxy node in the Pulsar Proxy node cluster using any of the usual Pulsar Proxy node monitoring methods to determine whether the current leader node has failed.

[0040] In this embodiment of the application, if the current leader node fails, the re-election process of the leader node may not be initiated immediately. Instead, it may be determined whether the current leader node still has strong capabilities.

[0041] To determine whether the current leader node still has strong capabilities, we can obtain the node degree of the current leader node and its network environment information, as well as the configuration information and task execution information of each host included in the current leader node.

[0042] In graph theory, node degree refers to the number of edges associated with that node, also known as the degree of association. The node degree of the current leader node can be the number of PulsarProxy nodes in the Pulsar Proxy node cluster that are directly connected to it.

[0043] The network environment information of the current leadership node can mainly include high-speed network environment and low-speed network environment.

[0044] Optionally, high-speed network environments and low-speed network environments can be distinguished by a preset transmission rate. The preset transmission rate can be set according to actual conditions, and the specific value of the preset transmission rate is not specifically limited in this embodiment.

[0045] For example, the preset transmission rate can be 10MB / s, and the transmission rate of the current leader node can be obtained. If the transmission rate of the current leader node is greater than or equal to 10MB / s, it can be determined that the current leader node is in a high-speed network environment. If the transmission rate of the current leader node is less than 10MB / s, it can be determined that the current leader node is in a low-speed network environment.

[0046] Optionally, after determining that the current leader node is in a high-speed network environment based on the transmission rate, the geographical location information of the current leader node can also be obtained, and the geographical location information of the current leader node can be used to further confirm whether the current leader node is in a high-speed network environment.

[0047] The current leader node includes all hosts, referring to the current leader node and all its follower nodes.

[0048] The host's configuration information may include ratings of components such as the host's central processing unit (CPU), memory, and network.

[0049] The host's task execution information may include information such as the time taken and resource consumption when the host executes the test task.

[0050] Step 202: Based on the node degree of the current leader node and its network environment information, as well as the configuration information and task execution information of each host included in the current leader node, obtain the capability value of the current leader node.

[0051] Specifically, the current leader node's capability value is used to measure the current leader node's ability to execute Proxy service tasks.

[0052] Optionally, the capability value of the current leader node can be calculated using a preset formula based on the node degree of the current leader node, the network environment information it is in, and the configuration and task execution information of each host included in the current leader node.

[0053] Optionally, the node degree of the current leader node and its network environment information, as well as the configuration information and task execution information of each host included in the current leader node, can be input into a pre-trained capability evaluation model to obtain the capability value of the current leader node output by the capability evaluation model.

[0054] The capability evaluation model can be obtained by training on sample data and its corresponding labels. The sample data may include the node degree of the sample Pulsar Proxy leader node, its network environment information, and the configuration and task execution information of each host. Correspondingly, the labels corresponding to the sample data can be the pre-determined capability values ​​of the sample Pulsar Proxy leader node.

[0055] Step 203: If the current leader node's capability value is higher than the preset value, continue to use the current leader node as the leader node and initialize the current leader node.

[0056] Specifically, after obtaining the current leader node's capability value, the current leader node's capability value can be compared with the preset value.

[0057] The preset value can be set according to the actual situation, and the specific value of the preset value is not specifically limited in the embodiments of this application.

[0058] If the current leader node's capability value is higher than or equal to the preset value, the current leader node will have one opportunity to be replaced without replacement. That is, the faulty current leader node will be initialized to continue serving as the leader node.

[0059] This embodiment of the application, in the event of a failure of the current leader node in the Pulsar Proxy node cluster, obtains the capability value of the current leader node based on its node degree, network environment information, configuration information and task execution information of each host included in the current leader node, scores the capability of the current leader node, and continues to use the current leader node as the leader node if the capability value of the current leader node is higher than a preset value. This can minimize the probability of leader node reselection and switching, reduce short-term interruption problems, thereby reducing the impact on the system and tasks and improving the stability of the entire system.

[0060] Based on the content of any of the above embodiments, based on the node degree of the current leader node and the network environment information in which it is located, as well as the configuration information and task execution information of each host included in the current leader node, the capability value of the current leader node is obtained, including: based on the node degree of the current leader node, obtaining information on whether the current leader node is a core node, and based on the configuration information and task execution information of each host included in the current leader node, obtaining the task execution capability information of the current leader node.

[0061] Specifically, the information on whether the current leader node is a core node is used to indicate whether the current leader node is a core node.

[0062] After obtaining the node degree of the current leader node, it can be determined whether the current leader node is a core node.

[0063] If the degree of the current leader node is greater than or equal to the preset threshold Y, then the current leader node can be determined as a core node; if the degree of the current leader node is less than the preset threshold Y, then the current leader node can be determined as a peripheral node, not a core node.

[0064] The threshold Y can be set according to the actual situation such as the number and distribution of Pulsar Proxy nodes in the Pulsar Proxy node cluster. In this embodiment of the application, the specific value of the threshold Y is not specifically limited.

[0065] After obtaining the configuration and task execution information of each host included in the current leader node, the task execution capability information of the current leader node can be obtained based on the configuration and task execution information of each host included in the current leader node.

[0066] The task execution capability information of the current leader node is used to indicate the current leader node's ability to execute test tasks.

[0067] Based on information such as whether the current leader node is a core node, its network environment, and its task execution capabilities, obtain the capability value of the current leader node.

[0068] Specifically, after obtaining information L about whether the current leader node is a core node, information H about its network environment, and information Z about its task execution capability, the capability value of the current leader node can be obtained based on the information L about whether the current leader node is a core node, information H about its network environment, and information Z about its task execution capability, using a preset formula or a pre-trained model.

[0069] This application embodiment obtains information on whether the current leader node is a core node based on the node degree of the current leader node, and obtains the task execution capability information of the current leader node based on the configuration information and task execution information of each host included in the current leader node. Based on the information on whether the current leader node is a core node, the network environment information, and the task execution capability information, the capability value of the current leader node is obtained, which can obtain a more accurate capability value of the current leader node.

[0070] Based on the content of any of the above embodiments, the capability value of the current leader node is obtained based on information such as whether the current leader node is a core node, the network environment information, and the task execution capability information. This includes obtaining a weighted sum of information such as whether the current leader node is a core node, the network environment information, and the task execution capability information based on preset weights, as the capability value of the current leader node.

[0071] Specifically, the formula for calculating the current leader node's capability value is as follows:

[0072] Ability value = αH + βL + γZ.

[0073] Where L represents whether the current leader node is a core node; H represents the network environment information of the current leader node; Z represents the task execution capability information of the current leader node; α, β, and γ represent the weights of the leader node's core node status, network environment information, and task execution capability information, respectively.

[0074] The weights α, β, and γ can be preset according to the actual situation. In this embodiment of the application, the specific values ​​of the weights α, β, and γ are not specifically limited.

[0075] Optionally, α+β+γ=1.

[0076] Optionally, if the current leader node is a core node, L = 1; or if the current leader node is an edge node, L = 0.

[0077] Optionally, if the current leader node is in a high-speed network environment, H=1; if the current leader node is in a low-speed network environment, H=0.

[0078] Optionally, if the current leader node has strong task execution capability, Z=1; if the current leader node has weak task execution capability, Z=0.

[0079] This application embodiment obtains a weighted sum of information such as whether the current leader node is a core node, its network environment information, and its task execution capability information based on preset weights, and uses this sum as the capability value of the current leader node, thus obtaining a more accurate capability value of the current leader node.

[0080] Based on the content of any of the above embodiments, based on the configuration information and task execution information of each host included in the current leader node, the task execution capability information of the current leader node is obtained, including: based on the configuration information of each host, the theoretical value of the host's task execution capability is obtained, and based on the host's task execution information, the actual value of the host's task execution capability is obtained.

[0081] Specifically, based on the configuration information of each host and the theoretical values ​​of the host's CPU, memory, and network for executing test tasks, the theoretical value of the host's task execution capability can be obtained.

[0082] By analyzing the host's task execution information, the actual value of the host's task execution capability can be obtained.

[0083] Based on the theoretical and actual values ​​of the task execution capabilities of each host, obtain the task execution capability information of the current leader node.

[0084] Specifically, the difference between the theoretical and actual values ​​of the task execution capabilities of each host can be statistically analyzed to obtain the execution capability value P of the current leader node.

[0085] If the execution power value P of the current leader node is greater than or equal to the threshold A, then the execution capability of the current leader node is strong, and Z = 1; if the execution power value P of the current leader node is less than the threshold A, then the execution capability of the current leader node is weak, and Z = 0.

[0086] Optionally, the R matrix is ​​a matrix representing the actual configuration task scores of m×n hosts, which includes scores for m host configurations and n task execution metrics; the X matrix is ​​an m×k score matrix for host task execution; and the Y matrix is ​​an n×k vector matrix of host configurations, where k <= m, n. T This is the transpose of Y. N is the number of nodes.

[0087] For example, the R matrix, X matrix, and Y matrix are shown in Table 1, Table 2, and Table 3, respectively.

[0088] Table 1 R matrix

[0089] Task time Task resource consumption CPU R11 R12 memory R21 R22 network R31 R32

[0090] Table 2 X Matrix

[0091] Task time Task resource consumption Host 1 X11 X12 Host 2 X21 X22 Host 3 X31 X32 Host 4 X41 X42 Host 5 X51 X52

[0092] Table 3 Y matrix

[0093] CPU memory network Host 1 Y11 Y12 Y13 Host 2 Y21 Y22 Y23 Host 3 Y31 Y32 Y33 Host 4 Y41 Y42 Y43 Host 5 Y51 Y52 Y53

[0094] The formula for calculating the node's execution force value P is as follows:

[0095]

[0096] Because a leader node leads multiple hosts (follower nodes), the leader node can control the configuration process of the hosts through decision-making, and the configuration of the hosts can also reflect the management capabilities of the node.

[0097] By calculating P, a mathematical representation reflecting the node's computing power is obtained. This is achieved by calculating the difference between the product of the host's task configuration score matrix, the host's task execution score matrix, and the host's configuration vector matrix. Subtracting the R matrix from the comprehensive score matrix yields the host's task configuration score matrix and the difference between this matrix and the actual configuration score during execution. This difference represents the difference between the theoretical and actual values ​​of the host's task execution capability.

[0098] Based on the host's configuration information, this application embodiment obtains the theoretical value of the host's task execution capability, and based on the host's task execution information, the actual value of the host's task execution capability, and the theoretical and actual values ​​of each host's task execution capability, obtains the task execution capability information of the current leader node.

[0099] Based on the content of any of the above embodiments, after obtaining the capability value of the current leader node based on the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node, the method further includes: if the capability value of the current leader node is lower than a preset value, the current leader node is not used as the leader node, and a re-election process for the leader node is initiated to select a Pulsar Proxy node different from the current leader node as the new leader node.

[0100] Specifically, after obtaining the capability value of the current leader node through step 202, the capability value of the current leader node can be compared with the preset value.

[0101] If the current leader node's capability value is lower than the preset value, the current leader node will not be used as the leader node, but as a follower node, and a leader node re-election will be initiated. That is, a leader node re-election process will be initiated to select a Pulsar Proxy node that is different from the current leader node as the new leader node.

[0102] Optionally, a re-election process for the leader node can be initiated by sending a re-election request to each Pulsar Proxy node in the Pulsar Proxy node cluster.

[0103] After receiving a re-election request, each Pulsar Proxy node can vote among all Pulsar Proxy nodes in the Pulsar Proxy node cluster that are in a high-speed network environment (excluding the current leader node). After receiving the voting results returned by the Pulsar Proxy nodes, the Pulsar Proxy node selection device can determine the Pulsar Proxy node with the most votes as the new leader node.

[0104] This application embodiment ensures the normal operation of the Pulsar system and Pulsar Proxy service by re-electing the current leader node when its capability value is lower than a preset value, and selecting a different PulsarProxy node as the new leader node.

[0105] Based on any of the above embodiments, after initiating the re-election process of the leader node and selecting a Pulsar Proxy node different from the current leader node as the new leader node, the method further includes: broadcasting the information of the new leader node to each Pulsar Proxy node in the Pulsar Proxy node cluster.

[0106] Specifically, after a new leader node is determined, the information of the new leader node can be broadcast to each PulsarProxy node in the Pulsar Proxy node cluster, so that each follower node can provide Pulsar Proxy services under the leadership of the new leader node.

[0107] This application embodiment ensures the normal operation of the Pulsar system and Pulsar Proxy service by broadcasting the information of the new leader node to each Pulsar Proxy node in the Pulsar Proxy node cluster.

[0108] The Pulsar Proxy node selection device provided in the embodiments of this application will be described below. The Pulsar Proxy node selection device described below can be referred to in correspondence with the Pulsar Proxy node selection method described above.

[0109] Figure 3 This is a schematic diagram of the structure of the Pulsar Proxy node selection device provided in an embodiment of this application. Based on the content of any of the above embodiments, such as... Figure 3 As shown, the device includes a first acquisition module 301, a second acquisition module 302, and a node selection module 303, wherein:

[0110] The first acquisition module 301 is used to acquire the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node, when the current leader node in the Pulsar Proxy node cluster fails.

[0111] The second acquisition module 302 is used to acquire the capability value of the current leader node based on the node degree of the current leader node and the network environment information in which it is located, as well as the configuration information and task execution information of each host included in the current leader node.

[0112] The node selection module 303 is used to continue to use the current leader node as the leader node and initialize the current leader node when the capability value of the current leader node is higher than the preset value.

[0113] Specifically, the first acquisition module 301, the second acquisition module 302, and the node selection module 303 can be electrically connected in sequence.

[0114] The first acquisition module 301 can monitor the current leader node or each Pulsar Proxy node in the Pulsar Proxy node cluster based on any common Pulsar Proxy node monitoring method, thereby determining whether the current leader node has failed. If the current leader node has failed, it can acquire the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node.

[0115] The second acquisition module 302 can obtain the capability value of the current leader node by using a preset formula or a pre-trained capability evaluation model, based on the node degree of the current leader node, the network environment information, and the configuration and task execution information of each host included in the current leader node.

[0116] The node selection module 303 can compare the capability value of the current leader node with the preset value. If the capability value of the current leader node is higher than or equal to the preset value, the current leader node will have one opportunity to be replaced without replacement. That is, the faulty current leader node will be initialized to continue to serve as the leader node.

[0117] Optionally, the second acquisition module 302 may include:

[0118] The first acquisition unit is used to acquire information on whether the current leader node is a core node based on the node degree of the current leader node.

[0119] The second acquisition unit is used to acquire the task execution capability information of the current leader node based on the configuration information and task execution information of each host included in the current leader node;

[0120] The third acquisition unit is used to acquire the capability value of the current leader node based on information such as whether the current leader node is a core node, the network environment information, and the task execution capability information.

[0121] Optionally, the third acquisition unit can be specifically used to acquire, based on preset weights, a weighted sum of information such as whether the current leader node is a core node, its network environment information, and its task execution capability information, as the capability value of the current leader node.

[0122] Optionally, the second acquisition unit can be specifically used to acquire the theoretical value of the host's task execution capability based on the configuration information of each host, and the actual value of the host's task execution capability based on the host's task execution information; and to acquire the task execution capability information of the current leader node based on the theoretical and actual values ​​of the task execution capability of each host.

[0123] Optionally, the node selection module 303 can also be used to prevent the current leader node from becoming the leader node and initiate a re-election process for the leader node when the current leader node's capability value is lower than a preset value, selecting a Pulsar Proxy node different from the current leader node as the new leader node.

[0124] Optionally, the Pulsar Proxy node selection device may further include a broadcast module for broadcasting information about the new leader node to each Pulsar Proxy node in the Pulsar Proxy node cluster.

[0125] The Pulsar Proxy node selection device provided in this application is used to execute the Pulsar Proxy node selection method of the above embodiments of this application. Its implementation method is the same as that of the Pulsar Proxy node selection method provided in the above embodiments of this application, and can achieve the same beneficial effects, so it will not be described again here.

[0126] The Pulsar Proxy node selection device is used in the Pulsar Proxy node selection methods of the foregoing embodiments. Therefore, the descriptions and definitions in the Pulsar Proxy node selection methods of the foregoing embodiments can be used to understand the execution modules in the embodiments of this application.

[0127] This embodiment of the application, in the event of a failure of the current leader node in the Pulsar Proxy node cluster, obtains the capability value of the current leader node based on its node degree, network environment information, configuration information and task execution information of each host included in the current leader node, scores the capability of the current leader node, and continues to use the current leader node as the leader node if the capability value of the current leader node is higher than a preset value. This can minimize the probability of leader node reselection and switching, reduce short-term interruption problems, thereby reducing the impact on the system and tasks and improving the stability of the entire system.

[0128] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 4 As shown, the electronic device may include a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call a computer program in the memory 430 to execute the steps of the Pulsar Proxy node selection method, such as: in the event that the current leader node in the Pulsar Proxy node cluster fails, obtaining the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node; based on the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node, obtaining the capability value of the current leader node; if the capability value of the current leader node is higher than a preset value, continuing to use the current leader node as the leader node and initializing the current leader node.

[0129] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0130] The processor 410 in the electronic device provided in this application embodiment can call the logical instructions in the memory 430. Its implementation method is consistent with the implementation method of the Pulsar Proxy node selection method provided in this application, and can achieve the same beneficial effects. It will not be described again here.

[0131] On the other hand, embodiments of this application also provide a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the steps of the Pulsar Proxy node selection method provided in the above embodiments, such as: in the event that the current leader node in the Pulsar Proxy node cluster fails, obtaining the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node; obtaining the capability value of the current leader node based on the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node; and continuing to use the current leader node as the leader node and initializing the current leader node if the capability value of the current leader node is higher than a preset value.

[0132] When the computer program product provided in this application embodiment is executed, it implements the above-described Pulsar Proxy node selection method. Its specific implementation method is consistent with the implementation method described in the aforementioned method embodiment, and can achieve the same beneficial effects, so it will not be repeated here.

[0133] On the other hand, embodiments of this application also provide a processor-readable storage medium storing a computer program for causing a processor to execute the steps of the methods provided in the above embodiments, such as: in the event that the current leader node in the Pulsar Proxy node cluster fails, obtaining the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node; obtaining the capability value of the current leader node based on the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node; and continuing to use the current leader node as the leader node and initializing the current leader node if the capability value of the current leader node is higher than a preset value.

[0134] When the computer program stored on the non-transitory computer-readable storage medium provided in this application embodiment is executed, it implements the above-described Pulsar Proxy node selection method. Its specific implementation method is consistent with the implementation method described in the aforementioned method embodiment and can achieve the same beneficial effects, so it will not be repeated here.

[0135] The processor-readable storage medium can be any available medium or data storage device that the processor can access, including but not limited to magnetic memory (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO)), optical memory (e.g., CD, DVD, BD, HVD), and semiconductor memory (e.g., ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)).

[0136] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0137] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A Pulsar Proxy node selection method, characterized in that, include: In the event of a failure of the current leader node in the Pulsar Proxy node cluster, obtain the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node. Based on the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node, the capability value of the current leader node is obtained; If the capability value of the current leader node is higher than the preset value, the current leader node will continue to be used as the leader node and the current leader node will be initialized.

2. The Pulsar Proxy node selection method according to claim 1, characterized in that, The process of obtaining the capability value of the current leader node based on its node degree and network environment information, as well as the configuration and task execution information of each host included in the current leader node, includes: Based on the node degree of the current leader node, information on whether the current leader node is a core node is obtained, and based on the configuration information and task execution information of each host included in the current leader node, task execution capability information of the current leader node is obtained. Based on information such as whether the current leader node is a core node, its network environment, and its task execution capabilities, the capability value of the current leader node is obtained.

3. The Pulsar Proxy node selection method according to claim 2, characterized in that, The process of obtaining the capability value of the current leader node based on information such as whether the current leader node is a core node, its network environment, and its task execution capability includes: Based on preset weights, the weighted sum of information such as whether the current leader node is a core node, its network environment information, and its task execution capability information is obtained as the capability value of the current leader node.

4. The Pulsar Proxy node selection method according to claim 2, characterized in that, The step of obtaining the task execution capability information of the current leader node based on the configuration information and task execution information of each host included in the current leader node includes: Based on the configuration information of each host, obtain the theoretical value of the host's task execution capability, and based on the host's task execution information, obtain the actual value of the host's task execution capability. Based on the theoretical and actual values ​​of the task execution capabilities of each host, the task execution capability information of the current leader node is obtained.

5. The Pulsar Proxy node selection method according to any one of claims 1 to 4, characterized in that, After obtaining the capability value of the current leader node based on its node degree and network environment information, as well as the configuration information and task execution information of each host included in the current leader node, the method further includes: If the capability value of the current leader node is lower than the preset value, the current leader node will not be the leader node, and a re-election process for the leader node will be initiated to select a PulsarProxy node different from the current leader node as the new leader node.

6. The Pulsar Proxy node selection method according to claim 5, characterized in that, After the process of initiating a new leader node re-election, in which a Pulsar Proxy node different from the current leader node is selected as the new leader node, the process further includes: The information of the new leader node is broadcast to each Pulsar Proxy node in the Pulsar Proxy node cluster.

7. A Pulsar Proxy node selection device, characterized in that, include: The first acquisition module is used to acquire the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node, when the current leader node in the Pulsar Proxy node cluster fails. The second acquisition module is used to acquire the capability value of the current leader node based on the node degree and network environment information of the current leader node, as well as the configuration information and task execution information of each host included in the current leader node; The node selection module is used to continue using the current leader node as the leader node and initialize the current leader node when the capability value of the current leader node is higher than a preset value.

8. An electronic device comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the Pulsar Proxy node selection method according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the Pulsar Proxy node selection method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the Pulsar Proxy node selection method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Election control method and device

    CN108494585A

  • Task allocation method and device, server and storage medium

    CN110866167A