Heavy balance method, device, equipment, medium and product

By splitting partitions and rebalancing strategies based on consumption in the Kafka system, the system unavailability problem caused by the traditional rebalancing mechanism is solved, and message processing efficiency and throughput are improved.

CN118677900APending Publication Date: 2024-09-20CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410915276.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-09
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

The traditional rebalancing mechanism will cause the consumer group to be temporarily unavailable in a high-throughput distributed publish-subscribe messaging system, affecting the system's business throughput and processing delay, resulting in a decrease in message processing efficiency.

Method used

When creating a topic, if the preset number of partitions exceeds the threshold, the original partition will be split into multiple smaller partitions, and the target partitions to participate in the rebalancing will be determined based on consumption during rebalancing to avoid unnecessary consumer pauses. Optimize load balancing and partition distribution.

Benefits of technology

It improves the overall throughput and message processing efficiency of the system, reduces the system's unavailable time, and achieves more accurate load balancing and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118677900A
    Figure CN118677900A
Patent Text Reader

Abstract

The invention provides a weight balance method and device, equipment, a medium and a product, under the condition that a first theme is created, if the preset partition number of the first theme is larger than a preset large partition threshold value, a first partition of the first theme is split to obtain a plurality of second partitions, the preset partition number is used for determining the partition number of the first partition of the first theme, and the partition number of the second partitions is used for determining the partition number of the first partition of the first theme. One first partition corresponds to a plurality of second partitions, and the number of the second partitions is larger than that of the first partitions; one consumption group consumes the message corresponding to at least one second partition; under the condition that the first consumption group receives whether to carry out the rebalance request, the consumption condition of all third partitions in charge of the first consumption group in a preset time is acquired, and the second partitions comprise the third partitions; determining a target partition participating in weight balance in all the third partitions according to the consumption condition; and carrying out heavy balance on the first consumption group and the target partition. According to the embodiment of the invention, the message processing efficiency of the kafka system can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a rebalancing method, device, equipment, medium and product. Background Art

[0002] In a high-throughput distributed publish-subscribe messaging system (Kafka), consumer groups are key components for processing message flows. They are coordinated through service nodes (Broker) to achieve load balancing and fault recovery. When a consumer group faces certain changes, such as the increase or decrease of consumer members, the adjustment of subscription topics, etc., a rebalancing operation is required. Rebalancing refers to a process automatically triggered by the service node (Broker) when the state of the consumer group changes, aiming to reallocate message partitions to consumers to maintain the load balance and stability of the system.

[0003] However, the traditional rebalancing mechanism will cause all consumers in the consumer group to be temporarily unavailable during execution, which seriously affects the system's business throughput and processing latency, resulting in a decrease in the efficiency of message processing in the Kafka system. Summary of the invention

[0004] The present application provides a rebalancing method, device, equipment, medium and product, which can improve the efficiency of message processing in the Kafka system.

[0005] In a first aspect, an embodiment of the present application provides a rebalancing method, which is applied to a Kafka cluster. The method includes:

[0006] When creating the first topic, if the preset number of partitions of the first topic is greater than the preset large partition threshold, the first partition of the first topic is split into multiple second partitions. The preset number of partitions is used to determine the number of partitions of the first partition of the first topic. One first partition corresponds to multiple second partitions, and the number of partitions of the second partition is greater than the number of partitions of the first partition. A consumer group consumes messages corresponding to at least one second partition.

[0007] When the first consumer group receives a request for whether to perform a rebalance, the consumption status of all third partitions that the first consumer group is responsible for within a preset time is obtained, and the second partition includes the third partition;

[0008] According to the consumption situation, determine the target partitions to be rebalanced among all third partitions;

[0009] Rebalance the first consumer group and the target partition.

[0010] In a second aspect, the present application provides a rebalancing device, applied to a kafka cluster, the device comprising:

[0011] A splitting module is used for, when creating a first topic, if the preset number of partitions of the first topic is greater than the preset large partition threshold, splitting the first partition of the first topic into multiple second partitions, the preset number of partitions is used to determine the number of partitions of the first partition of the first topic, one first partition corresponds to multiple second partitions, and the number of partitions of the second partition is greater than the number of partitions of the first partition; a consumer group consumes messages corresponding to at least one second partition;

[0012] An acquisition module is used to acquire the consumption status of all third partitions that the first consumer group is responsible for within a preset time when the first consumer group receives a request whether to perform a rebalancing, and the second partition includes the third partition;

[0013] A determination module, configured to determine, according to the consumption situation, a target partition among all the third partitions to participate in the rebalancing;

[0014] A rebalancing module is used to rebalance the first consumer group and the target partition.

[0015] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a memory storing computer program instructions;

[0016] When the processor executes the computer program instructions, the rebalancing method as in any one of the embodiments of the first aspect is implemented.

[0017] In a fourth aspect, an embodiment of the present application provides a computer storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, a rebalancing method as in any one of the embodiments in the first aspect is implemented.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes a rebalancing method as in any one of the embodiments in the first aspect above.

[0019] In a rebalancing method, apparatus, device, medium and product provided in an embodiment of the present application, when creating a first topic, if the preset number of partitions exceeds a preset large partition threshold, the present application will split the original first partition into multiple smaller second partitions. This partition splitting strategy allows for more refined load balancing, because more consumers can process messages in parallel, thereby improving the overall throughput of the system. Furthermore, when the first consumer group faces a rebalancing request, the present application does not simply suspend all consumers and reallocate partitions, but first collects and analyzes the consumption of all partitions that the consumer group is responsible for within a preset time. This data-driven strategy based on consumption enables the system to more accurately identify which partitions need to participate in the rebalancing and which consumers are most suitable for processing these partitions. This precise rebalancing strategy avoids unnecessary consumer pauses, thereby reducing the unavailable time of the system and improving the real-time and efficiency of message processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0021] Figure 1 is a flow chart of a rebalancing method provided by an embodiment of the present application;

[0022] Figure 2 is a schematic diagram of the structure of a tuning device provided by an embodiment of the present application;

[0023] Figure 3 is a flow chart of a rebalancing method provided by another embodiment of the present application;

[0024] Figure 4 is a flow chart of a rebalancing method provided by another embodiment of the present application;

[0025] Figure 5 It is a structural schematic diagram of a weight-balancing device provided in an embodiment of the present application;

[0026] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0028] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0029] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0030] In the existing rebalancing mechanism, when the coordinator decides to start a new round of rebalancing, it will encapsulate "REBALANCE_IN_PROGRESS" into the response of the heartbeat request and send it back to the consumer instance. When the consumer instance finds that the heartbeat response contains "REBALANCE_IN_PROGRESS", it notifies the consumer to participate in the rebalancing, and then performs the state flow involving the control of the consumer group. On the consumer side, rebalancing is divided into two steps: joining the group and waiting for the leader consumer (LeaderConsumer) allocation plan. These two steps correspond to two specific types of requests: JoinGroup request and SyncGroup request. When a member in the group joins the group, it sends a JoinGroup request to the coordinator. In this request, each member must report the topic it subscribes to, so that the coordinator can collect the subscription information of all members. Once the JoinGroup requests of all members are collected, the coordinator will select one of these members to serve as the leader of this consumer group. This existing rebalancing mechanism has the following shortcomings: 1. All consumers are unavailable during rebalancing; consumers are completely unavailable during rebalancing, which affects business throughput and latency. 2. In high-partition situations, rebalancing is likely to be triggered frequently.

[0031] In order to solve the problems existing in the prior art, the embodiments of the present application provide a rebalancing method, device, equipment, medium and product.

[0032] The present application embodiment provides a rebalancing method, device, equipment, medium and product. The following first introduces the rebalancing method provided by the present application embodiment. Figure 1 As shown, the method specifically comprises the following steps:

[0033] S100, when creating the first topic, if the preset number of partitions of the first topic is greater than the preset large partition threshold, the first partition of the first topic is split into multiple second partitions, and the preset number of partitions is used to determine the number of partitions of the first partition of the first topic, one first partition corresponds to multiple second partitions, and the number of partitions of the second partition is greater than the number of partitions of the first partition; a consumer group consumes messages corresponding to at least one second partition.

[0034] Optionally, in a feasible implementation of the present application, in the Kafka system, when a new topic (i.e., the first topic) needs to be created, the system will first determine the initial number of partitions (i.e., the preset number of partitions) of the first topic according to the configuration set by the user or the default setting. Subsequently, check whether the preset number of partitions of the first topic exceeds the preset large partition threshold. If the threshold is exceeded, the system will start an automatic partition splitting process. During the partition splitting process, the system will split each original large partition (i.e., the first partition) into multiple smaller partitions (i.e., the second partition). Each first partition will correspond to multiple second partitions, and the number of second partitions will be greater than the number of first partitions to achieve finer-grained load balancing. After the split is completed, the system will update the configuration of the consumer group to ensure that each consumer group can consume messages corresponding to at least one second partition.

[0035] The key to this process is how to determine the number of partitions to split and how to update the configuration of the consumer group. In order to determine the number of partitions to split, the system can use some heuristic algorithms or machine learning models to predict a suitable number of partitions based on historical data and the current system status. At the same time, the system also needs to ensure that the split process will not cause too much impact on the running consumer group, so some buffer mechanisms or degradation strategies can be introduced to ensure the stability and availability of the system.

[0036] S200, when the first consumer group receives a request for whether to perform a rebalancing, obtain the consumption status of all third partitions that the first consumer group is responsible for within a preset time, and the second partition includes the third partition.

[0037] Optionally, in a feasible implementation of the present application, in the Kafka system, when the first consumer group receives a request for rebalancing, the system will first ensure that it can collect and analyze the consumption of all partitions that the consumer group is responsible for (in this step, we call them third partitions, which are actually part of the second partition obtained by splitting in the previous step) within a preset time. This step is a key link in the Kafka rebalancing mechanism because it directly determines which partitions need to participate in the rebalancing and how to make a more reasonable partition allocation.

[0038] To achieve this step, the Kafka system will first start a monitoring and collection mechanism, which will regularly record the consumption of each consumer group and the partitions that its member consumers are responsible for over a period of time, such as key indicators such as consumption rate, latency, and error rate. These data will be stored in the internal data structure of the Kafka cluster, or directly collected and stored using an external monitoring system.

[0039] When the first consumer group receives a rebalance request, the system triggers an analysis process. This process first determines all third partitions that the consumer group is responsible for, and queries the consumption data of these partitions within the preset time. The preset time is usually a configurable parameter, which can be adjusted according to the actual situation of the system to balance the accuracy and real-time nature of data collection.

[0040] Next, the system will conduct an in-depth analysis of these consumption data. The analysis process may include calculating statistical indicators such as the average consumption rate, maximum latency, error rate, etc. of each partition, as well as identifying partitions with anomalies or bottlenecks. These data and analysis results will serve as an important basis for determining the target partitions to participate in the rebalancing. In addition, the system may also consider other factors, such as the current load of the consumer group, the processing power of the consumer, network conditions, etc., to more comprehensively evaluate the status and performance of the system. This additional information can help the system make more reasonable rebalancing decisions, ensuring that the consumer group will not be overly affected during the rebalancing process, while maintaining the stability and availability of the system.

[0041] In general, the implementation of this step requires the Kafka system to have strong monitoring, collection and analysis capabilities. By regularly collecting and storing consumption data of consumer groups and performing in-depth analysis and evaluation when receiving rebalancing requests, the system can more accurately identify partitions that need to participate in rebalancing and make more reasonable partition allocation decisions. This helps improve the performance, stability and availability of the Kafka system, ensuring that high-quality services can be continuously provided in high-throughput, low-latency distributed message processing scenarios.

[0042] S300: Determine a target partition participating in rebalancing among all the third partitions according to the consumption situation.

[0043] Optionally, in a feasible implementation of the present application, in the Kafka system, when the first consumer group receives a rebalancing request, the system determines the target partition to participate in the rebalancing based on the consumption of the third partition previously collected. This process involves a comprehensive assessment of the current state of the consumer group to ensure that the rebalancing operation can optimize the load distribution without causing excessive impact on the stability and performance of the system.

[0044] First, the system will obtain the consumption data of all third partitions that the first consumer group is responsible for within the preset time. These data include but are not limited to key indicators such as message consumption rate, latency, and error rate of each partition. By analyzing these data, the system can understand the load and performance of each partition.

[0045] Next, the system will filter the target partitions. The filtering criteria may include:

[0046] Unbalanced load: If the consumption rate of some partitions is much higher than that of other partitions, or the latency and error rates of some partitions are consistently high, these partitions may be regarded as heavily loaded target partitions and need to participate in rebalancing to optimize the load distribution.

[0047] Consumer failure: If the system detects that a consumer instance fails or crashes, the partition it was originally responsible for will become the target partition that needs to be reassigned.

[0048] Add or delete partitions: If the topic subscribed by the first consumer group has new partitions or deleted partitions, these new or deleted partitions will also become target partitions that need to participate in rebalancing.

[0049] When determining the target partition, the system also considers other factors, such as the current number of members in the consumer group, the processing power of the consumer, network conditions, etc. These factors will affect the complexity and scope of the rebalancing operation.

[0050] Finally, the system generates a rebalancing plan. This plan will specify which target partitions need to participate in the rebalancing and how to redistribute these partitions to different consumer instances in the consumer group. When generating the plan, the system may use some optimization algorithms or strategies to ensure that the partitions can be distributed as evenly as possible to each member of the consumer group while avoiding overloading of some consumer instances.

[0051] In general, determining the target partition to participate in rebalancing is a decision-making process that takes into account multiple factors. By deeply analyzing the current status and consumption data of the consumer group, the system can accurately identify the target partition that needs to be optimized and generate a reasonable rebalancing plan to ensure that the stability and performance of the Kafka system are continuously improved.

[0052] S400: Rebalance the first consumer group and the target partition.

[0053] Optionally, in a feasible implementation of the present application, in Kafka, each consumer group has an associated coordinator, which is responsible for handling management operations of the consumer group, such as consumers joining or leaving the group, partition allocation, etc. When rebalancing is required, the coordinator will be started first. According to the target partitions determined in step S300, the coordinator will identify the list of partitions that need to participate in the rebalancing. These partitions may become target partitions due to changes in the number of consumer group members, changes in subscribed topics, or new partitions.

[0054] Specifically, the coordinator will use the appropriate partition assignment strategy to redistribute partitions based on the current state of the consumer group and the number of target partitions. This process ensures that each consumer instance processes data from different partitions evenly when possible. Once the partition assignment is completed, the coordinator will update the metadata of the consumer group and each consumer, including the list of partitions they are responsible for and the current offset. This metadata will be stored in the Kafka cluster for subsequent data processing and recovery.

[0055] The coordinator will then notify each consumer instance in the consumer group of the new partition assignments. After receiving the notification, the consumer instance will start pulling data from the new partition and process the data according to its own consumption logic. During the rebalancing process, consumer instances need to send heartbeat requests to the coordinator regularly to indicate that they are still alive and working properly. If the coordinator does not receive a heartbeat request from a consumer instance for a period of time, it may think that the consumer has failed and trigger a new rebalancing operation. If an abnormal situation occurs during the rebalancing process (such as network failure, Broker downtime, etc.), the Kafka system will handle it according to its fault tolerance mechanism. For example, if a Broker goes down, the partition data stored on the Broker will be copied to other Brokers to ensure data reliability and availability.

[0056] In a rebalancing method, apparatus, device, medium and product provided in an embodiment of the present application, when creating a first topic, if the preset number of partitions exceeds a preset large partition threshold, the present application will split the original first partition into multiple smaller second partitions. This partition splitting strategy allows for more refined load balancing, because more consumers can process messages in parallel, thereby improving the overall throughput of the system. Furthermore, when the first consumer group faces a rebalancing request, the present application does not simply suspend all consumers and reallocate partitions, but first collects and analyzes the consumption of all partitions that the consumer group is responsible for within a preset time. This data-driven strategy based on consumption enables the system to more accurately identify which partitions need to participate in the rebalancing and which consumers are most suitable for processing these partitions. This precise rebalancing strategy avoids unnecessary consumer pauses, thereby reducing the unavailable time of the system and improving the real-time and efficiency of message processing.

[0057] In one embodiment, the kafka cluster includes multiple logical clusters, and the multiple logical clusters include a main cluster and multiple extended clusters;

[0058] The extended cluster includes multiple service Broker nodes, one Broker node is used to store messages corresponding to at least one second partition, and the main cluster is used to store consumer groups and storage locations corresponding to each second partition, wherein the main cluster is elected from the multiple logical clusters according to a preset election algorithm rule.

[0059] Optionally, in an embodiment of the present application, the rebalancing method provided by the present application may be performed by a tuning device. Figure 2 As shown, the tuning device may include a configuration module, a partition device, a metadata device and a traffic judgment device. Specifically, the tuning device aims to reduce the rebalancing triggering conditions through the configuration module, the partition device and the metadata device analyzing and coordinating, thereby improving the stability of service transmission and reducing the delay of service transmission.

[0060] Optionally, in an embodiment of the present application, the partitioning device automatically splits the large partition topic into logical partitions. Specifically, the CMMESSAGE topic creation is managed by the CMMESSAGE management and control platform. The CMMESSAGE management and control platform is a platform specifically used to manage and control the Kafka message system. The platform provides comprehensive monitoring, configuration, management and optimization functions for the Kafka cluster.

[0061] When a tenant creates a topic (i.e., the first topic) from the CMMESSAGE management and control platform, the background logic of the management and control platform will determine whether the number of created topic partitions (i.e., the preset number of partitions) exceeds the preset large partition threshold (the large partition threshold is configured in the system parameter configuration module of the CMMESSAGE management and control platform. In the CMMESSAGE system parameter setting module, the corresponding large partition threshold parameter is named minrebalance, the default value is 200, and the recommended adjustment value is between 200-1000). When the threshold is exceeded, the topic partition will be automatically split to the extended cluster. The coordination of consumption and transactions and the consumption location of each partition are stored on the main cluster and returned to the consumer by the metadata device.

[0062] Optionally, in a specific implementation of the present application, in the CMMESSAGE management and control platform, when a tenant needs to create a new Kafka topic, the system will follow a strict set of logical processes to ensure that the topic creation process not only meets business needs but also ensures the stability and performance of the system. Specifically, the platform will first check the number of partitions preset for the topic requested to be created by the tenant. This preset number of partitions is set based on the tenant's business needs and the expected amount of data processing. However, in order to avoid problems such as unbalanced system load and performance degradation caused by too many partitions in a single topic, the CMMESSAGE management and control platform sets a large partition threshold parameter called minrebalance. This parameter can be flexibly configured in the system parameter configuration module. The default value is set to 200, but the recommended adjustment value range is between 200 and 1000.

[0063] When the number of topic partitions set by the tenant exceeds this large partition threshold, the background logic of the management and control platform will automatically trigger the topic partition splitting mechanism. This means that the large partition topic originally planned to be created will be split into multiple smaller partitions and distributed to different Brokers in the extended cluster. This split not only optimizes the system's resource usage and improves data processing capabilities, but also enhances the system's fault tolerance and scalability.

[0064] It is worth noting that although data partitions may be distributed on different clusters or brokers, the coordination of consumption and transactions and the consumption location information of each partition are still centrally stored in the main cluster. This design ensures that consumers can easily obtain the information they need, such as the current consumption location, the amount of data that can be consumed, etc., so that they can consume data efficiently. At the same time, the main cluster is also responsible for processing consumer requests, coordinating their consumption behaviors, and ensuring data consistency and integrity.

[0065] In summary, the CMMESSAGE management and control platform intelligently determines whether the number of topic partitions created by tenants exceeds the preset large partition threshold and automatically splits the topic partitions, thus achieving efficient utilization and load balancing of Kafka system resources. At the same time, by centrally storing the coordination of consumption and transactions and the partition consumption location information in the main cluster, the platform provides consumers with convenient data consumption services and ensures the stability and performance of the system.

[0066] In these optional embodiments, by setting a large partition threshold, the platform can intelligently identify and handle large partition topics that may cause performance bottlenecks or increase management complexity. When the number of topic partitions created by a tenant exceeds this threshold, the system can automatically split these partitions and expand them to other clusters, thereby ensuring the stability and scalability of the Kafka messaging system.

[0067] In addition, this automatic splitting mechanism not only reduces the need for manual intervention by administrators and the possibility of human error, but also improves the system's responsiveness to sudden high-concurrency scenarios. The coordination of consumption and transactions and the consumption location of each partition are still stored on the main cluster and are uniformly managed by the metadata device, which ensures data consistency and reliability.

[0068] In summary, the function of automatically splitting large partition topics effectively optimizes the performance and management efficiency of the Kafka messaging system, reduces the complexity of system maintenance, and improves the availability and scalability of the system, thereby providing users with more stable, efficient and reliable messaging services.

[0069] In one embodiment, the method further comprises:

[0070] Receive a first input from a client, where the first input is used to obtain allocation status of each second partition corresponding to the first topic, where the first topic is created by the client;

[0071] In response to the first input, obtaining identification information of a consumer group that consumes messages corresponding to each second partition from all extended clusters;

[0072] Store identification information of a consumer group that consumes messages corresponding to each second partition corresponding to the first topic in the main cluster, and determine allocation status of each second partition corresponding to the first topic;

[0073] The allocation status of each second partition corresponding to the first topic is sent to the client through the main cluster.

[0074] Optionally, in a specific implementation of the present application, the metadata device automatically returns corresponding logical metadata to the consumer each time the consumer connects.

[0075] In multiple logical clusters, one is selected as the main cluster according to the election algorithm rules, and the other clusters are extended clusters. The main cluster is responsible for providing metadata, consumption location, and transaction-related services to the outside world. Among them, the extended cluster can only be used for the production and consumption of business messages, while the main cluster can provide metadata, consumption location, and transaction-related services to the outside world, as well as message production and consumption services.

[0076] The metadata device is placed in the metadata interface in the main cluster. When the client pulls metadata (i.e., the first input), the metadata device can jump to other clusters to pull metadata (i.e., obtain the identification information of the consumer group that consumes the message corresponding to each second partition), and then perform fusion and assembly on the main cluster and return it to the client.

[0077] Optionally, in the embodiments of the present application, Figure 3 As shown in the figure, the metadata device is not on the path of message production and consumption, and will not have a significant impact on the client. By assembling metadata when the client pulls, the problem of updating metadata across physical clusters can be avoided, while also ensuring real-time performance and solving the problem that the control node (controller) cannot perceive the Broker nodes in other clusters when the master node switches. In the Kafka distributed messaging system, the controller is a special Broker role that is responsible for managing and coordinating the status of the entire Kafka cluster.

[0078] Optionally, in one embodiment of the present application, the system determines the architecture of a main cluster and multiple extended clusters through an election algorithm. The main cluster not only bears the core responsibilities of metadata, consumption location and transaction-related services, but also handles the production and consumption of messages. The extended cluster focuses on the production and consumption of business messages to share the load of the main cluster.

[0079] In this architecture, the metadata device is a key component located in the metadata interface of the main cluster, but does not directly participate in the message production and consumption process, so it does not have a significant performance impact on the client. When the client needs to pull metadata, the metadata device can intelligently jump to other clusters (including extended clusters) to obtain the required information, and return it to the client after integration in the main cluster. This design allows the system to achieve cross-cluster metadata management and real-time updates without worrying about the complexity and latency that may be caused by updating metadata across physical clusters.

[0080] In addition, this solution also solves the problem that the controller may not be able to perceive the status changes of broker nodes in other clusters in time when the master node switches. By assembling metadata in real time when the client pulls, the system can ensure that the controller always has the latest cluster status information, thereby improving the robustness and fault tolerance of the system.

[0081] In these optional embodiments, the division of the main cluster and the extended cluster is achieved through an election algorithm, which optimizes the performance and stability of the message system. The main cluster assumes core service responsibilities, while the extended cluster shares the business load. The metadata device is located in the main cluster, and provides cross-cluster metadata services through intelligent jumps and real-time assembly to ensure the efficiency and real-time performance of the system. At the same time, it also solves the problem that the controller cannot perceive the status of other clusters when the master node switches, further improving the robustness and reliability of the system. This design enables the distributed messaging system to better adapt to complex and changing business scenarios and provide users with stable, efficient and reliable messaging services.

[0082] In one embodiment, determining the target partition participating in the rebalancing among all the third partitions according to the consumption situation includes:

[0083] Obtaining the corresponding consumption situation of each of the third partitions within the preset time;

[0084] The third partition whose consumption status is that there is no consumption service, or the third partition whose consumption status is that it is offline, is determined as the target partition.

[0085] Optionally, in a specific implementation of the present application, the above-mentioned traffic judgment device is the arbiter that determines which consumers are rebalanced, and calculates which consumers participate in the rebalancing through balancing algorithms such as historical throughput. The algorithm flow is roughly as follows: After the control node receives a request from a consumer in the current consumer group to initiate a rebalancing, it will query the consumption of the subject partitions corresponding to all consumers in the current consumer group within the past 5 minutes (that is, obtain the corresponding consumption of each third partition within the preset time). After obtaining the results, only the partitions that are offline or have no business traffic (that is, the target partition) participate in the reallocation.

[0086] Optionally, in one embodiment of the present application, a traffic judgment device is introduced as a arbitrator to determine which consumers participate in the rebalancing. The traffic judgment device intelligently analyzes the consumption of the subject partition of each consumer in the current consumer group by using a balancing algorithm such as historical throughput, and then determines which consumers should participate in the rebalancing process.

[0087] Specifically, when the control node (i.e., the controller in the Kafka cluster) receives a request from a consumer in the current consumer group regarding whether to initiate a rebalance, the traffic judgment device will immediately start its workflow. First, the traffic judgment device will query and record the consumption of each topic partition by all consumers in the current consumer group in the past 5 minutes. The selection of this time period may be based on considerations of system performance and real-time requirements, ensuring that the consumer's recent active status can be captured without affecting the system response speed due to long query time.

[0088] Next, the traffic judgment device processes and analyzes the collected consumption data. It uses a balancing algorithm, such as considering factors such as the consumer's historical throughput and consumption speed, to evaluate the processing capabilities of each consumer for different topic partitions. Based on these analysis results, the device determines which partitions are offline or have no business traffic. These partitions are candidates for reallocation during the rebalancing process because they no longer need to be consumed or have low consumption pressure.

[0089] In this way, the traffic judgment device can accurately identify those consumers and partitions that really need to participate in rebalancing, thereby avoiding unnecessary rebalancing operations and reducing the waste of system resources. At the same time, since only those resources that really need to be adjusted are reallocated, this mechanism can also better ensure the stability and performance of the Kafka cluster.

[0090] In these optional embodiments, the consumer rebalancing mechanism based on the flow judgment device intelligently analyzes the consumer's consumption by using balancing algorithms such as historical throughput, and determines which consumers and partitions should participate in the rebalancing process. This mechanism can not only improve the utilization of system resources and reduce unnecessary rebalancing operations, but also better ensure the stability and performance of the Kafka cluster, providing strong support for the efficient operation of the distributed messaging system.

[0091] In one embodiment, after rebalancing the first consumer group and the target partition, the method further includes:

[0092] When the real-time traffic throughput of any first cluster among the multiple extended clusters is greater than the first traffic threshold, the second topic in the first cluster is migrated to the second cluster, the real-time traffic throughput of the second topic is greater than the second traffic threshold, and the traffic throughput of the second cluster is less than the first traffic threshold.

[0093] Optionally, in a specific implementation of the present application, the flow determination device is divided into two parts. The server-side device is placed in the server-side coordination interface, which is responsible for handling the determination of rebalancing consumers and which client consumers participate in rebalancing. In the present application, only consumers corresponding to the extended partition will be rebalanced. Figure 4 As shown, the management device is placed in the control interface of the CMMESSAGE management and control platform. According to the real-time traffic throughput of the topic of each cluster and the traffic algorithm, for the cluster that exceeds the single cluster limit, some of the above topics are migrated to the extended cluster to complete automatic splitting.

[0094] Optionally, in one embodiment of the present application, it is intended to optimize consumer rebalancing and automatic expansion management of the cluster in the Kafka system. Specifically, the traffic determination device is divided into a server device and a management device, each of which has different responsibilities to work together to ensure high performance and stability of the system.

[0095] First, the server device is deployed in the coordination interface of the server, and its core function is to handle the logic of consumer rebalancing. In a distributed system, consumers are responsible for consuming messages from different partitions. When the number of partitions changes (such as the increase in partitions due to system expansion) or the number of consumers increases or decreases, consumer rebalancing is required to ensure that messages can be processed evenly and efficiently. The server device is responsible for determining when rebalancing is required and which client consumers will participate in this process. It is worth noting that in this implementation, only consumers corresponding to the expanded partitions are rebalanced, which means that when new partitions are created due to system expansion, consumers of these new partitions will undergo a rebalancing process.

[0096] On the other hand, the management device is placed in the control interface of the CMMESSAGE management and control platform. It is responsible for automatically managing the cluster according to the real-time traffic throughput of the system. Specifically, the management device monitors the traffic of each topic in each cluster and uses a specific traffic algorithm for real-time analysis. When the traffic of a cluster reaches or exceeds its processing capacity limit, that is, it breaks through the limitation of a single cluster, the management device will trigger the automatic split mechanism. The core of this mechanism is to migrate some topics with higher traffic to the extended cluster to reduce the load pressure of the original cluster, thereby realizing the horizontal expansion of the system. In this way, the system can dynamically adapt to traffic changes to ensure stable and efficient operation in high-concurrency scenarios.

[0097] In these optional embodiments, the server device is responsible for processing the consumer rebalancing logic to ensure that messages can be processed evenly and efficiently; while the management device is responsible for automatically managing the cluster according to the real-time traffic throughput and realizing the horizontal expansion of the system through the automatic split mechanism. This implementation method can not only improve the performance and stability of the system, but also reduce the operation and maintenance costs, and is an important optimization method in distributed systems.

[0098] In one embodiment, in the case of creating the first topic, if the preset number of partitions of the first topic is greater than the preset large partition threshold, before splitting the first partition of the first topic to obtain multiple second partitions, the method further includes:

[0099] Get the rebalancing parameter type;

[0100] In a case where the rebalancing parameter type is the first type, when creating the first topic, creating the first partition corresponding to the first topic according to the preset number of partitions;

[0101] In the case of creating the first topic, if the preset number of partitions of the first topic is greater than the preset large partition threshold, the first partition of the first topic is split to obtain multiple second partitions, including:

[0102] When the rebalancing parameter type is the second type and the first topic is created, if the preset number of partitions of the first topic is greater than the preset large partition threshold, the first partition of the first topic is split into multiple second partitions.

[0103] Optionally, in a specific implementation of the present application, the configuration module of the present application adds a new configuration balancetype (i.e., rebalancing parameter type): a new balancetype parameter is added to the configuration file, and the user defines how the component handles rebalancing. When it is 0 (i.e., the first type), the existing rebalancing method is used; when it is 1 (i.e., the second type), the rebalancing method of the present application is used.

[0104] Optionally, in one embodiment of the present application, the system adds a new configuration parameter called balancetype, which allows users to customize the way components handle rebalancing. In traditional rebalancing strategies, the system usually uses a fixed algorithm to automatically complete this task, but this method may not meet the specific needs or optimization goals of all users. In order to provide a more flexible and personalized rebalancing solution, the present application introduces the balancetype parameter. By configuring this parameter, users can choose different rebalancing methods according to their actual situation and needs.

[0105] Specifically, when the balancetype parameter is set to 0 (ie, the first type), the system will use the existing rebalancing method. This method is usually based on some preset algorithms and rules, such as polling, hashing, etc., to automatically assign the mapping relationship between consumers and partitions. This method is simple and direct and suitable for most common scenarios. However, when the balancetype parameter is set to 1 (ie, the second type), the system will use the rebalancing method proposed in this application. By customizing the rebalancing method, users can more flexibly adjust the behavior of the system to cope with different business scenarios and challenges.

[0106] In these optional embodiments, the present application provides a mechanism for the system to flexibly configure the rebalancing strategy by introducing the balancetype configuration parameter. Users can choose different rebalancing methods according to their needs to achieve better performance, load balancing or other goals. This mechanism not only improves the flexibility and scalability of the system, but also provides users with a more personalized solution, which helps to meet complex and changing business needs.

[0107] Figure 5 A schematic structural diagram of a weight-balancing device provided in another embodiment of the present application is shown. For ease of explanation, only the portion related to the embodiment of the present application is shown.

[0108] Reference Figure 5 , the rebalancing device is applied to the Kafka cluster, and the rebalancing device may include:

[0109] The splitting module 501 is used for splitting the first partition of the first topic into multiple second partitions when creating the first topic, if the preset number of partitions of the first topic is greater than the preset large partition threshold, the preset number of partitions is used to determine the number of partitions of the first partition of the first topic, one first partition corresponds to multiple second partitions, and the number of partitions of the second partition is greater than the number of partitions of the first partition; a consumer group consumes messages corresponding to at least one second partition;

[0110] An acquisition module 502 is configured to acquire consumption status of all third partitions that the first consumer group is responsible for within a preset time when the first consumer group receives a request whether to perform a rebalancing, wherein the second partition includes the third partition;

[0111] A determination module 503 is used to determine a target partition participating in rebalancing among all the third partitions according to the consumption situation;

[0112] The rebalancing module 504 is used to rebalance the first consumer group and the target partition.

[0113] In one embodiment, the kafka cluster includes multiple logical clusters, and the multiple logical clusters include a main cluster and multiple extended clusters;

[0114] The extended cluster includes multiple service Broker nodes, one Broker node is used to store messages corresponding to at least one second partition, and the main cluster is used to store consumer groups and storage locations corresponding to each second partition, wherein the main cluster is elected from the multiple logical clusters according to a preset election algorithm rule.

[0115] In one embodiment, the determination module 503 may include:

[0116] A first acquisition submodule is used to acquire the consumption situation corresponding to each of the third partitions within the preset time;

[0117] The first determination submodule is used to determine the third partition whose consumption status is no consumption service, or the third partition whose consumption status is offline, as the target partition.

[0118] In one embodiment, the weight-balancing device may further include:

[0119] A first receiving module, configured to receive a first input from a client, wherein the first input is used to obtain the allocation status of each second partition corresponding to the first topic, and the first topic is created by the client;

[0120] A second acquisition module, configured to acquire, in response to the first input, identification information of a consumer group that consumes messages corresponding to each second partition from all extended clusters;

[0121] A storage module, used to store identification information of a consumer group that consumes messages corresponding to each second partition corresponding to the first topic in the main cluster, and determine the allocation status of each second partition corresponding to the first topic;

[0122] A sending module is used to send the allocation status of each second partition corresponding to the first topic to the client through the main cluster.

[0123] In one embodiment, the weight-balancing device may further include:

[0124] A migration module is used to migrate the second topic in any first cluster among the multiple extended clusters to a second cluster when the real-time traffic throughput of the first cluster is greater than the first traffic threshold, the real-time traffic throughput of the second topic is greater than the second traffic threshold, and the traffic throughput of the second cluster is less than the first traffic threshold.

[0125] In one embodiment, the weight-balancing device may further include:

[0126] A third acquisition module is used to obtain a rebalancing parameter type;

[0127] A creation module is used to create the first partition corresponding to the first topic according to the preset number of partitions when creating the first topic when the rebalancing parameter type is the first type.

[0128] In one embodiment, the splitting module 501 may include:

[0129] A splitting submodule is used to split the first partition of the first topic into multiple second partitions when the rebalancing parameter type is the second type and when the first topic is created, if the preset number of partitions of the first topic is greater than the preset large partition threshold.

[0130] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application, and are devices corresponding to the above-mentioned battery thermal runaway warning method. All implementation methods in the above-mentioned method embodiment are applicable to the embodiments of the device. Its specific functions and technical effects can be found in the method embodiment part, which will not be repeated here.

[0131] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0132] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.

[0133] The device may include a processor 601 and a memory 602 storing program instructions.

[0134] When the processor 601 executes the program, the steps in any of the above method embodiments are implemented.

[0135] Exemplarily, the program may be divided into one or more modules / units, one or more modules / units are stored in the memory 602 and executed by the processor 601 to complete the present application. One or more modules / units may be a series of program instruction segments capable of completing a specific function, and the instruction segments are used to describe the execution process of the program in the device.

[0136] Specifically, the processor 601 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0137] The memory 602 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 602 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 602 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 602 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 602 is a non-volatile solid-state memory.

[0138] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) readable storage media (e.g., memory devices) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.

[0139] The processor 601 implements any one of the methods in the above embodiments by reading and executing program instructions stored in the memory 602 .

[0140] In one example, the electronic device may further include a communication interface 603 and a bus 610. The processor 601, the memory 602, and the communication interface 603 are connected via the bus 610 and communicate with each other.

[0141] The communication interface 603 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0142] Bus 610 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 610 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.

[0143] In addition, in combination with the method in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores program instructions; when the program instructions are executed by a processor, any one of the methods in the above embodiment is implemented.

[0144] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0145] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0146] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0147] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0148] The functional modules shown in the above block diagram can be implemented as hardware, software, firmware or their combination. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), suitable firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. Programs or code segments can be stored in machine-readable media, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable media" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. Code segments can be downloaded via computer grids such as the Internet, intranets, etc.

[0149] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0150] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0151] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A rebalancing method, characterized in that: Applied to a kafka cluster, the method includes: In the case of creating the first topic, if the preset number of partitions of the first topic is greater than the preset large partition threshold, the first partition of the first topic is split into multiple second partitions, and the preset number of partitions is used to determine the number of partitions of the first partition of the first topic. One first partition corresponds to multiple second partitions, and the number of partitions of the second partition is greater than the number of partitions of the first partition; a consumer group consumes messages corresponding to at least one second partition; When the first consumer group receives a request for whether to perform a rebalancing, the consumption status of all third partitions that the first consumer group is responsible for within a preset time is obtained, and the second partition includes the third partition; According to the consumption situation, determining a target partition to be involved in rebalancing among all the third partitions; Rebalance the first consumer group and the target partition.

2. The method according to claim 1, characterized in that The kafka cluster includes multiple logical clusters, and the multiple logical clusters include a main cluster and multiple extended clusters; The extended cluster includes multiple service Broker nodes, one Broker node is used to store messages corresponding to at least one second partition, and the main cluster is used to store consumer groups and storage locations corresponding to each second partition, wherein the main cluster is elected from the multiple logical clusters according to a preset election algorithm rule.

3. The method according to claim 1, characterized in that: The step of determining, according to the consumption situation, a target partition among all the third partitions to participate in the rebalancing comprises: Obtaining the corresponding consumption situation of each of the third partitions within the preset time; The third partition whose consumption status is that there is no consumption service, or the third partition whose consumption status is that it is offline, is determined as the target partition.

4. The method according to claim 2, characterized in that: The method further comprises: Receive a first input from a client, where the first input is used to obtain allocation status of each second partition corresponding to the first topic, where the first topic is created by the client; In response to the first input, obtaining identification information of a consumer group that consumes messages corresponding to each second partition from all extended clusters; Store identification information of a consumer group that consumes messages corresponding to each second partition corresponding to the first topic in the main cluster, and determine allocation status of each second partition corresponding to the first topic; The allocation status of each second partition corresponding to the first topic is sent to the client through the main cluster.

5. The method according to claim 2, characterized in that: After rebalancing the first consumer group and the target partition, the method further includes: When the real-time traffic throughput of any first cluster among the multiple extended clusters is greater than the first traffic threshold, the second topic in the first cluster is migrated to the second cluster, the real-time traffic throughput of the second topic is greater than the second traffic threshold, and the traffic throughput of the second cluster is less than the first traffic threshold.

6. The method according to claim 1, characterized in that In the case of creating the first topic, if the preset number of partitions of the first topic is greater than the preset large partition threshold, before splitting the first partition of the first topic to obtain multiple second partitions, the method further includes: Get the rebalancing parameter type; In a case where the rebalancing parameter type is the first type, when creating the first topic, creating the first partition corresponding to the first topic according to the preset number of partitions; In the case of creating the first topic, if the preset number of partitions of the first topic is greater than the preset large partition threshold, the first partition of the first topic is split to obtain multiple second partitions, including: When the rebalancing parameter type is the second type and the first topic is created, if the preset number of partitions of the first topic is greater than the preset large partition threshold, the first partition of the first topic is split into multiple second partitions.

7. A weight balancing device, characterized in that: Applied to a kafka cluster, the device comprises: A splitting module is used for, when creating a first topic, if the preset number of partitions of the first topic is greater than the preset large partition threshold, splitting the first partition of the first topic into multiple second partitions, the preset number of partitions is used to determine the number of partitions of the first partition of the first topic, one first partition corresponds to multiple second partitions, and the number of partitions of the second partition is greater than the number of partitions of the first partition; a consumer group consumes messages corresponding to at least one second partition; An acquisition module is used to acquire the consumption status of all third partitions that the first consumer group is responsible for within a preset time when the first consumer group receives a request whether to perform a rebalancing, and the second partition includes the third partition; A determination module, configured to determine, according to the consumption situation, a target partition among all the third partitions to participate in the rebalancing; A rebalancing module is used to rebalance the first consumer group and the target partition.

8. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the rebalancing method according to any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the rebalancing method according to any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the rebalancing method as described in any one of claims 1 to 6.