Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
Fig. 1 is the Kafka message system framework figure in the embodiment of the present invention, referring to FIG. 1, the embodiment of the present invention is to be based on
Kafka message system including producer Producer, subscriber Consumer and cluster, wherein cover in Kafka cluster
Several themes Topic, every Topic include several subregions Partition, include several realities in the Kafka cluster
It include several subregion copies in example Broker, every Broker.
It should be noted that several in the embodiment of the present invention refer to one or more.
Fig. 2 is the module map of message system resources balance Installation practice of the present invention, as shown in Fig. 2, including load monitoring
Engine 201, analysis engine 202 and operation enforcement engine 203;The load monitors engine 201, for from Kafka cluster
Kafka index is acquired, and the Kafka index is sent to the analysis engine 202, wherein the Kafka index includes institute
State load and the partition information of Kafka cluster;The analysis engine 202, for according to the Kafka index, the Kafka collection
The rigid target of group and the soft target of the Kafka cluster generate the first equalization scheme for corresponding to all subscribers, and will
First equalization scheme is sent to the operation enforcement engine 203, wherein the hardness target is several described Kafka
The target that cluster must be realized, the soft target are the target that several described Kafka clusters are preferably realized;The operation is held
Row engine 203, for generating several operational orders according to first equalization scheme, and will several operational orders hair
It send to the Kafka cluster so that the Kafka cluster carries out resources balance according to the operational order.
It should be noted that load monitoring engine 201 is connected with analysis engine 202, and analysis is drawn in the balancer
202 are held up to be connected with operation enforcement engine 203.
Specifically, in the analysis engine 202, the rigid target of appearance and soft target difference are as follows:
1, rigid target:
1) subregion copy configuration must be that rack is identifiable.Identical partitions copy is put on different racks, in this way when
When some rack is shut down, any subregion at most has a copy and loses.This helps to control failure boundary, and makes Kafka more
Add stalwartness.
2) resource utilization of Broker must be in predefined threshold value.
Even if 3) all subregion copies on Broker all become leader, network can not be allowed to utilize beyond fixed in advance
The capacity of justice.In this case, all subscriber's flows will be redirected to the Broker, this will lead to higher than usually
Network utilization.
2, soft target:
1) resource utilization as consistent as possible is realized between all Broker.
2) the uniform byte input rate of leader subregion is realized between Broker.
3) subregion of specific subject is evenly distributed on all Broker.
4) subregion copy is evenly distributed on all Broker.
It should be noted that there are priority between each subscriber, and balancer is in descending order of priority
Guarantee each rigid target and soft target.
Further, the workflow of the message system resources balance device of the present embodiment is as described below: load monitoring is drawn
It holds up 201 and acquires Kafka index from Kafka cluster, and the Kafka index is sent to the analysis engine 202.Analysis is drawn
202 are held up by the Kafka index and the rigid target and soft target of the Kafka cluster, generates and corresponds to all order
The first equalization scheme of reader, and first equalization scheme is sent to the operation enforcement engine 203.The operation executes
Engine 203 generates several operational orders according to first equalization scheme, and several described operational orders are sent to institute
Kafka cluster is stated so that the Kafka cluster carries out resources balance according to the operational order.
Further, the first equalization scheme generated in analysis engine 202 is to need to meet whole rigid targets.
Message system resources balance device provided in an embodiment of the present invention, by generating first in analysis engine 202
Weighing apparatus scheme, can be using rigid target and soft target as core foundation, the operation of Dynamic Execution resource automatic equalization, efficient balance clothes
The utilization rate for device resource of being engaged in, promotes the performance of message system, greatly improves the High Availabitity and robustness of message system;Raising business
The displaying real-time of achievement data and platform performance data, the true health condition and Real-time Feedback business operation for reflecting system
The effective of platform and business datum is required as a result, meeting tenant, promote user experience.
Based on the above embodiment, the information apparatus further includes abnormality detection engine, for being drawn according to load monitoring
The Kafka index for holding up 201 transmissions, detects the exception in the Kafka cluster, obtains abnormality detection result, and
The abnormality detection result is sent to the analysis engine 202;It is corresponding, it is described according to the Kafka index, it is described
The soft target of the rigid target of Kafka cluster and the Kafka cluster generates the first equilibrium side for corresponding to all subscribers
Case specifically includes: according to the Kafka index, the rigid target of the abnormality detection result and the Kafka cluster and soft
Property target, generate correspond to all subscribers the first equalization scheme.
Specifically, it will appear various exceptions in Kafka cluster, by abnormality detection engine to different in Kafka cluster
It is often detected, and will test result and be sent to the analysis engine 202.The first equilibrium side is generated in analysis engine 202 in this way
Also it can take into account the testing result when case.
It should be noted that testing result reflects the abnormal conditions in Kafka cluster, can illustrate are as follows: non-empty
XxBroker peels off.
Based on the above embodiment, the Kafka index sent according to the load monitoring engine 201, to described
Exception in Kafka cluster is detected, and is obtained abnormality detection result, is specifically included: monitoring that engine 201 is sent out according to the load
The Kafka index sent, to the non-empty Broker in the Kafka cluster peel off and the Kafka cluster in violate institute
The case where stating rigid target and the soft target is detected, and abnormality detection result is obtained.
It should be noted that the present embodiment specifically refers to, abnormal conditions include that non-empty Broker peels off and Kafka collection
The case where rigid target and the soft target are violated in group.
Non-empty Broker, which peels off, will lead to subregion number of copies deficiency.Because this may send out during normal cluster recovery
It is raw, so abnormality detection engine provides the configurable grace period in trigger notice and before repairing cluster.
Message system resources balance device provided in an embodiment of the present invention according to Broker failure and violates mesh by setting
Active is attempted to violate by automatically analyzing workload and executing the first equalization scheme to solve target by mark, solves existing skill
With the rapid growth of portfolio in art, needs to handle GB even TB data volume, Message Processing daily and significant delays, platform occur
It can not be presented to tenant in real time with business datum, it is thus possible to cause platform and operation system failure to occur, cannot generate in time
The problem of alarm.The present invention is improved the business throughput of message system using subregion automatic equalization, reduces data delay, and industry is promoted
Business system user experience.
Based on the above embodiment, described that Kafka index is acquired from Kafka cluster, and the Kafka index is sent to
The analysis engine 202, wherein the Kafka index includes load and the partition information of the Kafka cluster, is specifically included:
Kafka index is acquired from Kafka cluster, cluster work load model is generated by the Kafka index, and by the cluster
Work load model is sent to the analysis engine 202 and the abnormality detection engine;Wherein, the Kafka index includes
Kafka cluster overall load information, Kafka clustering performance achievement data, the quantity of the clustered partition Kafka, the clustered partition Kafka
Distributed intelligence and the clustered partition Kafka data balancing information;The cluster work load model includes the disk of Kafka cluster
Utilization rate, the cpu busy percentage of Kafka cluster and the byte input and output rate of Kafka cluster.
It should be noted that the present embodiment refers to, it is negative that load monitoring engine 201 is based on the generation cluster work of Kafka index
Model is carried, analysis engine 202 and abnormality detection engine are the cluster work load models for receiving load monitoring engine 201 and sending
, cluster work load model reflects the information such as load and the work of Kafka cluster.
Message system resources balance device provided in an embodiment of the present invention loads monitoring engine 201 by setting and is based on
Kafka index generates cluster work load model, and the first equalization scheme ultimately generated is enabled to accurately to be applicable in.
Based on the above embodiment, the analysis engine 202 is also used to through the Kafka index and the Kafka
The rigid target and soft target of cluster generate when the Kafka cluster violates any rigid target and correspond to all order
The second equalization scheme of reader, and second equalization scheme is sent to the operation enforcement engine 203.
It should be noted that the present embodiment is to violate the premise of rigid target in the first equalization scheme of previous execution
Under, second equalization scheme is regenerated, herein, violating rigid target is detected by abnormality detection engine.
Based on the above embodiment, the Kafka cluster carries out resources balance according to the operational order, comprising: described
Kafka cluster carries out the dilatation of the clustered partition Kafka, the clustered partition Kafka reassignment and Kafka collection according to the operational order
At least one of group's subregion copy reassignment, so that the Kafka cluster resource is balanced.
It should be noted that the instruction operation of several operational orders in the embodiment of the present invention includes Kafka cluster point
At least one of area's dilatation, the clustered partition Kafka reassign and the clustered partition Kafka copy reassigns, and are a kind of preferred
Scheme, it includes other schemes for indicating operation that the present invention, which also protects,.
Message system resources balance device provided in an embodiment of the present invention will be operated by setting operation enforcement engine 203
Instruction is sent in the Kafka cluster to carry out the dilatation of the clustered partition Kafka, the clustered partition Kafka to the Kafka cluster
At least one of reassignment and the clustered partition Kafka copy reassignment, so that resources balance, can be realized Kafka and disappear
The resource automatic equalization of breath system, enhances the High Availabitity of data, avoids loss of data, to reach highest business throughput, subtract
Minority promotes operation system user experience according to blocking time.
Based on the above embodiment, the balancer further includes data collector, and the data collector includes
Workload collector, Metrics collector and Partition collector;The Workload collector is described for acquiring
Kafka cluster overall load information;The Metrics collector is for acquiring Kafka clustering performance achievement data;It is described
Partition collector be used to acquire the quantity of the clustered partition Kafka, the clustered partition Kafka distributed intelligence and
The clustered partition the Kafka data balancing information.
It should be noted that the data collector in the present embodiment is to acquire the Kafka index proposed in above-described embodiment
's.
Further, the data collector proposed in the embodiment of the present invention includes Workload collector, Metrics collection
Device and Partition collector, are a kind of preferable cases, and the present invention also protects the scheme including other kinds of collectors.
Message system resources balance device provided in an embodiment of the present invention includes Workload by setting data collector
Collector, Metrics collector and Partition collector can acquire more accurate Kafka index, greatly improve
The each Broker resource utilization of message system.
As a preferred embodiment, Fig. 3 is the another message system resources balance apparatus module in the embodiment of the present invention
Figure, as shown in figure 3, including load monitoring engine 201, analysis engine 202 and operation enforcement engine 203;The load monitoring
The Kafka index for acquiring Kafka index from Kafka cluster, and is sent to the analysis engine by engine 201
202, wherein the Kafka index includes load and the partition information of the Kafka cluster;The analysis engine 202, is used for
According to the Kafka index, the soft target of the rigid target of the Kafka cluster and the Kafka cluster, generation corresponds to
The first equalization scheme of all subscribers, and first equalization scheme is sent to the operation enforcement engine 203, wherein
The hardness target is the target that several described Kafka clusters must be realized, the soft target is several described Kafka
The target that cluster is preferably realized;The operation enforcement engine 203, for generating several operations according to first equalization scheme
Instruction, and several described operational orders are sent to the Kafka cluster so that the Kafka cluster refers to according to the operation
It enables and carries out resources balance.
It further include abnormality detection engine, the Kafka index for being sent according to the load monitoring engine 201 is right
Exception in the Kafka cluster is detected, and abnormality detection result is obtained, and the abnormality detection result is sent to described
Analysis engine 202;It is corresponding, it is described according to the Kafka index, the rigid target of the Kafka cluster and the Kafka collection
The soft target of group generates the first equalization scheme for corresponding to all subscribers, specifically includes: according to the Kafka index, institute
It states the rigid target and soft target of abnormality detection result and the Kafka cluster, generates and correspond to the of all subscribers
One equalization scheme.
The balancer further includes data collector, and the data collector includes Workload collector, Metrics
Collector and Partition collector;The Workload collector is for acquiring the Kafka cluster overall load information;
The Metrics collector is for acquiring Kafka clustering performance achievement data;The Partition collector is for acquiring institute
State quantity, the clustered partition Kafka distributed intelligence and the clustered partition the Kafka data balancing of the clustered partition Kafka
Information.
Message system resources balance device provided in an embodiment of the present invention, by introducing data collector, load monitoring is drawn
201, abnormality detection engine, analysis engine 202 and operation enforcement engine 203 are held up, can be realized message system subregion, subregion copy
And Broker resource automatic equalization, Broker server resource utilization rate is improved, the arrangement achieves the height between each engine
Degree decoupling, meets the requirement of distributed deployment, and can precisely judge that each Broker resource makes by comprehensive collector
With situation, operation system is operated in the environment of optimum performance, promotes operation system stability and user experience.This
Invention implement in balancer make that Kafka message system is reliable, has strong processing capacity and high-throughput, meet constantly
The business demand of the cloud pipe platform of development.
Based on the above embodiment, Fig. 4 is the flow chart of message system resources balance embodiment of the method for the present invention, such as Fig. 4 institute
Show, comprising: S401, load monitoring engine 201 acquire Kafka index from Kafka cluster, and the Kafka index sent
To the analysis engine 202, wherein the Kafka index includes load and the partition information of the Kafka cluster;S402, institute
Analysis engine 202 is stated according to the soft mesh of the Kafka index, the rigid target of the Kafka cluster and the Kafka cluster
Mark generates the first equalization scheme for corresponding to all subscribers, and first equalization scheme is sent to operation enforcement engine
203, wherein the hardness target is the target that several described Kafka clusters must be realized, the soft target is several
The target that the Kafka cluster is preferably realized;S403, the operation enforcement engine 203 are generated according to first equalization scheme
Several operational orders, and by several described operational orders be sent to the Kafka cluster for the Kafka cluster according to
The operational order carries out resources balance.
Based on the above embodiment, Fig. 5 is the block schematic illustration of the message system resources balance equipment in the embodiment of the present invention.
Referring to FIG. 5, the embodiment of the present invention provides a kind of message system resources balance equipment, comprising: processor (processor) 510,
Communication interface (Communications Interface) 520, memory (memory) 530 and bus 540, wherein processor
510, communication interface 520, memory 530 completes mutual communication by bus 540.Processor 510 can call memory
Logical order in 530, to execute following method, comprising: load monitoring engine 201 acquires Kafka from Kafka cluster and refers to
Mark, and the Kafka index is sent to the analysis engine 202, wherein the Kafka index includes the Kafka cluster
Load and partition information;The analysis engine 202 is according to the Kafka index, the rigid target of the Kafka cluster and institute
It states the soft target of Kafka cluster, generates the first equalization scheme for corresponding to all subscribers, and by first equalization scheme
It is sent to operation enforcement engine 203, wherein the hardness target is the target that several described Kafka clusters must be realized, institute
Stating soft target is the target that several described Kafka clusters are preferably realized;The operation enforcement engine 203 is according to described first
Equalization scheme generates several operational orders, and several described operational orders are sent to the Kafka cluster for described
Kafka cluster carries out resources balance according to the operational order.
Based on the above embodiment, the embodiment of the present invention discloses a kind of computer program product, the computer program product
Including the computer program being stored in non-transient computer readable storage medium, the computer program includes program instruction,
When described program instruction is computer-executed, computer is able to carry out equalization methods provided by above method embodiment, example
Such as include: that load monitoring engine 201 acquire Kafka index from Kafka cluster, and described in the Kafka index is sent to
Analysis engine 202, wherein the Kafka index includes load and the partition information of the Kafka cluster;The analysis engine
202 according to the Kafka index, the soft target of the rigid target of the Kafka cluster and the Kafka cluster, generation pair
Operation enforcement engine 203 should be sent in the first equalization scheme of all subscribers, and by first equalization scheme, wherein
The hardness target is the target that several described Kafka clusters must be realized, the soft target is several described Kafka
The target that cluster is preferably realized;The operation enforcement engine 203 generates several operational orders according to first equalization scheme,
And by several described operational orders be sent to the Kafka cluster for the Kafka cluster according to the operational order into
Row resources balance.
Based on the above embodiment, the embodiment of the present invention provides a kind of non-transient computer readable storage medium, described non-temporary
State computer-readable recording medium storage computer instruction, the computer instruction make the computer execute above method implementation
Equalization methods provided by example, for example, load monitoring engine 201 acquires Kafka index from Kafka cluster, and by institute
State Kafka index and be sent to the analysis engine 202, wherein the Kafka index include the Kafka cluster load and
Partition information;The analysis engine 202 is according to the Kafka index, the rigid target of the Kafka cluster and the Kafka
The soft target of cluster generates the first equalization scheme for corresponding to all subscribers, and first equalization scheme is sent to
Operate enforcement engine 203, wherein the hardness target is the target that several described Kafka clusters must be realized, described soft
Target is the target that several described Kafka clusters are preferably realized;The operation enforcement engine 203 is according to the first equilibrium side
Case generates several operational orders, and several described operational orders are sent to the Kafka cluster for the Kafka collection
Group carries out resources balance according to the operational order.
Those of ordinary skill in the art will appreciate that: realize that above equipment embodiment or embodiment of the method are only schematic
, wherein the processor and the memory can be physically separate component may not be it is physically separated, i.e.,
It can be located in one place, or may be distributed over multiple network units.It can select according to the actual needs therein
Some or all of the modules achieves the purpose of the solution of this embodiment.Those of ordinary skill in the art are not paying creative labor
In the case where dynamic, it can understand and implement.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment can
It realizes by means of software and necessary general hardware platform, naturally it is also possible to pass through hardware.Based on this understanding, on
Stating technical solution, substantially the part that contributes to existing technology can be embodied in the form of software products in other words, should
Computer software product may be stored in a computer readable storage medium, such as USB flash disk, mobile hard disk, ROM/RAM, magnetic disk, CD
Deng, including some instructions use is so that a computer equipment (can be personal computer, server or the network equipment etc.)
Execute method described in certain parts of each embodiment or embodiment.
Message system resources balance device provided in an embodiment of the present invention, method and apparatus pass through raw in analysis engine
, can be using rigid target and soft target as core foundation at the first equalization scheme, the operation of Dynamic Execution resource automatic equalization has
The utilization rate for imitating equalization server resource, promotes the performance of message system, greatly improves the High Availabitity and robustness of message system;
Improve the displaying real-time of operational indicator data and platform performance data, the true health condition and Real-time Feedback for reflecting system
Requiring as a result, meeting tenant platform and the effective of business datum for business operation, promotes user experience.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although
Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used
To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features;
And these are modified or replaceed, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution spirit and
Range.