Multi-cluster queue dynamic shunting method and device and cluster acquisition method

By implementing real-time monitoring and dynamic traffic distribution, the performance bottleneck of RabbitMQ clusters in high TPS scenarios has been resolved, achieving load balancing and unlimited scalability, and reducing reconstruction costs.

CN116389496BActive Publication Date: 2026-03-31CHINA CITIC BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

The existing RabbitMQ cluster cannot be effectively scaled in high TPS scenarios, resulting in performance bottlenecks. Furthermore, replacing the message middleware is costly and affects application layer efficiency.

Method used

By monitoring the load of each cluster in real time through the agent, new queues are dynamically generated and routed to the cluster with the lowest load, and the queues subscribed to by consumers are updated, thus realizing dynamic traffic distribution of queues across multiple clusters.

Benefits of technology

It achieves cluster load balancing, supports unlimited TPS expansion, enables efficient expansion without application awareness, and reduces reconstruction costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116389496B_ABST
    Figure CN116389496B_ABST
Patent Text Reader

Abstract

The present application relates to the field of financial technology, and particularly relates to a multi-cluster queue dynamic shunting method and device and a cluster acquisition method. The method comprises the following steps: acquiring the load of each inventory queue in each cluster and the load of each cluster in real time, wherein the load of each cluster is the sum of the loads of all inventory queues in the cluster; determining the minimum load cluster, the inventory queue in the cluster that has reached the preset load threshold, and acquiring the attribute data of the inventory queue that has reached the preset load threshold according to the load of each cluster and the load of each inventory queue in each cluster; generating a new queue in the minimum load cluster according to the attribute data of the inventory queue that has reached the preset load threshold; routing a new message to the new queue; and delivering the new queue containing the new message to a consumer and updating the queue subscribed by the consumer. The present application monitors the cluster in real time, dynamically pulls up a new cluster for shunting when the cluster load TPS exceeds the threshold, realizes application non-perception, routes new traffic to a low-load cluster, and ensures cluster load balancing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This article relates to the field of financial technology, especially to the dynamic routing method, device, and cluster acquisition method of multi-cluster queues. Background Technology

[0002] RabbitMQ, as an open-source message middleware, is commonly used in distributed systems for storing and forwarding messages asynchronously, decoupling, and peak shaving. It boasts advantages such as high message reliability, high cluster availability, flexible routing, and support for dynamic plugin expansion. RabbitMQ employs layered management based on the business architecture: each business system creates a separate RabbitMQ instance, logically isolated into different virtual machine hosts. Within each business subsystem, different message exchanges and routing keys are built based on different functionalities to produce and consume messages from different message queues, thus achieving layered management.

[0003] In existing technologies, as business expands and the number of transactions per second (TPS) increases, individual message queues within a cluster easily reach performance bottlenecks, impacting support for business expansion. Horizontal scaling of RabbitMQ clusters in existing technologies can only increase the overall TPS and the number of message queues, while vertical scaling (increasing memory) can only improve the message backlog capacity supported by the cluster. For existing message queues, queue-level scaling is not effective; furthermore, a single RabbitMQ cluster can only support tens of thousands of TPS, which is insufficient for high-throughput business scenarios. For application systems already using RabbitMQ, if message queue performance requirements exceed tens of thousands, reselection and refactoring of the message middleware are necessary, resulting in extremely high costs.

[0004] Existing technologies also include solutions that address performance bottlenecks at the application level by adjusting the RabbitMQ cluster accordingly. However, this approach impacts application-side resources and can easily lead to reduced efficiency.

[0005] To address the issues of high cost and low efficiency at the application layer in current technologies for message reselection, a method, device, and cluster acquisition method for dynamic traffic splitting across multiple cluster queues is needed. Summary of the Invention

[0006] To address the problems of the prior art, this embodiment provides a method, apparatus, and cluster acquisition method for dynamic traffic splitting across multiple cluster queues.

[0007] This embodiment provides a dynamic traffic distribution method for multi-cluster queues. The method is executed by a proxy. When a new message published by a producer is received, the method includes: real-time acquisition of the load of each existing queue in each cluster and the load of each cluster, wherein the load of a cluster is the sum of the loads of all existing queues in the cluster; determining the minimum load cluster and the existing queues in the cluster that have reached a preset load threshold based on the load of each cluster and the load of the existing queues in each cluster, and acquiring the attribute data of the existing queues that have reached the preset load threshold; generating a new queue in the minimum load cluster based on the attribute data of the existing queues that have reached the preset load threshold; routing the new message to the new queue; and sending the new queue containing the new message to the consumer, updating the queues subscribed to by the consumer.

[0008] According to one aspect of the embodiments herein, generating a new queue includes: generating a new queue in a minimum load cluster, the new queue having no initial message; and recording and storing the mapping relationship between the new queue and the cluster queue of the minimum load cluster.

[0009] According to one aspect of the embodiments herein, generating a new queue further includes: obtaining the names of existing queues that have reached a preset load threshold; and assigning the new queue the same name as the queues that have reached the preset load threshold, or assigning a queue name related to the names of the queues that have reached the preset load threshold.

[0010] According to one aspect of the embodiments herein, the real-time acquisition of the load of each cluster in multiple clusters and the load of the existing queues in each cluster includes: real-time collection of cluster status information and queue status information based on the application programming interface (API), and acquisition of the cluster load and the load of each existing queue in the cluster by an agent.

[0011] According to one aspect of the embodiments herein, sending the newly added queue to the consumer and updating the queues subscribed to by the consumer includes: determining the consumer's subscription message based on the connection with the consumer, the subscription message including the queues subscribed to by the consumer; determining whether the newly added queue is related to the queues subscribed to by the consumer based on the queue name of the newly added queue; if related, updating the newly added queue to the queues subscribed to by the consumer.

[0012] This embodiment provides a cluster acquisition method applied to a consumer. The method includes: acquiring the queues subscribed to by the consumer; and querying the cluster to which the queues subscribed to by the consumer belong from a pre-stored cluster queue mapping relationship based on the queues.

[0013] This embodiment also discloses a multi-cluster queue dynamic traffic splitting device, the device comprising:

[0014] The load acquisition unit is used to acquire the load of each cluster and the load of the existing queues in each cluster in real time, wherein the load of the cluster is the sum of the loads of all existing queues in the cluster; the attribute data acquisition unit is used to determine the minimum load cluster and the existing queues in the cluster that have reached a preset load threshold based on the load of each cluster and the load of the existing queues in each cluster, and to acquire the attribute data of the existing queues; the new queue generation unit is used to copy the attribute data of the queue to the minimum load cluster and generate a new queue; the routing unit is used to route new messages to the new queue; and the queue update unit is used to distribute the new queue to consumers and update the queues subscribed to by consumers.

[0015] This embodiment also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the multi-cluster queue dynamic distribution method.

[0016] This embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the multi-cluster queue dynamic distribution method.

[0017] This embodiment also provides a computer program product, which includes a computer program that, when executed by a processor, implements the multi-cluster queue dynamic distribution method.

[0018] This solution provides real-time monitoring of the cluster. When the TPS carried by the cluster exceeds the threshold, a new cluster is dynamically launched to distribute the traffic, achieving seamless application operation. All new traffic is routed to the low-load cluster to ensure cluster load balancing. Attached Figure Description

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

[0020] Figure 1 The figure shown is a system schematic diagram of a multi-cluster queue dynamic traffic splitting method according to an embodiment of this paper;

[0021] Figure 2 The diagram shown is a flowchart of a dynamic traffic splitting method for multiple cluster queues according to an embodiment of this paper;

[0022] Figure 3 The diagram shown is a flowchart of a method for generating a new queue according to an embodiment of this article;

[0023] Figure 4 The diagram shown is a flowchart of a method for generating a new queue according to an embodiment of this article;

[0024] Figure 5 The diagram shown is a flowchart of a method for updating a consumer subscription queue according to an embodiment of this paper;

[0025] Figure 6 The diagram shown is a structural schematic of a multi-cluster queue dynamic traffic splitting device according to an embodiment of this paper;

[0026] Figure 7 The diagram shown is a schematic representation of the specific structure of the multi-cluster queue dynamic traffic splitting device in this embodiment.

[0027] Figure 8 The diagram shown is a schematic of a computer device provided in an embodiment of this article.

[0028] Explanation of symbols in the attached drawings:

[0029] 101. Producers;

[0030] 102. Agent;

[0031] 103. Message Queue Server;

[0032] 104. Cluster;

[0033] 105. Consumers;

[0034] 601. Load Acquisition Unit;

[0035] 602. Attribute Data Acquisition Unit;

[0036] 603. Added a queue generation unit;

[0037] 6031. Cluster queue mapping relationship recording module;

[0038] 6032. Name Assignment Module;

[0039] 604, Routing Unit;

[0040] 605. Queue Update Unit;

[0041] 802. Computer equipment;

[0042] 804, Processor;

[0043] 806. Memory;

[0044] 808. Drive mechanism;

[0045] 810. Input / Output Module;

[0046] 812. Input devices;

[0047] 814. Output devices;

[0048] 816. Presentation equipment;

[0049] 818. Graphical User Interface;

[0050] 820. Network interface;

[0051] 822. Communication link;

[0052] 824. Communication bus. Detailed Implementation

[0053] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments herein will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments herein, and not all of the embodiments. Based on the embodiments herein, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this document.

[0054] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings herein are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0055] This specification provides the operational steps of the methods described in the embodiments or flowcharts, but based on conventional or non-inventive labor, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or device products, the methods shown in the embodiments or drawings can be executed sequentially or in parallel.

[0056] It should be noted that the multi-cluster queue dynamic traffic splitting method in this paper can be used in the field of software development as well as the field of financial technology. This paper does not limit the application field of the multi-cluster queue dynamic traffic splitting method and device.

[0057] Figure 1The figure shown is a system diagram of a dynamic traffic distribution method for multi-cluster queues according to an embodiment of this paper. The system includes: producer 101, proxy (RabbitMQ Proxy) 102, cluster 104 and consumer 105.

[0058] In some embodiments of this specification, the RabbitMQ cluster is deployed in container mode, and MQ Proxy provides a dynamic registration interface so that the RabbitMQ cluster can register with MQ Proxy through the interface.

[0059] When deploying a cluster, the rabbitmq_management plugin needs to be enabled to provide real-time monitoring of the RabbitMQ cluster status. In this system, producer 101 sends messages to the broker RabbitMQ Proxy 101. RabbitMQ Proxy 101 queries the cluster list corresponding to the queue based on the tenant and queue name, iterates through the cluster list in real time, and obtains the least loaded queue in the cluster list. The least loaded queue cluster receives the message and routes the message to the message queue server (Broker) 103 for storage. The broker RabbitMQ Proxy 102 binds to cluster 104, and the producer connects to RabbitMQ Proxy to create metadata (user, permissions, queue, and other metadata information).

[0060] The RabbitMQ Proxy 102 periodically collects connection cluster and queue status information and caches cluster and queue load information. When producer 101 creates metadata, it selects the lowest-loaded cluster in the cache for routing. The lowest-loaded cluster stores the metadata and records the mapping relationship between the metadata and the cluster.

[0061] Multiple brokers form a cluster 104. Consumer 105 connects to the RabbitMQ Proxy 102 to subscribe to queues. The RabbitMQ Proxy 102 queries the list of all queue clusters and returns it to consumer 105, who then subscribes to the list of cluster queues.

[0062] Figure 2 The diagram shown is a flowchart of a dynamic traffic splitting method for multiple cluster queues according to an embodiment of this paper. This method is executed by the agent. When the agent receives a new message published by the producer, the method specifically includes the following steps:

[0063] Step 201: Obtain the load of each existing queue in each cluster and the load of each cluster in real time, wherein the load of a cluster is the sum of the loads of all existing queues in the cluster. In this application, the RabbitMQ system includes multiple clusters. As the traffic carried by the cluster increases and messages accumulate, higher requirements are placed on the performance of the cluster and the queues within the cluster. A cluster may include multiple queues. The load of a cluster is the sum of the loads of all existing queues in the cluster.

[0064] This step involves obtaining the load of each existing queue in each cluster and the load of the entire cluster. Specifically, the MQ Proxy monitors the load of the cluster and its existing queues in real time through the RabbitMQ Management plugin. The MQ Proxy traverses the RabbitMQ cluster and uses the RESTful API provided by the RabbitMQ Management plugin to obtain the status of each RabbitMQ cluster at fixed time intervals. The RabbitMQ cluster status includes: cluster load TPS, cluster memory usage, queue load TPS, and queue message backlog.

[0065] Step 202: Determine the minimum load cluster and the existing queues in the cluster that have reached the preset load threshold based on the load of each cluster and the load of the existing queues in each cluster, and obtain the attribute data of the existing queues that have reached the preset load threshold.

[0066] This step can use the cluster status information and queue status information collected in real time through the API interface, and the agent MQProxy can obtain the load of the cluster and the load of each existing queue in the cluster.

[0067] After obtaining the load of the cluster and existing queues, the system further determines whether there are any existing queues whose load has reached a threshold and the cluster with the lowest current load. If an existing queue has reached its load threshold, it can be determined that the performance of that queue has reached its performance bottleneck and cannot continue to receive new messages to complete subsequent tasks. Therefore, a new queue needs to be created based on the existing queue that has reached the preset load threshold. Specifically, the MQ Proxy obtains the attribute data of the existing queues that have reached the preset load threshold. This attribute data, also known as the metadata of the existing queues, includes, but is not limited to: the tenant (Vhost), exchange, binding key, queue name, cluster IP address, and cluster port of the existing queue.

[0068] In some other embodiments of this specification, when a producer produces a new message, the MQ Proxy obtains a list of queues subscribed to by the consumer, and then selects the cluster with the lowest load based on the tenant, queue name, and load status of the queue on each cluster obtained from monitoring, and routes the new message to the cluster with the lowest load.

[0069] Step 203: Generate a new queue in the minimum load cluster based on the attribute data of the existing queues that have reached the preset load threshold. The new queue is created in the minimum load cluster determined in step 202 based on the attribute data of the existing queues that have reached the preset load threshold. The new queue has the same attribute data as the existing queues that have reached the preset load threshold. The new queue does not store any data and is initially an empty queue.

[0070] Step 204: Route new messages to the newly added queue. When a new message published by a producer is received, the new message is routed to the partition where the newly added queue is located, and the new queue stores the new message, thereby expanding the queues in the cluster.

[0071] Step 205: The newly added queue containing the new message is sent to the consumer, updating the queues subscribed to by the consumer. In this step, the new queue is updated in the queues subscribed to by the consumer and sent to the consumer. In this specification, when a consumer subscribes to all relevant cluster queues, and when existing queues are sharded and expanded due to load, the broker MQProxy creates a new queue and sends the new queue to the MQ SDK, which then automatically updates the subscribed queues.

[0072] This invention introduces MQ Proxy to dynamically distribute queues across multiple RabbitMQ clusters, ensuring sufficient resources and meeting real-time usage demands. MQ Proxy monitors all managed RabbitMQ clusters in real time. When a cluster's TPS exceeds a threshold, it dynamically launches a new cluster for traffic distribution, achieving application-level seamless integration. RabbitMQ clusters support unlimited TPS scaling. By monitoring RabbitMQ cluster load, MQ Proxy ensures that new traffic is routed to lower-load clusters, guaranteeing balanced cluster load.

[0073] Figure 3 The diagram shown is a flowchart of a method for generating a new queue according to an embodiment of this paper, which specifically includes the following steps:

[0074] Step 301: Create a new queue in the minimum load cluster. The new queue has no initial message. In this application, a new queue can be created in the cluster according to the creation request of the application system; when the usage of the application system has reached the performance limit of the queue, the MQ Proxy will automatically create the queue based on the load of the cluster and the queue.

[0075] Step 302: Record and store the mapping relationship between the newly added queue and the cluster queue of the minimum load cluster. In this step, after a new queue is generated in the minimum load cluster, MQ Proxy can record and store the mapping relationship between the new queue and the cluster queue of the minimum load cluster. For example, in the previous steps, the queue that has reached the preset load threshold is queue1, and its cluster is cluster A. MQ Proxy adds a new queue in the minimum load cluster D, and the name of this new queue is also queue1. Then MQ Proxy records the mapping relationship between the new queue1 and the cluster queue of its cluster D.

[0076] Figure 4 The diagram shown is a flowchart of a method for generating a new queue according to an embodiment of this paper, which specifically includes the following steps:

[0077] Step 401: Obtain the names of the existing queues that have reached the preset load threshold. In addition to obtaining the names of the queues that have reached the preset load threshold, this step also includes obtaining attribute data such as the tenant (Vhost), exchange, binding key, queue name, cluster IP address, and cluster port of the existing queues that have reached the preset load threshold.

[0078] Step 402: Assign the new queue the same name as the queue that has reached the preset load threshold, or assign a queue name related to the name of the queue that has reached the preset load threshold. In this step, the name of the new queue is the same as the name of the queue that has reached the preset load threshold. For example, if the name of the queue that has reached the preset load threshold is queue1, the name of the new queue corresponding to it in at least one cluster with the lowest load is also queue1.

[0079] Figure 5 The diagram shown is a flowchart of a method for updating a consumer subscription queue according to an embodiment of this paper, which specifically includes the following steps:

[0080] Step 501: Based on the connection with the consumer, determine the consumer's subscribed messages, including the queues subscribed to by the consumer. In this application, the consumer establishes a connection with the RabbitMQ Broker and opens a channel. Then, the consumer requests to consume messages from its subscribed queues, waits for a response from the RabbitMQ Broker, and receives and consumes the messages from the relevant queues. After successful consumption, the consumer confirms the received messages.

[0081] Step 502: Based on the name of the newly added queue, determine whether the newly added queue is related to the queues subscribed by the consumer. Specifically, based on the name of the newly added queue, query the queues subscribed by the consumer to see if there is a queue with the same name. If there is a queue with the same name, it can be determined that the newly added queue is related to the queues subscribed by the consumer; if there is no queue with the same name, it can be determined that the newly added queue is not related to the queues subscribed by the consumer.

[0082] Step 503: If relevant, update the newly added queue to the queues subscribed to by the consumer. If relevant, update the newly added queue to the queues subscribed to by the consumer according to the cluster queue mapping relationship stored in MQProxy. Further, the cluster to which the newly added queue belongs can be updated to the queues subscribed to by the consumer according to the cluster queue mapping relationship. If irrelevant, do not update the queues subscribed to by the consumer.

[0083] In some embodiments of this specification, the system or the RabbitMQ Proxy can obtain the queues subscribed to by the consumer. By obtaining all the queues subscribed to by the consumer, and further querying the cluster to which the queues subscribed to by the consumer belong according to the pre-stored cluster queue mapping relationship, the system returns the message to the consumer, thereby updating the cluster queues subscribed to by the consumer.

[0084] like Figure 6 The diagram shown is a structural schematic of a multi-cluster queue dynamic traffic splitting device according to an embodiment of this paper. The basic structure of the device is illustrated in this diagram. The functional units and modules can be implemented in software, or using general-purpose chips or specific chips to achieve dynamic traffic splitting of multi-cluster queues. Specifically, the device includes:

[0085] The load acquisition unit 601 is used to acquire the load of each cluster and the load of the existing queues in each cluster in real time, wherein the load of the cluster is the sum of the loads of all existing queues in the cluster.

[0086] The attribute data acquisition unit 602 is used to determine the minimum load cluster and the existing queues in the cluster that have reached the preset load threshold based on the load of each cluster and the load of the existing queues in each cluster, and to acquire the attribute data of the existing queues.

[0087] A new queue generation unit 603 is added, which is used to copy the attribute data of the queue to the minimum load cluster and generate a new queue;

[0088] Routing unit 604 is used to route the new message to the newly added queue;

[0089] The queue update unit 605 is used to send the newly added queue to the consumer and update the queue subscribed by the consumer.

[0090] This solution supports dynamic traffic splitting across cluster queues. When the TPS load performance of a queue in RabbitMQ cluster A reaches a threshold, the MQ Proxy dynamically migrates the queue's metadata in the cluster with the lowest load, and sets all new production messages to be routed by the MQ Proxy to the new queue with the low load.

[0091] Supports dynamic scaling at the cluster level. MQ Proxy monitors all managed RabbitMQ clusters in real time. When the TPS of a cluster exceeds the threshold, it dynamically starts a new cluster to distribute the traffic, achieving application-level seamless scaling. RabbitMQ clusters support unlimited TPS expansion. By monitoring the load of RabbitMQ clusters, MQ Proxy ensures that new traffic is routed to low-load clusters, guaranteeing cluster load balancing.

[0092] As an example of this article, reference may also be made to, for example, Figure 7 The diagram shown is a schematic representation of the specific structure of the multi-cluster queue dynamic diversion device in this embodiment.

[0093] As an embodiment of this document, the newly added queue generation unit 603 further includes: a cluster queue mapping relationship recording module 6031, used to record and store the cluster queue mapping relationship between the newly added queue and the minimum load cluster.

[0094] As one embodiment of this document, the newly added queue generation unit 603 further includes:

[0095] The naming module 6032 is used to assign a queue name to the newly added queue.

[0096] like Figure 8The diagram illustrates a computer device provided in an embodiment of this document. The multi-cluster queue dynamic routing method described in this application can be applied to the computer device. The computer device 802 may include one or more processors 804, such as one or more central processing units (CPUs), each of which can implement one or more hardware threads. The computer device 802 may also include any memory 806 for storing any kind of information such as code, settings, data, etc. Without limitation, for example, the memory 806 may include any type of RAM, any type of ROM, flash memory, hard disk, optical disk, etc. More generally, any memory can use any technology to store information. Further, any memory can provide volatile or non-volatile retention of information. Further, any memory can represent a fixed or removable component of the computer device 802. In one case, when the processor 804 executes associated instructions stored in any memory or combination of memories, the computer device 802 can perform any operation of the associated instructions. The computer device 802 also includes one or more drive mechanisms 808 for interacting with any memory, such as hard disk drive mechanisms, optical disk drive mechanisms, etc.

[0097] Computer device 802 may also include an input / output module 810 (I / O) for receiving various inputs (via input device 812) and providing various outputs (via output device 814). A specific output mechanism may include a presentation device 816 and an associated graphical user interface (GUI) 818. In other embodiments, the input / output module 810 (I / O), input device 812, and output device 814 may be omitted, and the device may function solely as a computer device within a network. Computer device 802 may also include one or more network interfaces 820 for exchanging data with other devices via one or more communication links 822. One or more communication buses 824 couple the components described above together.

[0098] Communication link 822 can be implemented in any way, such as via a local area network, a wide area network (e.g., the Internet), a point-to-point connection, or any combination thereof. Communication link 822 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.

[0099] Corresponding to Figures 1 to 5 In addition to the methods described above, this embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the above-described methods.

[0100] This embodiment also provides a computer-readable instruction, wherein when a processor executes the instruction, the program therein causes the processor to perform the following: Figures 1 to 5 The method shown.

[0101] This embodiment also provides a computer program product, which includes a computer program that, when executed by a processor, implements the following: Figures 1 to 5 The method shown.

[0102] It should be understood that in the various embodiments of this document, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.

[0103] It should also be understood that, in the embodiments herein, the term "and / or" is merely a description of the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following associated objects have an "or" relationship.

[0104] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this document.

[0105] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0106] In the embodiments provided herein, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or units, or they may be electrical, mechanical, or other forms of connection.

[0107] 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 units can be selected to achieve the purpose of the embodiments described herein, depending on actual needs.

[0108] Furthermore, the functional units in the various embodiments of this document can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0109] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this paper, in essence, or the part that contributes to the prior art, or all or 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 paper. 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.

[0110] This document uses specific embodiments to illustrate the principles and implementation methods of this document. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of this document. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this document. Therefore, the content of this specification should not be construed as a limitation of this document.

Claims

1. A multi-cluster queue dynamic offloading method, characterized in that, The method is executed by an agent, and when a new message published by a producer is received, the method comprises: Real-time acquisition of the load of each inventory queue in each cluster and the load of each cluster, wherein the load of each cluster is the sum of the loads of all inventory queues in the cluster; Determination of a minimum load cluster, an inventory queue in the cluster that has reached a preset load threshold, and acquisition of attribute data of the inventory queue that has reached the preset load threshold according to the load of each cluster and the load of each inventory queue in the cluster; Generation of a new queue in the minimum load cluster according to the attribute data of the inventory queue that has reached the preset load threshold; the attribute data is metadata of the inventory queue, and the metadata at least comprises a tenant of the inventory queue; Routing of a new message to the new queue; for the new queue, a same queue name as the inventory queue that has reached the preset load threshold is assigned, or a queue name related to the queue name of the inventory queue that has reached the preset load threshold is assigned; Downlink of the new queue containing the new message to a consumer and update of a queue subscribed by the consumer.

2. The multi-cluster queue dynamic offloading method of claim 1, wherein, The generation of the new queue comprises: Generation of the new queue in the minimum load cluster, the new queue having no initial message; Recording and storage of a cluster queue mapping relationship between the new queue and the minimum load cluster.

3. The multi-cluster queue dynamic offloading method of claim 1, wherein, The real-time acquisition of the load of each cluster in the multi-cluster and the load of each inventory queue in the cluster comprises: Acquisition of the load of each cluster and the load of each inventory queue in the cluster by the agent based on cluster state information and queue state information collected in real time through an API interface.

4. The multi-cluster queue dynamic offloading method of claim 1, wherein, The downlink of the new queue to the consumer end and the update of the queue subscribed by the consumer comprise: Determination of a subscription message of the consumer according to a connection with the consumer, the subscription message comprising a queue subscribed by the consumer; Judgment of whether the new queue is related to the queue subscribed by the consumer according to a queue name of the new queue; If related, the new queue is updated to the queue subscribed by the consumer.

5. A multi-cluster queue dynamic offloading apparatus, characterized in that, The apparatus comprises: A load acquisition unit configured to acquire the load of each cluster and the load of each inventory queue in the cluster in real time, wherein the load of each cluster is the sum of the loads of all inventory queues in the cluster; An attribute data acquisition unit configured to determine a minimum load cluster and an inventory queue in the cluster that has reached a preset load threshold according to the load of each cluster and the load of each inventory queue in the cluster, and acquire attribute data of the inventory queue; A new queue generation unit configured to copy the attribute data of the queue to the minimum load cluster and generate a new queue; the attribute data is metadata of the inventory queue, and the metadata at least comprises a tenant of the inventory queue; A routing unit configured to route a new message to the new queue; for the new queue, a same queue name as the inventory queue that has reached the preset load threshold is assigned, or a queue name related to the queue name of the inventory queue that has reached the preset load threshold is assigned; A queue update unit configured to downlink the new queue to a consumer and update a queue subscribed by the consumer.

6. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the method of any one of claims 1 to 4 when executing the computer program.

7. A computer readable storage medium characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method in any one of claims 1 to 4.

8. A computer program product, characterised in that, The computer program product comprises a computer program, and the computer program is executed by the processor to implement the method in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Charging facility data transmission dynamic control method and system

    CN111131082A

  • Message queue system, service processing method and computer readable storage medium

    CN114338063A