CN105302634B - The method for parallel processing and device of event - Google Patents
The method for parallel processing and device of event Download PDFInfo
- Publication number
- CN105302634B CN105302634B CN201410244381.8A CN201410244381A CN105302634B CN 105302634 B CN105302634 B CN 105302634B CN 201410244381 A CN201410244381 A CN 201410244381A CN 105302634 B CN105302634 B CN 105302634B
- Authority
- CN
- China
- Prior art keywords
- event
- handler
- buffer
- identifier
- sent
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Multi Processors (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the invention provides a kind of method for parallel processing of event and device, which includes: that receiving unit receives the M event that case distribution device is sent;First processing units handle M event, to obtain N number of event;The sequence consensus of the sequence of N number of event and N number of event in the sequence of M event;The second processing unit obtains first identifier;Transmission unit sends N number of event and the first identifier to event follower, in order to which the event follower sends N number of event to other devices, and after sending N number of event to other devices, according to the first identifier, the N number of event obtained from next event handler is sent to other described devices.The technical solution provided according to embodiments of the present invention may be implemented to improve event handling efficiency while guaranteeing event order.
Description
[technical field]
The present invention relates to the method for parallel processing and device of field of computer technology more particularly to a kind of event.
[background technique]
Currently, event-driven framework (Event Driven Architecture, EDA) can pass through application program, adaptation
Device and agent operation without invasive create service.EDA can also be used to realize enterprise application system, in these application systems
In system, the message of event triggering can be transmitted between independent, non-coupled component.Wherein, Complex event processing
(Complex Event Processing, CEP) engine is for coordinating these stand-alone utilities.CEP can be detected rapidly
Outgoing event and the type for judging outgoing event, thus help organization quickly, properly handle these events.CEP technology conduct
Realize that the mainstream technology of EDA is developed by leaps and bounds.
In the prior art, the event-handling method based on CEP technology is a kind of orderly method for parallel processing, this method packet
Include: case distribution device receives the flow of event of input, and the event in flow of event has certain sequence;Then case distribution device is by thing
Event in part stream is sent to multiple event handlers according to polling mode;Multiple event handlers concurrently handle the thing received
Then event is randomly sent to event follower by part, the sequence and input of event in the flow of event in order to guarantee output
The sequence consensus of event in flow of event, event follower need to be ranked up processing to the event that event handler is sent, then
Export ranking results.
However, in order to guarantee the order of event, event follower needs to occupy longer time in above-mentioned processing method
Processing is ranked up to event, increases the time overhead of event handling, so that event handling efficiency is lower.
[summary of the invention]
In view of this, being protected the embodiment of the invention provides a kind of method for parallel processing of event and device to realize
Event handling efficiency is improved while card event order.
In a first aspect, described device is event handling the embodiment of the invention provides a kind of parallel processing apparatus of event
Device, comprising:
Receiving unit, for receiving M event of case distribution device transmission, M is the integer more than or equal to 1;
First processing units, for handling the M event, to obtain N number of event;N is less than or equal to M
And the integer more than or equal to 0;The sequence of N number of event described in sequence of the sequence of N number of event with the M event
Unanimously;
The second processing unit, for obtaining first identifier;
Transmission unit, for sending N number of event and the first identifier to event follower, in order to the event
Follower sends N number of event to other devices, and after having sent N number of event to other devices, according to institute
First identifier is stated, the N number of event obtained from next event handler is sent to other described devices.
In the first possible implementation of the first aspect, the first identifier is next event handler
Mark, the receiving unit is also used to: receiving the mark for next event handler that the case distribution device is sent
Know, next event handler is identified as the case distribution device according to the mark of each event handler and pre-
If at least two event handler sequence obtain;Alternatively,
The first identifier is used to indicate each event handler and sends N number of event to the event follower
It finishes, described the second processing unit is specifically used for: generating the first identifier.
With reference to first aspect or the first possible implementation of first aspect, second in first aspect are possible
In implementation, the event follower includes controller and at least two event buffers, at least two event buffer
Device and at least two event handler correspond, and the transmission unit is specifically used for:
N number of event is successively sent to the corresponding event buffer, in order to the corresponding event buffer
The N number of event obtained from the corresponding event handler is stored, in order to which the controller sends institute to other described devices
State N number of event of event buffer storage;
After having sent N number of event to the corresponding event buffer, sent to the corresponding event buffer
The first identifier is successively sent under described in order to which the controller is according to the first identifier to other described devices
N number of event that the corresponding event buffer of one event handler obtains.
Second aspect, the embodiment of the invention provides a kind of parallel processing apparatus of event, described device is event output
Device, including controller and at least two event buffers, at least two event buffer and at least two event handlers
It corresponds:
Each event buffer, for receiving and storing N number of event that corresponding event handler is sent and described
First identifier;N number of event is after the event handler receives the M event that case distribution device is sent, to the M
What event obtained after being handled, M is the integer more than or equal to 1, and N is less than or equal to M and more than or equal to 0
Integer;The sequence consensus of N number of event described in sequence of the sequence of N number of event with the M event;
The controller, for sending N number of event that each event buffer stores to other devices, and
After having sent N number of event to other devices, according to the first identifier of each event buffer storage, to
Other described devices send N number of event of next event buffer storage.
In the first possible implementation of the second aspect, the first identifier is used to indicate at each event
Reason device sends N number of event to the corresponding event buffer and finishes, and the controller is specifically used for:
According to the sequence of the first identifier and preset at least two event handler, next thing is determined
Part processor;
According to the corresponding relationship of event handler and event buffer, the corresponding thing of next event handler is determined
Part buffer;
N number of thing that the corresponding event buffer of next event handler stores is sent to other described devices
Part.
In a second possible implementation of the second aspect, the first identifier is next event handler
Mark, the controller is specifically used for:
According to the mark of next event handler, next event handler is determined;
According to the corresponding relationship of event handler and event buffer, the corresponding thing of next event handler is determined
Part buffer;
N number of thing that the corresponding event buffer of next event handler stores is sent to other described devices
Part.
The third aspect is applied to include case distribution the embodiment of the invention provides a kind of method for parallel processing of event
The system of device, at least two event handlers and event follower, comprising:
Each event handler receives the M event that the case distribution device is sent, and M is more than or equal to 1
Integer;
Each event handler handles the M event, to obtain N number of event;N be less than or equal to
M and be more than or equal to 0 integer;N number of event described in sequence of the sequence of N number of event with the M event it is suitable
Sequence is consistent;
Each event handler obtains first identifier;
Each event handler sends N number of event and the first identifier to event follower, in order to institute
It states event follower and sends N number of event to other devices, and after having sent N number of event to other devices,
According to the first identifier, the N number of event obtained from next event handler is sent to other described devices.
In the first possible implementation of the third aspect, the first identifier is next event handler
Mark, each event handler obtains first identifier, comprising: each event handler receives the event
The mark for next event handler that distributor is sent, next event handler are identified as the event point
Send out what device was obtained according to the mark of each event handler and the sequence of preset at least two event handler;Or
Person,
The first identifier is used to indicate each event handler and sends N number of event to the event follower
It finishes, each event handler obtains first identifier, comprising: each event handler generates described the
One mark.
In conjunction with the possible implementation of the first of the third aspect or the third aspect, second in the third aspect is possible
In implementation, the event follower includes controller and at least two event buffers, at least two event buffer
Device and at least two event handler correspond, and each event handler is to described in the transmission of event follower
N number of event and the first identifier, comprising:
Each event handler successively sends N number of event to the corresponding event buffer, in order to right
The event buffer answered stores the N number of event obtained from the corresponding event handler, in order to the controller to
Other described devices send N number of event of the event buffer storage;
After each event handler has sent N number of event to the corresponding event buffer, to corresponding
The event buffer sends the first identifier, in order to which the controller is according to the first identifier, to other described devices
Part successively sends the N number of event obtained from the corresponding event buffer of the next event handler.
Fourth aspect, the embodiment of the invention also provides a kind of method for parallel processing of event, are applied to including event point
The system for sending out device, at least two event handlers and event follower, comprising:
The event follower receives and stores the N number of event and the first identifier that corresponding event handler is sent;
N number of event is after the event handler receives the M event that case distribution device is sent, to carry out to the M event
It is obtained after processing, M is the integer more than or equal to 1, and N is the integer less than or equal to M and more than or equal to 0;Institute
State the sequence consensus of N number of event described in sequence of the sequence of N number of event with the M event;
The event follower sends N number of event that each event buffer stores to other devices, and
After having sent N number of event to other devices, according to the first identifier of each event buffer storage, to
Other described devices send N number of event of next event buffer storage.
In the first possible implementation of the fourth aspect, the first identifier is used to indicate at each event
Reason device sends N number of event to the event follower and finishes, described according to described in each event buffer storage
First identifier sends N number of event that next event buffer stores to other described devices, comprising:
Sequence of the controller according to the first identifier and preset at least two event handler, determines institute
State next event handler;
Corresponding relationship of the controller according to event handler and event buffer, triggers determining next thing
The corresponding event buffer of part processor;
N number of thing that the corresponding event buffer of next event handler stores is sent to other described devices
Part.
In the second possible implementation of the fourth aspect, the first identifier is next event handler
Mark, the first identifier according to each event buffer storage sends next to other described devices
N number of event of event buffer storage, comprising:
Mark of the controller according to next event handler, determines next event handler;
Corresponding relationship of the controller according to event handler and event buffer, triggers determining next thing
The corresponding event buffer of part processor;
N number of thing that the corresponding event buffer of next event handler stores is sent to other described devices
Part.
As can be seen from the above technical solutions, the embodiment of the present invention has the advantages that
Event handler is handled event according to the sequence of event, and event follower foundation first identifier is according to thing
The sequence of part processor is sequentially output the event obtained from each event handler, therefore, so that event follower is to other devices
The sequence of event and the sequence of these event entry event distributors of part output are consistent, to ensure that event is being divided
The order of whole process is sent out, handles and exports, so that event follower does not need that event ordering can be exported sequence guarantor
Constant event is held, the processing time of event is saved, improves the treatment effeciency of event.
[Detailed description of the invention]
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be to needed in the embodiment attached
Figure is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for this field
For those of ordinary skill, without any creative labor, it can also be obtained according to these attached drawings other attached
Figure.
Fig. 1 is the schematic diagram of the parallel processing system (PPS) of event provided by the embodiment of the present invention;
Fig. 2 is the functional block diagram of the parallel processing apparatus one of event provided by the embodiment of the present invention;
Fig. 3 is the structural schematic diagram of the parallel processing apparatus one of event provided by the embodiment of the present invention;
Fig. 4 is the functional block diagram of the parallel processing apparatus two of event provided by the embodiment of the present invention;
Fig. 5 is the structural schematic diagram of the parallel processing apparatus two of event provided by the embodiment of the present invention;
Fig. 6 is the flow diagram of the method for parallel processing one of event provided by the embodiment of the present invention;
Fig. 7 is the schematic diagram of flow of event in the parallel processing system (PPS) of event provided by the embodiment of the present invention;
Fig. 8 is event format schematic diagram provided by the embodiment of the present invention;
Fig. 9 is the schematic diagram of time slip-window provided by the embodiment of the present invention;
Figure 10, which is event handler provided by the embodiment of the present invention, sends event and first identifier to event follower
Schematic diagram;
Figure 11 is the flow diagram of the method for parallel processing two of event provided by the embodiment of the present invention;
Figure 12 is the schematic diagram of pointer and event buffer provided by the embodiment of the present invention.
[specific embodiment]
For a better understanding of the technical solution of the present invention, being retouched in detail to the embodiment of the present invention with reference to the accompanying drawing
It states.
It will be appreciated that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Base
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts it is all its
Its embodiment, shall fall within the protection scope of the present invention.
Referring to FIG. 1, its schematic diagram for the parallel processing system (PPS) of event provided by the embodiment of the present invention, as schemed institute
Show, which includes case distribution device 101, at least two event handlers 102 and event follower 103, wherein event output
Device 103 includes controller 1031 and at least two event buffers 1032.
Referring to FIG. 2, its functional block diagram for the parallel processing apparatus one of event provided by the embodiment of the present invention, it should
Device is above-mentioned event handler, as shown, the device includes:
Receiving unit 201, for receiving M event of case distribution device transmission, M is the integer more than or equal to 1;
First processing units 202, for handling the M event, to obtain N number of event;N is to be less than or wait
In M and be more than or equal to 0 integer;N number of event described in sequence of the sequence of N number of event with the M event
Sequence consensus;
The second processing unit 203, for obtaining first identifier;
Transmission unit 204, for sending N number of event and the first identifier to event follower, in order to described
Event follower sends N number of event to other devices, and after having sent N number of event to other devices, according to
According to the first identifier, the N number of event obtained from next event handler is sent to other described devices.
Preferably, the first identifier is the mark of next event handler, and the receiving unit 201 is also used
In: the mark for next event handler that the case distribution device is sent is received, next event handler
It is identified as mark and preset at least two event handling of the case distribution device according to each event handler
What the sequence of device obtained;It is sent out alternatively, the first identifier is used to indicate each event handler to the event follower
N number of event is sent to finish, described the second processing unit 203 is specifically used for: generating the first identifier.
Preferably, the event follower includes controller and at least two event buffers, at least two event
Buffer and at least two event handler correspond, and the transmission unit 201 is specifically used for: to the corresponding thing
Part buffer successively sends N number of event, in order to which the corresponding event buffer storage is from the corresponding event
N number of event that device obtains is managed, in order to which the controller sends the N that the event buffer stores to other described devices
A event;After having sent N number of event to the corresponding event buffer, institute is sent to the corresponding event buffer
First identifier is stated, in order to which the controller is according to the first identifier, is successively sent to other described devices from described next
N number of event that the corresponding event buffer of a event handler obtains.
Referring to FIG. 3, its structural schematic diagram for the parallel processing apparatus one of event provided by the embodiment of the present invention, it should
Device is above-mentioned event handler, as shown, the device includes:
Receiver 301, for receiving M event of case distribution device transmission, M is the integer more than or equal to 1;
Memory 302, for storing one or more groups of program codes;
Processor 303 is coupled respectively with receiver 301, memory 302 and transmitter 304, is deposited for calling in memory
The program code of storage, to perform the following operations: handling the M event, to obtain N number of event;N is to be less than or wait
In M and be more than or equal to 0 integer;N number of event described in sequence of the sequence of N number of event with the M event
Sequence consensus;Obtain first identifier;
Transmitter 304, for sending N number of event and the first identifier to event follower, in order to the thing
Part follower sends N number of event to other devices, and after having sent N number of event to other devices, foundation
The first identifier sends the N number of event obtained from next event handler to other described devices.
Referring to FIG. 4, its functional block diagram for the parallel processing apparatus two of event provided by the embodiment of the present invention, it should
Device is above-mentioned event follower, as shown, the event follower includes controller 401 and at least two event buffers
402, at least two event buffer 402 and at least two event handlers correspond:
Each event buffer 402, for receiving and storing the N number of event and institute that corresponding event handler is sent
State first identifier;N number of event is after the event handler receives the M event that case distribution device is sent, to the M
What a event obtained after being handled, M is the integer more than or equal to 1, and N is less than or equal to M and to be more than or equal to 0
Integer;The sequence consensus of N number of event described in sequence of the sequence of N number of event with the M event;
The controller 401, for sending N number of event that each event buffer stores to other devices,
First mark and after having sent N number of event to other devices, according to each event buffer storage
Know, sends N number of event that next event buffer stores to other described devices.
Preferably, the first identifier is used to indicate each event handler and sends out to the corresponding event buffer
N number of event is sent to finish, the controller 401 is specifically used for: according to the first identifier and preset described at least two
The sequence of event handler determines next event handler;According to event handler pass corresponding with event buffer
System triggers the corresponding event buffer 402 of the determining next event handler;To other described devices send it is described under
N number of event of the corresponding event buffer storage of one event handler.
Preferably, the first identifier is the mark of next event handler, and the controller 401 is specifically used
In: according to the mark of next event handler, determine next event handler;According to event handler and thing
The corresponding relationship of part buffer triggers the corresponding event buffer 402 of the determining next event handler;To it is described its
His device sends N number of event of the corresponding event buffer storage of next event handler.
Referring to FIG. 5, its structural schematic diagram for the parallel processing apparatus two of event provided by the embodiment of the present invention, it should
Device is above-mentioned event follower, as shown, the device includes:
Receiver 501, the N number of event and the first identifier sent for receiving and storing corresponding event handler;
N number of event is after the event handler receives the M event that case distribution device is sent, to carry out to the M event
It is obtained after processing, M is the integer more than or equal to 1, and N is the integer less than or equal to M and more than or equal to 0;Institute
State the sequence consensus of N number of event described in sequence of the sequence of N number of event with the M event;
Memory 502, for storing one or more groups of program codes;
Processor 503 couples respectively with receiver 501 and memory 502, for calling the journey stored in memory 502
Sequence code, to perform the following operations: sending N number of event that each receiver 501 stores, Yi Ji to other devices
After having sent N number of event to other devices, according to the first identifier that each receiver 501 stores, to institute
State N number of event that other devices send next receiver storage.
The embodiment of the present invention further provides the embodiment of the method for realizing each unit in above-mentioned apparatus embodiment.
The embodiment of the present invention provides a kind of method for parallel processing of event, referring to FIG. 6, it is mentioned by the embodiment of the present invention
The flow diagram of the method for parallel processing one of the event of confession, this method is applied to system shown in Figure 1, as shown, this method
The following steps are included:
Step 601, each event handler receives the M event that the case distribution device is sent, M to be greater than or
Integer equal to 1.
Specifically, referring to FIG. 7, it is flow of event in parallel processing system (PPS) of event provided by the embodiment of the present invention
Schematic diagram as shown, case distribution device can obtain event from default file, or obtains event from database, or
Person obtains event from card reader, or obtains flow of event from other information flow devices that can be used as event.Case distribution device
It may include K event in the flow of event of acquisition, wherein K is the integer more than or equal to 2, the K event tool in flow of event
There is certain sequence.In the embodiment of the present invention, event refers to information entity predetermined, can be handled by computing system
Unit.
For example, referring to FIG. 8, it is event format schematic diagram provided by the embodiment of the present invention, as shown, flow of event
In each event include ID, Attr1~AttrP and TS;Wherein, ID is the mark of event, and Attr1~AttrP is the P of event
A attribute value, TS are the timestamp of event.The event that case distribution device receives needs to meet TSi<TSi+1, the footmark expression of TS
Case distribution device obtains the sequencing of event, and P is the integer more than or equal to 1.
Preferably, can preset a configuration file in case distribution device, the configuration file for save event with
The corresponding relationship of grouping strategy, in this way, case distribution device can be according to thing in flow of event after case distribution device obtains flow of event
The mark of part finds corresponding grouping strategy in the corresponding relationship of event and grouping strategy, using the grouping strategy as the thing
The grouping strategy of the affiliated flow of event of part.Alternatively, case distribution device obtains the event according to certain attribute value in event in flow of event
The grouping strategy of stream, wherein the attribute value can serve to indicate that grouping strategy.
Preferably, case distribution device, can be according to the grouping strategy and event after the grouping strategy for obtaining flow of event
The sequence of K event in stream is grouped K event in flow of event, obtains at least two event groups, each event group can
To include M event, wherein M is the integer more than or equal to 1;Then, an event group is issued one by case distribution device
Event handler.
For example, sequence of the case distribution device according to K event in grouping strategy and flow of event, in flow of event
The method that K event is grouped may include following three kinds:
The first: case distribution device is grouped processing to flow of event according to time span.For example, case distribution device is established
One buffer area, the time span threshold value of the buffer area are L;The event of acquisition is successively put into the buffer area by case distribution device
In, remember that the time stamp T S for the event that first enters the buffer area is TS0, will when case distribution device obtains an event
The time stamp T S and TS of the event0It is compared, if (TS-TS0) > L, then using M event in current buffer as a thing
Then the event group is sent to an event handler by part group, then case distribution thinks highly of again above-mentioned treatment process.
Second: case distribution device is grouped processing to flow of event according to event number.For example, case distribution device is established
One buffer area, the event number threshold value of the buffer area are M;A counter is arranged in simultaneous events distributor, which uses
The number of event counts in buffer area;The event of acquisition is successively put into the buffer area by case distribution device, works as meter
When the numerical value of number device is equal to event number threshold value M, case distribution device is using M event in current buffer as an event
Then the event group is sent to an event handler by group, then case distribution thinks highly of again above-mentioned treatment process.
The third: case distribution device is grouped processing to flow of event according to time slip-window.Figure Fig. 9 is please referred to, is
The schematic diagram of time slip-window provided by the embodiment of the present invention, as shown, case distribution device, which establishes one, to be slided
Buffer area, sliding step S;The time span threshold value of the buffer area is L, and the event of acquisition, which is successively put into this, to slide
Buffer area in, remember first enter the buffer area that can be slided event time stamp T S be TS0, whenever case distribution device
When obtaining an event, by the time stamp T S and TS of the event0It is compared, if (TS-TS0) > L, then case distribution device will be current
M event in buffer area is as an event group, and then the event group is sent to an event handler by case distribution device;
Meanwhile emptying TS0To TS0Event in+S range updates current TS0, make TS0=TS0+ S, then case distribution is thought highly of again above-mentioned
Treatment process.
It should be noted that case distribution device utilizes above-mentioned grouping strategy, by the K with certain sequence in flow of event
Each event group after being divided at least two event groups according to the time sequencing of event, is distributed to an event handler by event,
The sequence of event group is consistent with the sequence of event handler, in this way, each event handler will receive event point
Send out the M event that device is sent.In addition, the M event that case distribution device is sent to certain event handler is sent together, without
Be by M event one by one be sent in sequence to the event handler, similarly, event handler is also disposably to have received M
A event with certain sequence.
For example, as shown in fig. 7, case distribution device obtains n event, then by n event as unit of every 10 events
It is grouped, each event group of acquisition includes 10 events, and the event group of acquisition is then distributed to 1~thing of event handler
Part processor m, is such as sent to event handler 1 for 1~event of event 10, and 11~event of event 20 is sent to event handler
2,21~time of event 30 is sent to event handler 3, and so on.
It should be noted that the number m of event handler is less than the number of event group, for exceeding event handler
Number m other than event group distributed since event handler 1 again, have at least one event handler that will receive at least in this way
Two event groups.
Step 602, each event handler handles the M event, to obtain N number of event;N be less than
Or the integer equal to M and more than or equal to 0;It is N number of described in sequence of the sequence of N number of event with the M event
The sequence consensus of event.
Specifically, each event handler needs after receiving M event according to M at least two event handlers
The sequence of event handles M event, to obtain N number of event;Wherein, N is less than or equal to M and to be greater than or wait
In 0 integer;In the embodiment of the present invention, the sequence of the M event refers to that the case distribution device obtains the M event
Sequence, and the sequence consensus of N number of event described in sequence of the sequence of N number of event with the M event.
For example, case distribution device obtains as shown in fig. 7, case distribution device sends 1~event of event 10 to event handler 1
The sequence for obtaining 1~event of event 10 is consistent with the serial number of event, and event handler 1 is also pressed after obtaining 1~event of event 10
According to event 1, event 2, event 3 ..., the sequence of event 10 successively handles each event.
M event is carried out for example, each event handler can use preset operation (Operator) logic
Processing, to obtain N number of event, the sequence one of N number of event described in sequence of the sequence of N number of event with the M event
It causes.For example, at least one attribute conditions, such as attribute thresholds are arranged on each event handler, event handler successively judges
Whether the attribute value in each event meets preset attribute conditions, if the attribute value in an event is unsatisfactory for attribute item
Part then abandons the event;If the attribute value in an event meets attribute conditions, retain the event, and the event is sent out
Give event follower.
Optionally, when the number m of event handler is less than the number of event group, there is at least one event handler that will receive
To at least two event groups, and since the processing capacity of event handler is limited, event handler can received at least
When two event groups, the event group received to after is cached, after waiting the event handling in the event group first received,
The event group of caching is handled.
Step 603, each event handler obtains first identifier.
Specifically, each event handler needs to obtain first identifier.The first identifier can be next thing
The mark of part processor is sent out alternatively, the first identifier is used to indicate each event handler to the event follower
N number of event is sent to finish.
Preferably, the method that each event handler obtains first identifier may include following two:
The first: it, can be in case distribution device if the first identifier is the mark of next event handler
It is pre-configured with the sequence of event handler and the mark of each event handler, in this way, case distribution device can be according to each
The mark of event handler and the sequence of preset at least two event handler, obtain next thing of each event handler
The mark of part processor, then case distribution device sends the mark of its next event handler to the event handler, in this way,
Each event handler can receive the mark of next event handler of case distribution device transmission, that is to say, that each
Event handler can obtain first identifier from event distributor.
Second: if the first identifier, which is used to indicate each event handler, sends institute to the event follower
N number of event is stated to finish, before each event handler sends N number of event to event follower, alternatively, each event handler to
After event follower sends N number of event, alternatively, while each event handler sends N number of event to event follower, by
Each event handler automatically generates the first identifier.
For example, if the attribute value of first attribute is 2 in an event, if the attribute value of the Attr1 in Fig. 8 is 2,
Indicate that the event is a common event, i.e., the event is that event handler is obtained from event distributor;If in an event,
The attribute value of first attribute is 1, indicates the event not instead of common event, the first identifier that event handler generates, this
Sample, event follower is when discovery has the attribute value of first attribute in an event to be 1, so that it may determine that the event is first
Mark.
Step 604, each event handler sends N number of event and the first identifier to event follower,
In order to which the event follower sends N number of event to other devices, and N number of thing is being sent to other devices
After part, according to the first identifier, the N number of event obtained from next event handler is sent to other described devices.
Specifically, the event follower may include a controller and at least two events in the embodiment of the present invention
Buffer, at least two event buffer and at least two event handler correspond, that is to say, that each thing
Part processor has a corresponding event buffer, and the number of event buffer needs to be equal to event handling in event follower
The number of device.
Preferably, each event handler may is that the method that event follower sends N number of event and first identifier
Firstly, each event handler successively sends N number of event to the corresponding event buffer, in order to right
The event buffer answered stores the N number of event obtained from the corresponding event handler, in order to the controller to
Other described devices send N number of event of the event buffer storage.
Wherein, event handler just at once will when handling M event of acquisition whenever having handled an event
The event is sent to corresponding event buffer, and therefore, N number of event that event handler is sent to corresponding event buffer is
Successively transmission one by one, moreover, the sequence of event handler processing event is the sequence according to the event of acquisition, and at event
Reason device is to the sequence that the sequence that corresponding event buffer sends event is according to processing event, it may therefore be assured that corresponding
The sequence of event obtains the sequence consensus of event with event handler in event buffer.In this way, event buffer is from event
Reason device receives an event, caches to the event, and controller can be monitored event buffer, judges that event is slow
Whether the event cached in storage is first identifier, if not first identifier, just sends other devices for the event at once;
To which controller can realize that N number of event by event buffer storage is successively sent to other devices.
Then, after each event handler has sent N number of event to corresponding event buffer, then to corresponding described
Event buffer sends the first identifier, in order to which the controller is according to the first identifier, to other described devices according to
It is secondary to send the N number of event obtained from the corresponding event buffer of the next event handler.Event buffer is from event
After reason device receives first identifier, which is cached, controller can be monitored event buffer, judgement
Whether the event cached in event buffer is first identifier, if it is first identifier, then jumps to next event handler
Corresponding event buffer successively sends N number of event of the corresponding event buffer storage of the next event handler
Give other devices.
Referring to FIG. 10, it sends event and the to event follower for event handler provided by the embodiment of the present invention
The schematic diagram of one mark, as shown, event group 1 is sent to corresponding event buffer 1 by event handler 1, in event group 1
Including 12 events, 12 events are successively sent to event buffer 1 by event handler 1, and are sending the 12nd event
Afterwards, the first identifier that itself is obtained is sent to event buffer 1;Similarly, event group 2 is sent to correspondence by event handler 2
Event buffer 2, include 14 events in event group 2,14 events are successively sent to event buffer by event handler 2
2, and after having sent the 14th event, the first identifier that itself is obtained is sent to event buffer 2, and so on, each
Event handler sends one first mark all after having sent N number of event to corresponding event buffer, then to event buffer
Know.
The embodiment of the present invention provides a kind of method for parallel processing of event, please refers to Figure 11, for institute of the embodiment of the present invention
The flow diagram of the method for parallel processing two of the event of offer, this method is applied to system shown in Figure 1, as shown, the party
Method the following steps are included:
Step 1101, the event follower receives and stores N number of event that corresponding event handler is sent and described
First identifier;N number of event is after the event handler receives the M event that case distribution device is sent, to the M
What event obtained after being handled, M is the integer more than or equal to 1, and N is less than or equal to M and more than or equal to 0
Integer;The sequence consensus of N number of event described in sequence of the sequence of N number of event with the M event.
Specifically, event follower is mainly used for the event for sending over event handler according to the original sequence of event
It is received and is stored, in order to realize this operation, event follower needs first to be initialized, and event follower carries out
Initialization includes: the foundation of event follower and the one-to-one event buffer of each event handler, and slow for each event
Storage configures a corresponding serial number;Then a pointer is arranged in event follower, and event buffer pointed by the pointer is deposited
The event of storage will be sent to other devices by controller.Figure 12 is please referred to, is pointer and thing provided by the embodiment of the present invention
The schematic diagram of part buffer, as shown, event handler 1 corresponds to event buffer 1, the corresponding event buffer of event handler 2
Device 2, and so on, pointer shown in Figure 12 currently points to event handler 1.
Each event buffer in the event follower can receive N number of thing that corresponding event handler is sent
Part;For example, as shown in figure 12, event buffer 1 event of the reception from event handler 1, event buffer 2 receive
From the event of event handler 2, and so on.N number of event is that each event handler receives the event point
After sending out the M event that device is sent, according to the sequence of the M event, obtained after handling the M event, M is big
In or equal to 2 integer, N be less than or equal to M and be more than or equal to 0 integer;The sequence of the M event is institute
State the sequence that case distribution device obtains the M event.
Step 1102, the event follower sends the described N number of of each event buffer storage to other devices
Event, and after having sent N number of event to other devices, described the according to each event buffer storage
One mark sends N number of event that next event buffer stores to other described devices.
Specifically, each event buffer in event handler can successively receive what corresponding event handler was sent
N number of event will be sent to other devices by N number of event that the event buffer that pointer is directed toward stores by controller.
For example, each event follower may is that event buffer to the method that other devices successively send N number of event
As soon as device often receives an event, controller detects the flag bit in the event;If having 8 flag bits in the event, by controlling
Device processed is directly by the event forwarding to other devices;If there is 1 flag bit in the event, indicate that the event is first identifier,
Illustrate that the event handler has sent N number of event to the corresponding event buffer, then controller foundation first identifier,
The corresponding event buffer of next event handler is jumped to, the corresponding event buffer of next event handler is stored
N number of event be successively sent to other devices.
Controller jumps to the corresponding event buffer of next event handler according to the first identifier, will be next
The method that N number of event of the corresponding event buffer storage of a event handler is successively sent to other devices includes following two
Kind:
The first: sending the N to the event follower when first identifier is used to indicate each event handler
When a event finishes, controller foundation first identifier determines that the N number of event for the event handler that current pointer is directed toward has been sent
It finishes, needs to control pointer and jumped, then the order information of preset at least two event handler of controller, determine
Next event handler;Then corresponding relationship of the controller according to event handler and event buffer obtains next
Then the corresponding event buffer of a event handler controls pointer and is directed toward the corresponding event buffer of the next event handler
Device, in this way, N number of event that the corresponding event buffer of next event handler stores is sent in sequence to other devices by controller
Part.That is, whenever event buffer receives an event from event handler, event is slow due in the embodiment of the present invention
Storage will just store event, after controller detects first identifier in event buffer, know the thing that current pointer is directed toward
Part buffer has received first identifier, indicates that event buffer all issues N number of event of acquisition, needing will be next
The event of event buffer storage is sent to other devices, and therefore, controller can preset at least two event handlings
The order information of device determines next event buffer, so as to by the corresponding event buffer of next event handler
N number of event of storage is sent to other devices.
Preferably, controller can first judge the event buffer that preset pointer currently points to after obtaining first identifier
Whether the serial number of device is maximum value;If the serial number for the event buffer that pointer currently points to is maximum value, controller control
Pointer is jumped, and pointer is made to be directed toward the smallest event buffer of serial number;If the sequence for the event buffer that pointer currently points to
It number is not maximum value, then controller control pointer is jumped, and pointer is made to be directed toward the corresponding event buffer of Next Sequence.
Second: when first identifier is the mark of next event handler, controller is according to described next
The mark of event handler determines next event handler;The controller is according to event handler and event buffer
The corresponding relationship of device is sent described in the corresponding event buffer storage of next event handler to other described devices
N number of event.That is, due in the embodiment of the present invention, whenever event buffer receives an event from event handler, control
Device processed just gives the event forwarding to other devices, and after event buffer receives first identifier, controller is needed next thing
N number of event of part buffer storage is sent to other devices, and therefore, controller can determine next according to first identifier
Event buffer, so as to send the corresponding event buffer storage of next event handler to other described devices
N number of event.
It should be noted that above controller jumping according to first identifier control pointer, so as to control pointer
It is directed toward, the N number of event stored in the event buffer for being directed toward pointer is sent to other devices, since controller controls
When pointer is jumped, the sequence according to event buffer is needed, therefore, so that the thing that event follower is exported to other devices
The sequence of part and the sequence of these event entry event distributors are consistent,
The technical solution of the embodiment of the present invention has the advantages that
1, event handler is handled event according to the sequence of event, and event follower according to first identifier according to
The sequence of event handler is sequentially output the event obtained from each event handler, therefore so that event follower to other
The sequence of event and the sequence of these event entry event distributors of device output are consistent, to ensure that event is being divided
The order of whole process is sent out, handles and exports, so that event follower does not need that event ordering can be exported sequence guarantor
Constant event is held, the processing time of event is saved, improves the treatment effeciency of event.
2, event handler does not need to be ranked up event, therefore can reduce the algorithm complexity of event handler.
3, event is handled using at least two event handlers, improves system to the parallel processing capability of event.
4, event handler handles event, can reduce output to the event number of other devices, additionally it is possible to drop
The processing load of other low subsequent devices improves system-through-up capability and extended capability.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention
Within mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the present invention.
Claims (12)
1. a kind of parallel processing apparatus of event, which is characterized in that described device is event handler, the event handler packet
It includes:
Receiving unit, for receiving M event of case distribution device transmission, M is the integer more than or equal to 1;
First processing units, for handling the M event, to obtain N number of event;N is less than or equal to M and greatly
In or equal to 0 integer;The sequence one of N number of event described in sequence of the sequence of N number of event with the M event
It causes;
The second processing unit, for obtaining first identifier;
Transmission unit, for sending N number of event and the first identifier to event follower, in order to event output
Device sends N number of event to other devices, and after having sent N number of event to other devices, according to described the
One mark, the N number of event obtained from next event handler is sent to other described devices.
2. the apparatus according to claim 1, which is characterized in that
The first identifier is the mark of next event handler, and the receiving unit is also used to: receiving the event
The mark for next event handler that distributor is sent, next event handler are identified as the event point
Send out what device was obtained according to the mark of each event handler and the sequence of preset at least two event handler;Alternatively,
It is complete to event follower transmission N number of event that the first identifier is used to indicate each event handler
Finish, described the second processing unit is specifically used for: generating the first identifier.
3. device according to claim 1 or 2, which is characterized in that the event follower includes controller and at least two
A event buffer, at least two event buffer and at least two event handler correspond, the transmission
Unit is specifically used for:
N number of event is successively sent to the corresponding event buffer, in order to which the corresponding event buffer stores
The N number of event obtained from the corresponding event handler, in order to which the controller sends the thing to other described devices
N number of event of part buffer storage;
After having sent N number of event to the corresponding event buffer, to described in the corresponding event buffer transmission
First identifier is successively sent to other described devices from described next in order to which the controller is according to the first identifier
N number of event that the corresponding event buffer of event handler obtains.
4. a kind of parallel processing apparatus of event, which is characterized in that described device is event follower, the event follower packet
Controller and at least two event buffers are included, at least two event buffer and at least two event handler one are a pair of
It answers:
Each event buffer, the N number of event and first identifier sent for receiving and storing corresponding event handler;
N number of event is after the event handler receives the M event that case distribution device is sent, to carry out to the M event
It is obtained after processing, M is the integer more than or equal to 1, and N is the integer less than or equal to M and more than or equal to 0;Institute
State the sequence consensus of N number of event described in sequence of the sequence of N number of event with the M event;
The controller, for sending N number of event that each event buffer stores to other devices, and to
After other devices have sent N number of event, according to the first identifier of each event buffer storage, Xiang Suoshu
Other devices send N number of event of next event buffer storage.
5. device according to claim 4, which is characterized in that the first identifier is used to indicate each event handling
Device sends N number of event to the corresponding event buffer and finishes, and the controller is specifically used for:
According to the sequence of the first identifier and preset at least two event handler, determine at next event
Manage device;
According to the corresponding relationship of event handler and event buffer, determine that the corresponding event of next event handler is slow
Storage;
N number of event that the corresponding event buffer of next event handler stores is sent to other described devices.
6. device according to claim 4, which is characterized in that the first identifier is next event handler
Mark, the controller are specifically used for:
According to the mark of next event handler, next event handler is determined;
According to the corresponding relationship of event handler and event buffer, determine that the corresponding event of next event handler is slow
Storage;
N number of event that the corresponding event buffer of next event handler stores is sent to other described devices.
7. a kind of method for parallel processing of event, which is characterized in that be applied to include case distribution device, at least two event handlings
The system of device and event follower, which comprises
Each event handler receives the M event that the case distribution device is sent, and M is the integer more than or equal to 1;
Each event handler handles the M event, to obtain N number of event;N be less than or equal to M and
Integer more than or equal to 0;The sequence one of N number of event described in sequence of the sequence of N number of event with the M event
It causes;
Each event handler obtains first identifier;
Each event handler sends N number of event and the first identifier to event follower, in order to the thing
Part follower sends N number of event to other devices, and after having sent N number of event to other devices, foundation
The first identifier sends the N number of event obtained from next event handler to other described devices.
8. the method according to the description of claim 7 is characterized in that
The first identifier is the mark of next event handler, and each event handler obtains the first mark
To know, comprising: each event handler receives the mark for next event handler that the case distribution device is sent,
Next event handler is identified as the case distribution device according to the mark of each event handler and default
At least two event handler sequence obtain;Alternatively,
It is complete to event follower transmission N number of event that the first identifier is used to indicate each event handler
Finish, each event handler obtains first identifier, comprising: each event handler generates described first
Mark.
9. method according to claim 7 or 8, which is characterized in that the event follower includes controller and at least two
A event buffer, at least two event buffer and at least two event handler correspond, described each
The event handler sends N number of event and the first identifier to event follower, comprising:
Each event handler successively sends N number of event to the corresponding event buffer, in order to corresponding
The event buffer stores the N number of event obtained from the corresponding event handler, in order to which the controller is to described
Other devices send N number of event of the event buffer storage;
After each event handler has sent N number of event to the corresponding event buffer, to corresponding described
Event buffer sends the first identifier, in order to which the controller is according to the first identifier, to other described devices according to
It is secondary to send the N number of event obtained from the corresponding event buffer of the next event handler.
10. a kind of method for parallel processing of event, which is characterized in that be applied to including at case distribution device, at least two events
The system for managing device and event follower, which comprises
The event follower receives and stores the N number of event and first identifier that corresponding event handler is sent;N number of thing
Part is after the event handler receives the M event that case distribution device is sent, to obtain after handling the M event
, M is the integer more than or equal to 1, and N is the integer less than or equal to M and more than or equal to 0;N number of event
The sequence consensus of N number of event described in sequence of the sequence with the M event;
The event follower sends N number of event that each event buffer stores to other devices, and to other
After device has sent N number of event, according to the first identifier of each event buffer storage, to it is described other
Device sends N number of event of next event buffer storage.
11. according to the method described in claim 10, it is characterized in that, the first identifier is used to indicate at each event
Reason device sends N number of event to the event follower and finishes, described according to described in each event buffer storage
First identifier sends N number of event that next event buffer stores to other described devices, comprising:
Sequence of the controller according to the first identifier and preset at least two event handler, determines described next
Event handler;
Corresponding relationship of the controller according to event handler and event buffer, is triggered at determining next event
Manage the corresponding event buffer of device;
N number of event that the corresponding event buffer of next event handler stores is sent to other described devices.
12. according to the method described in claim 10, it is characterized in that, the first identifier is next event handler
Mark, the first identifier according to each event buffer storage sends next to other described devices
N number of event of event buffer storage, comprising:
Mark of the controller according to next event handler, determines next event handler;
Corresponding relationship of the controller according to event handler and event buffer, is triggered at determining next event
Manage the corresponding event buffer of device;
N number of event that the corresponding event buffer of next event handler stores is sent to other described devices.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410244381.8A CN105302634B (en) | 2014-06-04 | 2014-06-04 | The method for parallel processing and device of event |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410244381.8A CN105302634B (en) | 2014-06-04 | 2014-06-04 | The method for parallel processing and device of event |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105302634A CN105302634A (en) | 2016-02-03 |
CN105302634B true CN105302634B (en) | 2019-04-26 |
Family
ID=55199928
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410244381.8A Active CN105302634B (en) | 2014-06-04 | 2014-06-04 | The method for parallel processing and device of event |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105302634B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101661574A (en) * | 2008-08-27 | 2010-03-03 | 国际商业机器公司 | System, method and device for event processing |
CN102968339A (en) * | 2012-12-19 | 2013-03-13 | 上海普元信息技术股份有限公司 | System and method for realizing complicated event handling based on cloud computing architecture |
CN103530084A (en) * | 2013-09-26 | 2014-01-22 | 北京奇虎科技有限公司 | Data parallel sequencing method and system |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9009234B2 (en) * | 2007-02-06 | 2015-04-14 | Software Ag | Complex event processing system having multiple redundant event processing engines |
KR101276340B1 (en) * | 2009-09-22 | 2013-06-18 | 한국전자통신연구원 | System and method for parallel processing |
-
2014
- 2014-06-04 CN CN201410244381.8A patent/CN105302634B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101661574A (en) * | 2008-08-27 | 2010-03-03 | 国际商业机器公司 | System, method and device for event processing |
CN102968339A (en) * | 2012-12-19 | 2013-03-13 | 上海普元信息技术股份有限公司 | System and method for realizing complicated event handling based on cloud computing architecture |
CN103530084A (en) * | 2013-09-26 | 2014-01-22 | 北京奇虎科技有限公司 | Data parallel sequencing method and system |
Also Published As
Publication number | Publication date |
---|---|
CN105302634A (en) | 2016-02-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10284487B2 (en) | Software load balancer to maximize utilization | |
US8806507B1 (en) | Dynamic provisioning of message groups | |
US10341264B2 (en) | Technologies for scalable packet reception and transmission | |
CN107005467B (en) | Apparatus and method for routing data in a switch | |
CN103309738A (en) | User job scheduling method and device | |
US9736226B2 (en) | Rule distribution server, event processing system and method, and program | |
CN108228363A (en) | A kind of message method and device | |
JP6273069B2 (en) | Data processing system and data processing method | |
CN113595926B (en) | API data transmission method, device, equipment and medium based on data middlebox | |
CN103049240A (en) | Peripheral component interconnect express (PCI-E) device and data receiving reordering method thereof | |
CN103595736B (en) | Access request treating method and apparatus in video monitoring system | |
CN104094558B (en) | Multithreading packet transaction | |
CN112769943A (en) | Service processing method and device | |
CN115118784A (en) | Computing resource scheduling method, device and system | |
CN108093047B (en) | Data sending method and device, electronic equipment and middleware system | |
CN113542043A (en) | Data sampling method, device, equipment and medium of network equipment | |
CN109150720B (en) | Service chain message forwarding method, device, equipment and computer readable storage medium | |
CN105302634B (en) | The method for parallel processing and device of event | |
KR101099447B1 (en) | Link aggregation device considering physical link information and method for transmitting data using the link aggregation device | |
JP4365381B2 (en) | Communication control method and communication control apparatus | |
CN109818767B (en) | Method and device for adjusting Redis cluster capacity and storage medium | |
CN106161242B (en) | A kind of route sending-down method and device | |
EP2874357A1 (en) | Switch, communication system, switch control method, and program | |
CN109600421A (en) | The selection method of distributed computing resource in a kind of wireless cloud computing system | |
CN102810083B (en) | A kind of doorbell message distribution method, rapidly input o controller and processor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |